Skip to content

Commit da0ee3d

Browse files
Sync
1 parent 5b4c38d commit da0ee3d

5 files changed

Lines changed: 416 additions & 1079 deletions

File tree

scripts/ui/chestServerForm.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ const textureBindings = [
5050
},
5151
{
5252
binding_type: "view",
53-
source_property_name: "(#form_button_texture * 1)",
53+
source_property_name: "(1 * (#form_button_texture - ']'))",
5454
target_property_name: "#item_id_aux",
5555
},
5656
];
@@ -148,7 +148,7 @@ export default defineUI("chest_ui", (ns) => {
148148
binding_name: "#null",
149149
binding_type: "view",
150150
source_property_name:
151-
"(('§z') + (('%.12s' * #form_button_text) - ('%.10s' * #form_button_text)))",
151+
"(('§z') + (('%.14s' * #form_button_text) - ('%.12s' * #form_button_text)))",
152152
target_property_name: "#stack_size",
153153
},
154154
],
@@ -199,15 +199,15 @@ export default defineUI("chest_ui", (ns) => {
199199
},
200200
{
201201
binding_name: "#null",
202-
binding_type: "view",
203-
source_property_name:
204-
"(#form_button_text - ('%.12s' * #form_button_text))",
205-
target_property_name: "#hover_text",
202+
binding_type: "collection_details",
203+
binding_collection_name: "form_buttons",
206204
},
207205
{
208206
binding_name: "#null",
209-
binding_type: "collection_details",
210-
binding_collection_name: "form_buttons",
207+
binding_type: "view",
208+
source_property_name:
209+
"(#form_button_text - ('%.14s' * #form_button_text))",
210+
target_property_name: "#hover_text",
211211
},
212212
],
213213
},

scripts/ui/pokemon/pc.ts

Lines changed: 163 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,71 @@ const buttonImage = boundImage("image")
5353
.bindings(...formButtonImageBindings());
5454

5555
const actionButtonTextures = simpleButtonTextures(
56-
"textures/ui/pc",
56+
"textures/ui/pc/buttons",
5757
"action_button"
5858
);
5959

60+
const filterButtonTextures = simpleButtonTextures(
61+
"textures/ui/pc/buttons",
62+
"filter_button"
63+
);
64+
65+
const searchButtonTextures = simpleButtonTextures(
66+
"textures/ui/pc/buttons",
67+
"search_button"
68+
);
69+
70+
const settingsButtonTextures = simpleButtonTextures(
71+
"textures/ui/pc/buttons",
72+
"settings_button"
73+
);
74+
75+
// Container slots with grid
76+
const smallChestGrid = grid("small_chest_grid")
77+
.gridDimensions(6, 6)
78+
.size(108, 118)
79+
.offset(5, 5)
80+
.anchor("top_left")
81+
.gridItemTemplate("chest_ui.chest_item")
82+
.collectionName("form_buttons")
83+
.layer(1);
84+
85+
const partySlots = image("party_slots", "textures/ui/pc/party_slots").size(
86+
"default",
87+
26
88+
);
89+
90+
const titleLabel = boundLabel("text", "text")
91+
.textAlignment("center")
92+
.fontScaleFactor(0.95)
93+
.bindings(
94+
globalBinding("#title_text"),
95+
viewBinding(strip(first(22, skip(22, "#title_text"))), "#text")
96+
);
97+
98+
const title = panel("title")
99+
.size(84)
100+
.offset(0, 7)
101+
.layer(3)
102+
.controls(titleLabel);
103+
104+
// Search field label in details bar
105+
const searchFieldText = boundLabel("text")
106+
.offset(-8, 0.5)
107+
.textAlignment("left")
108+
.fontScaleFactor(0.85)
109+
.bindings(
110+
globalBinding("#title_text"),
111+
viewBinding(strip("%.22s * #title_text"), "#text")
112+
);
113+
114+
const searchField = panel("search_field")
115+
.size(66)
116+
.offset(0, 1)
117+
.layer(3)
118+
.controls(searchFieldText);
119+
120+
// Left content box with close button, header and body text
60121
const leftContentBoxHeader = boundLabel("header_text")
61122
.size(64, 8)
62123
.fontScaleFactor(0.7)
@@ -91,38 +152,6 @@ const leftContentBox = image("left_content_box", "textures/ui/pc/content_box")
91152
.size(73, 115)
92153
.controls(closeButton, leftContentStack);
93154

94-
// Container slots with grid
95-
const smallChestGrid = grid("small_chest_grid")
96-
.gridDimensions(6, 6)
97-
.size(108, 118)
98-
.offset(5, 5)
99-
.anchor("top_left")
100-
.gridItemTemplate("chest_ui.chest_item")
101-
.collectionName("form_buttons")
102-
.layer(1);
103-
104-
const containerSlotsBackground = image(
105-
"container_slots",
106-
"textures/ui/pc/container_slots"
107-
)
108-
.size("default", 105)
109-
.controls(smallChestGrid);
110-
111-
const partySlots = image("party_slots", "textures/ui/pc/party_slots").size(
112-
"default",
113-
26
114-
);
115-
116-
const titleLabel = boundLabel("text", "title_text")
117-
.textAlignment("center")
118-
.fontScaleFactor(0.95);
119-
120-
const title = panel("title")
121-
.size(84)
122-
.offset(0, 7)
123-
.layer(3)
124-
.controls(titleLabel);
125-
126155
export default defineUI("pc", (ns) => {
127156
// Register button stack factory from shared module
128157
const buttonStackNs = buttonStack.addToNamespace(ns);
@@ -141,7 +170,7 @@ export default defineUI("pc", (ns) => {
141170

142171
// Button variants - extending base button with different textures
143172
const leftArrowTextures = simpleButtonTextures(
144-
"textures/ui/pc",
173+
"textures/ui/pc/buttons",
145174
"left_arrow"
146175
);
147176
const leftArrowButtonNs = panel("left_arrow_button")
@@ -156,7 +185,7 @@ export default defineUI("pc", (ns) => {
156185
.addToNamespace(ns);
157186

158187
const rightArrowTextures = simpleButtonTextures(
159-
"textures/ui/pc",
188+
"textures/ui/pc/buttons",
160189
"right_arrow"
161190
);
162191
const rightArrowButtonNs = panel("right_arrow_button")
@@ -170,6 +199,39 @@ export default defineUI("pc", (ns) => {
170199
.bindings(...visibilityForId("btn:right_arrow"))
171200
.addToNamespace(ns);
172201

202+
const filterButtonNs = panel("filter_button")
203+
.extendsFrom(buttonNs)
204+
.variable("default_button_texture", filterButtonTextures.default)
205+
.variable("hover_button_texture", filterButtonTextures.hover)
206+
.variable("pressed_button_texture", filterButtonTextures.pressed)
207+
.variable("locked_button_texture", filterButtonTextures.locked)
208+
.variable("button_image_fill", false)
209+
.variable("border_visible", false)
210+
.bindings(...visibilityForId("btn:filter_button"))
211+
.addToNamespace(ns);
212+
213+
const searchButtonNs = panel("search_button")
214+
.extendsFrom(buttonNs)
215+
.variable("default_button_texture", searchButtonTextures.default)
216+
.variable("hover_button_texture", searchButtonTextures.hover)
217+
.variable("pressed_button_texture", searchButtonTextures.pressed)
218+
.variable("locked_button_texture", searchButtonTextures.locked)
219+
.variable("button_image_fill", false)
220+
.variable("border_visible", false)
221+
.bindings(...visibilityForId("btn:search_button"))
222+
.addToNamespace(ns);
223+
224+
const settingsButtonNs = panel("settings_button")
225+
.extendsFrom(buttonNs)
226+
.variable("default_button_texture", settingsButtonTextures.default)
227+
.variable("hover_button_texture", settingsButtonTextures.hover)
228+
.variable("pressed_button_texture", settingsButtonTextures.pressed)
229+
.variable("locked_button_texture", settingsButtonTextures.locked)
230+
.variable("button_image_fill", false)
231+
.variable("border_visible", false)
232+
.bindings(...visibilityForId("btn:settings_button"))
233+
.addToNamespace(ns);
234+
173235
// TODO: Make textures type safe.
174236
const iconBoxTexture = "textures/ui/pc/icon_box";
175237
const iconButtonNs = panel("icon_button")
@@ -178,9 +240,8 @@ export default defineUI("pc", (ns) => {
178240
.variable("hover_button_texture", iconBoxTexture)
179241
.variable("pressed_button_texture", iconBoxTexture)
180242
.variable("locked_button_texture", iconBoxTexture)
181-
.variable("image_size", [54, 54])
182-
.variable("image_offset", [0, -7])
183-
.variable("button_image_fill", false)
243+
.variable("image_size", ["100%", "100%"])
244+
.variable("button_image_fill", true)
184245
.variable("border_visible", false)
185246
.bindings(...visibilityForId("btn:icon"))
186247
.addToNamespace(ns);
@@ -191,26 +252,66 @@ export default defineUI("pc", (ns) => {
191252
.variable("hover_button_texture", actionButtonTextures.hover)
192253
.variable("pressed_button_texture", actionButtonTextures.pressed)
193254
.variable("locked_button_texture", actionButtonTextures.locked)
194-
.variable("text_offset", [0, -3])
195255
.variable("button_image_fill", false)
196256
.variable("border_visible", false)
197-
.bindings(...visibilityForId("btn:action"))
257+
.variable("text_alignment", "center")
258+
.variable("text_font_scale_factor", 0.8)
259+
.variable("text_offset", ["0px", "5px"])
260+
.bindings(...visibilityForId("btn:action_button"))
198261
.addToNamespace(ns);
199262

263+
// Details bar buttons
264+
const filterButton = panel("filter_button")
265+
.extendsFrom(buttonStackNs)
266+
.size(14)
267+
.layer(3)
268+
.anchor("center")
269+
.variable("button", filterButtonNs.getQualifiedName());
270+
271+
const searchButton = panel("search_button")
272+
.extendsFrom(buttonStackNs)
273+
.size(14)
274+
.layer(3)
275+
.anchor("center")
276+
.variable("button", searchButtonNs.getQualifiedName());
277+
278+
const settingsButton = panel("settings_button")
279+
.extendsFrom(buttonStackNs)
280+
.size(14)
281+
.offset(0, 3)
282+
.layer(3)
283+
.anchor("center")
284+
.variable("button", settingsButtonNs.getQualifiedName());
285+
286+
const detailsBarContent = stackPanel("box_details", "horizontal").controls(
287+
panel("start_padding").size(5),
288+
filterButton,
289+
searchButton,
290+
searchField,
291+
settingsButton,
292+
panel("end_padding").size(5)
293+
);
294+
295+
const detailsBar = image("details_bar", "textures/ui/pc/details_bar")
296+
.size("default", 17)
297+
.controls(detailsBarContent);
298+
200299
// Title box with navigation arrows
201300
const leftButton = panel("left_button")
202301
.extendsFrom(buttonStackNs)
203302
.size(11)
204303
.layer(3)
304+
.anchor("center")
205305
.variable("button", leftArrowButtonNs.getQualifiedName());
206306

207307
const rightButton = panel("right_button")
208308
.extendsFrom(buttonStackNs)
209309
.size(11)
210310
.layer(3)
311+
.anchor("center")
211312
.variable("button", rightArrowButtonNs.getQualifiedName());
212313

213-
const boxDetails = stackPanel("box_details", "horizontal").controls(
314+
const titleBoxContent = stackPanel("box_details", "horizontal").controls(
214315
panel("start_padding").size(5),
215316
leftButton,
216317
title,
@@ -220,16 +321,30 @@ export default defineUI("pc", (ns) => {
220321

221322
const titleBox = image("title_box", "textures/ui/pc/title_box")
222323
.size("default", 17)
223-
.controls(boxDetails);
324+
.controls(titleBoxContent);
325+
326+
// Container slots with dynamic background texture
327+
const containerSlotsBackground = boundImage("container_slots")
328+
.size("default", 105)
329+
.controls(smallChestGrid)
330+
.bindings(
331+
globalBinding("#title_text"),
332+
viewBinding(
333+
"(('textures/ui/pc/backgrounds/' + (#title_text - (%.44s * #title_text))) - '_')",
334+
"#texture"
335+
)
336+
);
224337

225338
// Center grid stack
226339
const centerGridNs = stackPanel("center_grid", "vertical")
227340
.size(116, "100%c")
228341
.controls(
229-
titleBox,
342+
detailsBar,
230343
panel("spacer1").size("default", 1),
344+
titleBox,
345+
panel("spacer2").size("default", 1),
231346
containerSlotsBackground,
232-
panel("spacer2").size("default", 1.5),
347+
panel("spacer3").size("default", 1.5),
233348
partySlots
234349
);
235350

@@ -238,15 +353,17 @@ export default defineUI("pc", (ns) => {
238353
.extendsFrom(buttonStackNs)
239354
.size("default", 70)
240355
.layer(3)
356+
.anchor("center")
241357
.variable("button", iconButtonNs.getQualifiedName());
242358

243359
const actionButtonBox = panel("action_button")
244360
.extendsFrom(buttonStackNs)
245361
.size("default", 18)
246362
.layer(3)
363+
.anchor("center")
247364
.variable("button", actionButtonTemplateNs.getQualifiedName());
248365

249-
const rightContentNs = stackPanel("right_content", "vertical")
366+
const rightContent = stackPanel("right_content", "vertical")
250367
.size(71, "100%c")
251368
.controls(iconBox, panel("spacer").size("default", 0.5), actionButtonBox);
252369

@@ -258,7 +375,7 @@ export default defineUI("pc", (ns) => {
258375
panel("spacer1").size(2),
259376
centerGridNs,
260377
panel("spacer2").size(1),
261-
rightContentNs
378+
rightContent
262379
)
263380
);
264381
});

ui/__generated__/chestServerForm.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)