Skip to content

Commit fc86bcc

Browse files
committed
fix: reposition upper UI targets
1 parent 4b537ab commit fc86bcc

1 file changed

Lines changed: 31 additions & 25 deletions

File tree

src/lib/player/objects/GameUI.ts

Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,25 @@ export class GameUI {
2020

2121
private _positions: number[][] = [
2222
[-650, 435],
23-
[0, 435],
24-
[0, 435],
25-
[650, 435],
26-
[650, 435],
23+
[0, 440],
24+
[0, 440],
25+
[650, 425],
26+
[650, 430],
2727
[-650, -435],
2828
[650, -435],
2929
[0, -435],
3030
];
3131
private _offsets: number[][] = [
3232
[0, 5],
3333
[0, 0],
34-
[0, 60],
34+
[0, 53],
3535
[0, 0],
36-
[0, 50],
36+
[0, 38],
3737
[0, 0],
3838
[0, 0],
3939
[0, 0],
4040
];
41-
private _fontSizes: number[] = [0, 60, 20, 50, 25, 32, 32, 18];
41+
private _fontSizes: number[] = [0, 55, 18, 40, 19, 32, 32, 18];
4242
private _targets: (Button | UIComponent | ProgressBar)[];
4343
private _upperTargets: (Button | UIComponent | ProgressBar)[];
4444
private _lowerTargets: UIComponent[];
@@ -47,12 +47,17 @@ export class GameUI {
4747
constructor(scene: Game) {
4848
this._scene = scene;
4949
const stats = scene.statistics.stats;
50+
const showAccuracy = !scene.render;
51+
52+
if (showAccuracy) {
53+
this._positions[3][1] = this._positions[4][1];
54+
}
5055

5156
this._pause = this.createButton(
5257
scene.w(this._positions[0][0]),
5358
scene.h(this._positions[0][1]),
54-
this._scene.p(this._offsets[0][0]),
55-
this._scene.p(this._offsets[0][1]),
59+
scene.p(this._offsets[0][0]),
60+
scene.p(this._offsets[0][1]),
5661
0,
5762
0,
5863
8,
@@ -82,8 +87,8 @@ export class GameUI {
8287
'combo',
8388
scene.w(this._positions[1][0]),
8489
scene.h(this._positions[1][1]),
85-
this._scene.p(this._offsets[1][0]),
86-
this._scene.p(this._offsets[1][1]),
90+
scene.p(this._offsets[1][0]),
91+
scene.p(this._offsets[1][1]),
8792
0.5,
8893
0,
8994
9,
@@ -96,8 +101,8 @@ export class GameUI {
96101
'combotext',
97102
scene.w(this._positions[2][0]),
98103
scene.h(this._positions[2][1]),
99-
this._scene.p(this._offsets[2][0]),
100-
this._scene.p(this._offsets[2][1]),
104+
scene.p(this._offsets[2][0]),
105+
scene.p(this._offsets[2][1]),
101106
0.5,
102107
0,
103108
10,
@@ -109,8 +114,8 @@ export class GameUI {
109114
'score',
110115
scene.w(this._positions[3][0]),
111116
scene.h(this._positions[3][1]),
112-
this._scene.p(this._offsets[3][0]),
113-
this._scene.p(this._offsets[3][1]),
117+
scene.p(this._offsets[3][0]),
118+
scene.p(this._offsets[3][1]),
114119
1,
115120
0,
116121
11,
@@ -119,13 +124,13 @@ export class GameUI {
119124
scene.respack.bitmapFonts[0].name,
120125
);
121126

122-
if (!this._scene.render) {
127+
if (showAccuracy) {
123128
this._accuracy = this.createComponent(
124129
'accuracy',
125130
scene.w(this._positions[4][0]),
126131
scene.h(this._positions[4][1]),
127-
this._scene.p(this._offsets[4][0]),
128-
this._scene.p(this._offsets[4][1]),
132+
scene.p(this._offsets[4][0]),
133+
scene.p(this._offsets[4][1]),
129134
1,
130135
0,
131136
12,
@@ -143,8 +148,8 @@ export class GameUI {
143148
'title',
144149
scene.w(this._positions[5][0]),
145150
scene.h(this._positions[5][1]),
146-
this._scene.p(this._offsets[5][0]),
147-
this._scene.p(this._offsets[5][1]),
151+
scene.p(this._offsets[5][0]),
152+
scene.p(this._offsets[5][1]),
148153
0,
149154
1,
150155
14,
@@ -156,8 +161,8 @@ export class GameUI {
156161
'level',
157162
scene.w(this._positions[6][0]),
158163
scene.h(this._positions[6][1]),
159-
this._scene.p(this._offsets[6][0]),
160-
this._scene.p(this._offsets[6][1]),
164+
scene.p(this._offsets[6][0]),
165+
scene.p(this._offsets[6][1]),
161166
1,
162167
1,
163168
15,
@@ -172,8 +177,8 @@ export class GameUI {
172177
'debug',
173178
scene.w(this._positions[7][0]),
174179
scene.h(this._positions[7][1]),
175-
this._scene.p(this._offsets[7][0]),
176-
this._scene.p(this._offsets[7][1]),
180+
scene.p(this._offsets[7][0]),
181+
scene.p(this._offsets[7][1]),
177182
0.5,
178183
1,
179184
Infinity,
@@ -235,7 +240,7 @@ export class GameUI {
235240
this._scene.h(this._positions[i][1]),
236241
);
237242
if ('resize' in obj) {
238-
obj.resize(this._scene.p(0.36));
243+
obj.resize(this._scene.p(0.32));
239244
} else {
240245
obj.text.setFontSize(this._scene.p(this._fontSizes[i]));
241246
obj.text.setPosition(
@@ -247,6 +252,7 @@ export class GameUI {
247252

248253
this._progressBar.bar.setScale(
249254
this._scene.p(1350) / this._progressBar.bar.texture.getSourceImage().width,
255+
this._scene.p(1080) / this._progressBar.bar.texture.getSourceImage().width,
250256
);
251257
this._progressBar.bar.setX(
252258
this._scene.p(

0 commit comments

Comments
 (0)