Add 'Attempt Counter', Instant Level Select 0.2

Merge preview related config to codes/preview.js
This commit is contained in:
sup39 2023-02-05 23:25:44 +09:00
parent 334faafeca
commit d75bdaa3ff
13 changed files with 714 additions and 135 deletions

589
Codes.xml
View file

@ -4048,8 +4048,8 @@
<title lang="en-US">Instant Level Select</title>
<title lang="ja-JP">レベル選択DX</title>
<author>sup39(サポミク)</author>
<version>0.1</version>
<date>Oct 16, 2022</date>
<version>0.2</version>
<date>Feb 05, 2023</date>
<description lang="en-US">
::: warning
Shine Get Timer does not restart with this code.
@ -4109,20 +4109,8 @@
4. これで好きなだけハニスキを練習できます。他のエリアに入ろうとする時に自動的にやり直すので、手動でやり直す必要がありません。必要であれば`B + 十字キー上`でやり直すこともできます。
</description>
<source version="GMSJ01">
040ED64C 4970C435
0410B100 496EE990
040EC420 4970D600
04236600 495C34C4
0410B3CC 496EE6DC
040FBAD8 496FDF30
040F9D68 496FFD78
040EAB80 4970EEC0
077F9800 000002F4
3CA08040 80A50D80
70A00208 28800208
3C60817F 88030004
7C000379 4CC61202
4CA60020 7D8802A6
C20F9B74 00000044
7C7D1B79 41820218
4800003D 00141516
0017181D 34000090
2F2E3020 32293328
@ -4131,94 +4119,330 @@
08090200 123457D0
24567000 12234070
23467001 7D2802A6
7D8803A6 3D40803E
394A6000 816D97D0
54A6CF38 50A6F77A
50A6E7BC 50A6D7FE
54A0C738 50A0B77C
7CC60378 54A4873F
41820054 2C040009
41820098 3C00C84A
6000C004 1C840003
5C04277E 5485103A
2C06000C 408000BC
2C06000A 408000D4
2C060008 40800090
3C005689 60000234
548C103A 5C0C652E
7CC76378 54C8077E
480000C4 A0EA000E
2C060000 41820028
2C060004 41820028
2C06000A 41820028
7C0930AE 540744AE
5408CFFE 1D080007
48000094 A00A000A
B00A000E 890B00DF
4800008C A0E30000
89030002 48000078
3989000C 7C0C30AE
540744AE 5007CFFE
3C00AC1A 60005CA2
1D860003 5C08677E
48000054 39890018
7C0C20AE 540744AE
3C001373 60002301
5C082F7E 48000038
3989FFF8 54C016B8
7C0C006E 5C072F7E
5007252E 800C0004
5C082F7E 48000018
3C001578 60009200
5C072F3E 60E70100
39000000 B0E30000
99030002 38000001
980300B3 98030004
990B00DF 38000000
900B00D8 A00B00CC
60004000 54000524
B00B00CC B0EA0012
54E0C63E 818A0020
3880003B 2C000007
41820010 2C00000E
41820008 38800000
B08C00E4 4E800020
3D80817F 880C0004
7C000379 4C820020
3800003C 4A9020C0
4BFFFDE1 40A60014
7FE3FB78 4A8F1115
3B800009 4A8F30F4
881F0064 4A8F29E8
3C60817F A0030004
2C000001 40820028
A01F004C 5400062C
B01F004C 816D97D0
7F8AE378 A0EA000E
4BFFFEB5 A0FC000A
B0FC000E 380000FF
38810054 4A8F1108
3D80817F 888C0005
68840001 4A8EE414
4BFFFD71 40A6000C
38600002 9061012C
807F0020 4A911660
3C60817F 88030004
2C000001 40820008
4A911A7C 2805000E
4A911910 4BFFFD3D
40A60008 4AA3CB54
807E0020 38BFFFCC
8803013B 4AA3CB28
3C60817F 38000000
98030004 7FA3EB78
4A90027C 00000000
3C60817F 3CA08040
80A50D80 816D97D0
38C00000 2C9D0001
88030005 7C000379
4C423042 41820084
70A00208 28000208
40A201A4 54A6CF38
50A6F77A 50A6E7BC
50A6D7FE 54A0C738
50A0B77C 7CC60378
54A4873F 41820054
2C040009 41820098
3C00C84A 6000C004
1C840003 5C04277E
5485103A 2C06000C
408000BC 2C06000A
408000D4 2C060008
40800090 3C005689
60000234 548C103A
5C0C652E 7CC76378
54C8077E 480000C4
A0FF000E 2C060000
41820028 2C060004
41820028 2C06000A
41820028 7C0930AE
540744AE 5408CFFE
1D080007 48000094
A01F000A B01F000E
890B00DF 4800008C
A0E30000 89030002
48000078 3989000C
7C0C30AE 540744AE
5007CFFE 3C00AC1A
60005CA2 1D860003
5C08677E 48000054
39890018 7C0C20AE
540744AE 3C001373
60002301 5C082F7E
48000038 3989FFF8
54C016B8 7C0C006E
5C072F7E 5007252E
800C0004 5C082F7E
48000018 3C001578
60009200 5C072F3E
60E70100 39000000
B0E30000 99030002
38000001 980300B3
98030004 990B00DF
38000000 900B00D8
A00B00CC 60004000
54000524 B00B00CC
B0FF0012 54E0C63E
819F0020 2C000007
2C80000E 4C423382
3800003B 41820008
38000000 B00C00E4
A00C00E2 540007FA
B00C00E2 54FDD7BE
3BBD0005 00000000
28400D50 00000021
017F0005 00000001
C20EAB80 00000002
A01C000E B01C0012
380000FF 00000000
000ED64B 00000000
C60ECAAC 800ECABC
28400D51 00000022
017F0005 00000000
040EAB80 380000FF
000ED64B 00000001
040ECAAC 38800100
E0000000 00000000
</source>
<source version="GMSJ0A">
C2285FCC 00000044
7C7D1B79 41820218
4800003D 00141516
0017181D 34000090
2F2E3020 32293328
2A1FBA3C 371E213A
0E2C3900 00010507
08090200 123457D0
24567000 12234070
23467001 7D2802A6
3C60817F 3CA0803F
80A55458 816D9E60
38C00000 2C9D0001
88030005 7C000379
4C423042 41820084
70A00208 28000208
40A201A4 54A6CF38
50A6F77A 50A6E7BC
50A6D7FE 54A0C738
50A0B77C 7CC60378
54A4873F 41820054
2C040009 41820098
3C00C84A 6000C004
1C840003 5C04277E
5485103A 2C06000C
408000BC 2C06000A
408000D4 2C060008
40800090 3C005689
60000234 548C103A
5C0C652E 7CC76378
54C8077E 480000C4
A0FF000E 2C060000
41820028 2C060004
41820028 2C06000A
41820028 7C0930AE
540744AE 5408CFFE
1D080007 48000094
A01F000A B01F000E
890B00DF 4800008C
A0E30000 89030002
48000078 3989000C
7C0C30AE 540744AE
5007CFFE 3C00AC1A
60005CA2 1D860003
5C08677E 48000054
39890018 7C0C20AE
540744AE 3C001373
60002301 5C082F7E
48000038 3989FFF8
54C016B8 7C0C006E
5C072F7E 5007252E
800C0004 5C082F7E
48000018 3C001578
60009200 5C072F3E
60E70100 39000000
B0E30000 99030002
38000001 980300B3
98030004 990B00DF
38000000 900B00D8
A00B00CC 60004000
54000524 B00B00CC
B0FF0012 54E0C63E
819F0020 2C000007
2C80000E 4C423382
3800003B 41820008
38000000 B00C00E4
A00C00E2 540007FA
B00C00E2 54FDD7BE
3BBD0005 00000000
283F5428 00000021
017F0005 00000001
C227726C 00000002
A01C000E B01C0012
380000FF 00000000
00279D77 00000000
C62791D8 802791E8
283F5429 00000022
017F0005 00000000
0427726C 380000FF
00279D77 00000001
042791D8 38800100
E0000000 00000000
</source>
<source version="GMSP01">
C229E080 00000044
7C7D1B79 41820218
4800003D 00141516
0017181D 34000090
2F2E3020 32293328
2A1FBA3C 371E213A
0E2C3900 00010507
08090200 123457D0
24567000 12234070
23467001 7D2802A6
3C60817F 3CA08040
80A5BC24 816D9EC8
38C00000 2C9D0001
88030005 7C000379
4C423042 41820084
70A00208 28000208
40A201A4 54A6CF38
50A6F77A 50A6E7BC
50A6D7FE 54A0C738
50A0B77C 7CC60378
54A4873F 41820054
2C040009 41820098
3C00C84A 6000C004
1C840003 5C04277E
5485103A 2C06000C
408000BC 2C06000A
408000D4 2C060008
40800090 3C005689
60000234 548C103A
5C0C652E 7CC76378
54C8077E 480000C4
A0FF000E 2C060000
41820028 2C060004
41820028 2C06000A
41820028 7C0930AE
540744AE 5408CFFE
1D080007 48000094
A01F000A B01F000E
890B00DF 4800008C
A0E30000 89030002
48000078 3989000C
7C0C30AE 540744AE
5007CFFE 3C00AC1A
60005CA2 1D860003
5C08677E 48000054
39890018 7C0C20AE
540744AE 3C001373
60002301 5C082F7E
48000038 3989FFF8
54C016B8 7C0C006E
5C072F7E 5007252E
800C0004 5C082F7E
48000018 3C001578
60009200 5C072F3E
60E70100 39000000
B0E30000 99030002
38000001 980300B3
98030004 990B00DF
38000000 900B00D8
A00B00CC 60004000
54000524 B00B00CC
B0FF0012 54E0C63E
819F0020 2C000007
2C80000E 4C423382
3800003B 41820008
38000000 B00C00E4
A00C00E2 540007FA
B00C00E2 54FDD7BE
3BBD0005 00000000
283FBBF4 00000021
017F0005 00000001
C228F45C 00000002
A01C000E B01C0012
380000FF 00000000
00291F5F 00000000
C62913C0 802913D0
283FBBF5 00000022
017F0005 00000000
0428F45C 380000FF
00291F5F 00000001
042913C0 38800100
E0000000 00000000
</source>
<source version="GMSE01">
C22A6170 00000044
7C7D1B79 41820218
4800003D 00141516
0017181D 34000090
2F2E3020 32293328
2A1FBA3C 371E213A
0E2C3900 00010507
08090200 123457D0
24567000 12234070
23467001 7D2802A6
3C60817F 3CA08040
80A54484 816D9FA0
38C00000 2C9D0001
88030005 7C000379
4C423042 41820084
70A00208 28000208
40A201A4 54A6CF38
50A6F77A 50A6E7BC
50A6D7FE 54A0C738
50A0B77C 7CC60378
54A4873F 41820054
2C040009 41820098
3C00C84A 6000C004
1C840003 5C04277E
5485103A 2C06000C
408000BC 2C06000A
408000D4 2C060008
40800090 3C005689
60000234 548C103A
5C0C652E 7CC76378
54C8077E 480000C4
A0FF000E 2C060000
41820028 2C060004
41820028 2C06000A
41820028 7C0930AE
540744AE 5408CFFE
1D080007 48000094
A01F000A B01F000E
890B00DF 4800008C
A0E30000 89030002
48000078 3989000C
7C0C30AE 540744AE
5007CFFE 3C00AC1A
60005CA2 1D860003
5C08677E 48000054
39890018 7C0C20AE
540744AE 3C001373
60002301 5C082F7E
48000038 3989FFF8
54C016B8 7C0C006E
5C072F7E 5007252E
800C0004 5C082F7E
48000018 3C001578
60009200 5C072F3E
60E70100 39000000
B0E30000 99030002
38000001 980300B3
98030004 990B00DF
38000000 900B00D8
A00B00CC 60004000
54000524 B00B00CC
B0FF0012 54E0C63E
819F0020 2C000007
2C80000E 4C423382
3800003B 41820008
38000000 B00C00E4
A00C00E2 540007FA
B00C00E2 54FDD7BE
3BBD0005 00000000
28404454 00000021
017F0005 00000001
C22975C4 00000002
A01C000E B01C0012
380000FF 00000000
0029A0C7 00000000
C6299528 80299538
28404455 00000022
017F0005 00000000
042975C4 380000FF
0029A0C7 00000001
04299528 38800100
E0000000 00000000
040eb024 60000000
</source>
</code>
<code>
@ -4373,4 +4597,171 @@
38210030 00000000
</source>
</code>
<code>
<id>AttemptCounter</id>
<category>misc</category>
<title lang="en-US">Attempt Counter</title>
<author>sup39(サポミク)</author>
<version>0.1</version>
<date>Feb 05, 2023</date>
<dependencies>drawText</dependencies>
<description lang="en-US">
Display attempt count and success count of current area.
This code can be used with 'Area Lock' of 'Instant Level Select'.
</description>
<description lang="ja-JP">
現在のエリアの試行回数と成功回数を表示します。
このコードは「レベル選択DX」の「エリアロック」と併用できます。
</description>
<source version="GMSJ01">
C210C3C8 00000008
7C7E1B78 3D80817F
A00C0476 A17E007C
7C005800 B16C0476
896C0479 996C0478
39600000 996C04A8
39600001 4082000C
816C04A4 396B0001
916C04A4 00000000
C20EDAE8 00000005
7C0802A6 3D80817F
816C04A4 3D6B0001
916C04A4 896C0479
996C0478 39600001
996C04A8 00000000
C20EAB7C 00000008
3B836000 A19C000E
A17C000A 7C0C5800
41820028 3D80817F
896C04A8 7D6B5B79
40820018 816C04A4
3D6B0001 916C04A4
896C0479 996C0478
60000000 00000000
C22069D8 0000000A
3D80817F 886C0478
3463FFFF 41A00040
986C0478 386C0490
38830010 3D808020
398C1EA8 7D8803A6
4E800021 3D80817F
386C0480 388C047A
A0AC04A4 A0CC04A6
398C0238 7D8803A6
4E800021 00000000
</source>
<source version="GMSJ0A">
C2296F20 00000008
7C7E1B78 3D80817F
A00C0476 A17E007C
7C005800 B16C0476
896C0479 996C0478
39600000 996C04A8
39600001 4082000C
816C04A4 396B0001
916C04A4 00000000
C227A214 00000005
7C0802A6 3D80817F
816C04A4 3D6B0001
916C04A4 896C0479
996C0478 39600001
996C04A8 00000000
C2277268 00000008
3B83A8E0 A19C000E
A17C000A 7C0C5800
41820028 3D80817F
896C04A8 7D6B5B79
40820018 816C04A4
3D6B0001 916C04A4
896C0479 996C0478
60000000 00000000
C2125544 0000000A
3D80817F 886C0478
3463FFFF 41A00040
986C0478 386C0490
38830010 3D808012
398C1660 7D8803A6
4E800021 3D80817F
386C0480 388C047A
A0AC04A4 A0CC04A6
398C0238 7D8803A6
4E800021 00000000
</source>
<source version="GMSP01">
C22AF6E0 00000008
7C7E1B78 3D80817F
A00C0476 A17E007C
7C005800 B16C0476
896C0479 996C0478
39600000 996C04A8
39600001 4082000C
816C04A4 396B0001
916C04A4 00000000
C22923FC 00000005
7C0802A6 3D80817F
816C04A4 3D6B0001
916C04A4 896C0479
996C0478 39600001
996C04A8 00000000
C228F458 00000008
3B8310C0 A19C000E
A17C000A 7C0C5800
41820028 3D80817F
896C04A8 7D6B5B79
40820018 816C04A4
3D6B0001 916C04A4
896C0479 996C0478
60000000 00000000
C2138DF4 0000000A
3D80817F 886C0478
3463FFFF 41A00040
986C0478 386C0490
38830010 3D808013
398C4F0C 7D8803A6
4E800021 3D80817F
386C0480 388C047A
A0AC04A4 A0CC04A6
398C0238 7D8803A6
4E800021 00000000
</source>
<source version="GMSE01">
C22B7710 00000008
7C7E1B78 3D80817F
A00C0476 A17E007C
7C005800 B16C0476
896C0479 996C0478
39600000 996C04A8
39600001 4082000C
816C04A4 396B0001
916C04A4 00000000
C229A564 00000005
7C0802A6 3D80817F
816C04A4 3D6B0001
916C04A4 896C0479
996C0478 39600001
996C04A8 00000000
C22975C0 00000008
3B839700 A19C000E
A17C000A 7C0C5800
41820028 3D80817F
896C04A8 7D6B5B79
40820018 816C04A4
3D6B0001 916C04A4
896C0479 996C0478
60000000 00000000
C21441B8 0000000A
3D80817F 886C0478
3463FFFF 41A00040
986C0478 386C0490
38830010 3D808014
398C0390 7D8803A6
4E800021 3D80817F
386C0480 388C047A
A0AC04A4 A0CC04A6
398C0238 7D8803A6
4E800021 00000000
</source>
</code>
</codes>

View file

@ -35,6 +35,8 @@ you may also need to check the following files:
- [site/.vuepress/components/codes/ui.js](site/.vuepress/components/codes/ui.js):
Specify the vue component for the configuration of the code.
The version string will be passed as a property.
- [site/.vuepress/components/codes/preview.js](site/.vuepress/components/codes/preview.js):
Specify the `id` and the `getConfig(version)` function of the code to make it shown in preview.
#### Reserved Memory
@ -67,18 +69,28 @@ Some codes store some states in the games memory starting from address 0x817F000
| ![](./docs/reserved.svg) | `0x110` | `0x237` | QF Timer: Timer Textbox |
| ![](./docs/reserved.svg) | `0x238` | `0x347` | General Function (`drawText`) |
| ![](./docs/buffer.svg) | `0x348` | `0x39B` | Buffer (QF Timer) |
| ![](./docs/reserved.svg) | `0x39C` | `0x3AF` | QF Section Timer: Background Options |
| ![](./docs/reserved.svg) | `0x3B0` | `0x3BF` | QF Section Timer: Text Options |
| ![](./docs/reserved.svg) | `0x39C` | `0x3AF` | QF Section Timer: Background Config |
| ![](./docs/reserved.svg) | `0x3B0` | `0x3BF` | QF Section Timer: Text Config |
| ![](./docs/reserved.svg) | `0x3C0` | `0x3C8` | QF Section Timer: Format String |
| ![](./docs/reserved.svg) | `0x3C9` | `0x3C9` | QF Section Timer: (Unused) |
| ![](./docs/reserved.svg) | `0x3CA` | `0x3CB` | QF Section Timer: Section Count |
| ![](./docs/reserved.svg) | `0x3CC` | `0x3CF` | QF Section Timer: Last Freezed Time |
| ![](./docs/reserved.svg) | `0x3D0` | `0x40F` | QF Section Timer: Section Time Array |
| ![](./docs/reserved.svg) | `0x410` | `0x41F` | Pattern Selector: Background Options |
| ![](./docs/reserved.svg) | `0x424` | `0x433` | Pattern Selector: Text Options |
| ![](./docs/reserved.svg) | `0x410` | `0x41F` | Pattern Selector: Background Config |
| ![](./docs/reserved.svg) | `0x424` | `0x433` | Pattern Selector: Text Config |
| ![](./docs/reserved.svg) | `0x434` | `0x440` | Pattern Selector: Format String |
| ![](./docs/reserved.svg) | `0x441` | `0x475` | Pattern Selector: Pattern Data |
| ![](./docs/unallocated.svg) | `0x476` | `0xFFF` | Not Allocated |
| ![](./docs/reserved.svg) | `0x476` | `0x477` | Attempt Counter: Previous Area |
| ![](./docs/reserved.svg) | `0x478` | `0x478` | Attempt Counter: Display Timer |
| ![](./docs/reserved.svg) | `0x479` | `0x479` | Attempt Counter: Display Duration |
| ![](./docs/reserved.svg) | `0x47A` | `0x47F` | Attempt Counter: Format String |
| ![](./docs/reserved.svg) | `0x480` | `0x48F` | Attempt Counter: Text Config |
| ![](./docs/reserved.svg) | `0x490` | `0x4A3` | Attempt Counter: Background Config |
| ![](./docs/reserved.svg) | `0x4A4` | `0x4A5` | Attempt Counter: Success Count |
| ![](./docs/reserved.svg) | `0x4A6` | `0x4A7` | Attempt Counter: Attempt Count |
| ![](./docs/reserved.svg) | `0x4A8` | `0x4A8` | Attempt Counter: Got Shine Flag |
| ![](./docs/buffer.svg) | `0x4A9` | `0x4AF` | Buffer (Attempt Counter) |
| ![](./docs/unallocated.svg) | `0x4B0` | `0xFFF` | Not Allocated |
### Adding translations

View file

@ -1,4 +1,11 @@
# Changelog
## Feb 05, 2023
### Created 'Attempt Counter'
Display attempt count and success count of current area
### Updated 'Instant Level Select'
- Rewrote with C2
- Go to level instantly without transition
## Jan 31, 2023
### Created 'Quarterframe Section Timer'
Calculate and display section times whenever Quarterframe Timer freezes

View file

@ -19,6 +19,7 @@
<script>
import { translate, translateCode } from '../i18n/localeHelper';
import { previewIds } from './codes/preview.js';
import configUIs from './codes/ui.js';
export default {
@ -36,12 +37,7 @@ export default {
return configUIs[this.code.id];
},
showPreview() {
return [
'PatternSelector',
'CustomizedDisplay',
'qft',
'qfst',
].includes(this.code.id); // TODO
return previewIds.includes(this.code.id);
},
},
data() {

View file

@ -112,10 +112,7 @@ import codeCategories from '../data/codeCategories.json';
import { translate } from '../i18n/localeHelper';
// Code Configs
import {getConfig as getConfigQFT} from './codes/qft/codegen';
import {getConfig as getConfigQFST} from './codes/qfst/codegen';
import {getConfig as getConfigCD} from './codes/CustomizedDisplay/codegen';
import {getConfig as getConfigPS} from './codes/PatternSelector/codegen';
import {getConfigs} from './codes/preview.js';
export default {
data() {
@ -162,12 +159,7 @@ export default {
} catch {}
// update config for preview
this.codeConfigs = {
qft: getConfigQFT(),
qfst: getConfigQFST(),
PatternSelector: getConfigPS(),
CustomizedDisplay: getConfigCD(e),
};
this.codeConfigs = getConfigs(e);
},
onFormatChanged(e) {
this.selectedFormat = e;

View file

@ -1,25 +1,34 @@
<template>
<div class="preview-root">
<div class="preview-ctn">
<PreviewString v-for="mdp,i in (config.CustomizedDisplay || [])"
:key="'mdp'+i" :config="mdp" :version="_version" />
<PreviewString :config="config.PatternSelector" :version="_version" />
<PreviewString :config="config.qft" :version="_version" />
<PreviewString :config="config.qfst" :version="_version" />
<PreviewString v-for="c in previews"
:key="c.key" :config="c" :version="_version" />
</div>
</div>
</template>
<script>
import {previewIds} from './codes/preview.js';
export default {
props: {
config: {type: Object},
},
computed: {
_version() {
const {_version} = this.config
const {_version} = this.config;
return _version;
},
previews() {
return previewIds.flatMap(id => {
const config = /**@type{any}*/(this.config)[id];
if (config == null) return [];
if (config instanceof Array) {
return config.map((c, i) => ({...c, key: `${id}-${i}`}));
} else {
return {...config, key: id};
}
});
},
},
}
</script>

View file

@ -0,0 +1,55 @@
import { parseJSON } from '../codegen.js';
import { insts2hex, getDrawTextOpt, getFillRectParams } from '../asm';
import { measureText } from '../text.js';
import { int2hex } from '../utils.js';
export const lskey = 'config/AttemptCounter';
export const defaultConfig = {
x: 152,
y: 125,
fontSize: 32,
fgRGB: 0xffff99,
fgA: 0xff,
fgRGB2: null,
fgA2: null,
bgRGB: 0x000000,
bgA: 0x40,
bgLeft: 4,
bgRight: 6,
bgTop: 4,
bgBot: 3,
duration: 60,
};
export const getPreviewText = () => '88\n99';
/** @returns {typeof defaultConfig} */
export function getConfig() {
const config =
(typeof localStorage !== 'undefined' && parseJSON(localStorage.getItem(lskey))) || {};
return {
...defaultConfig,
...config,
text: getPreviewText(),
};
}
/**
* @param {keyof typeof import('../addrs.js').ctxSpOff} version
* @param {string=} baseCode
*/
export default function codegen(version, baseCode) {
if (!baseCode) return '';
const config = getConfig();
let code = baseCode;
code += '077F0479 0000002B';
code += int2hex(config.duration, 1);
code += '25640A256400'; // fmt = "%d\n%d"
code += insts2hex(getDrawTextOpt(config));
code += insts2hex(getFillRectParams(config, measureText(getPreviewText(), version)));
code += '0000000000'; // padding
return code.replace(/\s/g, '');
}

View file

@ -0,0 +1,76 @@
<template>
<div>
<section class="appearance">
<h3>{{ l('h3.appearance') }}</h3>
<TextConfig v-model="textConfig" />
<div>
<span>{{ l('display.duration') }}</span><input type="number" min="0" max="255" v-model="duration" />
{{ l('display.frame') }} = {{ ((duration * 1001) / 30000).toFixed(2) }} {{ l('display.sec') }}
</div>
</section>
</div>
</template>
<script>
import { defaultConfig, lskey, getConfig, getPreviewText } from './codegen.js';
import { makeUpdateConfig, makeGetLabel } from '../utils';
import labels from '../labels.json';
import TextConfig from '../TextConfig.vue';
const updateConfig = makeUpdateConfig(lskey, defaultConfig, getPreviewText);
export default {
components: {
TextConfig,
},
props: {
version: { type: String },
},
methods: {
updateConfig,
},
data() {
const config = getConfig();
return {...config};
},
computed: {
l() {
return makeGetLabel(labels, this.$lang);
},
textConfig: {
get() {
return this;
},
set(value) {
Object.assign(this, value);
this.updateConfig();
},
},
},
watch: {
duration: updateConfig,
},
};
</script>
<style scoped>
input[type='number'],
td.right {
text-align: right;
}
input[type='number'] {
width: 3em;
margin: 0 2px;
}
.appearance > div {
padding: 0 0 4px;
}
input[type='number'] {
-moz-appearance: textfield;
}
input[type='number']::-webkit-inner-spin-button,
input[type='number']::-webkit-outer-spin-button {
-webkit-appearance: none;
margin: 0;
}
</style>

View file

@ -1,15 +1,15 @@
<template>
<div>
<Preview :config="previewConfig" />
<div v-for="c,i in config" :key="i" class="textcell">
<div v-for="c,i in config" :key="c.key" class="textcell">
<button class="textcell-remove" @click="deletionConfirm(i)">&#215;</button>
<Cell :value="c" @input="$event => config.splice(i, 1, $event)" :version="version" />
<Cell :value="c" @input="$event => config.splice(i, 1, {...$event, key: c.key})" :version="version" />
</div>
<div class="btn-ctn">
<button @click="config.push(db.PAS)">{{l('add.PAS')}}</button>
<button @click="config.push(db.speed)">{{l('add.speed')}}</button>
<button @click="config.push(db.detailed)">{{l('add.detailed')}}</button>
<button @click="config.push(db.rect)">{{l('add.rect')}}</button>
<button @click="append(db.PAS)">{{l('add.PAS')}}</button>
<button @click="append(db.speed)">{{l('add.speed')}}</button>
<button @click="append(db.detailed)">{{l('add.detailed')}}</button>
<button @click="append(db.rect)">{{l('add.rect')}}</button>
</div>
</div>
</template>
@ -49,7 +49,8 @@ export default {
text: format2previewText(defaultConfig[0].fmt, version),
...defaultConfig[0],
};
return {config, defaultConfigCell};
const keys = config.map((e, i) => i);
return {config, defaultConfigCell, keys, nextKey: keys.length};
},
watch: {
config: makeUpdateConfig(lskey, defaultConfig),
@ -60,6 +61,10 @@ export default {
// if (window.confirm(this.l('deletionConfirm'))) {
this.config.splice(i, 1);
},
/** @param {any} c */
append(c) {
this.config.push({...c, key: this.nextKey++});
},
},
}
</script>

View file

@ -3,6 +3,7 @@ import qft from './qft/codegen.js';
import qfst from './qfst/codegen.js';
import CustomizedDisplay from './CustomizedDisplay/codegen.js';
import PatternSelector from './PatternSelector/codegen.js';
import AttemptCounter from './AttemptCounter/codegen.js';
export default {
InstantRestart,
@ -10,6 +11,7 @@ export default {
qfst,
CustomizedDisplay,
PatternSelector,
AttemptCounter,
};
/**

View file

@ -15,7 +15,12 @@
"left": "左",
"right": "右",
"top": "上",
"bottom": "下"
"bottom": "下",
"display": {
"duration": "表示時間:",
"frame": "(フレーム)",
"sec": "(秒)"
}
},
"en-US": {
"h3": {
@ -33,7 +38,12 @@
"left": "Left",
"right": "Right",
"top": "Top",
"bottom": "Bottom"
"bottom": "Bottom",
"display": {
"duration": "Display duration: ",
"frame": "(frame)",
"sec": "(sec)"
}
},
"fr-FR": {
"location": "Position : ",

View file

@ -0,0 +1,22 @@
import * as qft from './qft/codegen.js';
import * as qfst from './qfst/codegen.js';
import * as CustomizedDisplay from './CustomizedDisplay/codegen.js';
import * as PatternSelector from './PatternSelector/codegen.js';
import * as AttemptCounter from './AttemptCounter/codegen.js';
export const previewIds = ['CustomizedDisplay', 'AttemptCounter', 'PatternSelector', 'qft', 'qfst'];
/**
* Get code configs for preview
* @param {keyof typeof import('./addrs.js').ctxSpOff} version
*/
export const getConfigs = (version) =>
Object.fromEntries(
Object.entries({
qft,
qfst,
CustomizedDisplay,
PatternSelector,
AttemptCounter,
}).map(([k, v]) => [k, v.getConfig(version)]),
);

View file

@ -3,6 +3,7 @@ import CustomizedDisplay from './CustomizedDisplay/config.vue';
import PatternSelector from './PatternSelector/config.vue';
import qft from './qft/config.vue';
import qfst from './qfst/config.vue';
import AttemptCounter from './AttemptCounter/config.vue';
export default {
InstantRestart,
@ -10,4 +11,5 @@ export default {
PatternSelector,
qft,
qfst,
AttemptCounter,
};