ElSid wrote:How widgets are classified by those that are deployed with the new client version and fetched as a resource? Is it content, visual structure or logic?
ElSid wrote:Content clearly should be fetched as a resource if it's some text or a specific image. Background texture or a window border might be customized. The visual structure is definitely something to be customized. In general markdown languages solve this but it might be an overkill. Instead a special function can be a customization point that takes a content as an input and should provide some widget in the output according to a contract defined by the logic. Default implementation still can be fetched as a resource. And I don't propose to touch the logic.
loftar wrote:ElSid wrote:How widgets are classified by those that are deployed with the new client version and fetched as a resource? Is it content, visual structure or logic?
I'm not sure I understand your question, but if what you're asking is how the client knows whether a widget is implemented with code that is included in the client or to load a resource to create the widget, then generally speaking, the message from the server to create a widget just contains a string to identify the widget being created. If that string contains a colon, then that is assumed to encode a resource as name:version. Otherwise, it identifies a widget that is included in the client (by the @Widget.RName annotation on the corresponding widget factory classes). This is in gettype/gettype2 in Widget.java.
loftar wrote:ElSid wrote:Content clearly should be fetched as a resource if it's some text or a specific image. Background texture or a window border might be customized. The visual structure is definitely something to be customized. In general markdown languages solve this but it might be an overkill. Instead a special function can be a customization point that takes a content as an input and should provide some widget in the output according to a contract defined by the logic. Default implementation still can be fetched as a resource. And I don't propose to touch the logic.
Sorry, I just don't really understand what you're talking about here. What is even the context? Are you suggesting that code for sprites/tooltips/widgets in resources be replaced with... markdown? Why? And how is that even a programming language?
public void tick(double dt) {
if (img == null) {
Tex pic = exp.get().layer(Resource.imgc).tex();
String text = exp.get().layer(Resource.pagina).text;
// ...
add(new Img(pic));
add(new Img(fnd.render(text, 300).tex()));
// ...
}
}
// defined in the resource
class ExpWnd {
public void tick(double dt) {
if (img == null) {
Content content = ExpWndContentBuilder.get().make_content(exp.get().layer(Resource.imgc).tex(), exp.get().layer(Resource.pagina).text);
add(conent.pic);
add(conent.text);
}
}
}
// defined in the vanilla client source code
interface ExpWndContentBuilder {
class Content {
Img pic;
Img text;
}
public Content make_content(Tex pic, String text);
static public ExpWndContentBuilder get() {
return Widget.gettype2("ui/expwndcontentbuilder");
// This line can be changed by a custom client to
// return new MyExpWndContentBuilder();
}
}
// defined in the resource
class DefaultExpWndContentBuilder implements ExpWndContentBuilder {
public Content make_content(Tex pic, String text) {
// ...
return content;
}
}
// defined in the custom client code
class MyExpWndContentBuilder implements ExpWndContentBuilder {
public Content make_content(Tex pic, String text) {
// ...
return content;
}
}
ElSid wrote:My question is why ExpWnd is end up in the game resources and haven.BuddyWnd with its all tabs and subtabs in the client source?
ElSid wrote:I mentioned markdown language as an example. I haven't written "programming language" just "language". A some set of rules that can describe a widget only from a visual point of view (e.g. place a button with text "foo" and width 100 at position 50, 100, a label with text "bar" at 50, 50, and a picture from "gfx/baz" resource at 0, 0). But as I said it might be an overkill.
ElSid wrote:Instead I want each widget that is stored as a resource to be more customizable on initialization. For example ExpWnd adds child widgets in the method tick:
loftar wrote: I tend to use the "relpos" DSL (the one in Widget.java) for layout specifications instead of widget code in resources.
120!wpyc
${x}!wpyc
x = 120
120!wpy3*10+c
${width}!wpy${n}*${offset}+c
width = 120
n = 3
offset = 10
mvgulik wrote:> less than optimal
...
https://developer.mozilla.org/en-US/doc ... Status/304
and / or
https://developer.mozilla.org/en-US/doc ... aders/ETag
comes to mind.
Users browsing this forum: No registered users and 5 guests