@famibee/skynovel 1.65.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/Button.js +131 -163
- package/dist/Button.js.map +1 -1
- package/dist/CallStack.js +19 -22
- package/dist/CallStack.js.map +1 -1
- package/dist/CmnInterface.js +91 -0
- package/dist/CmnInterface.js.map +1 -0
- package/dist/CmnLib.js +94 -0
- package/dist/CmnLib.js.map +1 -0
- package/dist/Config.js +26 -0
- package/dist/Config.js.map +1 -0
- package/dist/ConfigBase.js +152 -0
- package/dist/ConfigBase.js.map +1 -0
- package/dist/DebugMng.js +89 -102
- package/dist/DebugMng.js.map +1 -1
- package/dist/EventListenerCtn.js +21 -0
- package/dist/EventListenerCtn.js.map +1 -0
- package/dist/EventMng.js +1435 -1577
- package/dist/EventMng.js.map +1 -1
- package/dist/Grammar.js +194 -0
- package/dist/Grammar.js.map +1 -0
- package/dist/GrpLayer.js +163 -195
- package/dist/GrpLayer.js.map +1 -1
- package/dist/Layer.js +260 -0
- package/dist/Layer.js.map +1 -0
- package/dist/LayerMng.js +810 -991
- package/dist/LayerMng.js.map +1 -1
- package/dist/Main.js +144 -393
- package/dist/Main.js.map +1 -1
- package/dist/PropParser.js +936 -834
- package/dist/PropParser.js.map +1 -1
- package/dist/Reading.js +917 -786
- package/dist/Reading.js.map +1 -1
- package/dist/RubySpliter.js +59 -92
- package/dist/RubySpliter.js.map +1 -1
- package/dist/ScriptIterator.js +805 -1034
- package/dist/ScriptIterator.js.map +1 -1
- package/dist/SndBuf.js +1097 -1332
- package/dist/SndBuf.js.map +1 -1
- package/dist/SoundMng.js +124 -135
- package/dist/SoundMng.js.map +1 -1
- package/dist/SpritesMng.js +220 -232
- package/dist/SpritesMng.js.map +1 -1
- package/dist/SysBase.js +1729 -0
- package/dist/SysBase.js.map +1 -0
- package/dist/TxtLayer.js +1212 -1397
- package/dist/TxtLayer.js.map +1 -1
- package/dist/Variable.js +398 -466
- package/dist/Variable.js.map +1 -1
- package/dist/chunk.js +18 -0
- package/dist/gamepad.js +723 -511
- package/dist/gamepad.js.map +1 -1
- package/dist/pixi.js +13422 -0
- package/dist/pixi.js.map +1 -0
- package/dist/platform.js +424 -369
- package/dist/platform.js.map +1 -1
- package/dist/sn/AnalyzeTagArg.d.ts +1 -1
- package/dist/sn/AnalyzeTagArg.d.ts.map +1 -1
- package/dist/sn/CmnInterface.d.ts +3 -1
- package/dist/sn/CmnInterface.d.ts.map +1 -1
- package/dist/sn/CmnLib.d.ts.map +1 -1
- package/dist/sn/CmnTween.d.ts +3 -3
- package/dist/sn/CmnTween.d.ts.map +1 -1
- package/dist/sn/EventMng.d.ts.map +1 -1
- package/dist/sn/Grammar.d.ts +1 -1
- package/dist/sn/Grammar.d.ts.map +1 -1
- package/dist/sn/PropParser.d.ts +2 -2
- package/dist/sn/PropParser.d.ts.map +1 -1
- package/dist/sn/Reading.d.ts +6 -0
- package/dist/sn/Reading.d.ts.map +1 -1
- package/dist/sn/ScriptIterator.d.ts.map +1 -1
- package/dist/sn/SndBuf.d.ts +27 -16
- package/dist/sn/SndBuf.d.ts.map +1 -1
- package/dist/sn/SoundMng.d.ts +4 -1
- package/dist/sn/SoundMng.d.ts.map +1 -1
- package/dist/sn/SysBase.d.ts.map +1 -1
- package/dist/sn/TxtStage.d.ts +2 -1
- package/dist/sn/TxtStage.d.ts.map +1 -1
- package/dist/test/ValTest.d.ts +1 -1
- package/dist/test/ValTest.d.ts.map +1 -1
- package/dist/web.js +653 -8
- package/dist/web.js.map +1 -1
- package/dist_app/Button.js +131 -163
- package/dist_app/Button.js.map +1 -1
- package/dist_app/CallStack.js +19 -22
- package/dist_app/CallStack.js.map +1 -1
- package/dist_app/CmnInterface.js +91 -0
- package/dist_app/CmnInterface.js.map +1 -0
- package/dist_app/CmnLib.js +94 -0
- package/dist_app/CmnLib.js.map +1 -0
- package/dist_app/Config.js +26 -0
- package/dist_app/Config.js.map +1 -0
- package/dist_app/ConfigBase.js +152 -0
- package/dist_app/ConfigBase.js.map +1 -0
- package/dist_app/DebugMng.js +92 -0
- package/dist_app/DebugMng.js.map +1 -0
- package/dist_app/EventListenerCtn.js +21 -0
- package/dist_app/EventListenerCtn.js.map +1 -0
- package/dist_app/EventMng.js +1435 -1577
- package/dist_app/EventMng.js.map +1 -1
- package/dist_app/Grammar.js +194 -0
- package/dist_app/Grammar.js.map +1 -0
- package/dist_app/GrpLayer.js +163 -195
- package/dist_app/GrpLayer.js.map +1 -1
- package/dist_app/Layer.js +260 -0
- package/dist_app/Layer.js.map +1 -0
- package/dist_app/LayerMng.js +810 -991
- package/dist_app/LayerMng.js.map +1 -1
- package/dist_app/Main.js +144 -392
- package/dist_app/Main.js.map +1 -1
- package/dist_app/PropParser.js +936 -834
- package/dist_app/PropParser.js.map +1 -1
- package/dist_app/Reading.js +917 -786
- package/dist_app/Reading.js.map +1 -1
- package/dist_app/RubySpliter.js +59 -92
- package/dist_app/RubySpliter.js.map +1 -1
- package/dist_app/ScriptIterator.js +805 -1033
- package/dist_app/ScriptIterator.js.map +1 -1
- package/dist_app/SndBuf.js +1097 -1332
- package/dist_app/SndBuf.js.map +1 -1
- package/dist_app/SoundMng.js +124 -135
- package/dist_app/SoundMng.js.map +1 -1
- package/dist_app/SpritesMng.js +220 -231
- package/dist_app/SpritesMng.js.map +1 -1
- package/dist_app/SysBase.js +1729 -0
- package/dist_app/SysBase.js.map +1 -0
- package/dist_app/TxtLayer.js +1212 -1396
- package/dist_app/TxtLayer.js.map +1 -1
- package/dist_app/Variable.js +398 -466
- package/dist_app/Variable.js.map +1 -1
- package/dist_app/app.js +211 -8
- package/dist_app/app.js.map +1 -1
- package/dist_app/appMain.js +20 -21
- package/dist_app/appMain.js.map +1 -1
- package/dist_app/chunk.js +18 -0
- package/dist_app/gamepad.js +723 -511
- package/dist_app/gamepad.js.map +1 -1
- package/dist_app/pixi.js +11181 -0
- package/dist_app/pixi.js.map +1 -0
- package/dist_app/platform.js +424 -369
- package/dist_app/platform.js.map +1 -1
- package/dist_app/preload.js +2 -2
- package/dist_app/preload.js.map +1 -1
- package/dist_app/sn/AnalyzeTagArg.d.ts +1 -1
- package/dist_app/sn/AnalyzeTagArg.d.ts.map +1 -1
- package/dist_app/sn/CmnInterface.d.ts +3 -1
- package/dist_app/sn/CmnInterface.d.ts.map +1 -1
- package/dist_app/sn/CmnLib.d.ts.map +1 -1
- package/dist_app/sn/CmnTween.d.ts +3 -3
- package/dist_app/sn/CmnTween.d.ts.map +1 -1
- package/dist_app/sn/EventMng.d.ts.map +1 -1
- package/dist_app/sn/Grammar.d.ts +1 -1
- package/dist_app/sn/Grammar.d.ts.map +1 -1
- package/dist_app/sn/PropParser.d.ts +2 -2
- package/dist_app/sn/PropParser.d.ts.map +1 -1
- package/dist_app/sn/Reading.d.ts +6 -0
- package/dist_app/sn/Reading.d.ts.map +1 -1
- package/dist_app/sn/ScriptIterator.d.ts.map +1 -1
- package/dist_app/sn/SndBuf.d.ts +27 -16
- package/dist_app/sn/SndBuf.d.ts.map +1 -1
- package/dist_app/sn/SoundMng.d.ts +4 -1
- package/dist_app/sn/SoundMng.d.ts.map +1 -1
- package/dist_app/sn/SysBase.d.ts.map +1 -1
- package/dist_app/sn/TxtStage.d.ts +2 -1
- package/dist_app/sn/TxtStage.d.ts.map +1 -1
- package/dist_app/test/ValTest.d.ts +1 -1
- package/dist_app/test/ValTest.d.ts.map +1 -1
- package/package.json +23 -13
- package/dist/CmnTween.js +0 -1005
- package/dist/CmnTween.js.map +0 -1
- package/dist/web2.js +0 -21644
- package/dist/web2.js.map +0 -1
- package/dist_app/CmnTween.js +0 -1005
- package/dist_app/CmnTween.js.map +0 -1
- package/dist_app/app2.js +0 -18547
- package/dist_app/app2.js.map +0 -1
package/dist/Main.js
CHANGED
|
@@ -1,394 +1,145 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
if (this.#t.test(o)) throw "[bracket2macro] text【" + o + "】は括弧マクロに使用できない文字です";
|
|
143
|
-
this.#s[o] = "0", this.#s[r] = `[${i} text=`, this.addC2M(`\\${r}[^\\${o}]*\\${o}`, `\\${r}\\${o}`), this.#u(s, n);
|
|
144
|
-
}
|
|
145
|
-
// 一文字マクロの定義
|
|
146
|
-
char2macro(t, e, s, n) {
|
|
147
|
-
const { char: i, name: a } = t;
|
|
148
|
-
if (!i) throw "[char2macro] charは必須です";
|
|
149
|
-
if (this.#s ??= {}, i in this.#s) throw "[char2macro] char【" + i + "】が登録済みの括弧マクロまたは一文字マクロです";
|
|
150
|
-
if (this.#t.test(i)) throw "[char2macro] char【" + i + "】は一文字マクロに使用できない文字です";
|
|
151
|
-
if (!a) throw "[char2macro] nameは必須です";
|
|
152
|
-
if (!(a in e)) throw `[char2macro] 未定義のタグ又はマクロ[${a}]です`;
|
|
153
|
-
this.#s[i] = `[${a}]`, this.addC2M(`\\${i}`, `\\${i}`), this.#u(s, n);
|
|
154
|
-
}
|
|
155
|
-
#t;
|
|
156
|
-
#n = new RegExp("");
|
|
157
|
-
#a = "";
|
|
158
|
-
#i = "";
|
|
159
|
-
addC2M(t, e) {
|
|
160
|
-
this.#a += `${t}|`, this.#i += e, this.#n = new RegExp(
|
|
161
|
-
`(${this.#a}[^${this.#i}]+)`,
|
|
162
|
-
"g"
|
|
163
|
-
);
|
|
164
|
-
}
|
|
165
|
-
resolveScript(t) {
|
|
166
|
-
const e = t.replaceAll(/\r\n?/g, `
|
|
167
|
-
`).match(this.#e)?.flatMap((n) => {
|
|
168
|
-
if (!this.testTagLetml(n)) return n;
|
|
169
|
-
const i = /^([^\]]+?])(.*)$/s.exec(n);
|
|
170
|
-
if (!i) return n;
|
|
171
|
-
const [, a, r] = i;
|
|
172
|
-
return [a, r];
|
|
173
|
-
}) ?? [], s = { aToken: e, len: e.length, aLNum: [] };
|
|
174
|
-
return this.#u(s), this.#h(s), s;
|
|
175
|
-
}
|
|
176
|
-
#l = /^\[(call|loadplugin)\s/;
|
|
177
|
-
#o = /\bfn\s*=\s*[^\s\]]+/;
|
|
178
|
-
#h(t) {
|
|
179
|
-
for (let e = t.len - 1; e >= 0; --e) {
|
|
180
|
-
const s = t.aToken[e];
|
|
181
|
-
if (!this.#l.test(s)) continue;
|
|
182
|
-
const [n, i] = A(s);
|
|
183
|
-
this.#c.parse(i);
|
|
184
|
-
const a = this.#c.hPrm.fn;
|
|
185
|
-
if (!a) continue;
|
|
186
|
-
const { val: r } = a;
|
|
187
|
-
if (!r.endsWith("*")) continue;
|
|
188
|
-
t.aToken.splice(e, 1, " ", "; " + s), t.aLNum.splice(e, 1, NaN, NaN);
|
|
189
|
-
const o = n === "loadplugin" ? C.CSS : C.SN, u = this.cfg.matchPath("^" + r.slice(0, -1) + ".*", o);
|
|
190
|
-
for (const f of u) {
|
|
191
|
-
const d = s.replace(
|
|
192
|
-
this.#o,
|
|
193
|
-
"fn=" + decodeURIComponent(L(f[o]))
|
|
194
|
-
);
|
|
195
|
-
t.aToken.splice(e, 0, d), t.aLNum.splice(e, 0, NaN);
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
t.len = t.aToken.length;
|
|
199
|
-
}
|
|
200
|
-
#c = new W();
|
|
201
|
-
testTagLetml(t) {
|
|
202
|
-
return /^\[let_ml\s/.test(t);
|
|
203
|
-
}
|
|
204
|
-
testTagEndLetml(t) {
|
|
205
|
-
return /^\[endlet_ml\s*]/.test(t);
|
|
206
|
-
}
|
|
207
|
-
#s = void 0;
|
|
208
|
-
#r;
|
|
209
|
-
#u(t, e = 0) {
|
|
210
|
-
if (this.#s) {
|
|
211
|
-
for (let s = t.len - 1; s >= e; --s) {
|
|
212
|
-
const n = t.aToken[s];
|
|
213
|
-
if (this.testNoTxt(n.at(0) ?? `
|
|
214
|
-
`)) continue;
|
|
215
|
-
const i = t.aLNum[s], a = n.match(this.#n);
|
|
216
|
-
if (!a) continue;
|
|
217
|
-
let r = 1;
|
|
218
|
-
for (let o = a.length - 1; o >= 0; --o) {
|
|
219
|
-
let u = a[o];
|
|
220
|
-
const f = this.#s[u.at(0) ?? " "];
|
|
221
|
-
f && (u = f + (f.endsWith("]") ? "" : `'${u.slice(1, -1)}']`)), t.aToken.splice(s, r, u), t.aLNum.splice(s, r, i), r = 0;
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
t.len = t.aToken.length;
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
testNoTxt(t) {
|
|
228
|
-
return this.#r.test(t);
|
|
229
|
-
}
|
|
230
|
-
//4tst
|
|
231
|
-
}
|
|
232
|
-
const y = "skynovel";
|
|
233
|
-
class x {
|
|
234
|
-
constructor(t) {
|
|
235
|
-
this.sys = t;
|
|
236
|
-
}
|
|
237
|
-
static async generate(t) {
|
|
238
|
-
G();
|
|
239
|
-
const e = new x(t);
|
|
240
|
-
return await e.#l().catch((s) => console.error("Main.generate err e:%o", s)), e;
|
|
241
|
-
}
|
|
242
|
-
cvs;
|
|
243
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
244
|
-
#e = /* @__PURE__ */ Object.create(null);
|
|
245
|
-
// タグ処理辞書
|
|
246
|
-
#t;
|
|
247
|
-
#n;
|
|
248
|
-
#a;
|
|
249
|
-
#i = [];
|
|
250
|
-
async #l() {
|
|
251
|
-
const t = await b.generate(this.sys);
|
|
252
|
-
this.sys.setMain(this, t);
|
|
253
|
-
const e = {
|
|
254
|
-
width: t.oCfg.window.width,
|
|
255
|
-
height: t.oCfg.window.height,
|
|
256
|
-
backgroundColor: M(String(t.oCfg.init.bg_color)),
|
|
257
|
-
// このString()は後方互換性のため必須
|
|
258
|
-
resolution: globalThis.devicePixelRatio
|
|
259
|
-
}, s = document.getElementById(y);
|
|
260
|
-
if (s) {
|
|
261
|
-
const h = s.cloneNode(!0);
|
|
262
|
-
h.id = y, e.view = s;
|
|
263
|
-
const m = s.parentNode;
|
|
264
|
-
this.#i.unshift(() => m.appendChild(h));
|
|
265
|
-
} else {
|
|
266
|
-
const h = document.createElement("canvas");
|
|
267
|
-
h.id = y, e.view = h, document.body.appendChild(h), this.#i.unshift(() => document.body.removeChild(h));
|
|
268
|
-
}
|
|
269
|
-
const n = new R(e);
|
|
270
|
-
this.#i.unshift(() => {
|
|
271
|
-
P(), this.sys.destroy(), n.destroy(!1);
|
|
272
|
-
}), this.cvs = n.view, this.cvs.id = y + "_act", s || document.body.appendChild(this.cvs);
|
|
273
|
-
const i = document.createElement("canvas").getContext("2d");
|
|
274
|
-
if (!i) throw "#init cc err";
|
|
275
|
-
w.cc4ColorName = i;
|
|
276
|
-
const [{ Variable: a }, { PropParser: r }, { SoundMng: o }, { ScriptIterator: u }, { LayerMng: f }, { EventMng: d }, { Button: _ }] = await Promise.all([
|
|
277
|
-
import("./Variable.js"),
|
|
278
|
-
import("./PropParser.js"),
|
|
279
|
-
import("./SoundMng.js"),
|
|
280
|
-
import("./ScriptIterator.js"),
|
|
281
|
-
import("./LayerMng.js"),
|
|
282
|
-
import("./EventMng.js"),
|
|
283
|
-
import("./Button.js")
|
|
284
|
-
]);
|
|
285
|
-
_.init(t);
|
|
286
|
-
const l = new a(this.sys, t, this.#e), p = new r(l, t.oCfg.init.escape);
|
|
287
|
-
this.#o = (h, m, v, N) => l.setVal_Nochk(h, m, v, N), this.#s = (h) => p.getValAmpersand(h), this.#r = (h) => p.parse(h), await Promise.allSettled(this.sys.init(this.#e, n, l));
|
|
288
|
-
const g = new o(t, this.#e, l, this, this.sys);
|
|
289
|
-
this.#i.unshift(() => g.destroy()), this.#t = new u(t, this.#e, this, l, p, g, this.sys), this.#i.unshift(() => this.#t.destroy());
|
|
290
|
-
const k = new $(this.sys, this.#e, this.#t);
|
|
291
|
-
this.#i.unshift(() => k.destroy()), this.errScript = (h, m = !0) => {
|
|
292
|
-
if (this.stop(), $.myTrace(h), w.debugLog && console.log("🍜 SKYNovel err!"), m) throw h;
|
|
293
|
-
}, this.#n = new f(t, this.#e, n, l, this, this.#t, this.sys, g, p), this.#i.unshift(() => this.#n.destroy()), this.#a = new d(t, this.#e, n, this, this.#n, l, g, this.#t, this.sys), this.#i.unshift(() => this.#a.destroy()), this.#i.unshift(() => {
|
|
294
|
-
this.stop(), this.#h = !1;
|
|
295
|
-
const h = () => !0;
|
|
296
|
-
for (const m in this.#e) this.#e[m] = h;
|
|
297
|
-
});
|
|
298
|
-
}
|
|
299
|
-
destroy() {
|
|
300
|
-
this.resume = this.destroy = () => {
|
|
301
|
-
}, this.cvs.parentElement?.removeChild(this.cvs);
|
|
302
|
-
for (const t of this.#i) t();
|
|
303
|
-
this.#i = [];
|
|
304
|
-
}
|
|
305
|
-
errScript = (t, e = !0) => {
|
|
306
|
-
};
|
|
307
|
-
resumeByJumpOrCall(t) {
|
|
308
|
-
if (t.url) {
|
|
309
|
-
this.#e.navigate_to(t), this.#t.jumpJustBefore();
|
|
310
|
-
return;
|
|
311
|
-
}
|
|
312
|
-
if (this.#o("tmp", "sn.eventArg", String(t.arg ?? "")), this.#o("tmp", "sn.eventLabel", t.label ?? ""), O(t, "call", !1)) {
|
|
313
|
-
if (this.#t.subIdxToken(), this.#e.call(t)) return;
|
|
314
|
-
} else if (this.#e.clear_event({}), this.#e.jump(t)) return;
|
|
315
|
-
this.resume();
|
|
316
|
-
}
|
|
317
|
-
#o = (t, e, s, n = !1) => {
|
|
318
|
-
};
|
|
319
|
-
resume() {
|
|
320
|
-
this.#n.clearBreak(), this.#t.noticeBreak(!1), this.#a.hideHint(), queueMicrotask(() => {
|
|
321
|
-
this.#c();
|
|
322
|
-
});
|
|
323
|
-
}
|
|
324
|
-
stop = () => {
|
|
325
|
-
this.#t.noticeBreak(!0);
|
|
326
|
-
};
|
|
327
|
-
setLoop(t, e = "") {
|
|
328
|
-
(this.#h = t) ? this.resume() : this.stop(), this.sys.setTitleInfo(e ? ` -- ${e}中` : "");
|
|
329
|
-
}
|
|
330
|
-
// oxlint-disable-next-line no-unused-private-class-members
|
|
331
|
-
#h = !0;
|
|
332
|
-
//MARK: メイン処理(シナリオ解析)
|
|
333
|
-
async #c() {
|
|
334
|
-
let t = "";
|
|
335
|
-
try {
|
|
336
|
-
for (; this.#h; ) {
|
|
337
|
-
let e = this.#t.nextToken();
|
|
338
|
-
if (!e) return;
|
|
339
|
-
const s = e.charCodeAt(0);
|
|
340
|
-
if (s === 9) continue;
|
|
341
|
-
if (s === 10) {
|
|
342
|
-
this.#t.addLineNum(e.length);
|
|
343
|
-
continue;
|
|
344
|
-
}
|
|
345
|
-
if (s === 91) {
|
|
346
|
-
if (t = "タグ開始", this.#t.isBreak(e)) return;
|
|
347
|
-
const [i, a] = A(e);
|
|
348
|
-
t = `[${i}]例外`;
|
|
349
|
-
const r = (e.match(/\n/g) ?? []).length;
|
|
350
|
-
if (r > 0 && this.#t.addLineNum(r), await this.#t.タグ解析(
|
|
351
|
-
i,
|
|
352
|
-
a
|
|
353
|
-
)) {
|
|
354
|
-
this.stop();
|
|
355
|
-
return;
|
|
356
|
-
}
|
|
357
|
-
continue;
|
|
358
|
-
}
|
|
359
|
-
if (s === 38) {
|
|
360
|
-
if (!e.endsWith("&")) {
|
|
361
|
-
if (t = "変数計算", this.#t.isBreak(e)) return;
|
|
362
|
-
const i = I(e.slice(1));
|
|
363
|
-
i.name = this.#s(i.name), i.text = String(this.#r(i.text)), this.#e.let(i);
|
|
364
|
-
continue;
|
|
365
|
-
}
|
|
366
|
-
if (t = "変数操作", e.charAt(1) === "&") throw new Error("「&表示&」書式では「&」指定が不要です");
|
|
367
|
-
e = String(this.#r(e.slice(1, -1)));
|
|
368
|
-
} else {
|
|
369
|
-
if (s === 59) continue;
|
|
370
|
-
if (s === 42 && e.length > 1) continue;
|
|
371
|
-
}
|
|
372
|
-
t = "文字表示", this.#n.setNormalChWait(), this.#n.currentTxtlayForeNeedErr.tagCh(e);
|
|
373
|
-
}
|
|
374
|
-
} catch (e) {
|
|
375
|
-
this.errScript(`${t} ${e instanceof Error ? `mes=${e.message}(${e.name})` : String(e)}`, !1);
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
#s = (t) => "";
|
|
379
|
-
#r;
|
|
380
|
-
}
|
|
381
|
-
const z = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
382
|
-
__proto__: null,
|
|
383
|
-
Main: x
|
|
384
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
385
|
-
export {
|
|
386
|
-
W as A,
|
|
387
|
-
K as G,
|
|
388
|
-
z as M,
|
|
389
|
-
B as P,
|
|
390
|
-
A as a,
|
|
391
|
-
D as b,
|
|
392
|
-
V as t
|
|
1
|
+
import { h as parseColor, s as argChk_Boolean, t as CmnLib } from "./CmnLib.js";
|
|
2
|
+
import { _ as clearTextureCache, r as Application, y as skipHello } from "./pixi.js";
|
|
3
|
+
import "./ConfigBase.js";
|
|
4
|
+
import { t as DebugMng } from "./DebugMng.js";
|
|
5
|
+
import { t as Config } from "./Config.js";
|
|
6
|
+
import { i as tagToken2Name_Args, n as splitAmpersand } from "./Grammar.js";
|
|
7
|
+
var SN_ID = "skynovel", Main = class d {
|
|
8
|
+
static async generate(e) {
|
|
9
|
+
skipHello();
|
|
10
|
+
let i = new d(e);
|
|
11
|
+
return await i.#a().catch((e) => console.error("Main.generate err e:%o", e)), i;
|
|
12
|
+
}
|
|
13
|
+
cvs;
|
|
14
|
+
#e = Object.create(null);
|
|
15
|
+
#t;
|
|
16
|
+
#n;
|
|
17
|
+
#r;
|
|
18
|
+
#i = [];
|
|
19
|
+
constructor(e) {
|
|
20
|
+
this.sys = e;
|
|
21
|
+
}
|
|
22
|
+
async #a() {
|
|
23
|
+
let i = await Config.generate(this.sys);
|
|
24
|
+
this.sys.setMain(this, i);
|
|
25
|
+
let c = {
|
|
26
|
+
width: i.oCfg.window.width,
|
|
27
|
+
height: i.oCfg.window.height,
|
|
28
|
+
backgroundColor: parseColor(String(i.oCfg.init.bg_color)),
|
|
29
|
+
resolution: globalThis.devicePixelRatio
|
|
30
|
+
}, l = document.getElementById(SN_ID);
|
|
31
|
+
if (l) {
|
|
32
|
+
let e = l.cloneNode(!0);
|
|
33
|
+
e.id = SN_ID, c.view = l;
|
|
34
|
+
let i = l.parentNode;
|
|
35
|
+
this.#i.unshift(() => i.appendChild(e));
|
|
36
|
+
} else {
|
|
37
|
+
let e = document.createElement("canvas");
|
|
38
|
+
e.id = SN_ID, c.view = e, document.body.appendChild(e), this.#i.unshift(() => document.body.removeChild(e));
|
|
39
|
+
}
|
|
40
|
+
let u = new Application(c);
|
|
41
|
+
this.#i.unshift(() => {
|
|
42
|
+
clearTextureCache(), this.sys.destroy(), u.destroy(!1);
|
|
43
|
+
}), this.cvs = u.view, this.cvs.id = SN_ID + "_act", l || document.body.appendChild(this.cvs);
|
|
44
|
+
let d = document.createElement("canvas").getContext("2d");
|
|
45
|
+
if (!d) throw "#init cc err";
|
|
46
|
+
CmnLib.cc4ColorName = d;
|
|
47
|
+
let [{ Variable: f }, { PropParser: p }, { SoundMng: m }, { ScriptIterator: h }, { LayerMng: g }, { EventMng: _ }, { Button: v }] = await Promise.all([
|
|
48
|
+
import("./Variable.js"),
|
|
49
|
+
import("./PropParser.js"),
|
|
50
|
+
import("./SoundMng.js"),
|
|
51
|
+
import("./ScriptIterator.js"),
|
|
52
|
+
import("./LayerMng.js"),
|
|
53
|
+
import("./EventMng.js"),
|
|
54
|
+
import("./Button.js")
|
|
55
|
+
]);
|
|
56
|
+
v.init(i);
|
|
57
|
+
let y = new f(this.sys, i, this.#e), b = new p(y, i.oCfg.init.escape);
|
|
58
|
+
this.#o = (e, i, a, o) => y.setVal_Nochk(e, i, a, o), this.#l = (e) => b.getValAmpersand(e), this.#u = (e) => b.parse(e), await Promise.allSettled(this.sys.init(this.#e, u, y));
|
|
59
|
+
let x = new m(i, this.#e, y, this, this.sys);
|
|
60
|
+
this.#i.unshift(() => x.destroy()), this.#t = new h(i, this.#e, this, y, b, x, this.sys), this.#i.unshift(() => this.#t.destroy());
|
|
61
|
+
let S = new DebugMng(this.sys, this.#e, this.#t);
|
|
62
|
+
this.#i.unshift(() => S.destroy()), this.errScript = (e, i) => {
|
|
63
|
+
if (this.stop(), DebugMng.myTrace(e), CmnLib.debugLog && console.log("🍜 SKYNovel err!"), i) throw e;
|
|
64
|
+
}, this.#n = new g(i, this.#e, u, y, this, this.#t, this.sys, x, b), this.#i.unshift(() => this.#n.destroy()), this.#r = new _(i, this.#e, u, this, this.#n, y, x, this.#t, this.sys), this.#i.unshift(() => this.#r.destroy()), this.#i.unshift(() => {
|
|
65
|
+
this.stop(), this.#s = !1;
|
|
66
|
+
let e = () => !0;
|
|
67
|
+
for (let i in this.#e) this.#e[i] = e;
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
destroy() {
|
|
71
|
+
this.resume = this.destroy = () => {}, this.cvs.parentElement?.removeChild(this.cvs);
|
|
72
|
+
for (let e of this.#i) e();
|
|
73
|
+
this.#i = [];
|
|
74
|
+
}
|
|
75
|
+
errScript = (e, i = !0) => {};
|
|
76
|
+
resumeByJumpOrCall(e) {
|
|
77
|
+
if (e.url) {
|
|
78
|
+
this.#e.navigate_to(e), this.#t.jumpJustBefore();
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
if (this.#o("tmp", "sn.eventArg", String(e.arg ?? "")), this.#o("tmp", "sn.eventLabel", e.label ?? ""), argChk_Boolean(e, "call", !1)) {
|
|
82
|
+
if (this.#t.subIdxToken(), this.#e.call(e)) return;
|
|
83
|
+
} else if (this.#e.clear_event({}), this.#e.jump(e)) return;
|
|
84
|
+
this.resume();
|
|
85
|
+
}
|
|
86
|
+
#o = (e, i, a, o = !1) => {};
|
|
87
|
+
resume() {
|
|
88
|
+
this.#n.clearBreak(), this.#t.noticeBreak(!1), this.#r.hideHint(), queueMicrotask(() => {
|
|
89
|
+
this.#c();
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
stop = () => {
|
|
93
|
+
this.#t.noticeBreak(!0);
|
|
94
|
+
};
|
|
95
|
+
setLoop(e, i = "") {
|
|
96
|
+
(this.#s = e) ? this.resume() : this.stop(), this.sys.setTitleInfo(i ? ` -- ${i}中` : "");
|
|
97
|
+
}
|
|
98
|
+
#s = !0;
|
|
99
|
+
async #c() {
|
|
100
|
+
let e = "";
|
|
101
|
+
try {
|
|
102
|
+
for (; this.#s;) {
|
|
103
|
+
let i = this.#t.nextToken();
|
|
104
|
+
if (!i) return;
|
|
105
|
+
let a = i.charCodeAt(0);
|
|
106
|
+
if (a !== 9) {
|
|
107
|
+
if (a === 10) {
|
|
108
|
+
this.#t.addLineNum(i.length);
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
if (a === 91) {
|
|
112
|
+
if (e = "タグ開始", this.#t.isBreak(i)) return;
|
|
113
|
+
let [a, o] = tagToken2Name_Args(i);
|
|
114
|
+
e = `[${a}]例外`;
|
|
115
|
+
let s = (i.match(/\n/g) ?? []).length;
|
|
116
|
+
if (s > 0 && this.#t.addLineNum(s), await this.#t.タグ解析(a, o)) {
|
|
117
|
+
this.stop();
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
if (a === 38) {
|
|
123
|
+
if (!i.endsWith("&")) {
|
|
124
|
+
if (e = "変数計算", this.#t.isBreak(i)) return;
|
|
125
|
+
let a = splitAmpersand(i.slice(1));
|
|
126
|
+
a.name = this.#l(a.name), a.text = String(this.#u(a.text)), this.#e.let(a);
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
if (e = "変数操作", i.charAt(1) === "&") throw Error("「&表示&」書式では「&」指定が不要です");
|
|
130
|
+
i = String(this.#u(i.slice(1, -1)));
|
|
131
|
+
} else if (a === 59) continue;
|
|
132
|
+
else if (a === 42 && i.length > 1) continue;
|
|
133
|
+
e = "文字表示", this.#n.setNormalChWait(), this.#n.currentTxtlayForeNeedErr.tagCh(i);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
} catch (i) {
|
|
137
|
+
this.errScript(`${e} ${i instanceof Error ? `mes=${i.message}(${i.name})` : String(i)}`, !1);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
#l = (e) => "";
|
|
141
|
+
#u;
|
|
393
142
|
};
|
|
394
|
-
|
|
143
|
+
export { Main };
|
|
144
|
+
|
|
145
|
+
//# sourceMappingURL=Main.js.map
|