@famibee/skynovel 1.48.13 → 1.63.11
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 +2 -1
- package/dist/CallStack.js +25 -0
- package/dist/CallStack.js.map +1 -0
- package/dist/EventMng.js +1588 -0
- package/dist/EventMng.js.map +1 -0
- package/dist/LayerMng.js +2924 -0
- package/dist/LayerMng.js.map +1 -0
- package/dist/PropParser.js +833 -0
- package/dist/PropParser.js.map +1 -0
- package/dist/Reading.js +784 -0
- package/dist/Reading.js.map +1 -0
- package/dist/ScriptIterator.js +1125 -0
- package/dist/ScriptIterator.js.map +1 -0
- package/dist/SndBuf.js +1519 -0
- package/dist/SndBuf.js.map +1 -0
- package/dist/SoundMng.js +136 -0
- package/dist/SoundMng.js.map +1 -0
- package/dist/Variable.js +479 -0
- package/dist/Variable.js.map +1 -0
- package/dist/app.d.ts +5 -1
- package/dist/app.d.ts.map +1 -1
- package/dist/appMain.d.ts +6 -6
- package/dist/appMain.d.ts.map +1 -1
- package/dist/appMain_cmn.d.ts +30 -0
- package/dist/appMain_cmn.d.ts.map +1 -0
- package/dist/build.d.ts +2 -0
- package/dist/build.d.ts.map +1 -0
- package/dist/gamepad.js +511 -0
- package/dist/gamepad.js.map +1 -0
- package/dist/index.d.ts +32 -38
- package/dist/index.d.ts.map +1 -1
- package/dist/preload.d.ts +34 -31
- package/dist/preload.d.ts.map +1 -1
- package/dist/sn/AnalyzeTagArg.d.ts +10 -6
- package/dist/sn/AnalyzeTagArg.d.ts.map +1 -1
- package/dist/sn/Areas.d.ts +7 -5
- package/dist/sn/Areas.d.ts.map +1 -1
- package/dist/sn/Button.d.ts +2 -2
- package/dist/sn/Button.d.ts.map +1 -1
- package/dist/sn/CallStack.d.ts +12 -5
- package/dist/sn/CallStack.d.ts.map +1 -1
- package/dist/sn/CmnInterface.d.ts +178 -117
- package/dist/sn/CmnInterface.d.ts.map +1 -1
- package/dist/sn/CmnLib.d.ts +20 -19
- package/dist/sn/CmnLib.d.ts.map +1 -1
- package/dist/sn/CmnTween.d.ts +6 -8
- package/dist/sn/CmnTween.d.ts.map +1 -1
- package/dist/sn/Config.d.ts +6 -4
- package/dist/sn/Config.d.ts.map +1 -1
- package/dist/sn/ConfigBase.d.ts +39 -24
- package/dist/sn/ConfigBase.d.ts.map +1 -1
- package/dist/sn/DebugMng.d.ts +3 -2
- package/dist/sn/DebugMng.d.ts.map +1 -1
- package/dist/sn/DesignCast.d.ts +5 -6
- package/dist/sn/DesignCast.d.ts.map +1 -1
- package/dist/sn/EventListenerCtn.d.ts +3 -3
- package/dist/sn/EventListenerCtn.d.ts.map +1 -1
- package/dist/sn/EventMng.d.ts +5 -11
- package/dist/sn/EventMng.d.ts.map +1 -1
- package/dist/sn/FocusMng.d.ts.map +1 -1
- package/dist/sn/FrameMng.d.ts +3 -4
- package/dist/sn/FrameMng.d.ts.map +1 -1
- package/dist/sn/Grammar.d.ts +133 -16
- package/dist/sn/Grammar.d.ts.map +1 -1
- package/dist/sn/GrpLayer.d.ts +8 -4
- package/dist/sn/GrpLayer.d.ts.map +1 -1
- package/dist/sn/Hyphenation.d.ts +42 -0
- package/dist/sn/Hyphenation.d.ts.map +1 -0
- package/dist/sn/Layer.d.ts +24 -4
- package/dist/sn/Layer.d.ts.map +1 -1
- package/dist/sn/LayerMng.d.ts +17 -24
- package/dist/sn/LayerMng.d.ts.map +1 -1
- package/dist/sn/Log.d.ts +18 -0
- package/dist/sn/Log.d.ts.map +1 -0
- package/dist/sn/Main.d.ts +4 -6
- package/dist/sn/Main.d.ts.map +1 -1
- package/dist/sn/Pages.d.ts +1 -1
- package/dist/sn/Pages.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 +86 -0
- package/dist/sn/Reading.d.ts.map +1 -0
- package/dist/sn/RubySpliter.d.ts +1 -3
- package/dist/sn/RubySpliter.d.ts.map +1 -1
- package/dist/sn/ScriptIterator.d.ts +20 -10
- package/dist/sn/ScriptIterator.d.ts.map +1 -1
- package/dist/sn/SndBuf.d.ts +15 -5
- package/dist/sn/SndBuf.d.ts.map +1 -1
- package/dist/sn/SoundMng.d.ts +3 -2
- package/dist/sn/SoundMng.d.ts.map +1 -1
- package/dist/sn/SpritesMng.d.ts +4 -4
- package/dist/sn/SpritesMng.d.ts.map +1 -1
- package/dist/sn/SysApp.d.ts +12 -16
- package/dist/sn/SysApp.d.ts.map +1 -1
- package/dist/sn/SysBase.d.ts +24 -27
- package/dist/sn/SysBase.d.ts.map +1 -1
- package/dist/sn/SysNode.d.ts +9 -9
- package/dist/sn/SysNode.d.ts.map +1 -1
- package/dist/sn/SysWeb.d.ts +10 -14
- package/dist/sn/SysWeb.d.ts.map +1 -1
- package/dist/sn/TxtLayer.d.ts +79 -7
- package/dist/sn/TxtLayer.d.ts.map +1 -1
- package/dist/sn/TxtStage.d.ts +45 -30
- package/dist/sn/TxtStage.d.ts.map +1 -1
- package/dist/sn/Variable.d.ts +33 -13
- package/dist/sn/Variable.d.ts.map +1 -1
- package/dist/sn/htm2tx.d.ts +3 -0
- package/dist/sn/htm2tx.d.ts.map +1 -0
- package/dist/test/AnalyzeTagArg.test.d.ts +2 -0
- package/dist/test/AnalyzeTagArg.test.d.ts.map +1 -0
- package/dist/test/AreasTest.test.d.ts +2 -0
- package/dist/test/AreasTest.test.d.ts.map +1 -0
- package/dist/test/CmnLib.test.d.ts +2 -0
- package/dist/test/CmnLib.test.d.ts.map +1 -0
- package/dist/test/Config.test.d.ts +2 -0
- package/dist/test/Config.test.d.ts.map +1 -0
- package/dist/test/Grammar.test.d.ts +2 -0
- package/dist/test/Grammar.test.d.ts.map +1 -0
- package/dist/test/HyphTest.test.d.ts +2 -0
- package/dist/test/HyphTest.test.d.ts.map +1 -0
- package/dist/test/Log.test.d.ts +2 -0
- package/dist/test/Log.test.d.ts.map +1 -0
- package/dist/test/PropParser.test.d.ts +2 -0
- package/dist/test/PropParser.test.d.ts.map +1 -0
- package/dist/test/RubySpliter.test.d.ts +2 -0
- package/dist/test/RubySpliter.test.d.ts.map +1 -0
- package/dist/test/SysTest.d.ts +5 -0
- package/dist/test/SysTest.d.ts.map +1 -0
- package/dist/test/ValTest.d.ts +31 -0
- package/dist/test/ValTest.d.ts.map +1 -0
- package/dist/test/Variable.test.d.ts +2 -0
- package/dist/test/Variable.test.d.ts.map +1 -0
- package/dist/web.d.ts +5 -1
- package/dist/web.d.ts.map +1 -1
- package/dist/web.js +6 -30102
- package/dist/web.js.map +1 -1
- package/dist/web2.js +23020 -0
- package/dist/web2.js.map +1 -0
- package/dist_app/CallStack.js +25 -0
- package/dist_app/CallStack.js.map +1 -0
- package/dist_app/EventMng.js +1588 -0
- package/dist_app/EventMng.js.map +1 -0
- package/dist_app/LayerMng.js +2924 -0
- package/dist_app/LayerMng.js.map +1 -0
- package/dist_app/PropParser.js +833 -0
- package/dist_app/PropParser.js.map +1 -0
- package/dist_app/Reading.js +784 -0
- package/dist_app/Reading.js.map +1 -0
- package/dist_app/ScriptIterator.js +1125 -0
- package/dist_app/ScriptIterator.js.map +1 -0
- package/dist_app/SndBuf.js +1519 -0
- package/dist_app/SndBuf.js.map +1 -0
- package/dist_app/SoundMng.js +136 -0
- package/dist_app/SoundMng.js.map +1 -0
- package/dist_app/Variable.js +479 -0
- package/dist_app/Variable.js.map +1 -0
- package/dist_app/app.d.ts +9 -0
- package/dist_app/app.d.ts.map +1 -0
- package/dist_app/app.js +9 -0
- package/dist_app/app.js.map +1 -0
- package/dist_app/app2.js +19819 -0
- package/dist_app/app2.js.map +1 -0
- package/dist_app/appMain.d.ts +9 -0
- package/dist_app/appMain.d.ts.map +1 -0
- package/dist_app/appMain.js +23 -0
- package/dist_app/appMain.js.map +1 -0
- package/dist_app/appMain_cmn.d.ts +30 -0
- package/dist_app/appMain_cmn.d.ts.map +1 -0
- package/dist_app/build.d.ts +2 -0
- package/dist_app/build.d.ts.map +1 -0
- package/dist_app/gamepad.js +511 -0
- package/dist_app/gamepad.js.map +1 -0
- package/dist_app/index.d.ts +33 -0
- package/dist_app/index.d.ts.map +1 -0
- package/dist_app/preload.d.ts +47 -0
- package/dist_app/preload.d.ts.map +1 -0
- package/dist_app/preload.js +2 -0
- package/dist_app/preload.js.map +1 -0
- package/dist_app/sn/AnalyzeTagArg.d.ts +28 -0
- package/dist_app/sn/AnalyzeTagArg.d.ts.map +1 -0
- package/dist_app/sn/Areas.d.ts +15 -0
- package/dist_app/sn/Areas.d.ts.map +1 -0
- package/dist_app/sn/Button.d.ts +23 -0
- package/dist_app/sn/Button.d.ts.map +1 -0
- package/dist_app/sn/CallStack.d.ts +23 -0
- package/dist_app/sn/CallStack.d.ts.map +1 -0
- package/dist_app/sn/CmnInterface.d.ts +227 -0
- package/dist_app/sn/CmnInterface.d.ts.map +1 -0
- package/dist_app/sn/CmnLib.d.ts +46 -0
- package/dist_app/sn/CmnLib.d.ts.map +1 -0
- package/dist_app/sn/CmnTween.d.ts +35 -0
- package/dist_app/sn/CmnTween.d.ts.map +1 -0
- package/dist_app/sn/Config.d.ts +12 -0
- package/dist_app/sn/Config.d.ts.map +1 -0
- package/dist_app/sn/ConfigBase.d.ts +111 -0
- package/dist_app/sn/ConfigBase.d.ts.map +1 -0
- package/dist_app/sn/DebugMng.d.ts +14 -0
- package/dist_app/sn/DebugMng.d.ts.map +1 -0
- package/dist_app/sn/DesignCast.d.ts +53 -0
- package/dist_app/sn/DesignCast.d.ts.map +1 -0
- package/dist_app/sn/EventListenerCtn.d.ts +13 -0
- package/dist_app/sn/EventListenerCtn.d.ts.map +1 -0
- package/dist_app/sn/EventMng.d.ts +29 -0
- package/dist_app/sn/EventMng.d.ts.map +1 -0
- package/dist_app/sn/FocusMng.d.ts +13 -0
- package/dist_app/sn/FocusMng.d.ts.map +1 -0
- package/dist_app/sn/FrameMng.d.ts +20 -0
- package/dist_app/sn/FrameMng.d.ts.map +1 -0
- package/dist_app/sn/Grammar.d.ts +291 -0
- package/dist_app/sn/Grammar.d.ts.map +1 -0
- package/dist_app/sn/GrpLayer.d.ts +49 -0
- package/dist_app/sn/GrpLayer.d.ts.map +1 -0
- package/dist_app/sn/Hyphenation.d.ts +42 -0
- package/dist_app/sn/Hyphenation.d.ts.map +1 -0
- package/dist_app/sn/Layer.d.ts +86 -0
- package/dist_app/sn/Layer.d.ts.map +1 -0
- package/dist_app/sn/LayerMng.d.ts +46 -0
- package/dist_app/sn/LayerMng.d.ts.map +1 -0
- package/dist_app/sn/Log.d.ts +18 -0
- package/dist_app/sn/Log.d.ts.map +1 -0
- package/dist_app/sn/Main.d.ts +16 -0
- package/dist_app/sn/Main.d.ts.map +1 -0
- package/dist_app/sn/Pages.d.ts +26 -0
- package/dist_app/sn/Pages.d.ts.map +1 -0
- package/dist_app/sn/PropParser.d.ts +12 -0
- package/dist_app/sn/PropParser.d.ts.map +1 -0
- package/dist_app/sn/Reading.d.ts +86 -0
- package/dist_app/sn/Reading.d.ts.map +1 -0
- package/dist_app/sn/RubySpliter.d.ts +14 -0
- package/dist_app/sn/RubySpliter.d.ts.map +1 -0
- package/dist_app/sn/ScriptIterator.d.ts +58 -0
- package/dist_app/sn/ScriptIterator.d.ts.map +1 -0
- package/dist_app/sn/SndBuf.d.ts +30 -0
- package/dist_app/sn/SndBuf.d.ts.map +1 -0
- package/dist_app/sn/SoundMng.d.ts +16 -0
- package/dist_app/sn/SoundMng.d.ts.map +1 -0
- package/dist_app/sn/SpritesMng.d.ts +27 -0
- package/dist_app/sn/SpritesMng.d.ts.map +1 -0
- package/dist_app/sn/SysApp.d.ts +32 -0
- package/dist_app/sn/SysApp.d.ts.map +1 -0
- package/dist_app/sn/SysBase.d.ts +79 -0
- package/dist_app/sn/SysBase.d.ts.map +1 -0
- package/dist_app/sn/SysNode.d.ts +15 -0
- package/dist_app/sn/SysNode.d.ts.map +1 -0
- package/dist_app/sn/SysWeb.d.ts +26 -0
- package/dist_app/sn/SysWeb.d.ts.map +1 -0
- package/dist_app/sn/TxtLayer.d.ts +121 -0
- package/dist_app/sn/TxtLayer.d.ts.map +1 -0
- package/dist_app/sn/TxtStage.d.ts +90 -0
- package/dist_app/sn/TxtStage.d.ts.map +1 -0
- package/dist_app/sn/Variable.d.ts +48 -0
- package/dist_app/sn/Variable.d.ts.map +1 -0
- package/dist_app/sn/htm2tx.d.ts +3 -0
- package/dist_app/sn/htm2tx.d.ts.map +1 -0
- package/dist_app/test/AnalyzeTagArg.test.d.ts +2 -0
- package/dist_app/test/AnalyzeTagArg.test.d.ts.map +1 -0
- package/dist_app/test/AreasTest.test.d.ts +2 -0
- package/dist_app/test/AreasTest.test.d.ts.map +1 -0
- package/dist_app/test/CmnLib.test.d.ts +2 -0
- package/dist_app/test/CmnLib.test.d.ts.map +1 -0
- package/dist_app/test/Config.test.d.ts +2 -0
- package/dist_app/test/Config.test.d.ts.map +1 -0
- package/dist_app/test/Grammar.test.d.ts +2 -0
- package/dist_app/test/Grammar.test.d.ts.map +1 -0
- package/dist_app/test/HyphTest.test.d.ts +2 -0
- package/dist_app/test/HyphTest.test.d.ts.map +1 -0
- package/dist_app/test/Log.test.d.ts +2 -0
- package/dist_app/test/Log.test.d.ts.map +1 -0
- package/dist_app/test/PropParser.test.d.ts +2 -0
- package/dist_app/test/PropParser.test.d.ts.map +1 -0
- package/dist_app/test/RubySpliter.test.d.ts +2 -0
- package/dist_app/test/RubySpliter.test.d.ts.map +1 -0
- package/dist_app/test/SysTest.d.ts +5 -0
- package/dist_app/test/SysTest.d.ts.map +1 -0
- package/dist_app/test/ValTest.d.ts +31 -0
- package/dist_app/test/ValTest.d.ts.map +1 -0
- package/dist_app/test/Variable.test.d.ts +2 -0
- package/dist_app/test/Variable.test.d.ts.map +1 -0
- package/dist_app/web.d.ts +9 -0
- package/dist_app/web.d.ts.map +1 -0
- package/package.json +57 -51
- package/dist/app.js +0 -28154
- package/dist/app.js.map +0 -1
- package/dist/appMain.js +0 -16
- package/dist/appMain.js.map +0 -1
- package/dist/preload.js +0 -2
- package/dist/preload.js.map +0 -1
- package/dist/sn/ReadState.d.ts +0 -79
- package/dist/sn/ReadState.d.ts.map +0 -1
package/dist/LayerMng.js
ADDED
|
@@ -0,0 +1,2924 @@
|
|
|
1
|
+
import { e as R, T as ct, L as Q, B as St, m as Z, o as D, i as bt, p as J, D as it, q as Rt, R as Y, A as gt, r as j, s as H, d as w, E as kt, g as S, t as tt, C as W, G as U, u as V, v as Tt, n as dt, w as Pt, x as Ft, h as ot, y as vt, z as Ot, F as Bt, P as It, H as _t, I as Vt, J as jt } from "./web2.js";
|
|
2
|
+
import { C as B, T as xt, b as A } from "./SndBuf.js";
|
|
3
|
+
import { a as F, T as Dt } from "./Reading.js";
|
|
4
|
+
import { R as wt, a as pt } from "./ScriptIterator.js";
|
|
5
|
+
class et {
|
|
6
|
+
constructor(t, e, s, i, n, a, o, r) {
|
|
7
|
+
this.cls = e, this.hArg = n, this.sys = a, this.val = o, this.ret = r;
|
|
8
|
+
const c = a.hFactoryCls[e];
|
|
9
|
+
if (!c) throw `属性 class【${e}】が不正です`;
|
|
10
|
+
const f = c(), l = c();
|
|
11
|
+
f.layname = l.layname = t;
|
|
12
|
+
const p = n[":id_tag"] = `layer:${t} cls:${e} page:`;
|
|
13
|
+
f.ctn.name = f.name = p + "A", l.ctn.name = l.name = p + "B", s.addChild(f.ctn), i.addChild(l.ctn), R(n, "visible", !0), R(n, "visible", !0), r.isWait = f.lay(n) || l.lay(n), this.#s = { fore: f, back: l }, i.visible = !1;
|
|
14
|
+
const d = `const.sn.lay.${t}`;
|
|
15
|
+
o.setVal_Nochk("tmp", d, !0), o.defTmp(d + ".fore.alpha", () => this.#s.fore.alpha), o.defTmp(d + ".back.alpha", () => this.#s.back.alpha), o.defTmp(d + ".fore.height", () => this.#s.fore.height), o.defTmp(d + ".back.height", () => this.#s.back.height), o.defTmp(d + ".fore.visible", () => this.#s.fore.ctn.visible), o.defTmp(d + ".back.visible", () => this.#s.back.ctn.visible), o.defTmp(d + ".fore.width", () => this.#s.fore.width), o.defTmp(d + ".back.width", () => this.#s.back.width), o.defTmp(d + ".fore.x", () => this.#s.fore.x), o.defTmp(d + ".back.x", () => this.#s.back.x), o.defTmp(d + ".fore.y", () => this.#s.fore.y), o.defTmp(d + ".back.y", () => this.#s.back.y);
|
|
16
|
+
}
|
|
17
|
+
#s;
|
|
18
|
+
destroy() {
|
|
19
|
+
this.#s.fore.destroy(), this.#s.back.destroy();
|
|
20
|
+
}
|
|
21
|
+
lay = (t) => this.getPage(t).lay(t);
|
|
22
|
+
getPage = (t) => et.argChk_page(t, "fore") !== "back" ? this.#s.fore : this.#s.back;
|
|
23
|
+
static argChk_page(t, e) {
|
|
24
|
+
const s = t.page ?? e;
|
|
25
|
+
if (s === "fore" || s === "back")
|
|
26
|
+
return t.page = s, s;
|
|
27
|
+
throw Error("属性 page【" + s + "】が不正です");
|
|
28
|
+
}
|
|
29
|
+
get fore() {
|
|
30
|
+
return this.#s.fore;
|
|
31
|
+
}
|
|
32
|
+
get back() {
|
|
33
|
+
return this.#s.back;
|
|
34
|
+
}
|
|
35
|
+
transPage(t) {
|
|
36
|
+
[this.#s.back, this.#s.fore] = [this.#s.fore, this.#s.back], this.#s.back.copy(this.#s.fore, t);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
class ut {
|
|
40
|
+
// static readonly #alzTagArg = new AnalyzeTagArg;
|
|
41
|
+
constructor(t, e = !1) {
|
|
42
|
+
this.bg_col = t, this.isLay = e;
|
|
43
|
+
}
|
|
44
|
+
static init(t, e, s, i, n, a) {
|
|
45
|
+
}
|
|
46
|
+
static cvsResizeDesign() {
|
|
47
|
+
}
|
|
48
|
+
destroy() {
|
|
49
|
+
}
|
|
50
|
+
gethArg() {
|
|
51
|
+
return this.hArg;
|
|
52
|
+
}
|
|
53
|
+
hArg = {};
|
|
54
|
+
sethArg(t) {
|
|
55
|
+
this.hArg = t;
|
|
56
|
+
}
|
|
57
|
+
setOther(t) {
|
|
58
|
+
}
|
|
59
|
+
adopt(t) {
|
|
60
|
+
}
|
|
61
|
+
static enterMode() {
|
|
62
|
+
}
|
|
63
|
+
static allHide() {
|
|
64
|
+
}
|
|
65
|
+
set visible(t) {
|
|
66
|
+
}
|
|
67
|
+
static leaveMode() {
|
|
68
|
+
}
|
|
69
|
+
cvsResize() {
|
|
70
|
+
}
|
|
71
|
+
make() {
|
|
72
|
+
}
|
|
73
|
+
static replaceToken(t) {
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
class Ht extends ut {
|
|
77
|
+
constructor(t, e) {
|
|
78
|
+
super("#29e", !0);
|
|
79
|
+
}
|
|
80
|
+
setSp(t) {
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
class m {
|
|
84
|
+
constructor(t = "", e, s = () => {
|
|
85
|
+
}, i = () => {
|
|
86
|
+
}) {
|
|
87
|
+
this.csvFn = t, this.ctn = e, this.fncFirstComp = s, this.fncAllComp = i, t && (this.#u = e ? (n) => {
|
|
88
|
+
e.addChild(n), this.#c.push(n);
|
|
89
|
+
} : () => {
|
|
90
|
+
}, this.ret = m.#x(
|
|
91
|
+
t,
|
|
92
|
+
(n) => this.fncFirstComp(n),
|
|
93
|
+
// 差し替え考慮
|
|
94
|
+
(n) => this.fncAllComp(n),
|
|
95
|
+
// 差し替え考慮
|
|
96
|
+
(n) => this.#u(n)
|
|
97
|
+
// 差し替え考慮
|
|
98
|
+
));
|
|
99
|
+
}
|
|
100
|
+
static #s;
|
|
101
|
+
static #e;
|
|
102
|
+
static #n;
|
|
103
|
+
static #r;
|
|
104
|
+
static init(t, e, s, i, n) {
|
|
105
|
+
m.#s = t, m.#e = e, m.#n = s, m.#r = i, s.arg.crypto && (m.#f = (o, r, c) => m.#a(o, r, c), m.#o = (o, r, c) => m.#I(o, r, c));
|
|
106
|
+
const a = () => {
|
|
107
|
+
const o = m.#l * m.#t;
|
|
108
|
+
for (const r of Object.values(m.#w)) r.volume = o;
|
|
109
|
+
};
|
|
110
|
+
n.setNoticeChgVolume(
|
|
111
|
+
(o) => {
|
|
112
|
+
m.#l = o, a();
|
|
113
|
+
},
|
|
114
|
+
(o) => {
|
|
115
|
+
m.#t = o, a();
|
|
116
|
+
}
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
static #t = 1;
|
|
120
|
+
static #l = 1;
|
|
121
|
+
static #p;
|
|
122
|
+
static setEvtMng(t) {
|
|
123
|
+
m.#p = t;
|
|
124
|
+
}
|
|
125
|
+
ret = !1;
|
|
126
|
+
#u;
|
|
127
|
+
#c = [];
|
|
128
|
+
destroy() {
|
|
129
|
+
this.fncFirstComp = () => {
|
|
130
|
+
}, this.fncAllComp = () => {
|
|
131
|
+
}, this.#u = (t) => t.destroy();
|
|
132
|
+
for (const t of this.#c)
|
|
133
|
+
m.stopVideo(t.name), t.parent?.removeChild(t), t.destroy();
|
|
134
|
+
this.#c = [];
|
|
135
|
+
}
|
|
136
|
+
static destroy() {
|
|
137
|
+
m.#i = {}, m.#d = {}, m.#w = {};
|
|
138
|
+
}
|
|
139
|
+
//static #ldrHFn: {[fn: string]: 1} = {};
|
|
140
|
+
static #x(t, e, s, i) {
|
|
141
|
+
if (!t) return !1;
|
|
142
|
+
let n = !1;
|
|
143
|
+
if (t.startsWith("data:")) {
|
|
144
|
+
const l = () => {
|
|
145
|
+
const p = j.from(t);
|
|
146
|
+
i(p), e(p), s(n);
|
|
147
|
+
};
|
|
148
|
+
return t in ct ? l() : (n = !0, new Q().add(t, t).load(l)), n;
|
|
149
|
+
}
|
|
150
|
+
const a = [], o = new Q(), r = t.split(","), c = r.length;
|
|
151
|
+
for (let l = 0; l < c; ++l) {
|
|
152
|
+
const p = r[l];
|
|
153
|
+
if (!p) throw "face属性に空要素が含まれます";
|
|
154
|
+
const { dx: d, dy: h, blendmode: u, fn: x } = m.#i[p] ?? {
|
|
155
|
+
fn: p,
|
|
156
|
+
dx: 0,
|
|
157
|
+
dy: 0,
|
|
158
|
+
blendmode: St.NORMAL
|
|
159
|
+
}, v = l === 0 ? e : (E) => {
|
|
160
|
+
E.transform && (E.x = d, E.y = h, E.blendMode = u);
|
|
161
|
+
};
|
|
162
|
+
if (a.push({ fn: x, fnc: v }), x in m.#d || x in ct || x in Q.shared.resources) continue;
|
|
163
|
+
n = !0;
|
|
164
|
+
const y = m.#s.searchPath(x, Z.SP_GSM), b = this.#n.arg.crypto ? { xhrType: y.endsWith(".json") ? D.XHR_RESPONSE_TYPE.TEXT : D.XHR_RESPONSE_TYPE.BUFFER } : {};
|
|
165
|
+
o.add({ ...b, name: x, url: y });
|
|
166
|
+
}
|
|
167
|
+
const f = (l, p) => {
|
|
168
|
+
for (const { fn: d, fnc: h } of a) {
|
|
169
|
+
const u = m.#k(d, p);
|
|
170
|
+
u.name = d, i(u), h(u);
|
|
171
|
+
}
|
|
172
|
+
s(n);
|
|
173
|
+
};
|
|
174
|
+
return n ? o.use((l, p) => {
|
|
175
|
+
try {
|
|
176
|
+
if (l.extension === "json") {
|
|
177
|
+
this.#n.dec("json", l.data).then((d) => m.#o(d, l, p));
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
this.#n.decAB(l.data).then((d) => m.#f(d, l, p));
|
|
181
|
+
} catch (d) {
|
|
182
|
+
const h = `画像/動画ロード失敗です fn:${l.name} ${String(d)}`;
|
|
183
|
+
m.#p.isSkipping ? console.warn(h) : console.error("%c" + h, "color:#FF3300;");
|
|
184
|
+
}
|
|
185
|
+
}).load(f) : queueMicrotask(() => f(0, {})), n;
|
|
186
|
+
}
|
|
187
|
+
static #i = {};
|
|
188
|
+
static #d = {};
|
|
189
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
190
|
+
static #f = (t, { type: e, name: s, data: i }, n) => {
|
|
191
|
+
switch (e) {
|
|
192
|
+
case D.TYPE.VIDEO: {
|
|
193
|
+
const a = i;
|
|
194
|
+
a.volume = m.#l, m.#w[s] = m.#g(a);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
n();
|
|
198
|
+
};
|
|
199
|
+
static #y(t) {
|
|
200
|
+
const e = /([^\d]+)\d+\.(\w+)/.exec(t[0] ?? "");
|
|
201
|
+
if (!e) return [];
|
|
202
|
+
const [, s = "", i = ""] = e, n = s.length, a = -i.length - 1;
|
|
203
|
+
return t.sort((o, r) => bt(o.slice(n, a)) > bt(r.slice(n, a)) ? 1 : -1);
|
|
204
|
+
}
|
|
205
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
206
|
+
static #a(t, e, s) {
|
|
207
|
+
if (e.data = t, e.extension !== "bin" && s(), t instanceof HTMLImageElement) {
|
|
208
|
+
J.fromLoader(t, e.url, e.name).then((i) => {
|
|
209
|
+
e.texture = i, e.type = D.TYPE.IMAGE;
|
|
210
|
+
});
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
t instanceof HTMLVideoElement && (t.volume = m.#l, m.#w[e.name] = m.#g(t), e.type = D.TYPE.VIDEO), s();
|
|
214
|
+
}
|
|
215
|
+
static #g(t) {
|
|
216
|
+
return m.#e.getVal("const.sn.needClick2Play") && (it.trace_beforeNew(`[lay系] ${it.strPos()}未クリック状態で動画を自動再生します。音声はミュートされます`, "W"), t.muted = !0), t.setAttribute("playsinline", ""), t;
|
|
217
|
+
}
|
|
218
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
219
|
+
static #o = (t, { type: e, spritesheet: s, name: i, data: n }, a) => {
|
|
220
|
+
switch (e) {
|
|
221
|
+
case D.TYPE.JSON: {
|
|
222
|
+
const o = s._frameKeys;
|
|
223
|
+
m.#y(o), m.#d[i] = {
|
|
224
|
+
aTex: o.map((r) => J.from(r)),
|
|
225
|
+
meta: n.meta
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
a();
|
|
230
|
+
};
|
|
231
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
232
|
+
static #I(t, e, s) {
|
|
233
|
+
const { meta: i, frames: n } = e.data = JSON.parse(t);
|
|
234
|
+
if (e.type = D.TYPE.JSON, !i?.image) {
|
|
235
|
+
s();
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
const a = Rt(i.image), o = m.#s.searchPath(a, Z.SP_GSM);
|
|
239
|
+
new Q().use((r, c) => {
|
|
240
|
+
this.#n.decAB(r.data).then((f) => {
|
|
241
|
+
r.data = f, f instanceof HTMLImageElement && (r.type = D.TYPE.IMAGE, URL.revokeObjectURL(f.src)), c();
|
|
242
|
+
}).catch((f) => this.#r.errScript(`画像/動画ロード失敗です dec2res4Cripto fn:${r.name} ${String(f)}`, !1));
|
|
243
|
+
}).add({ name: a, url: o, xhrType: D.XHR_RESPONSE_TYPE.BUFFER }).load((r, c) => {
|
|
244
|
+
for (const { data: f } of Object.values(r.resources)) {
|
|
245
|
+
const { baseTexture: l } = J.from(f), p = Object.values(n);
|
|
246
|
+
m.#d[e.name] = {
|
|
247
|
+
aTex: p.map(({ frame: { x: d, y: h, w: u, h: x } }) => new J(
|
|
248
|
+
l,
|
|
249
|
+
new Y(d, h, u, x)
|
|
250
|
+
)),
|
|
251
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
252
|
+
meta: i
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
s();
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
static #k(t, e) {
|
|
259
|
+
const s = m.#d[t];
|
|
260
|
+
if (s) {
|
|
261
|
+
const a = new gt(s.aTex);
|
|
262
|
+
return a.animationSpeed = s.meta.animationSpeed ?? 1, a.play(), a;
|
|
263
|
+
}
|
|
264
|
+
if (t in ct) return j.from(t);
|
|
265
|
+
const i = m.#w[t];
|
|
266
|
+
if (i) return j.from(i);
|
|
267
|
+
const n = e[t];
|
|
268
|
+
return n ? new j(n.texture) : new j();
|
|
269
|
+
}
|
|
270
|
+
static #w = {};
|
|
271
|
+
static getHFn2VElm(t) {
|
|
272
|
+
return m.#w[t];
|
|
273
|
+
}
|
|
274
|
+
static wv(t) {
|
|
275
|
+
const { fn: e } = t;
|
|
276
|
+
if (!e) throw "fnは必須です";
|
|
277
|
+
const s = m.#w[e];
|
|
278
|
+
if (!s || s.loop) return !1;
|
|
279
|
+
if (m.#p.isSkipping || s.ended)
|
|
280
|
+
return m.stopVideo(e), !1;
|
|
281
|
+
const i = "wv fn:" + e, n = R(t, "stop", !0), a = () => {
|
|
282
|
+
n && m.stopVideo(e);
|
|
283
|
+
};
|
|
284
|
+
return F.beginProc(i, a, !0, a), s.addEventListener("ended", () => F.notifyEndProc(i), { once: !0, passive: !0 }), !0;
|
|
285
|
+
}
|
|
286
|
+
static stopVideo(t) {
|
|
287
|
+
const e = m.#w[t];
|
|
288
|
+
e && (delete m.#w[t], e.pause(), e.currentTime = e.duration);
|
|
289
|
+
}
|
|
290
|
+
static add_face(t) {
|
|
291
|
+
const { name: e } = t;
|
|
292
|
+
if (!e) throw "nameは必須です";
|
|
293
|
+
if (e in m.#i) throw "一つのname(" + e + ")に対して同じ画像を複数割り当てられません";
|
|
294
|
+
const { fn: s = e } = t;
|
|
295
|
+
return m.#i[e] = {
|
|
296
|
+
fn: s,
|
|
297
|
+
dx: w(t, "dx", 0),
|
|
298
|
+
dy: w(t, "dy", 0),
|
|
299
|
+
blendmode: H.getBlendmodeNum(t.blendmode ?? "")
|
|
300
|
+
}, !1;
|
|
301
|
+
}
|
|
302
|
+
// static clearFace2Name(): void {SpritesMng.hFace = {}}
|
|
303
|
+
}
|
|
304
|
+
class L extends H {
|
|
305
|
+
static #s = new kt();
|
|
306
|
+
static #e;
|
|
307
|
+
static init(t, e, s, i, n, a) {
|
|
308
|
+
L.#e = s, m.init(e, a, i, t, n);
|
|
309
|
+
}
|
|
310
|
+
static destroy() {
|
|
311
|
+
L.#s.clear(), m.destroy();
|
|
312
|
+
}
|
|
313
|
+
#n = new Ht(this.ctn, this);
|
|
314
|
+
constructor() {
|
|
315
|
+
super(), S.isDbg && (this.#r = (t) => this.#n.setSp(t), this.cvsResize = () => {
|
|
316
|
+
super.cvsResize(), this.#n.cvsResize();
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
#r = () => {
|
|
320
|
+
};
|
|
321
|
+
#t = "";
|
|
322
|
+
#l = "";
|
|
323
|
+
#p = "";
|
|
324
|
+
lay = (t) => {
|
|
325
|
+
const e = F.procID + `GrpLayer lay name:${this.name_}`, s = this.#u(t, (i) => {
|
|
326
|
+
i && F.endProc(e);
|
|
327
|
+
});
|
|
328
|
+
return s && F.beginProc(e), s;
|
|
329
|
+
};
|
|
330
|
+
#u(t, e) {
|
|
331
|
+
const { fn: s, face: i = "" } = t;
|
|
332
|
+
if (this.#n.sethArg(t), !s)
|
|
333
|
+
return super.lay(t), this.ctn.children.length > 0 && this.setPos(t), this.#l = "", this.#t = this.#p = i, e(!1), !1;
|
|
334
|
+
const n = "fn" in t, a = "face" in t;
|
|
335
|
+
return this.clearLay({ clear_filter: R(t, "clear_filter", !0) }), n && (this.#l = s), a && (this.#p = i), super.lay(t), t.dx = 0, t.dy = 0, this.#c.destroy(), this.#c = new m(
|
|
336
|
+
this.#t = s + (i ? "," + i : ""),
|
|
337
|
+
this.ctn,
|
|
338
|
+
(o) => {
|
|
339
|
+
("width" in t || "height" in t) && (o.width = w(t, "width", 0), o.height = w(t, "height", 0)), this.#x = o.width, this.#i = o.height, H.setXY(o, t, this.ctn, !0), H.setBlendmode(this.ctn, t), this.#r(o);
|
|
340
|
+
},
|
|
341
|
+
(o) => e(o)
|
|
342
|
+
), this.#c.ret;
|
|
343
|
+
}
|
|
344
|
+
#c = new m();
|
|
345
|
+
#x = 0;
|
|
346
|
+
#i = 0;
|
|
347
|
+
get width() {
|
|
348
|
+
return this.#x;
|
|
349
|
+
}
|
|
350
|
+
get height() {
|
|
351
|
+
return this.#i;
|
|
352
|
+
}
|
|
353
|
+
renderStart() {
|
|
354
|
+
this.#f = new j(this.#d), this.#f.visible = !1, this.ctn.addChildAt(this.#f, 0), this.#f.position.set(-this.ctn.x, -this.ctn.y);
|
|
355
|
+
let t = () => {
|
|
356
|
+
const e = this.ctn.alpha;
|
|
357
|
+
this.ctn.alpha = 1;
|
|
358
|
+
for (const s of this.ctn.children) s.visible = !0;
|
|
359
|
+
this.#f.visible = !1, L.#e.renderer.render(this.ctn, { renderTexture: this.#d }), this.ctn.alpha = e;
|
|
360
|
+
for (const s of this.ctn.children) s.visible = !1;
|
|
361
|
+
};
|
|
362
|
+
if (!this.containMovement) {
|
|
363
|
+
const e = t;
|
|
364
|
+
t = () => {
|
|
365
|
+
t = () => {
|
|
366
|
+
}, e();
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
this.#y = () => {
|
|
370
|
+
t(), this.#f.visible = !0;
|
|
371
|
+
}, L.#e.ticker.add(this.#y);
|
|
372
|
+
}
|
|
373
|
+
#d = tt.create({
|
|
374
|
+
width: S.stageW,
|
|
375
|
+
height: S.stageH
|
|
376
|
+
});
|
|
377
|
+
#f = new j();
|
|
378
|
+
#y = () => {
|
|
379
|
+
};
|
|
380
|
+
renderEnd() {
|
|
381
|
+
L.#e.ticker.remove(this.#y), this.ctn.removeChild(this.#f);
|
|
382
|
+
for (const t of this.ctn.children) t.visible = !0;
|
|
383
|
+
this.#f.destroy(!0), this.#d = tt.create({
|
|
384
|
+
width: S.stageW,
|
|
385
|
+
height: S.stageH
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
setPos(t) {
|
|
389
|
+
H.setXY(
|
|
390
|
+
this.ctn.children[0] ?? this.ctn,
|
|
391
|
+
t,
|
|
392
|
+
this.ctn,
|
|
393
|
+
!0
|
|
394
|
+
);
|
|
395
|
+
}
|
|
396
|
+
// アニメ・動画を含むか
|
|
397
|
+
get containMovement() {
|
|
398
|
+
if (this.#t === "") return !1;
|
|
399
|
+
const t = this.ctn.children;
|
|
400
|
+
return this.#t.split(",").some(
|
|
401
|
+
(e, s) => t[s] instanceof gt || m.getHFn2VElm(e)
|
|
402
|
+
);
|
|
403
|
+
}
|
|
404
|
+
clearLay(t) {
|
|
405
|
+
super.clearLay(t), this.#c.destroy(), this.#l = "", this.#p = "", this.#t = "";
|
|
406
|
+
}
|
|
407
|
+
record = () => ({
|
|
408
|
+
...super.record(),
|
|
409
|
+
sBkFn: this.#l,
|
|
410
|
+
sBkFace: this.#p
|
|
411
|
+
// idc_hArg : this.#idc.gethArg(),
|
|
412
|
+
});
|
|
413
|
+
playback(t, e) {
|
|
414
|
+
if (super.playback(t, e), t.sBkFn === "" && t.sBkFace === "") {
|
|
415
|
+
this.#l = "", this.#p = "";
|
|
416
|
+
return;
|
|
417
|
+
}
|
|
418
|
+
e.push(new Promise((s) => this.#u(
|
|
419
|
+
{ fn: t.sBkFn, face: t.sBkFace, left: t.x, top: t.y, alpha: t.alpha, blendmode: H.getNum2Blendmode(t.blendMode), rotation: t.rotation, scale_x: t.scale_x, scale_y: t.scale_y },
|
|
420
|
+
(i) => {
|
|
421
|
+
this.ctn.position.set(t.x, t.y), s();
|
|
422
|
+
}
|
|
423
|
+
// Layer.setXY()の後に再度移動
|
|
424
|
+
)));
|
|
425
|
+
}
|
|
426
|
+
makeDesignCast(t) {
|
|
427
|
+
this.ctn.visible && t(this.#n);
|
|
428
|
+
}
|
|
429
|
+
//makeDesignCastChildren(_gdc: IMakeDesignCast) {}
|
|
430
|
+
cvsResize() {
|
|
431
|
+
super.cvsResize();
|
|
432
|
+
}
|
|
433
|
+
showDesignCast() {
|
|
434
|
+
this.#n.visible = !0;
|
|
435
|
+
}
|
|
436
|
+
//showDesignCastChildren() {}
|
|
437
|
+
dump = () => super.dump() + `, "pic":"${this.#t}"`;
|
|
438
|
+
}
|
|
439
|
+
const st = "、。,.)]}〉」』】〕”〟ぁぃぅぇぉっゃゅょゎァィゥェォッャュョヮヵヶ!?!?‼⁉・ーゝゞヽヾ々", rt = "[({〈「『【〔“〝", ht = "─‥…", ft = st, $t = new RegExp(`[${st}]`), Wt = new RegExp(`[${rt}]`), zt = new RegExp(`[${ht}]`), Lt = $t;
|
|
440
|
+
class Jt {
|
|
441
|
+
#s = st;
|
|
442
|
+
#e = rt;
|
|
443
|
+
#n = ht;
|
|
444
|
+
#r = ft;
|
|
445
|
+
get 行頭禁則() {
|
|
446
|
+
return this.#s;
|
|
447
|
+
}
|
|
448
|
+
get 行末禁則() {
|
|
449
|
+
return this.#e;
|
|
450
|
+
}
|
|
451
|
+
get 分割禁止() {
|
|
452
|
+
return this.#n;
|
|
453
|
+
}
|
|
454
|
+
get ぶら下げ() {
|
|
455
|
+
return this.#r;
|
|
456
|
+
}
|
|
457
|
+
#t = $t;
|
|
458
|
+
#l = Wt;
|
|
459
|
+
#p = zt;
|
|
460
|
+
#u = Lt;
|
|
461
|
+
break_fixed = !1;
|
|
462
|
+
break_fixed_left = 0;
|
|
463
|
+
break_fixed_top = 0;
|
|
464
|
+
bura = !1;
|
|
465
|
+
lay(t) {
|
|
466
|
+
t.kinsoku_sol && (this.#s = t.kinsoku_sol, this.#t = new RegExp(`[${this.#s}]`)), t.kinsoku_eol && (this.#e = t.kinsoku_eol, this.#c(), this.#l = new RegExp(`[${this.#e}]`)), t.kinsoku_dns && (this.#n = t.kinsoku_dns, this.#x(), this.#p = new RegExp(`[${this.#n}]`)), t.kinsoku_bura && (this.#r = t.kinsoku_bura, this.#c(), this.#x(), this.#u = new RegExp(`[${this.#r}]`)), "bura" in t && (this.bura = R(t, "bura", !1)), this.break_fixed = R(t, "break_fixed", this.break_fixed), this.break_fixed_left = w(t, "break_fixed_left", this.break_fixed_left), this.break_fixed_top = w(t, "break_fixed_top", this.break_fixed_top);
|
|
467
|
+
}
|
|
468
|
+
// 禁則の競合(ぶら下げ と 行末禁則 の両方に含まれる文字があってはならない)
|
|
469
|
+
#c() {
|
|
470
|
+
const t = this.#e.length, e = this.#r.length;
|
|
471
|
+
if (t < e)
|
|
472
|
+
for (let s = 0; s < t; ++s) {
|
|
473
|
+
const i = this.#e[s];
|
|
474
|
+
if (this.#r.includes(i)) throw `禁則の競合があります。文字 ${i} がぶら下げ と 行末禁則 の両方に含まれます`;
|
|
475
|
+
}
|
|
476
|
+
else
|
|
477
|
+
for (let s = 0; s < e; ++s) {
|
|
478
|
+
const i = this.#r[s];
|
|
479
|
+
if (this.#e.includes(i)) throw `禁則の競合があります。文字 ${i} がぶら下げ と 行末禁則 の両方に含まれます`;
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
// 禁則の競合(ぶら下げ と 分割禁止 の両方に含まれる文字があってはならない)
|
|
483
|
+
#x() {
|
|
484
|
+
const t = this.#n.length, e = this.#r.length;
|
|
485
|
+
if (t < e)
|
|
486
|
+
for (let s = 0; s < t; ++s) {
|
|
487
|
+
const i = this.#n[s];
|
|
488
|
+
if (this.#r.includes(i)) throw `禁則の競合があります。文字 ${i} がぶら下げ と 分割禁止 の両方に含まれます`;
|
|
489
|
+
}
|
|
490
|
+
else
|
|
491
|
+
for (let s = 0; s < e; ++s) {
|
|
492
|
+
const i = this.#r[s];
|
|
493
|
+
if (this.#n.includes(i)) throw `禁則の競合があります。文字 ${i} がぶら下げ と 分割禁止 の両方に含まれます`;
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
reNew(t) {
|
|
497
|
+
t.#i(this.#s, this.#e, this.#n, this.#r), t.break_fixed = this.break_fixed, t.break_fixed_left = this.break_fixed_left, t.break_fixed_top = this.break_fixed_top, t.bura = this.bura;
|
|
498
|
+
}
|
|
499
|
+
#i(t, e, s, i) {
|
|
500
|
+
this.#s !== t && (this.#s = t, this.#t = new RegExp(`[${t}]`)), this.#e !== e && (this.#e = e, this.#l = new RegExp(`[${e}]`)), this.#n !== s && (this.#n = s, this.#p = new RegExp(`[${s}]`)), this.#r !== i && (this.#r = i, this.#u = new RegExp(`[${i}]`));
|
|
501
|
+
}
|
|
502
|
+
record() {
|
|
503
|
+
const t = {
|
|
504
|
+
break_fixed: this.break_fixed,
|
|
505
|
+
break_fixed_left: this.break_fixed_left,
|
|
506
|
+
break_fixed_top: this.break_fixed_top,
|
|
507
|
+
bura: this.bura
|
|
508
|
+
};
|
|
509
|
+
return this.#s === st && (t.行頭禁則 = this.#s), this.#e === rt && (t.行末禁則 = this.#e), this.#n === ht && (t.分割禁止 = this.#n), this.#r === ft && (t.ぶら下げ = this.#r), t;
|
|
510
|
+
}
|
|
511
|
+
playback(t) {
|
|
512
|
+
t && (this.#i(
|
|
513
|
+
t.行頭禁則 ?? st,
|
|
514
|
+
t.行末禁則 ?? rt,
|
|
515
|
+
t.分割禁止 ?? ht,
|
|
516
|
+
t.ぶら下げ ?? ft
|
|
517
|
+
), this.break_fixed = t.break_fixed, this.break_fixed_left = t.break_fixed_left, this.break_fixed_top = t.break_fixed_top, this.bura = t.bura);
|
|
518
|
+
}
|
|
519
|
+
hyph(t, e, s, i, n) {
|
|
520
|
+
let a, o = 0, r = 2, c = (f) => (c = () => !1, i === f ? (i > 0 && (t.innerHTML = n.replaceAll('class="sn_ch"', 'class="sn_ch sn_ch_in_default"')), !0) : f < 2);
|
|
521
|
+
do {
|
|
522
|
+
if (a = this.#f(t, e), o = a.length, c(o)) break;
|
|
523
|
+
let f = -1 / 0;
|
|
524
|
+
for (; r < o; ++r) {
|
|
525
|
+
const { elm: l, rect: p, ch: d } = a[r];
|
|
526
|
+
if (l.tagName === "RT") continue;
|
|
527
|
+
const h = s ? p.y : p.x;
|
|
528
|
+
if (f <= h || l.previousElementSibling?.tagName === "SPAN" && l.previousElementSibling?.innerHTML.includes("<br>") || l.parentElement?.previousElementSibling?.tagName === "SPAN" && l.parentElement?.previousElementSibling?.innerHTML.includes("<br>")) {
|
|
529
|
+
f = h, this.break_fixed || (this.break_fixed_left = p.x, this.break_fixed_top = p.y);
|
|
530
|
+
continue;
|
|
531
|
+
}
|
|
532
|
+
const u = this.#d(a, r), { elm: x, rect: v, ch: y } = a[u];
|
|
533
|
+
if (!this.break_fixed) {
|
|
534
|
+
this.break_fixed_left = v.x, this.break_fixed_top = v.y;
|
|
535
|
+
const N = globalThis.getComputedStyle(x), O = parseFloat(N.fontSize);
|
|
536
|
+
s ? this.break_fixed_top += O : this.break_fixed_left += O;
|
|
537
|
+
}
|
|
538
|
+
f = -1 / 0;
|
|
539
|
+
const b = r, { cont: E, ins: _ } = this.bura ? this.hyph_alg_bura(a, u, y, r) : this.hyph_alg(a, u, y, r, d);
|
|
540
|
+
if (r = _, E) continue;
|
|
541
|
+
const T = a[r].elm, $ = T.parentElement, k = document.createElement("br");
|
|
542
|
+
if ($.classList.contains("sn_tx")) $.insertBefore(k, T);
|
|
543
|
+
else {
|
|
544
|
+
const N = $.parentElement;
|
|
545
|
+
N.classList.contains("sn_ch") ? N.parentElement.insertBefore(k, N) : N.insertBefore(k, $);
|
|
546
|
+
}
|
|
547
|
+
r += 2, r < b && (r = b), o = -1;
|
|
548
|
+
break;
|
|
549
|
+
}
|
|
550
|
+
} while (o < 0);
|
|
551
|
+
return [a, o];
|
|
552
|
+
}
|
|
553
|
+
// 一つ前の要素を探す(ルビ対応)
|
|
554
|
+
#d(t, e) {
|
|
555
|
+
const s = e - 1, { elm: i } = t[s];
|
|
556
|
+
return i.tagName !== "RT" ? s - (i.style.textCombineUpright === "all" ? Array.from(i.textContent).length - 1 : 0) : s - Array.from(i.textContent).length;
|
|
557
|
+
}
|
|
558
|
+
#f(t, e) {
|
|
559
|
+
const s = [];
|
|
560
|
+
if (t.nodeType !== t.TEXT_NODE) return Array.from(t.childNodes).map((o) => this.#f(o, e)).flat();
|
|
561
|
+
const i = t.ownerDocument.createRange();
|
|
562
|
+
i.selectNodeContents(t);
|
|
563
|
+
let n = 0;
|
|
564
|
+
const a = i.endOffset;
|
|
565
|
+
for (; n < a; ) {
|
|
566
|
+
i.setStart(t, n), i.setEnd(t, ++n);
|
|
567
|
+
const o = i.toString();
|
|
568
|
+
s.push({
|
|
569
|
+
ch: o,
|
|
570
|
+
rect: e(i, o),
|
|
571
|
+
elm: i.startContainer.parentElement
|
|
572
|
+
});
|
|
573
|
+
}
|
|
574
|
+
return i.detach(), s;
|
|
575
|
+
}
|
|
576
|
+
/**
|
|
577
|
+
* 抽象化した禁則処理アルゴリズム
|
|
578
|
+
* @method hyph_alg
|
|
579
|
+
* @param {IChRect[]} a - 文章の抽象化配列
|
|
580
|
+
* @param {number} p_i - 処理要素の一つ前の添字
|
|
581
|
+
* @param {string} p_ch - 処理要素の一つ前の文字
|
|
582
|
+
* @param {number} i - 処理要素の添字
|
|
583
|
+
* @param {string} ch - 処理要素の文字
|
|
584
|
+
* @return {Object} result 戻り値
|
|
585
|
+
* @return {boolean} result.cont - true: 呼び元で改行挿入せず continue
|
|
586
|
+
* @return {number} result.ins - 手前に改行を挿入すべき要素の添字
|
|
587
|
+
*/
|
|
588
|
+
hyph_alg(t, e, s, i, n) {
|
|
589
|
+
let a = i;
|
|
590
|
+
if (!this.#l.test(s)) {
|
|
591
|
+
if (this.#t.test(n))
|
|
592
|
+
for (; (a = this.#d(t, a)) >= 0 && this.#t.test(t[a].ch); )
|
|
593
|
+
;
|
|
594
|
+
else if (!(s === n && this.#p.test(s))) return { cont: !0, ins: a + 1 };
|
|
595
|
+
}
|
|
596
|
+
for (a = e; (a = this.#d(t, a)) >= 0 && this.#l.test(t[a].ch); )
|
|
597
|
+
;
|
|
598
|
+
return { cont: !1, ins: a + 1 };
|
|
599
|
+
}
|
|
600
|
+
/**
|
|
601
|
+
* 抽象化した禁則処理アルゴリズム
|
|
602
|
+
* @method hyph_alg
|
|
603
|
+
* @param {IChRect[]} a - 文章の抽象化配列
|
|
604
|
+
* @param {number} p_i - 処理要素の一つ前の添字
|
|
605
|
+
* @param {string} p_ch - 処理要素の一つ前の文字
|
|
606
|
+
* @param {number} i - 処理要素の添字
|
|
607
|
+
* @return {Object} result 戻り値
|
|
608
|
+
* @return {boolean} result.cont - true: 呼び元で改行挿入せず continue
|
|
609
|
+
* @return {number} result.ins - 手前に改行を挿入すべき要素の添字
|
|
610
|
+
*/
|
|
611
|
+
hyph_alg_bura(t, e, s, i) {
|
|
612
|
+
const n = this.#d(t, e), { ch: a } = t[n];
|
|
613
|
+
if (this.#u.test(a) || this.#t.test(a)) {
|
|
614
|
+
let r = e;
|
|
615
|
+
(this.#u.test(s) || this.#t.test(s)) && ++r;
|
|
616
|
+
const c = this.#d(t, r), { ch: f } = t[c], { ch: l } = t[r];
|
|
617
|
+
if (f === l && this.#p.test(l)) return { cont: !1, ins: c };
|
|
618
|
+
if (!this.#l.test(f)) return { cont: !1, ins: r };
|
|
619
|
+
r = c;
|
|
620
|
+
do
|
|
621
|
+
if (!this.#l.test(t[r].ch)) break;
|
|
622
|
+
while ((r = this.#d(t, r)) >= 0);
|
|
623
|
+
return { cont: !1, ins: r + 1 };
|
|
624
|
+
}
|
|
625
|
+
const o = this.#d(t, n);
|
|
626
|
+
if (i >= 3) {
|
|
627
|
+
const { ch: r } = t[o];
|
|
628
|
+
if (this.#p.test(a) && r === a)
|
|
629
|
+
return { cont: !1, ins: o };
|
|
630
|
+
if (this.#l.test(r)) {
|
|
631
|
+
let c = o;
|
|
632
|
+
for (; (c = this.#d(t, c)) >= 0 && this.#l.test(t[c].ch); )
|
|
633
|
+
;
|
|
634
|
+
return { cont: !1, ins: c + 1 };
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
return { cont: !1, ins: n };
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
function Ut(q, t, e, s, i, n = !0) {
|
|
641
|
+
const a = {
|
|
642
|
+
escape: (y) => y.replaceAll(/([.*+?^${}()|[\]/\\])/g, "\\$1"),
|
|
643
|
+
mimeType: (y) => {
|
|
644
|
+
const b = l(y).toLowerCase();
|
|
645
|
+
return o()[b] || "";
|
|
646
|
+
},
|
|
647
|
+
dataAsUrl: u,
|
|
648
|
+
isDataUrl: p,
|
|
649
|
+
resolveUrl: d,
|
|
650
|
+
getAndEncode: h,
|
|
651
|
+
asArray: (y) => {
|
|
652
|
+
const b = [], E = y.length;
|
|
653
|
+
for (let _ = 0; _ < E; ++_) b.push(y[_]);
|
|
654
|
+
return b;
|
|
655
|
+
}
|
|
656
|
+
};
|
|
657
|
+
function o() {
|
|
658
|
+
const y = "application/font-woff", b = "image/jpeg";
|
|
659
|
+
return {
|
|
660
|
+
woff: y,
|
|
661
|
+
woff2: y,
|
|
662
|
+
ttf: "application/font-truetype",
|
|
663
|
+
eot: "application/vnd.ms-fontobject",
|
|
664
|
+
png: "image/png",
|
|
665
|
+
jpg: b,
|
|
666
|
+
jpeg: b,
|
|
667
|
+
gif: "image/gif",
|
|
668
|
+
tiff: "image/tiff",
|
|
669
|
+
svg: "image/svg+xml"
|
|
670
|
+
};
|
|
671
|
+
}
|
|
672
|
+
const r = x(), c = v();
|
|
673
|
+
function f(y) {
|
|
674
|
+
return c.resolveAll().then((b) => {
|
|
675
|
+
const E = document.createElement("style");
|
|
676
|
+
return y.appendChild(E), E.appendChild(document.createTextNode(b)), y;
|
|
677
|
+
});
|
|
678
|
+
}
|
|
679
|
+
function l(y) {
|
|
680
|
+
return /\.([^./]*?)$/g.exec(y)?.[1] ?? "";
|
|
681
|
+
}
|
|
682
|
+
function p(y) {
|
|
683
|
+
return y.search(/^(data:)/) !== -1;
|
|
684
|
+
}
|
|
685
|
+
function d(y, b) {
|
|
686
|
+
const E = document.implementation.createHTMLDocument(), _ = E.createElement("base");
|
|
687
|
+
E.head.appendChild(_);
|
|
688
|
+
const T = E.createElement("a");
|
|
689
|
+
return E.body.appendChild(T), _.href = b, T.href = y, T.href;
|
|
690
|
+
}
|
|
691
|
+
function h(y) {
|
|
692
|
+
return new Promise(function(E) {
|
|
693
|
+
const _ = new XMLHttpRequest();
|
|
694
|
+
_.onreadystatechange = T, _.ontimeout = $, _.responseType = "blob", _.timeout = 3e4, _.open("GET", y, !0), _.send();
|
|
695
|
+
function T() {
|
|
696
|
+
if (_.readyState !== 4) return;
|
|
697
|
+
if (_.status !== 200) {
|
|
698
|
+
k("cannot fetch resource: " + y + ", status: " + _.status);
|
|
699
|
+
return;
|
|
700
|
+
}
|
|
701
|
+
const N = new FileReader();
|
|
702
|
+
N.onloadend = function() {
|
|
703
|
+
const O = N.result.toString().split(/,/)[1];
|
|
704
|
+
E(O);
|
|
705
|
+
}, N.readAsDataURL(_.response);
|
|
706
|
+
}
|
|
707
|
+
function $() {
|
|
708
|
+
k("timeout of 30000ms occured while fetching resource: " + y);
|
|
709
|
+
}
|
|
710
|
+
function k(N) {
|
|
711
|
+
console.error(N), E("");
|
|
712
|
+
}
|
|
713
|
+
});
|
|
714
|
+
}
|
|
715
|
+
function u(y, b) {
|
|
716
|
+
return "data:" + b + ";base64," + y;
|
|
717
|
+
}
|
|
718
|
+
function x() {
|
|
719
|
+
const y = /url\(['"]?([^'"]+?)['"]?\)/g;
|
|
720
|
+
return {
|
|
721
|
+
inlineAll: T,
|
|
722
|
+
shouldProcess: b
|
|
723
|
+
};
|
|
724
|
+
function b($) {
|
|
725
|
+
return $.search(y) !== -1;
|
|
726
|
+
}
|
|
727
|
+
function E($) {
|
|
728
|
+
const k = [];
|
|
729
|
+
let N;
|
|
730
|
+
for (; N = y.exec($); )
|
|
731
|
+
k.push(N[1]);
|
|
732
|
+
return k.filter(function(O) {
|
|
733
|
+
return !a.isDataUrl(O);
|
|
734
|
+
});
|
|
735
|
+
}
|
|
736
|
+
function _($, k, N, O) {
|
|
737
|
+
return Promise.resolve(k).then((I) => N ? a.resolveUrl(I, N) : I).then(O || a.getAndEncode).then((I) => a.dataAsUrl(I, a.mimeType(k))).then((I) => $.replace(M(k), "$1" + I + "$3"));
|
|
738
|
+
function M(I) {
|
|
739
|
+
return new RegExp(`(url\\(['"]?)(` + a.escape(I) + `)(['"]?\\))`, "g");
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
function T($, k, N) {
|
|
743
|
+
if (O()) return Promise.resolve($);
|
|
744
|
+
return Promise.resolve($).then(E).then((M) => {
|
|
745
|
+
let I = Promise.resolve($);
|
|
746
|
+
for (const K of M) I = I.then((lt) => _(lt, K, k, N));
|
|
747
|
+
return I;
|
|
748
|
+
});
|
|
749
|
+
function O() {
|
|
750
|
+
return !b($);
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
function v() {
|
|
755
|
+
return {
|
|
756
|
+
resolveAll: y,
|
|
757
|
+
impl: { readAll: b }
|
|
758
|
+
};
|
|
759
|
+
function y() {
|
|
760
|
+
return b().then((E) => Promise.allSettled(
|
|
761
|
+
E.map((_) => _.resolve())
|
|
762
|
+
)).then((E) => E.join(`
|
|
763
|
+
`));
|
|
764
|
+
}
|
|
765
|
+
function b() {
|
|
766
|
+
return Promise.resolve(a.asArray(document.styleSheets)).then(_).then(E).then(($) => $.map(T));
|
|
767
|
+
function E($) {
|
|
768
|
+
return $.filter((k) => k.type === CSSRule.FONT_FACE_RULE).filter((k) => r.shouldProcess(k.style.getPropertyValue("src")));
|
|
769
|
+
}
|
|
770
|
+
function _($) {
|
|
771
|
+
const k = [];
|
|
772
|
+
for (const N of $)
|
|
773
|
+
try {
|
|
774
|
+
if (N.href) continue;
|
|
775
|
+
a.asArray(N.cssRules || []).forEach(k.push.bind(k));
|
|
776
|
+
} catch (O) {
|
|
777
|
+
console.error("Error while reading CSS rules from " + N.href, String(O));
|
|
778
|
+
}
|
|
779
|
+
return k;
|
|
780
|
+
}
|
|
781
|
+
function T($) {
|
|
782
|
+
return {
|
|
783
|
+
resolve: function() {
|
|
784
|
+
const N = ($.parentStyleSheet || {}).href;
|
|
785
|
+
return r.inlineAll($.cssText, N);
|
|
786
|
+
},
|
|
787
|
+
src() {
|
|
788
|
+
return $.style.getPropertyValue("src");
|
|
789
|
+
}
|
|
790
|
+
};
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
Promise.resolve(t).then((y) => {
|
|
795
|
+
const b = y.cloneNode(!0);
|
|
796
|
+
return b.style.padding = "0px", b.style.paddingRight = s + "px", b.style.paddingTop = i + "px", b.style.left = "0px", b.style.top = "0px", b.style.width = e.$width - e.pad_left - e.pad_right + "px", b.style.height = e.$height - e.pad_top - e.pad_bottom + "px", t.hidden = n, b;
|
|
797
|
+
}).then(f).then((y) => {
|
|
798
|
+
y.setAttribute("xmlns", "http://www.w3.org/1999/xhtml");
|
|
799
|
+
const b = new Image();
|
|
800
|
+
return b.src = `data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="${e.$width}px" height="${e.$height}px"><foreignObject x="0" y="0" width="100%" height="100%">${new XMLSerializer().serializeToString(y).replaceAll("#", "%23").replaceAll(`
|
|
801
|
+
`, "%0A")}</foreignObject></svg>`, new Promise((E) => {
|
|
802
|
+
b.onload = () => E(b);
|
|
803
|
+
});
|
|
804
|
+
}).then((y) => new Promise((b) => setTimeout(() => b(y), 100))).then((y) => {
|
|
805
|
+
const b = document.createElement("canvas");
|
|
806
|
+
b.width = e.$width, b.height = e.$height, b.getContext("2d").drawImage(y, 0, 0), q(J.from(b));
|
|
807
|
+
}).catch((y) => it.myTrace(`goTxt() = ${y}`));
|
|
808
|
+
}
|
|
809
|
+
class g extends W {
|
|
810
|
+
constructor(t, e, s) {
|
|
811
|
+
super(), this.ctn = t, this.canFocus = e, this.sys = s, this.#t.classList.add("sn_tx"), this.#t.style.position = "absolute", g.#e.view.parentElement.appendChild(this.#t), this.addChild(this.#l), this.addChild(this.#p), this.#p.name = "grpDbgMasume";
|
|
812
|
+
const i = S.debugLog ? ({ ch: n, rect: { x: a, y: o, width: r, height: c } }) => console.log(`🍌 masume ch:${n} x:${a} y:${o} w:${r} h:${c}`) : () => {
|
|
813
|
+
};
|
|
814
|
+
this.#x = g.#s.oCfg.debug.masume ? (n) => {
|
|
815
|
+
i(n);
|
|
816
|
+
const { x: a, y: o, width: r, height: c } = n.rect;
|
|
817
|
+
this.#p.beginFill(6737151, 0.5).lineStyle(2, 16724736, 1).drawRect(a, o, r, c).endFill();
|
|
818
|
+
} : () => {
|
|
819
|
+
}, this.noticeCompTxt = s.isApp && g.#s.oCfg.debug.dumpHtm ? () => {
|
|
820
|
+
F.notifyEndProc(wt);
|
|
821
|
+
const n = this.#t.innerHTML;
|
|
822
|
+
if (n === "") return;
|
|
823
|
+
const { fn: a, ln: o } = g.#r.nowScrFnLn(), r = `dumpHtm ${t.name.slice(0, -7).replaceAll(":", "=")}(fn=${a} line=${String(o)})`;
|
|
824
|
+
s.outputFile(
|
|
825
|
+
s.path_downloads + r + ".htm",
|
|
826
|
+
`<!doctype html><html><head><meta charset=utf-8><title>${r}</title>
|
|
827
|
+
<h1>${r}</h1>${n.replaceAll(/ class="sn_ch"|animation-delay: \d+ms; ?| data-add="{"ch_in_style":"default", "ch_out_style":"default"}"/g, "").replaceAll(' style=""', "").replaceAll(/(<\/?ruby>)/g, `
|
|
828
|
+
$1
|
|
829
|
+
`).replaceAll(/<(br|\/span)>/g, `<$1>
|
|
830
|
+
`)}`
|
|
831
|
+
);
|
|
832
|
+
} : () => F.notifyEndProc(wt);
|
|
833
|
+
}
|
|
834
|
+
static #s;
|
|
835
|
+
static #e;
|
|
836
|
+
static init(t, e) {
|
|
837
|
+
g.#s = t, g.#e = e;
|
|
838
|
+
}
|
|
839
|
+
static #n;
|
|
840
|
+
static #r;
|
|
841
|
+
static setEvtMng(t, e) {
|
|
842
|
+
g.#n = t, g.#r = e;
|
|
843
|
+
}
|
|
844
|
+
static destroy() {
|
|
845
|
+
g.#F = /* @__PURE__ */ Object.create(null), g.#j = /* @__PURE__ */ Object.create(null), g.delBreak();
|
|
846
|
+
}
|
|
847
|
+
#t = document.createElement("span");
|
|
848
|
+
// サンプリング元
|
|
849
|
+
#l = new W();
|
|
850
|
+
// サンプリング先
|
|
851
|
+
#p = new U();
|
|
852
|
+
static #u = {
|
|
853
|
+
"background-color": 0,
|
|
854
|
+
"border-bottom-width": 0,
|
|
855
|
+
"border-left-width": 0,
|
|
856
|
+
"border-right-width": 0,
|
|
857
|
+
"border-top-width": 0,
|
|
858
|
+
"margin-bottom": 0,
|
|
859
|
+
"margin-left": 0,
|
|
860
|
+
"margin-right": 0,
|
|
861
|
+
"margin-top": 0
|
|
862
|
+
};
|
|
863
|
+
#c = new Jt();
|
|
864
|
+
noticeCompTxt = () => {
|
|
865
|
+
};
|
|
866
|
+
#x;
|
|
867
|
+
// readonly #idc :TxtLayDesignCast;
|
|
868
|
+
// readonly #idcCh = new TxtLayPadDesignCast(this);
|
|
869
|
+
#i = {
|
|
870
|
+
fontsize: 24,
|
|
871
|
+
$width: 0,
|
|
872
|
+
// レイヤサイズであり、背景色(画像)サイズ
|
|
873
|
+
$height: 0,
|
|
874
|
+
pad_left: 0,
|
|
875
|
+
// paddingLeft(レイヤサイズの内側のスペーサー)
|
|
876
|
+
pad_right: 0,
|
|
877
|
+
// paddingRight
|
|
878
|
+
pad_top: 0,
|
|
879
|
+
// paddingTop
|
|
880
|
+
pad_bottom: 0
|
|
881
|
+
// paddingBottom
|
|
882
|
+
};
|
|
883
|
+
lay(t) {
|
|
884
|
+
const e = this.#t.style;
|
|
885
|
+
if ("style" in t)
|
|
886
|
+
if (t.style) {
|
|
887
|
+
const s = document.createElement("span");
|
|
888
|
+
s.style.cssText = t.style;
|
|
889
|
+
const i = s.style.length;
|
|
890
|
+
for (let n = 0; n < i; ++n) {
|
|
891
|
+
const a = s.style[n];
|
|
892
|
+
if (a in g.#u) {
|
|
893
|
+
it.myTrace(`${String(a)}は指定できません`, "W");
|
|
894
|
+
continue;
|
|
895
|
+
}
|
|
896
|
+
e[a] = s.style[a];
|
|
897
|
+
}
|
|
898
|
+
!s.style.opacity && "alpha" in t && (e.opacity = String(this.ctn.alpha));
|
|
899
|
+
} else this.#t.style.cssText = "";
|
|
900
|
+
else "alpha" in t && (e.opacity = String(this.ctn.alpha));
|
|
901
|
+
if ("width" in t && (e.width = String(t.width ?? "0") + "px"), "height" in t && (e.height = String(t.height ?? "0") + "px"), "pl" in t && (e.paddingLeft = String(t.pl ?? "0") + "px"), "pr" in t && (e.paddingRight = String(t.pr ?? "0") + "px"), "pt" in t && (e.paddingTop = String(t.pt ?? "0") + "px"), "pb" in t && (e.paddingBottom = String(t.pb ?? "0") + "px"), this.#c.lay(t), this.#f(), this.#y = this.ctn.position.x, e.transformOrigin = `${this.ctn.pivot.x}px ${this.ctn.pivot.y}px`, this.cvsResize(), e.display = this.ctn.visible ? "inline" : "none", ":redraw" in t && this.#w > 0) {
|
|
902
|
+
const s = [
|
|
903
|
+
this.#t.innerHTML.replaceAll(/(animation-delay: )\d+ms/g, "$10ms"),
|
|
904
|
+
`<span class='sn_ch' data-add='{"ch_in_style":"default"}'> </span>`
|
|
905
|
+
];
|
|
906
|
+
this.#_(), this.goTxt(s, !0);
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
// oxlint-disable-next-line no-unused-private-class-members
|
|
910
|
+
#d = 0;
|
|
911
|
+
// 「g」などで下が欠ける問題対策
|
|
912
|
+
#f() {
|
|
913
|
+
const t = this.#t.style, e = parseFloat(t.fontSize || "0");
|
|
914
|
+
this.#i.fontsize = e, this.#i.pad_left = parseFloat(t.paddingLeft || "0"), this.#i.pad_right = parseFloat(t.paddingRight || "0"), this.#i.pad_top = parseFloat(t.paddingTop || "0"), this.#i.pad_bottom = parseFloat(t.paddingBottom || "0"), this.#i.$width = parseFloat(t.width || "0"), this.#i.$height = parseFloat(t.height || "0"), this.position.set(this.#i.pad_left, this.#i.pad_top), this.#a = t.writingMode === "vertical-rl", this.#g = 0, this.#o = 0;
|
|
915
|
+
const s = t.lineHeight ?? "0";
|
|
916
|
+
this.#d = this.#a ? 0 : (s.endsWith("px") ? parseFloat(s) : e * parseFloat(s) - e) / 2;
|
|
917
|
+
}
|
|
918
|
+
cvsResize() {
|
|
919
|
+
const t = this.#t.style, e = this.sys.cvsScale;
|
|
920
|
+
t.left = `${this.sys.ofsLeft4elm + this.#y * e}px`, t.top = `${this.sys.ofsTop4elm + this.ctn.position.y * e}px`, t.transform = `rotate(${this.ctn.angle}deg) scale(${this.ctn.scale.x * e}, ${this.ctn.scale.y * e})`;
|
|
921
|
+
}
|
|
922
|
+
#y = 0;
|
|
923
|
+
#a = !1;
|
|
924
|
+
get tategaki() {
|
|
925
|
+
return this.#a;
|
|
926
|
+
}
|
|
927
|
+
#g = 0;
|
|
928
|
+
#o = 0;
|
|
929
|
+
get infTL() {
|
|
930
|
+
return this.#i;
|
|
931
|
+
}
|
|
932
|
+
get getWidth() {
|
|
933
|
+
return this.#i.$width;
|
|
934
|
+
}
|
|
935
|
+
get getHeight() {
|
|
936
|
+
return this.#i.$height;
|
|
937
|
+
}
|
|
938
|
+
setMySize(t, e) {
|
|
939
|
+
this.#i.$width = t, this.#i.$height = e, this.#t.style.width = String(this.#i.$width) + "px", this.#t.style.height = String(this.#i.$height) + "px";
|
|
940
|
+
}
|
|
941
|
+
#I = [];
|
|
942
|
+
// FIFO実行バッファ
|
|
943
|
+
goTxt(t, e) {
|
|
944
|
+
const s = () => this.#h(t, e);
|
|
945
|
+
this.#I.push(s) === 1 && s();
|
|
946
|
+
}
|
|
947
|
+
#k = [];
|
|
948
|
+
#w = 0;
|
|
949
|
+
static #v = "<span class='sn_ch sn_ch_last'> </span>";
|
|
950
|
+
#h(t, e) {
|
|
951
|
+
g.#H.visible = !1;
|
|
952
|
+
let s = this.#k.length, i = "";
|
|
953
|
+
if (s === 0) {
|
|
954
|
+
if (g.#s.oCfg.debug.masume && (S.debugLog && console.log(`🍌 masume ${// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
955
|
+
this.name} v:${this.visible} l:${this.x} t:${this.y} a:${this.alpha} pl:${this.#i.pad_left} pr:${this.#i.pad_right} pt:${this.#i.pad_top} pb:${this.#i.pad_bottom} w:${this.#i.$width} h:${this.#i.$height}`), this.#p.clear().beginFill(3407616, 0.2).lineStyle(1, 3407616, 1).drawRect(-this.#i.pad_left, -this.#i.pad_top, this.#i.$width, this.#i.$height).endFill().beginFill(13311, 0.2).lineStyle(2, 13311, 1).drawRect(
|
|
956
|
+
0,
|
|
957
|
+
0,
|
|
958
|
+
this.#i.$width - this.#i.pad_left - this.#i.pad_right,
|
|
959
|
+
this.#i.$height - this.#i.pad_top - this.#i.pad_bottom
|
|
960
|
+
).endFill()), this.#t.innerHTML = [...t].join("").replaceAll(/[\n\t]/g, "") + g.#v, !this.#c.break_fixed) {
|
|
961
|
+
const u = globalThis.getComputedStyle(this.#t), x = parseFloat(u.fontSize);
|
|
962
|
+
this.#a ? (this.#c.break_fixed_left = (this.#i.$width - this.#i.pad_left - this.#i.pad_right - x * 1.5) * this.sys.cvsScale, this.#c.break_fixed_top = 0) : (this.#c.break_fixed_left = 0, this.#c.break_fixed_top = x / 2 * this.sys.cvsScale);
|
|
963
|
+
}
|
|
964
|
+
} else
|
|
965
|
+
i = this.#t.innerHTML, --s, this.#t.getElementsByClassName("sn_ch_last").item(0)?.remove(), this.#t.querySelectorAll(":scope > br").forEach((u) => u.remove()), this.#t.insertAdjacentHTML(
|
|
966
|
+
"beforeend",
|
|
967
|
+
t.slice(this.#w).join("").replaceAll(/[\n\t]/g, "") + g.#v
|
|
968
|
+
// 末尾改行削除挙動対策
|
|
969
|
+
);
|
|
970
|
+
this.#t.querySelectorAll(".sn_ch:has(> ruby)").forEach((u) => {
|
|
971
|
+
u.style.background = "";
|
|
972
|
+
}), this.#w = t.length;
|
|
973
|
+
const n = this.sys.cvsScale, a = this.#t.getBoundingClientRect(), o = a.left + this.#i.pad_left, r = a.top + this.#i.pad_top;
|
|
974
|
+
let c;
|
|
975
|
+
if (n === 1) c = (u, x) => {
|
|
976
|
+
const v = u.getBoundingClientRect();
|
|
977
|
+
return new Y(
|
|
978
|
+
v.left - o,
|
|
979
|
+
v.top - r,
|
|
980
|
+
v.width,
|
|
981
|
+
v.height + ("gjqy".includes(x) ? this.#d : 0)
|
|
982
|
+
);
|
|
983
|
+
};
|
|
984
|
+
else {
|
|
985
|
+
const u = this.sys.ofsPadLeft_Dom2PIXI + a.left * (1 - n), x = this.sys.ofsPadTop_Dom2PIXI + a.top * (1 - n);
|
|
986
|
+
c = (v, y) => {
|
|
987
|
+
const b = v.getBoundingClientRect();
|
|
988
|
+
return new Y(
|
|
989
|
+
(b.left - u) / n - o,
|
|
990
|
+
(b.top - x) / n - r,
|
|
991
|
+
b.width / n,
|
|
992
|
+
(b.height + ("gjqy".includes(y) ? this.#d : 0)) / n
|
|
993
|
+
);
|
|
994
|
+
};
|
|
995
|
+
}
|
|
996
|
+
const [f, l] = this.#c.hyph(this.#t, c, this.#a, s, i);
|
|
997
|
+
this.#k = f;
|
|
998
|
+
const p = B.ease(this.#$);
|
|
999
|
+
for (let u = s; u < l; ++u) {
|
|
1000
|
+
const x = this.#k[u], { elm: { dataset: v, parentElement: y }, rect: b } = x, E = JSON.parse(v.arg ?? '{"delay": 0}'), _ = JSON.parse(v.add ?? "{}"), T = g.#F[_.ch_in_style];
|
|
1001
|
+
if (this.#x(x), v.cmd === "grp") {
|
|
1002
|
+
const $ = new W();
|
|
1003
|
+
this.#l.addChild($), new m(E.pic, $, (k) => {
|
|
1004
|
+
this.#E($, E, _, b, p, T ?? {}), $.parent || $.removeChild(k);
|
|
1005
|
+
});
|
|
1006
|
+
}
|
|
1007
|
+
if (v.lnk) {
|
|
1008
|
+
const $ = y.closest("[data-arg]"), k = JSON.parse($.dataset.arg ?? "{}");
|
|
1009
|
+
k.key = `lnk=[${String(u)}] ` + this.name;
|
|
1010
|
+
const N = new j();
|
|
1011
|
+
this.#E(N, k, _, b, p, T ?? {});
|
|
1012
|
+
const O = k.style ?? "", M = O + (k.style_hover ?? ""), I = O + (k.style_clicked ?? ""), K = k.r_style ?? "", lt = K + (k.r_style_hover ?? ""), Ct = K + (k.r_style_clicked ?? ""), yt = Array.from($.getElementsByTagName("rt"));
|
|
1013
|
+
for (const at of yt) at.dataset.st_r_bk = at.style.cssText;
|
|
1014
|
+
const Et = $.style.cssText, nt = (at, Nt) => {
|
|
1015
|
+
$.style.cssText = Et + at;
|
|
1016
|
+
for (const mt of yt) mt.style.cssText = mt.dataset.st_r_bk + Nt;
|
|
1017
|
+
};
|
|
1018
|
+
R(k, "enabled", !0) ? g.#n.button(
|
|
1019
|
+
k,
|
|
1020
|
+
N,
|
|
1021
|
+
() => nt(O, K),
|
|
1022
|
+
() => this.canFocus() ? (nt(M, lt), !0) : !1,
|
|
1023
|
+
() => nt(I, Ct)
|
|
1024
|
+
) : nt(
|
|
1025
|
+
O + (k.style_disable ?? "color: gray;"),
|
|
1026
|
+
K + (k.r_style_disable ?? "color: gray;")
|
|
1027
|
+
), this.#l.addChild(N);
|
|
1028
|
+
}
|
|
1029
|
+
}
|
|
1030
|
+
const d = Array.from(this.#t.getElementsByClassName("sn_ch_yet"));
|
|
1031
|
+
this.#b = () => {
|
|
1032
|
+
this.#b = () => !1;
|
|
1033
|
+
for (const x of d) x.className = "sn_ch";
|
|
1034
|
+
g.#H.position.set(
|
|
1035
|
+
this.#c.break_fixed_left,
|
|
1036
|
+
this.#c.break_fixed_top
|
|
1037
|
+
), g.#H.visible = !0, this.noticeCompTxt();
|
|
1038
|
+
const u = this.#I.shift();
|
|
1039
|
+
return this.#I.length > 0 && u(), !0;
|
|
1040
|
+
};
|
|
1041
|
+
for (const u of d) u.className = u.className.replace("sn_ch_yet sn", "go");
|
|
1042
|
+
s > 0 && ++s;
|
|
1043
|
+
let h;
|
|
1044
|
+
for (let u = l - 2; u >= 0; --u) {
|
|
1045
|
+
const { elm: x } = this.#k[u];
|
|
1046
|
+
if (x.tagName === "SPAN") {
|
|
1047
|
+
h = x.parentElement?.tagName === "RUBY" ? x.parentElement.parentElement ?? x : x;
|
|
1048
|
+
break;
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
1051
|
+
if (!h || e || s === l) {
|
|
1052
|
+
this.#b();
|
|
1053
|
+
return;
|
|
1054
|
+
}
|
|
1055
|
+
h.addEventListener("animationend", () => this.#b(), { once: !0 });
|
|
1056
|
+
}
|
|
1057
|
+
#b = () => !1;
|
|
1058
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1059
|
+
#E(t, e, s, i, n, a) {
|
|
1060
|
+
t.alpha = 0, e.x && (i.x = e.x.startsWith("=") ? i.x + parseInt(e.x.slice(1)) : parseInt(e.x)), e.y && (i.y = e.y.startsWith("=") ? i.y + parseInt(e.y.slice(1)) : parseInt(e.y)), e.width && (i.width = parseInt(e.width)), e.height && (i.height = parseInt(e.height)), e.wait && (a.wait = e.wait), t.width = i.width, t.height = i.height, a.x ? t.position.set(
|
|
1061
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
1062
|
+
a.x.startsWith("=") ? i.x + t.width * a.nx : a.nx,
|
|
1063
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
1064
|
+
a.y.startsWith("=") ? i.y + t.height * a.ny : a.ny
|
|
1065
|
+
) : t.position.set(i.x, i.y);
|
|
1066
|
+
const o = {
|
|
1067
|
+
sp: t,
|
|
1068
|
+
tw: new Dt(t).to({ alpha: 1, x: i.x, y: i.y, width: i.width, height: i.height, angle: 0 }, a.wait ?? 0).easing(n).delay((s.wait ?? 0) + (e.delay ?? 0)).onComplete(() => {
|
|
1069
|
+
o.tw = void 0;
|
|
1070
|
+
}).start()
|
|
1071
|
+
};
|
|
1072
|
+
this.#V.push(o);
|
|
1073
|
+
}
|
|
1074
|
+
#V = [];
|
|
1075
|
+
skipChIn() {
|
|
1076
|
+
let t = this.#b();
|
|
1077
|
+
for (const e of this.#V)
|
|
1078
|
+
e.tw && (e.tw.stop().end(), t = !0);
|
|
1079
|
+
return this.#V = [], t;
|
|
1080
|
+
}
|
|
1081
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
1082
|
+
static #F = /* @__PURE__ */ Object.create(null);
|
|
1083
|
+
static #z = /[{\s.,*{]/;
|
|
1084
|
+
// https://regex101.com/r/APC91I/1
|
|
1085
|
+
static initChStyle() {
|
|
1086
|
+
g.#F = /* @__PURE__ */ Object.create(null), g.#j = /* @__PURE__ */ Object.create(null);
|
|
1087
|
+
}
|
|
1088
|
+
static getChInStyle(t) {
|
|
1089
|
+
return g.#F[t];
|
|
1090
|
+
}
|
|
1091
|
+
static ch_in_style(t) {
|
|
1092
|
+
const { name: e } = t;
|
|
1093
|
+
if (!e) throw "nameは必須です";
|
|
1094
|
+
if (g.#z.test(e)) throw `name【${e}】に使えない文字が含まれます`;
|
|
1095
|
+
if (e in g.#F) throw `name【${e}】はすでにあります`;
|
|
1096
|
+
const s = String(t.x ?? "=0"), i = String(t.y ?? "=0");
|
|
1097
|
+
return g.#F[e] = {
|
|
1098
|
+
wait: w(t, "wait", 500),
|
|
1099
|
+
// アニメ・FI時間
|
|
1100
|
+
alpha: w(t, "alpha", 0),
|
|
1101
|
+
x: s,
|
|
1102
|
+
// 初期x値
|
|
1103
|
+
y: i,
|
|
1104
|
+
// [tsy]と同様に絶対・相対指定可能
|
|
1105
|
+
// {x:500} X位置を500に
|
|
1106
|
+
// {x:'=500'} 現在のX位置に+500加算した位置
|
|
1107
|
+
// {x:'=-500'} 現在のX位置に-500加算した位置
|
|
1108
|
+
// {x:'250,500'} +250から+500までの間でランダムな値をX位置に
|
|
1109
|
+
// {x:'=250,500'} +250から+500までの間でランダムな値を現在のX位置に加算
|
|
1110
|
+
nx: parseFloat(s.at(0) === "=" ? s.slice(1) : s),
|
|
1111
|
+
ny: parseFloat(i.at(0) === "=" ? i.slice(1) : i),
|
|
1112
|
+
scale_x: w(t, "scale_x", 1),
|
|
1113
|
+
scale_y: w(t, "scale_y", 1),
|
|
1114
|
+
rotate: w(t, "rotate", 0),
|
|
1115
|
+
join: R(t, "join", !0),
|
|
1116
|
+
// 文字を順番に出すか(true)同時か(false)
|
|
1117
|
+
ease: t.ease ?? "ease-out"
|
|
1118
|
+
};
|
|
1119
|
+
}
|
|
1120
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
1121
|
+
static #j = /* @__PURE__ */ Object.create(null);
|
|
1122
|
+
static getChOutStyle(t) {
|
|
1123
|
+
return g.#j[t];
|
|
1124
|
+
}
|
|
1125
|
+
static ch_out_style(t) {
|
|
1126
|
+
const { name: e } = t;
|
|
1127
|
+
if (!e) throw "nameは必須です";
|
|
1128
|
+
if (g.#z.test(e)) throw `name【${e}】に使えない文字が含まれます`;
|
|
1129
|
+
if (e in g.#j) throw `name【${e}】はすでにあります`;
|
|
1130
|
+
const s = String(t.x ?? "=0"), i = String(t.y ?? "=0");
|
|
1131
|
+
return g.#j[e] = {
|
|
1132
|
+
wait: w(t, "wait", 500),
|
|
1133
|
+
// アニメ・FI時間
|
|
1134
|
+
alpha: w(t, "alpha", 0),
|
|
1135
|
+
x: s,
|
|
1136
|
+
// 初期x値
|
|
1137
|
+
y: i,
|
|
1138
|
+
// [tsy]と同様に絶対・相対指定可能
|
|
1139
|
+
// {x:500} X位置を500に
|
|
1140
|
+
// {x:'=500'} 現在のX位置に+500加算した位置
|
|
1141
|
+
// {x:'=-500'} 現在のX位置に-500加算した位置
|
|
1142
|
+
// {x:'250,500'} +250から+500までの間でランダムな値をX位置に
|
|
1143
|
+
// {x:'=250,500'} +250から+500までの間でランダムな値を現在のX位置に加算
|
|
1144
|
+
nx: parseFloat(s.at(0) === "=" ? s.slice(1) : s),
|
|
1145
|
+
ny: parseFloat(i.at(0) === "=" ? i.slice(1) : i),
|
|
1146
|
+
scale_x: w(t, "scale_x", 1),
|
|
1147
|
+
scale_y: w(t, "scale_y", 1),
|
|
1148
|
+
rotate: w(t, "rotate", 0),
|
|
1149
|
+
join: R(t, "join", !1),
|
|
1150
|
+
// 文字を順番に出すか(true)同時か(false)
|
|
1151
|
+
ease: t.ease ?? "ease-out"
|
|
1152
|
+
};
|
|
1153
|
+
}
|
|
1154
|
+
static #H = new W();
|
|
1155
|
+
static #O = new m();
|
|
1156
|
+
dispBreak(t) {
|
|
1157
|
+
g.delBreak();
|
|
1158
|
+
const e = g.#H;
|
|
1159
|
+
e.visible = !1, this.addChild(e), g.#O.destroy(), g.#O = new m(t.pic, e, (s) => {
|
|
1160
|
+
e.parent ? (s.x = w(t, "x", 0), s.y = w(t, "y", 0), s.width = w(t, "width", this.#i.fontsize), s.height = w(t, "height", this.#i.fontsize)) : e.removeChild(s);
|
|
1161
|
+
});
|
|
1162
|
+
}
|
|
1163
|
+
static delBreak() {
|
|
1164
|
+
const t = g.#H;
|
|
1165
|
+
t.parent?.removeChild(t), g.#O.destroy();
|
|
1166
|
+
}
|
|
1167
|
+
#$ = "Quadratic.Out";
|
|
1168
|
+
#N = "Quadratic.Out";
|
|
1169
|
+
#_() {
|
|
1170
|
+
this.#p.clear(), this.#k = [], this.#w = 0, this.#I = [], this.skipChIn();
|
|
1171
|
+
const t = this.#t.cloneNode(!0);
|
|
1172
|
+
t.textContent = "";
|
|
1173
|
+
const e = this.#t, s = Array.from(e.getElementsByClassName("sn_ch"));
|
|
1174
|
+
e.parentElement.insertBefore(t, e);
|
|
1175
|
+
let i = 0;
|
|
1176
|
+
s.forEach((a) => {
|
|
1177
|
+
const o = JSON.parse(
|
|
1178
|
+
a.dataset.add ?? // 通常文字
|
|
1179
|
+
a.children[0]?.getAttribute("data-add") ?? // ルビ
|
|
1180
|
+
a.children[0]?.children[0]?.getAttribute("data-add") ?? "{}"
|
|
1181
|
+
// 縦中横
|
|
1182
|
+
);
|
|
1183
|
+
if (!o.ch_out_style) return;
|
|
1184
|
+
const r = g.#j[o.ch_out_style];
|
|
1185
|
+
if (r) {
|
|
1186
|
+
if (r.wait === 0) {
|
|
1187
|
+
a.style.display = "none";
|
|
1188
|
+
return;
|
|
1189
|
+
}
|
|
1190
|
+
i += r.wait, r.join || (a.style.animationDelay = "0ms"), a.classList.add(`go_ch_out_${String(o.ch_out_style)}`);
|
|
1191
|
+
}
|
|
1192
|
+
});
|
|
1193
|
+
const n = () => {
|
|
1194
|
+
e.parentElement.removeChild(e);
|
|
1195
|
+
for (const a of this.#l.removeChildren())
|
|
1196
|
+
a instanceof W && g.#n.unButton(a), a.destroy();
|
|
1197
|
+
};
|
|
1198
|
+
i === 0 ? (this.#t.textContent = "", n()) : e.lastElementChild?.addEventListener("animationend", n, { once: !0 }), this.#t = t;
|
|
1199
|
+
}
|
|
1200
|
+
reNew() {
|
|
1201
|
+
this.#_();
|
|
1202
|
+
const t = new g(this.ctn, () => this.canFocus(), this.sys);
|
|
1203
|
+
return t.#i = this.#i, t.#t.style.cssText = this.#t.style.cssText, t.#y = this.#y, t.name = this.name, t.#f(), t.#W = this.#W, t.#$ = this.#$, t.#N = this.#N, this.#c.reNew(t.#c), this.destroy(), t;
|
|
1204
|
+
}
|
|
1205
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1206
|
+
#W = void 0;
|
|
1207
|
+
// 文字にかけるフィルター
|
|
1208
|
+
record() {
|
|
1209
|
+
return {
|
|
1210
|
+
infTL: this.#i,
|
|
1211
|
+
cssText: this.#t.style.cssText,
|
|
1212
|
+
left: this.#y,
|
|
1213
|
+
// idc_hArg : this.#idc.gethArg(),
|
|
1214
|
+
ch_filter: this.#W,
|
|
1215
|
+
fi_easing: this.#$,
|
|
1216
|
+
fo_easing: this.#N,
|
|
1217
|
+
hyph: this.#c.record()
|
|
1218
|
+
};
|
|
1219
|
+
}
|
|
1220
|
+
playback(t) {
|
|
1221
|
+
this.#i = t.infTL, this.position.set(this.#i.pad_left, this.#i.pad_top), this.#t.style.cssText = t.cssText, this.#y = t.left, this.#f(), this.#W = t.ch_filter, this.#$ = t.fi_easing, this.#N = t.fo_easing, this.#c.playback(t.hyph);
|
|
1222
|
+
}
|
|
1223
|
+
get cssText() {
|
|
1224
|
+
return this.#t.style.cssText;
|
|
1225
|
+
}
|
|
1226
|
+
set cssText(t) {
|
|
1227
|
+
this.#t.style.cssText = t;
|
|
1228
|
+
}
|
|
1229
|
+
#m = void 0;
|
|
1230
|
+
snapshot(t, e) {
|
|
1231
|
+
Ut((s) => {
|
|
1232
|
+
this.#m = j.from(s), this.#a && (this.#m.x += S.stageW - (this.#y + this.#i.$width)), this.#m.y -= this.#o, this.#m.texture.frame = new Y(
|
|
1233
|
+
0,
|
|
1234
|
+
0,
|
|
1235
|
+
Math.min(this.#m.width, this.#i.$width - this.#y),
|
|
1236
|
+
Math.min(this.#m.height, this.#i.$height)
|
|
1237
|
+
), this.#l.addChild(this.#m), t.render(this.#m, { clear: !1 }), e();
|
|
1238
|
+
}, this.#t, this.#i, this.#g, this.#o, !1);
|
|
1239
|
+
}
|
|
1240
|
+
snapshot_end() {
|
|
1241
|
+
this.#m && (this.#l.removeChild(this.#m), this.#m = void 0);
|
|
1242
|
+
}
|
|
1243
|
+
makeDesignCast(t) {
|
|
1244
|
+
}
|
|
1245
|
+
showDesignCast() {
|
|
1246
|
+
}
|
|
1247
|
+
// showDesignCast() {this.#idc.visible = true; this.#idcCh.visible = true}
|
|
1248
|
+
dump() {
|
|
1249
|
+
const t = [], e = this.#t.style, s = e.length;
|
|
1250
|
+
for (let i = 0; i < s; ++i) {
|
|
1251
|
+
const n = e[i];
|
|
1252
|
+
t.push(`"${String(n)}":"${e[n].replaceAll(/(["\\])/g, "\\$1")}"`);
|
|
1253
|
+
}
|
|
1254
|
+
return `"txt":"${this.#t.textContent.replaceAll(/(["\\])/g, "\\$1")}", "style":{${t.join(",")}}`;
|
|
1255
|
+
}
|
|
1256
|
+
destroy() {
|
|
1257
|
+
g.delBreak(), this.#t.parentElement.removeChild(this.#t), this.removeChild(this.#l), this.removeChild(this.#p), super.destroy();
|
|
1258
|
+
}
|
|
1259
|
+
}
|
|
1260
|
+
class z extends W {
|
|
1261
|
+
constructor(t, e, s, i) {
|
|
1262
|
+
if (super(), this.hArg = t, this.evtMng = e, this.resolve = s, this.canFocus = i, this.#t = {
|
|
1263
|
+
type: "pic",
|
|
1264
|
+
enabled: R(t, "enabled", !0),
|
|
1265
|
+
x: this.x = V(t.left ?? 0),
|
|
1266
|
+
y: this.y = V(t.top ?? 0),
|
|
1267
|
+
rotation: this.angle = w(t, "rotation", this.angle),
|
|
1268
|
+
// flash : rotation is in degrees.
|
|
1269
|
+
// pixijs: rotation is in radians, angle is in degrees.
|
|
1270
|
+
pivot_x: this.pivot.x = w(t, "pivot_x", this.pivot.x),
|
|
1271
|
+
pivot_y: this.pivot.y = w(t, "pivot_y", this.pivot.y),
|
|
1272
|
+
scale_x: this.scale.x = w(t, "scale_x", this.scale.x),
|
|
1273
|
+
scale_y: this.scale.y = w(t, "scale_y", this.scale.y),
|
|
1274
|
+
alpha: 1,
|
|
1275
|
+
text: "",
|
|
1276
|
+
b_pic: "",
|
|
1277
|
+
width: 0,
|
|
1278
|
+
height: 0
|
|
1279
|
+
}, this.getBtnBounds = () => (this.#n.x = this.#t.x, this.#n.y = this.#t.y, this.#n), this.#t.enabled && e.button(t, this, () => this.normal(), () => this.#p(), () => this.#u()), t.pic) {
|
|
1280
|
+
this.#t.type = "pic", this.#r = new m(
|
|
1281
|
+
t.pic,
|
|
1282
|
+
this,
|
|
1283
|
+
(l) => {
|
|
1284
|
+
this.#c(l), this.#n.width = l.width * this.#t.scale_x, this.#n.height = l.height * this.#t.scale_y;
|
|
1285
|
+
},
|
|
1286
|
+
(l) => s
|
|
1287
|
+
);
|
|
1288
|
+
return;
|
|
1289
|
+
}
|
|
1290
|
+
if (!t.text) throw "textまたはpic属性は必須です";
|
|
1291
|
+
const n = w(t, "height", 30), a = new Tt({
|
|
1292
|
+
align: "center",
|
|
1293
|
+
dropShadow: !0,
|
|
1294
|
+
dropShadowAlpha: 0.7,
|
|
1295
|
+
dropShadowColor: "white",
|
|
1296
|
+
dropShadowBlur: 7,
|
|
1297
|
+
dropShadowDistance: 0,
|
|
1298
|
+
fill: this.#t.enabled ? "black" : "gray",
|
|
1299
|
+
fontFamily: z.fontFamily,
|
|
1300
|
+
fontSize: n,
|
|
1301
|
+
padding: 5
|
|
1302
|
+
});
|
|
1303
|
+
if (t.style) try {
|
|
1304
|
+
const l = JSON.parse(t.style);
|
|
1305
|
+
for (const [p, d] of Object.entries(l)) a[p] = d;
|
|
1306
|
+
this.#t = { ...this.#t, ...l };
|
|
1307
|
+
} catch (l) {
|
|
1308
|
+
throw l instanceof SyntaxError ? new Error(dt(t, "style", l.message)) : "fn:Button.ts style";
|
|
1309
|
+
}
|
|
1310
|
+
const o = new Pt(t.text ?? "", a);
|
|
1311
|
+
o.alpha = w(t, "alpha", o.alpha), o.width = w(t, "width", 100), o.height = t.height = n, this.setText = (l) => {
|
|
1312
|
+
o.text = l;
|
|
1313
|
+
}, this.#t = {
|
|
1314
|
+
...this.#t,
|
|
1315
|
+
type: "text",
|
|
1316
|
+
// dump用
|
|
1317
|
+
alpha: o.alpha,
|
|
1318
|
+
text: o.text,
|
|
1319
|
+
width: o.width,
|
|
1320
|
+
height: o.height
|
|
1321
|
+
};
|
|
1322
|
+
let r = !1;
|
|
1323
|
+
if (this.#t.width = this.width, this.#t.height = this.height, t.b_pic && (this.#t.b_pic = t.b_pic, this.#r = new m(
|
|
1324
|
+
t.b_pic,
|
|
1325
|
+
this,
|
|
1326
|
+
(l) => {
|
|
1327
|
+
this.#l(l, o), this.#t.width = this.width, this.#t.height = this.height, o.name = JSON.stringify(this.#t);
|
|
1328
|
+
},
|
|
1329
|
+
(l) => {
|
|
1330
|
+
H.setBlendmode(this, t), l && s();
|
|
1331
|
+
}
|
|
1332
|
+
), r = this.#r.ret), o.name = JSON.stringify(this.#t), this.addChild(o), this.#n.width = o.width, this.#n.height = o.height, t.b_pic || H.setBlendmode(this, t), z.#s(this, o), !this.#t.enabled) {
|
|
1333
|
+
r || s();
|
|
1334
|
+
return;
|
|
1335
|
+
}
|
|
1336
|
+
const c = a.clone();
|
|
1337
|
+
if (t.style_hover) try {
|
|
1338
|
+
const l = JSON.parse(t.style_hover);
|
|
1339
|
+
for (const [p, d] of Object.entries(l)) c[p] = d;
|
|
1340
|
+
} catch (l) {
|
|
1341
|
+
throw l instanceof SyntaxError ? new Error(dt(t, "style_hover", l.message)) : "fn:Button.ts style_hover";
|
|
1342
|
+
}
|
|
1343
|
+
else c.fill = "white";
|
|
1344
|
+
const f = c.clone();
|
|
1345
|
+
if (t.style_clicked) try {
|
|
1346
|
+
const l = JSON.parse(t.style_clicked);
|
|
1347
|
+
for (const [p, d] of Object.entries(l)) f[p] = d;
|
|
1348
|
+
} catch (l) {
|
|
1349
|
+
throw l instanceof SyntaxError ? new Error(dt(t, "style_clicked", l.message)) : "fn:Button.ts style_clicked";
|
|
1350
|
+
}
|
|
1351
|
+
else f.dropShadow = !1;
|
|
1352
|
+
this.normal = () => {
|
|
1353
|
+
o.style = a;
|
|
1354
|
+
}, this.#p = () => i() ? (o.style = c, !0) : !1, this.#u = () => {
|
|
1355
|
+
o.style = f;
|
|
1356
|
+
}, r || s();
|
|
1357
|
+
}
|
|
1358
|
+
static fontFamily = "'Hiragino Sans', 'Hiragino Kaku Gothic ProN', '游ゴシック Medium', meiryo, sans-serif";
|
|
1359
|
+
static #s = (t, e) => {
|
|
1360
|
+
};
|
|
1361
|
+
static #e = (t, e, s, i) => {
|
|
1362
|
+
};
|
|
1363
|
+
static init(t) {
|
|
1364
|
+
t.oCfg.debug.masume && (z.#s = (e, s) => e.addChild(
|
|
1365
|
+
new U().beginFill(8926088, 0.2).lineStyle(1, 8926088, 1).drawRect(s.x, s.y, s.width, s.height).endFill()
|
|
1366
|
+
), z.#e = (e, s, i, n) => e.addChild(
|
|
1367
|
+
new U().beginFill(8926088, 0.2).lineStyle(1, 8926088, 1).drawRect(s.x, s.y, i, n).endFill()
|
|
1368
|
+
));
|
|
1369
|
+
}
|
|
1370
|
+
setText(t) {
|
|
1371
|
+
}
|
|
1372
|
+
getBtnBounds = () => this.#n;
|
|
1373
|
+
// 文字ボタンは背景画像を含まない位置指定なので、その当たり判定用
|
|
1374
|
+
#n = new Y();
|
|
1375
|
+
#r = new m();
|
|
1376
|
+
// #idc : DesignCast;
|
|
1377
|
+
#t;
|
|
1378
|
+
destroy() {
|
|
1379
|
+
this.evtMng.unButton(this), this.#r.destroy(), super.destroy();
|
|
1380
|
+
}
|
|
1381
|
+
makeDesignCast(t) {
|
|
1382
|
+
}
|
|
1383
|
+
showDesignCast() {
|
|
1384
|
+
}
|
|
1385
|
+
// showDesignCast() {this.#idc.visible = true}
|
|
1386
|
+
cvsResize() {
|
|
1387
|
+
}
|
|
1388
|
+
#l(t, e) {
|
|
1389
|
+
this.setChildIndex(t, 0), t.alpha = e.alpha, t.setTransform(
|
|
1390
|
+
e.x,
|
|
1391
|
+
e.y,
|
|
1392
|
+
1,
|
|
1393
|
+
1,
|
|
1394
|
+
e.rotation,
|
|
1395
|
+
0,
|
|
1396
|
+
0,
|
|
1397
|
+
(t.width - e.width) / 2,
|
|
1398
|
+
(t.height - e.height) / 2
|
|
1399
|
+
), t.name = e.name;
|
|
1400
|
+
}
|
|
1401
|
+
normal = () => {
|
|
1402
|
+
};
|
|
1403
|
+
#p = () => !1;
|
|
1404
|
+
#u = () => {
|
|
1405
|
+
};
|
|
1406
|
+
#c(t) {
|
|
1407
|
+
this.#t.alpha = t.alpha = w(this.hArg, "alpha", t.alpha);
|
|
1408
|
+
const e = t.width / 3, s = this.#t.enabled ? e : t.width, i = t.height, n = t.texture.baseTexture, a = new J(n, new Y(0, 0, e, i)), o = new J(n, new Y(e, 0, e, i)), r = new J(n, new Y(e * 2, 0, e, i)), c = () => {
|
|
1409
|
+
t.texture = a;
|
|
1410
|
+
};
|
|
1411
|
+
this.#t.enabled && c(), this.normal = c, this.#p = () => this.canFocus() ? (t.texture = r, !0) : !1, this.#u = () => {
|
|
1412
|
+
t.texture = o;
|
|
1413
|
+
}, "width" in this.hArg ? (this.#t.width = V(this.hArg.width), this.scale.x *= this.#t.width / s) : this.#t.width = s, "height" in this.hArg ? (this.#t.height = V(this.hArg.height), this.scale.y *= this.#t.height / i) : this.#t.height = i, t.name = JSON.stringify(this.#t), z.#e(this, t, s, i);
|
|
1414
|
+
}
|
|
1415
|
+
}
|
|
1416
|
+
class P extends H {
|
|
1417
|
+
static #s;
|
|
1418
|
+
static #e;
|
|
1419
|
+
static #n;
|
|
1420
|
+
static #r;
|
|
1421
|
+
static init(t, e, s, i, n, a) {
|
|
1422
|
+
this.#s = t, g.init(t, a), this.#e = s, this.#r = i, this.#n = n, s.setDoRecProc((o) => this.chgDoRec(o)), e.autowc = (o) => this.#i(o), e.autowc({ enabled: !1, text: "", time: 0 }), e.ch_in_style = (o) => this.#t(o), e.ch_out_style = (o) => this.#l(o), g.initChStyle(), Ft(), ot(
|
|
1423
|
+
t.matchPath(".+", Z.FONT).flatMap((o) => Object.values(o).map((r) => `
|
|
1424
|
+
@font-face {
|
|
1425
|
+
font-family: '${r}';
|
|
1426
|
+
src: url('${this.#s.searchPath(String(r), Z.FONT)}');
|
|
1427
|
+
}
|
|
1428
|
+
`)).join("") + `
|
|
1429
|
+
.sn_tx {
|
|
1430
|
+
pointer-events: none;
|
|
1431
|
+
user-select: none;
|
|
1432
|
+
-webkit-touch-callout: none;
|
|
1433
|
+
box-sizing: border-box;
|
|
1434
|
+
}
|
|
1435
|
+
.sn_ch {
|
|
1436
|
+
position: relative;
|
|
1437
|
+
display: inline-block;
|
|
1438
|
+
}
|
|
1439
|
+
`
|
|
1440
|
+
// 「sn_ch」と「sn_ch_in_〜」の中身が重複しているが、これは必須
|
|
1441
|
+
), this.#t({
|
|
1442
|
+
name: "default",
|
|
1443
|
+
wait: 500,
|
|
1444
|
+
alpha: 0,
|
|
1445
|
+
x: "=0.3",
|
|
1446
|
+
y: "=0",
|
|
1447
|
+
scale_x: 1,
|
|
1448
|
+
scale_y: 1,
|
|
1449
|
+
rotate: 0,
|
|
1450
|
+
join: !0,
|
|
1451
|
+
ease: "ease-out"
|
|
1452
|
+
}), this.#l({
|
|
1453
|
+
name: "default",
|
|
1454
|
+
wait: 0,
|
|
1455
|
+
alpha: 0,
|
|
1456
|
+
x: "=0",
|
|
1457
|
+
y: "=0",
|
|
1458
|
+
scale_x: 1,
|
|
1459
|
+
scale_y: 1,
|
|
1460
|
+
rotate: 0,
|
|
1461
|
+
join: !1,
|
|
1462
|
+
ease: "ease-out"
|
|
1463
|
+
});
|
|
1464
|
+
}
|
|
1465
|
+
// 文字出現演出
|
|
1466
|
+
static #t(t) {
|
|
1467
|
+
const e = g.ch_in_style(t), s = e.x.startsWith("=") ? `${e.nx * 100}%` : `${e.nx}px`, i = e.y.startsWith("=") ? `${e.ny * 100}%` : `${e.ny}px`, { name: n } = t;
|
|
1468
|
+
return ot(`
|
|
1469
|
+
.sn_ch_in_${n} {
|
|
1470
|
+
position: relative;
|
|
1471
|
+
display: inline-block;
|
|
1472
|
+
}
|
|
1473
|
+
.go_ch_in_${n} {
|
|
1474
|
+
opacity: ${e.alpha};
|
|
1475
|
+
position: relative;
|
|
1476
|
+
display: inline-block;
|
|
1477
|
+
animation: sn_ch_in_${n} ${e.wait}ms ${e.ease} 0s both;
|
|
1478
|
+
}
|
|
1479
|
+
@keyframes sn_ch_in_${n} {
|
|
1480
|
+
from {transform: rotate(${e.rotate}deg) scale(${e.scale_x}, ${e.scale_y}) translate(${s}, ${i})}
|
|
1481
|
+
to {opacity: 1; transform: none;}
|
|
1482
|
+
}
|
|
1483
|
+
`), !1;
|
|
1484
|
+
}
|
|
1485
|
+
// 文字消去演出
|
|
1486
|
+
static #l(t) {
|
|
1487
|
+
const e = g.ch_out_style(t), s = e.x.startsWith("=") ? `${e.nx * 100}%` : `${e.nx}px`, i = e.y.startsWith("=") ? `${e.ny * 100}%` : `${e.ny}px`, { name: n } = t;
|
|
1488
|
+
return ot(`
|
|
1489
|
+
.go_ch_out_${n} {
|
|
1490
|
+
position: relative;
|
|
1491
|
+
display: inline-block;
|
|
1492
|
+
animation: go_ch_out_${n} ${e.wait}ms ${e.ease} 0s both;
|
|
1493
|
+
}
|
|
1494
|
+
@keyframes go_ch_out_${n} {
|
|
1495
|
+
to {
|
|
1496
|
+
opacity: ${e.alpha};
|
|
1497
|
+
transform: rotate(${e.rotate}deg) scale(${e.scale_x}, ${e.scale_y}) translate(${s}, ${i});
|
|
1498
|
+
}
|
|
1499
|
+
`), !1;
|
|
1500
|
+
}
|
|
1501
|
+
static #p;
|
|
1502
|
+
static #u;
|
|
1503
|
+
static setEvtMng(t, e, s) {
|
|
1504
|
+
this.#p = t, this.#u = e, g.setEvtMng(t, s);
|
|
1505
|
+
}
|
|
1506
|
+
// 文字ごとのウェイト
|
|
1507
|
+
static #c = !1;
|
|
1508
|
+
static #x = {};
|
|
1509
|
+
static #i(t) {
|
|
1510
|
+
this.#c = R(t, "enabled", this.#c), this.#e.setVal_Nochk("save", "const.sn.autowc.enabled", this.#c);
|
|
1511
|
+
const { text: e } = t;
|
|
1512
|
+
if ("text" in t != "time" in t) throw "[autowc] textとtimeは同時指定必須です";
|
|
1513
|
+
if (this.#e.setVal_Nochk("save", "const.sn.autowc.text", e), !e)
|
|
1514
|
+
return this.#e.setVal_Nochk("save", "const.sn.autowc.time", ""), !1;
|
|
1515
|
+
const s = e.length;
|
|
1516
|
+
if (this.#c && s === 0) throw '[autowc] enabled === false かつ text === "" は許されません';
|
|
1517
|
+
const i = String(t.time).split(",");
|
|
1518
|
+
if (i.length !== s) throw "[autowc] text文字数とtimeに記述された待ち時間(コンマ区切り)は同数にして下さい";
|
|
1519
|
+
this.#x = {};
|
|
1520
|
+
for (let n = 0; n < s; ++n) this.#x[e[n]] = V(i[n]);
|
|
1521
|
+
return this.#e.setVal_Nochk("save", "const.sn.autowc.time", t.time), !1;
|
|
1522
|
+
}
|
|
1523
|
+
// バック
|
|
1524
|
+
#d = 0;
|
|
1525
|
+
#f = 0;
|
|
1526
|
+
#y = !1;
|
|
1527
|
+
#a = void 0;
|
|
1528
|
+
#g = "";
|
|
1529
|
+
// 背景画像無し(=単色塗り)
|
|
1530
|
+
// 文字表示
|
|
1531
|
+
#o = new g(this.ctn, () => this.canFocus(), P.#u);
|
|
1532
|
+
#I = new pt();
|
|
1533
|
+
#k = document.createElement("span");
|
|
1534
|
+
// cssチェック・保存用
|
|
1535
|
+
static #w = {
|
|
1536
|
+
"text-align": 0,
|
|
1537
|
+
"text-align-last": 0,
|
|
1538
|
+
height: 0,
|
|
1539
|
+
width: 0,
|
|
1540
|
+
"padding-left": 0,
|
|
1541
|
+
"padding-right": 0,
|
|
1542
|
+
"padding-top": 0,
|
|
1543
|
+
"padding-bottom": 0
|
|
1544
|
+
};
|
|
1545
|
+
#v = new W();
|
|
1546
|
+
constructor() {
|
|
1547
|
+
super(), this.ctn.addChild(this.#o), this.#I.init(this.#Q), this.ctn.addChild(this.#v), this.#v.name = "cntBtn", this.lay({ style: `width: ${S.stageW}px; height: ${S.stageH}px; font-family: 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', '游ゴシック Medium', meiryo, sans-serif; color: white; font-size: 24px; line-height: 1.5; padding: 16px;`, in_style: "default", out_style: "default", back_clear: "true" });
|
|
1548
|
+
}
|
|
1549
|
+
destroy() {
|
|
1550
|
+
this.#a && (this.ctn.removeChild(this.#a).destroy(), this.#a = void 0), P.#r.pagebreak(), this.#o.destroy();
|
|
1551
|
+
}
|
|
1552
|
+
static destroy() {
|
|
1553
|
+
this.#c = !1, this.#x = {}, this.#W = (t) => t;
|
|
1554
|
+
}
|
|
1555
|
+
set name(t) {
|
|
1556
|
+
this.name_ = t, this.#o.name = t;
|
|
1557
|
+
}
|
|
1558
|
+
get name() {
|
|
1559
|
+
return this.name_;
|
|
1560
|
+
}
|
|
1561
|
+
// getは継承しないらしい
|
|
1562
|
+
cvsResize() {
|
|
1563
|
+
this.#o.cvsResize();
|
|
1564
|
+
}
|
|
1565
|
+
cvsResizeChildren() {
|
|
1566
|
+
for (const t of this.#v.children) t.cvsResize();
|
|
1567
|
+
}
|
|
1568
|
+
procSetX(t) {
|
|
1569
|
+
this.#o.lay({ x: t });
|
|
1570
|
+
}
|
|
1571
|
+
procSetY(t) {
|
|
1572
|
+
this.#o.lay({ y: t });
|
|
1573
|
+
}
|
|
1574
|
+
lay(t) {
|
|
1575
|
+
if (super.lay(t), H.setXY(this.ctn, t, this.ctn), t[":id_tag"] = this.name_.slice(0, -7), pt.setting(t), this.#H(t), this.#o.lay(t), "r_align" in t && (this.#S = t.r_align ?? ""), this.#m = S.isSafari ? this.#o.tategaki ? (i, n) => `text-align: start; height: ${n}em; padding-top: ${i}; padding-bottom: ${i};` : (i, n) => `text-align: start; width: ${n}em; padding-left: ${i}; padding-right: ${i};` : this.#o.tategaki ? (i) => `text-align: justify; text-align-last: justify; padding-top: ${i}; padding-bottom: ${i};` : (i) => `text-align: justify; text-align-last: justify; padding-left: ${i}; padding-right: ${i};`, S.isFirefox && (this.#L = this.#M), "r_style" in t)
|
|
1576
|
+
if (t.r_style) {
|
|
1577
|
+
const i = document.createElement("span");
|
|
1578
|
+
i.style.cssText = t.r_style;
|
|
1579
|
+
const n = i.style.length, a = this.#k.style;
|
|
1580
|
+
for (let o = 0; o < n; ++o) {
|
|
1581
|
+
const r = i.style[o];
|
|
1582
|
+
if (r in P.#w) {
|
|
1583
|
+
it.myTrace(`${r}は指定できません`, "W");
|
|
1584
|
+
continue;
|
|
1585
|
+
}
|
|
1586
|
+
const c = i.style[r];
|
|
1587
|
+
c && (a[r] = c);
|
|
1588
|
+
}
|
|
1589
|
+
} else this.#k.style.cssText = "";
|
|
1590
|
+
if ("alpha" in t) for (const i of this.#v.children) i.alpha = this.ctn.alpha;
|
|
1591
|
+
this.#h(t), this.#V(t);
|
|
1592
|
+
const e = F.procID + `TxtLayer lay name:${this.name_}`, s = this.#j(t, (i) => {
|
|
1593
|
+
i && F.endProc(e);
|
|
1594
|
+
});
|
|
1595
|
+
return s && F.beginProc(e), s;
|
|
1596
|
+
}
|
|
1597
|
+
#h(t) {
|
|
1598
|
+
const { in_style: e } = t;
|
|
1599
|
+
if (!e) return;
|
|
1600
|
+
const s = g.getChInStyle(e);
|
|
1601
|
+
if (!s) throw `存在しないin_style【${e}】です`;
|
|
1602
|
+
this.#b = e, this.#E = s.join;
|
|
1603
|
+
}
|
|
1604
|
+
#b = "";
|
|
1605
|
+
#E = !0;
|
|
1606
|
+
get width() {
|
|
1607
|
+
return this.#o.getWidth;
|
|
1608
|
+
}
|
|
1609
|
+
get height() {
|
|
1610
|
+
return this.#o.getHeight;
|
|
1611
|
+
}
|
|
1612
|
+
#V(t) {
|
|
1613
|
+
const { out_style: e } = t;
|
|
1614
|
+
if (!e) return;
|
|
1615
|
+
if (!g.getChOutStyle(e)) throw `存在しないout_style【${e}】です`;
|
|
1616
|
+
this.#F = e;
|
|
1617
|
+
}
|
|
1618
|
+
#F = "";
|
|
1619
|
+
#z = new m();
|
|
1620
|
+
#j(t, e) {
|
|
1621
|
+
if ("back_clear" in t)
|
|
1622
|
+
return R(t, "back_clear", !1) && (this.#d = 0, this.#f = 0, this.#y = !1, this.#g = ""), e(!1), !1;
|
|
1623
|
+
this.#f = w(t, "b_alpha", this.#f), this.#y = R(t, "b_alpha_isfixed", this.#y);
|
|
1624
|
+
const s = (this.#y ? 1 : Number(P.#e.getVal("sys:TextLayer.Back.Alpha"))) * this.#f;
|
|
1625
|
+
if (t.b_pic) {
|
|
1626
|
+
if (this.#g !== t.b_pic)
|
|
1627
|
+
return this.#g = t.b_pic, this.#a && (this.ctn.removeChild(this.#a), this.#a.destroy()), this.#z = new m(this.#g, this.ctn, (i) => {
|
|
1628
|
+
this.#a = i, i.name = "back(pic)", i.visible = s > 0, i.alpha = s, this.#o.setMySize(i.width, i.height), this.ctn.setChildIndex(i, 0), e(!0);
|
|
1629
|
+
}), this.#z.ret;
|
|
1630
|
+
} else "b_color" in t && (this.#d = vt(t, "b_color", 0), this.#a && (this.ctn.removeChild(this.#a), this.#a.destroy()), this.#g = "", this.ctn.addChildAt(
|
|
1631
|
+
(this.#a = new U()).beginFill(this.#d, s).lineStyle(void 0).drawRect(0, 0, this.#o.getWidth, this.#o.getHeight).endFill(),
|
|
1632
|
+
0
|
|
1633
|
+
), this.#a.name = "back(color)");
|
|
1634
|
+
return this.#a && (this.#a.visible = s > 0, this.#a.alpha = s), e(!1), !1;
|
|
1635
|
+
}
|
|
1636
|
+
chgBackAlpha(t) {
|
|
1637
|
+
const e = this.#y ? this.#f : t * this.#f;
|
|
1638
|
+
this.#a instanceof U && (this.#a && (this.ctn.removeChild(this.#a), this.#a.destroy()), this.ctn.addChildAt(
|
|
1639
|
+
(this.#a = new U()).beginFill(this.#d, e).lineStyle(void 0).drawRect(0, 0, this.#o.getWidth, this.#o.getHeight).endFill(),
|
|
1640
|
+
0
|
|
1641
|
+
), this.#a.name = "back(color)"), this.#a && (this.#a.visible = e > 0, this.#a.alpha = e);
|
|
1642
|
+
}
|
|
1643
|
+
#H(t) {
|
|
1644
|
+
"noffs" in t && (this.#N = t.noffs ?? "", this.#_ = new RegExp(`[ ${this.#N}]`)), "ffs" in t && (this.#O ??= "", this.#$ = this.#O === "" ? () => "" : (e) => this.#_.test(e) ? "" : ` font-feature-settings: ${this.#O};`);
|
|
1645
|
+
}
|
|
1646
|
+
#O = "";
|
|
1647
|
+
#$ = (t) => "";
|
|
1648
|
+
#N = "";
|
|
1649
|
+
// eslint-disable-next-line no-irregular-whitespace
|
|
1650
|
+
#_ = /[ ]/;
|
|
1651
|
+
// Safariが全体に「font-feature-settings」した後、特定文字の「font-feature-settings: initial;」を受け付けてくれないのでわざわざ一つずつ指定
|
|
1652
|
+
static chgDoRec(t) {
|
|
1653
|
+
this.#W = t ? (e) => e : (e) => `<span class='offrec'>${e}</span>`;
|
|
1654
|
+
}
|
|
1655
|
+
static #W = (t) => t;
|
|
1656
|
+
isCur = !1;
|
|
1657
|
+
#m = () => "";
|
|
1658
|
+
#L = (t, e, s, i = "") => {
|
|
1659
|
+
if (!s) return ` style='${i}'`;
|
|
1660
|
+
const n = t.length * 2;
|
|
1661
|
+
if (n - e.length < 0) return ` style='text-align: ${s}; ${i}'`;
|
|
1662
|
+
let a = "";
|
|
1663
|
+
switch (s) {
|
|
1664
|
+
case "justify":
|
|
1665
|
+
a = this.#m("0", n);
|
|
1666
|
+
break;
|
|
1667
|
+
case "121":
|
|
1668
|
+
a = this.#m(`calc(${(n - e.length) / (e.length * 2)}em)`, n);
|
|
1669
|
+
break;
|
|
1670
|
+
case "even":
|
|
1671
|
+
a = this.#m(`calc(${(n - e.length) / (e.length + 1)}em)`, n);
|
|
1672
|
+
break;
|
|
1673
|
+
case "1ruby":
|
|
1674
|
+
a = this.#m("1em", n);
|
|
1675
|
+
break;
|
|
1676
|
+
default:
|
|
1677
|
+
a = `text-align: ${s};`;
|
|
1678
|
+
}
|
|
1679
|
+
return ` style='${a} ${i}'`;
|
|
1680
|
+
};
|
|
1681
|
+
#S = "";
|
|
1682
|
+
#M(t, e, s, i = "") {
|
|
1683
|
+
if (!s) return ` style='${i}'`;
|
|
1684
|
+
const n = t.length * 2;
|
|
1685
|
+
if (n - e.length < 0) return ` style='text-align: ${s}; ${i}'`;
|
|
1686
|
+
let a = "";
|
|
1687
|
+
switch (s) {
|
|
1688
|
+
case "left":
|
|
1689
|
+
a = "ruby-align: start;";
|
|
1690
|
+
break;
|
|
1691
|
+
case "center":
|
|
1692
|
+
a = "ruby-align: center;";
|
|
1693
|
+
break;
|
|
1694
|
+
case "right":
|
|
1695
|
+
a = "ruby-align: start;";
|
|
1696
|
+
break;
|
|
1697
|
+
case "justify":
|
|
1698
|
+
a = "ruby-align: space-between;";
|
|
1699
|
+
break;
|
|
1700
|
+
case "121":
|
|
1701
|
+
a = "ruby-align: space-around;";
|
|
1702
|
+
break;
|
|
1703
|
+
case "even":
|
|
1704
|
+
{
|
|
1705
|
+
const o = (n - e.length) / (e.length + 1);
|
|
1706
|
+
a = "ruby-align: space-between; " + (this.#o.tategaki ? `padding-top: ${o}em; padding-bottom: ${o}em;` : `padding-left: ${o}em; padding-right: ${o}em;`);
|
|
1707
|
+
}
|
|
1708
|
+
break;
|
|
1709
|
+
case "1ruby":
|
|
1710
|
+
a = "ruby-align: space-between; " + (this.#o.tategaki ? "padding-top: 1em; padding-bottom: 1em;" : "padding-left: 1em; padding-right: 1em;");
|
|
1711
|
+
break;
|
|
1712
|
+
default:
|
|
1713
|
+
a = `text-align: ${s};`;
|
|
1714
|
+
}
|
|
1715
|
+
return ` style='${a} ${i}'`;
|
|
1716
|
+
}
|
|
1717
|
+
tagCh(t) {
|
|
1718
|
+
this.#I.putTxt(t);
|
|
1719
|
+
}
|
|
1720
|
+
#R = !1;
|
|
1721
|
+
get needGoTxt() {
|
|
1722
|
+
return this.#R;
|
|
1723
|
+
}
|
|
1724
|
+
#Q = (t, e) => {
|
|
1725
|
+
let s = e;
|
|
1726
|
+
P.#s.oCfg.debug.putCh && console.log(`🖊 文字表示 text:\`${t}\`(${t.charCodeAt(0).toString(16)}) ruby:\`${s}\` name:\`${this.name_}\``);
|
|
1727
|
+
const i = s.split("|");
|
|
1728
|
+
let n = "";
|
|
1729
|
+
const [a, ...o] = i, r = o.join("|");
|
|
1730
|
+
switch (i.length) {
|
|
1731
|
+
case 1:
|
|
1732
|
+
if (this.#R = !0, t === `
|
|
1733
|
+
`) {
|
|
1734
|
+
this.#B ? (this.#B = !1, n = "<ruby> <rt> </rt></ruby><br/>") : n = "<br/>";
|
|
1735
|
+
break;
|
|
1736
|
+
}
|
|
1737
|
+
this.#B && (this.#B = !1, s === "" && (s = " ")), n = this.#Y(t, s, this.#S);
|
|
1738
|
+
break;
|
|
1739
|
+
default:
|
|
1740
|
+
switch (a) {
|
|
1741
|
+
// ルビ揃え指定と同時シリーズ
|
|
1742
|
+
case "start":
|
|
1743
|
+
// 初期値
|
|
1744
|
+
case "left":
|
|
1745
|
+
//(肩付き)先頭親文字から、ルビ間は密着
|
|
1746
|
+
case "center":
|
|
1747
|
+
//(中付き)センター合わせ、〃
|
|
1748
|
+
case "right":
|
|
1749
|
+
//(右/下揃え)末尾親文字から、〃
|
|
1750
|
+
case "justify":
|
|
1751
|
+
//(両端揃え)先頭から末尾親文字間に、ルビ間は均等にあける
|
|
1752
|
+
case "121":
|
|
1753
|
+
//(1-2-1(JIS))ルビの前後を比率1、ルビ間を比率2であける
|
|
1754
|
+
case "even":
|
|
1755
|
+
//(均等アキ)ルビの前後、ルビ間も均等にあける
|
|
1756
|
+
case "1ruby":
|
|
1757
|
+
this.#B = !1, this.#R = !0, n = this.#Y(t, r, a);
|
|
1758
|
+
break;
|
|
1759
|
+
case "gotxt":
|
|
1760
|
+
this.#X(), this.#R ? (this.isCur && P.#r.recText(
|
|
1761
|
+
this.#C.join("").replace(/^<ruby> <rt> <\/rt><\/ruby>(<br\/>)+/, "").replaceAll(/style='(anim\S+ [^;]+;\s*)+/g, "style='").replaceAll(/( style=''| data-(add|arg|cmd)='[^']+'|\n+|\t+)/g, "").replaceAll(/class='sn_ch[^']+/g, "class='sn_ch").replaceAll("display: none;", "").replaceAll("class='offrec'", "style='display: none;'")
|
|
1762
|
+
), this.#o.goTxt(this.#C, this.#J === 0), this.#R = !1, this.#J = 0) : this.isCur && this.#o.noticeCompTxt();
|
|
1763
|
+
return;
|
|
1764
|
+
// breakではない
|
|
1765
|
+
case "add":
|
|
1766
|
+
{
|
|
1767
|
+
const c = JSON.parse(r), { style: f = "", wait: l = null } = c, { cl: p, sty: d } = this.#U(!0, l ? V(l) : null);
|
|
1768
|
+
this.#C.push(`<span${p} style='${d} display: inline; ${f}'>`), delete c.style, this.#P(c);
|
|
1769
|
+
}
|
|
1770
|
+
return;
|
|
1771
|
+
// breakではない
|
|
1772
|
+
case "add_close":
|
|
1773
|
+
this.#C.push("</span>"), this.#X();
|
|
1774
|
+
return;
|
|
1775
|
+
// breakではない
|
|
1776
|
+
case "grp":
|
|
1777
|
+
this.#R = !0;
|
|
1778
|
+
{
|
|
1779
|
+
const c = JSON.parse(r);
|
|
1780
|
+
if (c.id ??= String(this.#C.length), c.id === "break") {
|
|
1781
|
+
this.#o.dispBreak(c);
|
|
1782
|
+
return;
|
|
1783
|
+
}
|
|
1784
|
+
this.#B = !1, c.delay = this.#J, c.r ??= "", c.style ??= "", c.r_style ??= "";
|
|
1785
|
+
const { r: f, wait: l = null, r_style: p } = c, { cl: d, sty: h, lnk: u } = this.#U(!0, l ? V(l) : null);
|
|
1786
|
+
n = `<span${d} style='${h} ${c.style}'><ruby><span data-cmd='grp' data-arg='${JSON.stringify(c)}'${u} style='${h} display: inline;'> </span><rt${u}${this.#L(
|
|
1787
|
+
" ",
|
|
1788
|
+
f,
|
|
1789
|
+
this.#S,
|
|
1790
|
+
this.#k.style.cssText + (this.#T.at(-1)?.o.r_style ?? "") + p
|
|
1791
|
+
)}>${c.r}</rt></ruby></span>`;
|
|
1792
|
+
}
|
|
1793
|
+
break;
|
|
1794
|
+
case "tcy":
|
|
1795
|
+
this.#B = !1, this.#R = !0;
|
|
1796
|
+
{
|
|
1797
|
+
const { t: c = "", r: f = "", wait: l = null, style: p = "", r_style: d = "" } = JSON.parse(r);
|
|
1798
|
+
P.#e.doRecLog() && (this.#q += t + (s ? `《${s}》` : ""), this.#D += c);
|
|
1799
|
+
const h = S.isSafari ? f.replaceAll(/[A-Za-z0-9]/g, (y) => String.fromCharCode(y.charCodeAt(0) + 65248)) : f, { cl: u, sty: x, lnk: v } = this.#U(!0, l ? V(l) : null);
|
|
1800
|
+
n = `<span${u} style='${x}${this.#$(c)} ${p}'><ruby><span${v} style='${x} display: inline; text-combine-upright: all;'>${c}</span><rt${v}${this.#L(
|
|
1801
|
+
c,
|
|
1802
|
+
h,
|
|
1803
|
+
this.#S,
|
|
1804
|
+
this.#k.style.cssText + (this.#T.at(-1)?.o.r_style ?? "") + d
|
|
1805
|
+
)}>${h}</rt></ruby></span>`;
|
|
1806
|
+
}
|
|
1807
|
+
break;
|
|
1808
|
+
case "del":
|
|
1809
|
+
g.delBreak();
|
|
1810
|
+
return;
|
|
1811
|
+
// breakではない
|
|
1812
|
+
case "span":
|
|
1813
|
+
this.#R = !0, this.#K(JSON.parse(r));
|
|
1814
|
+
return;
|
|
1815
|
+
// breakではない
|
|
1816
|
+
case "link":
|
|
1817
|
+
this.#R = !0;
|
|
1818
|
+
{
|
|
1819
|
+
const c = JSON.parse(r);
|
|
1820
|
+
c[":link"] = " data-lnk='@'";
|
|
1821
|
+
const { cl: f, sty: l, curpos: p } = this.#U(!1, c.wait ? V(c.wait) : null);
|
|
1822
|
+
this.#C.push(`<span${f} style='${l} display: inline; ${c.style ?? ""}' ${p} data-arg='${r}'>`), delete c.style, this.#K(c);
|
|
1823
|
+
}
|
|
1824
|
+
return;
|
|
1825
|
+
// breakではない
|
|
1826
|
+
case "endlink":
|
|
1827
|
+
this.#R = !0, this.#C.push("</span>"), this.#X();
|
|
1828
|
+
return;
|
|
1829
|
+
// breakではない
|
|
1830
|
+
default:
|
|
1831
|
+
this.#R = !0, n = this.#Y(t, s, this.#S);
|
|
1832
|
+
}
|
|
1833
|
+
break;
|
|
1834
|
+
}
|
|
1835
|
+
this.#C.push(P.#W(n));
|
|
1836
|
+
};
|
|
1837
|
+
#Y(t, e, s) {
|
|
1838
|
+
const i = t === " " ? " " : t === " " ? " " : t;
|
|
1839
|
+
P.#e.doRecLog() && (this.#q += i + (e ? `《${e}》` : ""), t !== " " && (this.#D += t));
|
|
1840
|
+
const { cl: n, sty: a, lnk: o } = this.#U(!0, null, t);
|
|
1841
|
+
return e ? `<span${n} style='${a} ${this.#$(t)}'><ruby>${// 文字個別に出現させるため以下にも ${cl} が必要
|
|
1842
|
+
Array.from(t).map((r, c) => `<span${n}${o} style='${c > 0 ? this.#U(!0, null, t).sty : a} display: inline;'>${r === " " ? " " : r === " " ? " " : r}</span>`).join("")}<rt${o}${this.#L(
|
|
1843
|
+
t,
|
|
1844
|
+
e,
|
|
1845
|
+
s,
|
|
1846
|
+
this.#k.style.cssText + (this.#T.at(-1)?.o.r_style ?? "")
|
|
1847
|
+
)}>${e}</rt></ruby></span>` : `<span${n} style='${a} ${this.#$(t)}'${o}>${i}</span>`;
|
|
1848
|
+
}
|
|
1849
|
+
#U(t, e, s = `
|
|
1850
|
+
`) {
|
|
1851
|
+
const i = this.#E ? e ?? this.#T.at(0)?.o.wait ?? (P.#c ? P.#x[s.at(0) ?? ""] ?? 0 : G.msecChWait) : 0;
|
|
1852
|
+
P.#p.isSkipping ? this.#J = 0 : t && this.#E && (this.#J += V(i));
|
|
1853
|
+
const n = `data-add='{"ch_in_style":"${this.#b}", "ch_out_style":"${this.#F}"}'`;
|
|
1854
|
+
return {
|
|
1855
|
+
cl: ` class='sn_ch sn_ch_yet sn_ch_in_${this.#b}'`,
|
|
1856
|
+
// TxtStage.goTxt()はこれ単位で文字出現させる
|
|
1857
|
+
sty: `animation-delay: ${this.#J}ms;${this.#T.at(-1)?.o.style ?? ""}`,
|
|
1858
|
+
// TxtStage.goTxt()はこれ単位で文字出現させる
|
|
1859
|
+
lnk: (this.#T.at(0)?.o[":link"] ?? "") + " " + n,
|
|
1860
|
+
curpos: n
|
|
1861
|
+
};
|
|
1862
|
+
}
|
|
1863
|
+
#J = 0;
|
|
1864
|
+
#B = !0;
|
|
1865
|
+
#C = [];
|
|
1866
|
+
#T = [];
|
|
1867
|
+
#P(t) {
|
|
1868
|
+
this.#T.push({
|
|
1869
|
+
o: t,
|
|
1870
|
+
r_align: this.#S,
|
|
1871
|
+
ch_in_style: this.#b,
|
|
1872
|
+
ch_out_style: this.#F
|
|
1873
|
+
}), t.r_align && (this.#S = t.r_align), this.#h(t), this.#V(t);
|
|
1874
|
+
}
|
|
1875
|
+
#X() {
|
|
1876
|
+
const t = this.#T.pop();
|
|
1877
|
+
t && (this.#S = t.r_align, this.#h({ in_style: t.ch_in_style }), this.#V({ out_style: t.ch_out_style }));
|
|
1878
|
+
}
|
|
1879
|
+
#K(t) {
|
|
1880
|
+
const e = this.#T.at(-1);
|
|
1881
|
+
if (!e) {
|
|
1882
|
+
this.#P(t);
|
|
1883
|
+
return;
|
|
1884
|
+
}
|
|
1885
|
+
e.o = { ...e.o, ...t }, !t.style && !t.r_style && (e.o.style = "", e.o.r_style = ""), t.r_align && (this.#S = t.r_align), this.#h(t), this.#V(t);
|
|
1886
|
+
}
|
|
1887
|
+
click = () => !this.ctn.interactiveChildren || !this.ctn.visible ? !1 : this.#o.skipChIn();
|
|
1888
|
+
clearText() {
|
|
1889
|
+
this.ctn.addChild(this.#o = this.#o.reNew()), this.#J = 0, this.#B = !0, this.#C = [], this.#q = "", this.#D = "", P.#r.pagebreak();
|
|
1890
|
+
}
|
|
1891
|
+
#q = "";
|
|
1892
|
+
#D = "";
|
|
1893
|
+
get pageText() {
|
|
1894
|
+
return this.#q.replace("《 》", "");
|
|
1895
|
+
}
|
|
1896
|
+
get pagePlainText() {
|
|
1897
|
+
return this.#D;
|
|
1898
|
+
}
|
|
1899
|
+
get enabled() {
|
|
1900
|
+
return this.ctn.interactiveChildren;
|
|
1901
|
+
}
|
|
1902
|
+
set enabled(t) {
|
|
1903
|
+
this.ctn.interactiveChildren = t;
|
|
1904
|
+
}
|
|
1905
|
+
addButton = (t) => new Promise((e) => {
|
|
1906
|
+
t.key = `btn=[${this.#v.children.length}] ` + this.name_, t[":id_tag"] = t.key.slice(0, -7), R(t, "hint_tate", this.#o.tategaki);
|
|
1907
|
+
const s = new z(t, P.#p, () => e(), () => this.canFocus());
|
|
1908
|
+
s.name = JSON.stringify(t).replaceAll('"', "'"), this.#v.addChild(s);
|
|
1909
|
+
});
|
|
1910
|
+
canFocus() {
|
|
1911
|
+
return (this.ctn.interactiveChildren ?? !1) && this.ctn.visible && P.#n(this);
|
|
1912
|
+
}
|
|
1913
|
+
clearLay(t) {
|
|
1914
|
+
super.clearLay(t), this.clearText();
|
|
1915
|
+
for (const e of this.#v.removeChildren()) e.destroy();
|
|
1916
|
+
}
|
|
1917
|
+
record = () => ({
|
|
1918
|
+
...super.record(),
|
|
1919
|
+
enabled: this.enabled,
|
|
1920
|
+
r_cssText: this.#k.style.cssText,
|
|
1921
|
+
r_align: this.#S,
|
|
1922
|
+
// バック
|
|
1923
|
+
b_do: this.#a === void 0 ? void 0 : this.#a instanceof j ? "Sprite" : "Graphics",
|
|
1924
|
+
b_pic: this.#g,
|
|
1925
|
+
b_color: this.#d,
|
|
1926
|
+
b_alpha: this.#f,
|
|
1927
|
+
b_alpha_isfixed: this.#y,
|
|
1928
|
+
ffs: this.#O,
|
|
1929
|
+
txs: this.#o.record(),
|
|
1930
|
+
strNoFFS: this.#N,
|
|
1931
|
+
btns: this.#v.children.map((t) => t.name)
|
|
1932
|
+
});
|
|
1933
|
+
playback(t, e) {
|
|
1934
|
+
super.playback(t, e), this.enabled = t.enabled, this.#k.style.cssText = t.r_cssText, this.#S = t.r_align, this.cvsResize(), this.#H(t), this.#o.playback(t.txs), this.#f = t.b_alpha, this.#y = t.b_alpha_isfixed, e.push(
|
|
1935
|
+
new Promise((s) => {
|
|
1936
|
+
const i = t.b_do ? t.b_do === "Sprite" ? { b_pic: t.b_pic } : { b_color: t.b_color } : { b_pic: "" };
|
|
1937
|
+
i.b_alpha = t.b_alpha, i.b_alpha_isfixed = t.b_alpha_isfixed, this.#j(i, (n) => {
|
|
1938
|
+
n && s();
|
|
1939
|
+
}) || s();
|
|
1940
|
+
}),
|
|
1941
|
+
...t.btns.map((s) => this.addButton(JSON.parse(s.replaceAll("'", '"')))).flat()
|
|
1942
|
+
);
|
|
1943
|
+
}
|
|
1944
|
+
get cssText() {
|
|
1945
|
+
return this.#o.cssText;
|
|
1946
|
+
}
|
|
1947
|
+
set cssText(t) {
|
|
1948
|
+
this.#o.cssText = t;
|
|
1949
|
+
}
|
|
1950
|
+
snapshot(t, e) {
|
|
1951
|
+
t.render(this.ctn, { clear: !1 }), this.#o.snapshot(t, e);
|
|
1952
|
+
}
|
|
1953
|
+
snapshot_end() {
|
|
1954
|
+
this.#o.snapshot_end();
|
|
1955
|
+
}
|
|
1956
|
+
makeDesignCast(t) {
|
|
1957
|
+
this.ctn.visible && this.#o.makeDesignCast(t);
|
|
1958
|
+
}
|
|
1959
|
+
makeDesignCastChildren(t) {
|
|
1960
|
+
if (this.ctn.visible)
|
|
1961
|
+
for (const e of this.#v.children) e.makeDesignCast(t);
|
|
1962
|
+
}
|
|
1963
|
+
showDesignCast() {
|
|
1964
|
+
this.#o.showDesignCast();
|
|
1965
|
+
}
|
|
1966
|
+
showDesignCastChildren() {
|
|
1967
|
+
for (const t of this.#v.children) t.showDesignCast();
|
|
1968
|
+
}
|
|
1969
|
+
dump() {
|
|
1970
|
+
return this.#Q("", "gotxt|"), super.dump() + `, "enabled":"${this.enabled}", ${this.#o.dump()}, "b_pic":"${this.#g}", "b_color":"${this.#d}", "b_alpha":${this.#f}, "b_alpha_isfixed":"${this.#y}", "width":${this.#o.getWidth}, "height":${this.#o.getHeight}, "pixi_obj":[${this.ctn.children.map((t) => `{"class":"${t instanceof j ? "Sprite" : t instanceof U ? "Graphics" : t instanceof W ? "Container" : "?"}", "name":"${t.name}", "alpha":${t.alpha}, "x":${t.x}, "y":${t.y}, "visible":"${t.visible}"}`).join(",")}], "button":[${this.#v.children.map((t) => t.children[0]?.name ?? "{}").join(",")}]`;
|
|
1971
|
+
}
|
|
1972
|
+
}
|
|
1973
|
+
class C {
|
|
1974
|
+
constructor(t, e, s) {
|
|
1975
|
+
this.appPixi = e, this.val = s, t.add_frame = (i) => this.#p(i), t.let_frame = (i) => this.#f(i), t.set_frame = (i) => this.#y(i), t.frame = (i) => this.#g(i), t.tsy_frame = (i) => this.#o(i);
|
|
1976
|
+
}
|
|
1977
|
+
static #s;
|
|
1978
|
+
static #e;
|
|
1979
|
+
static #n;
|
|
1980
|
+
static init(t, e, s) {
|
|
1981
|
+
C.#s = t, C.#e = e, C.#n = s;
|
|
1982
|
+
}
|
|
1983
|
+
#r;
|
|
1984
|
+
setEvtMng(t) {
|
|
1985
|
+
this.#r = t;
|
|
1986
|
+
}
|
|
1987
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
1988
|
+
#t = /* @__PURE__ */ Object.create(null);
|
|
1989
|
+
destroy() {
|
|
1990
|
+
for (const t of Object.values(this.#t)) t.parentElement.removeChild(t);
|
|
1991
|
+
this.#t = /* @__PURE__ */ Object.create(null);
|
|
1992
|
+
}
|
|
1993
|
+
hideAllFrame() {
|
|
1994
|
+
for (const [t, { style: e }] of Object.entries(this.#t))
|
|
1995
|
+
this.#l[t] = e.display !== "none", e.display = "none";
|
|
1996
|
+
}
|
|
1997
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
1998
|
+
#l = /* @__PURE__ */ Object.create(null);
|
|
1999
|
+
restoreAllFrame() {
|
|
2000
|
+
for (const [t, e] of Object.entries(this.#l)) {
|
|
2001
|
+
const s = this.#t[t];
|
|
2002
|
+
s && (s.style.display = e ? "inline" : "none");
|
|
2003
|
+
}
|
|
2004
|
+
this.#l = /* @__PURE__ */ Object.create(null);
|
|
2005
|
+
}
|
|
2006
|
+
// HTMLフレーム
|
|
2007
|
+
// フレーム追加
|
|
2008
|
+
#p(t) {
|
|
2009
|
+
const { id: e, src: s, alpha: i = 1, scale_x: n = 1, scale_y: a = 1, rotate: o = 0 } = t;
|
|
2010
|
+
if (!e) throw "idは必須です";
|
|
2011
|
+
if (!s) throw "srcは必須です";
|
|
2012
|
+
const r = "const.sn.frm." + e;
|
|
2013
|
+
if (this.val.getVal(`tmp:${r}`)) throw `frame【${e}】はすでにあります`;
|
|
2014
|
+
const c = R(t, "visible", !0), f = t.b_color ? ` background-color: ${t.b_color};` : "", l = this.#c(t);
|
|
2015
|
+
C.#n.cvs.insertAdjacentHTML("beforebegin", `<iframe id="${e}" style="opacity: ${i}; ${f} position: absolute; left:${C.#e.ofsLeft4elm + l.x * C.#e.cvsScale}px; top: ${C.#e.ofsTop4elm + l.y * C.#e.cvsScale}px; z-index: 1; border: 0px; overflow: hidden; display: ${c ? "inline" : "none"}; transform: scale(${n}, ${a}) rotate(${o}deg);" width="${l.width * C.#e.cvsScale}" height="${l.height * C.#e.cvsScale}"></iframe>`);
|
|
2016
|
+
const p = F.procID + `add_frame id:${e}`;
|
|
2017
|
+
F.beginProc(p);
|
|
2018
|
+
const d = C.#s.searchPath(s, Z.HTML), h = new Q().add({ name: s, url: d, xhrType: D.XHR_RESPONSE_TYPE.TEXT });
|
|
2019
|
+
return C.#e.arg.crypto && h.use(
|
|
2020
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
2021
|
+
(u, x) => void C.#e.dec(u.extension, u.data).then((v) => {
|
|
2022
|
+
u.data = v, x();
|
|
2023
|
+
}).catch((v) => {
|
|
2024
|
+
C.#n.errScript(`[add_frame]Html ロード失敗です src:${u.name} ${v}`, !1), x();
|
|
2025
|
+
})
|
|
2026
|
+
), h.load((u, x) => {
|
|
2027
|
+
const v = document.getElementById(e);
|
|
2028
|
+
this.#t[e] = v, this.#u[e] = !1;
|
|
2029
|
+
const y = d.lastIndexOf("/") + 1, b = d.slice(0, y), E = b.slice(0, y);
|
|
2030
|
+
v.srcdoc = String(x[s]?.data).replace("sn_repRes();", "").replaceAll(
|
|
2031
|
+
/\s(?:src|href)=(["'])(\S+?)\1/g,
|
|
2032
|
+
// 【\s】が大事、data-src弾く
|
|
2033
|
+
(_, T, $) => $.startsWith("../") ? E + _.slice(3) : _.replace("./", "").replace(T, T + b)
|
|
2034
|
+
), v.srcdoc.includes("true/*WEBP*/;") && (v.srcdoc = v.srcdoc.replaceAll(
|
|
2035
|
+
/data-src="(.+?\.)(?:jpe?g|png)/g,
|
|
2036
|
+
(_, T) => `data-src="${T}webp`
|
|
2037
|
+
)), v.onload = () => {
|
|
2038
|
+
F.endProc(p), this.val.setVal_Nochk("tmp", r, !0), this.val.setVal_Nochk("tmp", r + ".alpha", i), this.val.setVal_Nochk("tmp", r + ".x", l.x), this.val.setVal_Nochk("tmp", r + ".y", l.y), this.val.setVal_Nochk("tmp", r + ".scale_x", n), this.val.setVal_Nochk("tmp", r + ".scale_y", a), this.val.setVal_Nochk("tmp", r + ".rotate", o), this.val.setVal_Nochk("tmp", r + ".width", l.width), this.val.setVal_Nochk("tmp", r + ".height", l.height), this.val.setVal_Nochk("tmp", r + ".visible", c);
|
|
2039
|
+
const _ = v.contentWindow;
|
|
2040
|
+
this.#r.resvFlameEvent(_.document.body), _.sn_repRes?.((T) => C.#x(T.dataset.src ?? "", T));
|
|
2041
|
+
};
|
|
2042
|
+
}), !0;
|
|
2043
|
+
}
|
|
2044
|
+
#u = {};
|
|
2045
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
2046
|
+
getFrmDisabled(t) {
|
|
2047
|
+
return this.#u[t];
|
|
2048
|
+
}
|
|
2049
|
+
#c(t) {
|
|
2050
|
+
const e = { ...t }, s = C.#e.resolution;
|
|
2051
|
+
return new DOMRect(
|
|
2052
|
+
w(e, "x", 0) * s,
|
|
2053
|
+
w(e, "y", 0) * s,
|
|
2054
|
+
w(e, "width", S.stageW) * s,
|
|
2055
|
+
w(e, "height", S.stageH) * s
|
|
2056
|
+
);
|
|
2057
|
+
}
|
|
2058
|
+
static #x(t, e, s) {
|
|
2059
|
+
const i = this.#d[t];
|
|
2060
|
+
if (i) {
|
|
2061
|
+
e.src = i, s && (e.onload = () => s(e));
|
|
2062
|
+
return;
|
|
2063
|
+
}
|
|
2064
|
+
const n = this.#i[t];
|
|
2065
|
+
if (n) {
|
|
2066
|
+
n.push(e);
|
|
2067
|
+
return;
|
|
2068
|
+
}
|
|
2069
|
+
this.#i[t] = [e];
|
|
2070
|
+
const [a = "", o = ""] = t.split("?"), r = C.#s.searchPath(a, Z.SP_GSM), c = new Q().add({ name: t, url: r, xhrType: D.XHR_RESPONSE_TYPE.BUFFER });
|
|
2071
|
+
C.#e.use4ViteElectron(t, r, c, C.#n) || C.#e.arg.crypto && r.endsWith(".bin") && c.use((f, l) => {
|
|
2072
|
+
if (f.extension !== "bin") {
|
|
2073
|
+
l();
|
|
2074
|
+
return;
|
|
2075
|
+
}
|
|
2076
|
+
C.#e.decAB(f.data).then((p) => {
|
|
2077
|
+
f.data = p, p instanceof HTMLImageElement && (f.type = D.TYPE.IMAGE), l();
|
|
2078
|
+
}).catch((p) => {
|
|
2079
|
+
C.#n.errScript(`FrameMng loadPic ロード失敗です fn:${f.name} ${p}`, !1), l();
|
|
2080
|
+
});
|
|
2081
|
+
}), c.load((f, l) => {
|
|
2082
|
+
for (const [p, { data: { src: d } }] of Object.entries(l)) {
|
|
2083
|
+
const h = this.#d[p] = d + // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
|
|
2084
|
+
(d.startsWith("blob:") || d.startsWith("data:") ? "" : o ? "?" + o : ""), u = this.#i[p];
|
|
2085
|
+
if (u) for (const x of u)
|
|
2086
|
+
x.src = h, s && (x.onload = () => s(x));
|
|
2087
|
+
delete this.#i[p];
|
|
2088
|
+
}
|
|
2089
|
+
});
|
|
2090
|
+
}
|
|
2091
|
+
static #i = {};
|
|
2092
|
+
static #d = {};
|
|
2093
|
+
cvsResize() {
|
|
2094
|
+
for (const [t, e] of Object.entries(this.#t)) {
|
|
2095
|
+
const s = "const.sn.frm." + t, i = Number(this.val.getVal(s + ".x")), n = Number(this.val.getVal(s + ".y")), a = Number(this.val.getVal(s + ".width")), o = Number(this.val.getVal(s + ".height"));
|
|
2096
|
+
e.style.left = `${C.#e.ofsLeft4elm + i * C.#e.cvsScale}px`, e.style.top = `${C.#e.ofsTop4elm + n * C.#e.cvsScale}px`, e.width = String(a * C.#e.cvsScale), e.height = String(o * C.#e.cvsScale);
|
|
2097
|
+
}
|
|
2098
|
+
}
|
|
2099
|
+
// フレーム変数を取得
|
|
2100
|
+
#f(t) {
|
|
2101
|
+
const { id: e, var_name: s } = t;
|
|
2102
|
+
if (!e) throw "idは必須です";
|
|
2103
|
+
const i = document.getElementById(e);
|
|
2104
|
+
if (!i) throw `id【${e}】はフレームではありません`;
|
|
2105
|
+
const n = "const.sn.frm." + e;
|
|
2106
|
+
if (!this.val.getVal(`tmp:${n}`)) throw `frame【${e}】が読み込まれていません`;
|
|
2107
|
+
if (!s) throw "var_nameは必須です";
|
|
2108
|
+
const a = i.contentWindow;
|
|
2109
|
+
if (!Object.hasOwn(a, s)) throw `frame【${e}】に変数/関数【${s}】がありません。変数は var付きにして下さい`;
|
|
2110
|
+
const o = a[s];
|
|
2111
|
+
return this.val.setVal_Nochk(
|
|
2112
|
+
"tmp",
|
|
2113
|
+
n + "." + s,
|
|
2114
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call
|
|
2115
|
+
R(t, "function", !1) ? o() : o
|
|
2116
|
+
), !1;
|
|
2117
|
+
}
|
|
2118
|
+
// フレーム変数に設定
|
|
2119
|
+
#y(t) {
|
|
2120
|
+
const { id: e, var_name: s, text: i } = t;
|
|
2121
|
+
if (!e) throw "idは必須です";
|
|
2122
|
+
const n = document.getElementById(e);
|
|
2123
|
+
if (!n) throw `id【${e}】はフレームではありません`;
|
|
2124
|
+
const a = "const.sn.frm." + e;
|
|
2125
|
+
if (!this.val.getVal(`tmp:${a}`)) throw `frame【${e}】が読み込まれていません`;
|
|
2126
|
+
if (!s) throw "var_nameは必須です";
|
|
2127
|
+
if (!i) throw "textは必須です";
|
|
2128
|
+
this.val.setVal_Nochk("tmp", a + "." + s, i);
|
|
2129
|
+
const o = n.contentWindow;
|
|
2130
|
+
return o[s] = i, !1;
|
|
2131
|
+
}
|
|
2132
|
+
// フレームに設定
|
|
2133
|
+
#a = 1;
|
|
2134
|
+
#g(t) {
|
|
2135
|
+
const { id: e } = t;
|
|
2136
|
+
if (!e) throw "idは必須です";
|
|
2137
|
+
const s = document.getElementById(e);
|
|
2138
|
+
if (!s) throw `id【${e}】はフレームではありません`;
|
|
2139
|
+
const i = "const.sn.frm." + e;
|
|
2140
|
+
if (!this.val.getVal("tmp:" + i)) throw `frame【${e}】が読み込まれていません`;
|
|
2141
|
+
const n = s.style;
|
|
2142
|
+
if (R(t, "float", !1) ? n.zIndex = `${++this.#a}` : "index" in t ? n.zIndex = `${w(t, "index", 0)}` : t.dive && (n.zIndex = `-${++this.#a}`), "alpha" in t) {
|
|
2143
|
+
const o = n.opacity = String(t.alpha);
|
|
2144
|
+
this.val.setVal_Nochk("tmp", i + ".alpha", o);
|
|
2145
|
+
}
|
|
2146
|
+
const a = this.#c(t);
|
|
2147
|
+
if (("x" in t || "y" in t) && (n.left = `${C.#e.ofsLeft4elm + a.x * C.#e.cvsScale}px`, n.top = `${C.#e.ofsTop4elm + a.y * C.#e.cvsScale}px`, this.val.setVal_Nochk("tmp", i + ".x", a.x), this.val.setVal_Nochk("tmp", i + ".y", a.y)), "scale_x" in t || "scale_y" in t || "rotate" in t) {
|
|
2148
|
+
const o = w(t, "scale_x", 1), r = w(t, "scale_y", 1), c = w(t, "rotate", 0);
|
|
2149
|
+
n.transform = `scale(${o}, ${r}) rotate(${c}deg)`, this.val.setVal_Nochk("tmp", i + ".scale_x", o), this.val.setVal_Nochk("tmp", i + ".scale_y", r), this.val.setVal_Nochk("tmp", i + ".rotate", c);
|
|
2150
|
+
}
|
|
2151
|
+
if ("width" in t && (s.width = String(a.width * C.#e.cvsScale), this.val.setVal_Nochk("tmp", i + ".width", a.width)), "height" in t && (s.height = String(a.height * C.#e.cvsScale), this.val.setVal_Nochk("tmp", i + ".height", a.height)), "visible" in t) {
|
|
2152
|
+
const o = R(t, "visible", !0);
|
|
2153
|
+
n.display = o ? "inline" : "none", this.val.setVal_Nochk("tmp", i + ".visible", o);
|
|
2154
|
+
}
|
|
2155
|
+
if ("b_color" in t && (n.backgroundColor = t.b_color), "disabled" in t) {
|
|
2156
|
+
const o = this.#u[e] = R(t, "disabled", !0), r = s.contentDocument.body;
|
|
2157
|
+
for (const c of [
|
|
2158
|
+
...Array.from(r.getElementsByTagName("input")),
|
|
2159
|
+
...Array.from(r.getElementsByTagName("select"))
|
|
2160
|
+
]) c.disabled = o;
|
|
2161
|
+
}
|
|
2162
|
+
return !1;
|
|
2163
|
+
}
|
|
2164
|
+
// フレームをトゥイーン開始
|
|
2165
|
+
#o(t) {
|
|
2166
|
+
const { id: e, alpha: s, x: i, y: n, scale_x: a, scale_y: o, rotate: r, width: c, height: f } = t;
|
|
2167
|
+
if (!e) throw "idは必須です";
|
|
2168
|
+
const l = document.getElementById(e);
|
|
2169
|
+
if (!l) throw `id【${e}】はフレームではありません`;
|
|
2170
|
+
const p = "const.sn.frm." + e;
|
|
2171
|
+
if (!this.val.getVal(`tmp:${p}`, 0)) throw `frame【${e}】が読み込まれていません`;
|
|
2172
|
+
const d = {};
|
|
2173
|
+
s && (d.a = Number(l.style.opacity)), (i || n || a || o || r) && (d.x = Number(this.val.getVal(`tmp:${p}.x`)), d.y = Number(this.val.getVal(`tmp:${p}.y`)), d.sx = Number(this.val.getVal(`tmp:${p}.scale_x`)), d.sy = Number(this.val.getVal(`tmp:${p}.scale_y`)), d.r = Number(this.val.getVal(`tmp:${p}.rotate`))), c && (d.w = Number(this.val.getVal(`tmp:${p}.width`))), f && (d.h = Number(this.val.getVal(`tmp:${p}.height`)));
|
|
2174
|
+
const h = B.cnvTweenArg(t, d);
|
|
2175
|
+
let u = () => {
|
|
2176
|
+
};
|
|
2177
|
+
s && (w(h, "alpha", 0), u = () => {
|
|
2178
|
+
l.style.opacity = String(d.a), this.val.setVal_Nochk("tmp", "alpha", d.a);
|
|
2179
|
+
});
|
|
2180
|
+
let x = () => {
|
|
2181
|
+
};
|
|
2182
|
+
const v = this.#c(h);
|
|
2183
|
+
(i || n || a || o || r) && (v.x, v.y, w(h, "scale_x", 1), w(h, "scale_y", 1), w(h, "rotate", 0), x = () => {
|
|
2184
|
+
l.style.left = `${// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
2185
|
+
C.#e.ofsLeft4elm + d.x * C.#e.cvsScale} px`, l.style.top = `${// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
2186
|
+
C.#e.ofsTop4elm + d.y * C.#e.cvsScale} px`, l.style.transform = `scale(${d.sx}, ${d.sy}) rotate(${d.r}deg)`, this.val.setVal_Nochk("tmp", p + ".x", d.x), this.val.setVal_Nochk("tmp", p + ".y", d.y), this.val.setVal_Nochk("tmp", p + ".scale_x", d.sx), this.val.setVal_Nochk("tmp", p + ".scale_y", d.sy), this.val.setVal_Nochk("tmp", p + ".rotate", d.r);
|
|
2187
|
+
});
|
|
2188
|
+
let y = () => {
|
|
2189
|
+
};
|
|
2190
|
+
c && (v.width, y = () => {
|
|
2191
|
+
l.width = `${d.w * C.#e.cvsScale} px`, this.val.setVal_Nochk("tmp", p + ".width", d.w);
|
|
2192
|
+
});
|
|
2193
|
+
let b = () => {
|
|
2194
|
+
};
|
|
2195
|
+
return f && (v.height, b = () => {
|
|
2196
|
+
l.height = `${d.h * C.#e.cvsScale} px`, this.val.setVal_Nochk("tmp", p + ".height", d.h);
|
|
2197
|
+
}), this.appPixi.stage.interactive = !1, B.tween(`frm
|
|
2198
|
+
${e}`, t, d, B.cnvTweenArg(t, d), () => {
|
|
2199
|
+
u(), x(), y(), b();
|
|
2200
|
+
}, () => {
|
|
2201
|
+
this.appPixi.stage.interactive = !0;
|
|
2202
|
+
}, () => {
|
|
2203
|
+
}), !1;
|
|
2204
|
+
}
|
|
2205
|
+
}
|
|
2206
|
+
class Gt {
|
|
2207
|
+
// 🍚
|
|
2208
|
+
constructor(t, e, s) {
|
|
2209
|
+
this.oCfg = t, this.hTag = e, this.val = s, e.rec_ch = (i) => this.#n(i), e.rec_r = (i) => this.#r(i), e.reset_rec = (i) => this.#t(i), s.defTmp("const.sn.log.json", () => {
|
|
2210
|
+
this.#s.text = // 🌾
|
|
2211
|
+
this.#s.text.replaceAll("</span><span class='sn_ch'>", "");
|
|
2212
|
+
const i = [...this.#e, this.#s];
|
|
2213
|
+
return JSON.stringify(i);
|
|
2214
|
+
}), this.recText("");
|
|
2215
|
+
}
|
|
2216
|
+
#s = { text: "" };
|
|
2217
|
+
// 🌾
|
|
2218
|
+
#e = [];
|
|
2219
|
+
// [ch] からコールされる
|
|
2220
|
+
// [ch] // 文字を追加する
|
|
2221
|
+
// recText(text: string) コール
|
|
2222
|
+
// 🌾this.#LastLog = {text}; // 置換でよい
|
|
2223
|
+
// 🍊save:const.sn.sLog = 🦀const.sn.log.json // これを起動したい
|
|
2224
|
+
recText(t) {
|
|
2225
|
+
this.#s.text = t, this.val.setVal_Nochk(
|
|
2226
|
+
"save",
|
|
2227
|
+
"const.sn.sLog",
|
|
2228
|
+
// 🍊 リプレイ時の回復用
|
|
2229
|
+
String(this.val.getVal("const.sn.log.json"))
|
|
2230
|
+
// これを起動したい
|
|
2231
|
+
);
|
|
2232
|
+
}
|
|
2233
|
+
//MARK: 履歴書き込み
|
|
2234
|
+
// 🌾this.#LastLog = {...hArg, text: 🌾this.#LastLog.text};
|
|
2235
|
+
#n(t) {
|
|
2236
|
+
return this.#s = { ...t, text: this.#s.text }, t.text ? (t.record = !0, t.style ??= "", t.style += "display: none;", t.wait = 0, this.hTag.ch(t)) : (this.val.setVal_Nochk(
|
|
2237
|
+
"save",
|
|
2238
|
+
"const.sn.sLog",
|
|
2239
|
+
// 🍊 リプレイ時の回復用
|
|
2240
|
+
String(this.val.getVal("const.sn.log.json"))
|
|
2241
|
+
// これを起動したい
|
|
2242
|
+
), !1);
|
|
2243
|
+
}
|
|
2244
|
+
//MARK: 履歴改行
|
|
2245
|
+
#r(t) {
|
|
2246
|
+
return this.#n({ ...t, text: "[r]" });
|
|
2247
|
+
}
|
|
2248
|
+
//MARK: 履歴リセット
|
|
2249
|
+
// 以下をクリア。text で置き換え値を設定できる
|
|
2250
|
+
// 🌾this.#LastLog = {text: hArg.text ?? ''};
|
|
2251
|
+
// 🍚this.#aLog = []
|
|
2252
|
+
// 🍊save:const.sn.sLog= hArg.text ?[{text:"${hArg.text}"}] : []
|
|
2253
|
+
#t(t) {
|
|
2254
|
+
return this.#e = [], t.text ??= "", this.#s = { text: t.text }, this.val.setVal_Nochk("save", "const.sn.sLog", JSON.stringify([this.#s])), !1;
|
|
2255
|
+
}
|
|
2256
|
+
//MARK: 履歴改ページ
|
|
2257
|
+
pagebreak() {
|
|
2258
|
+
this.#s.text = // 🌾
|
|
2259
|
+
this.#s.text.replaceAll("</span><span class='sn_ch'>", ""), this.#s.text && (this.#e.push(this.#s) > this.oCfg.log.max_len && (this.#e = this.#e.slice(-this.oCfg.log.max_len)), this.#s = { text: "" });
|
|
2260
|
+
}
|
|
2261
|
+
//MARK: 履歴回復
|
|
2262
|
+
// save:const.sn.sLog からの復帰
|
|
2263
|
+
playback() {
|
|
2264
|
+
this.#e = JSON.parse(String(this.val.getVal("save:const.sn.sLog"))), this.#s = { text: "" };
|
|
2265
|
+
}
|
|
2266
|
+
}
|
|
2267
|
+
function X(q) {
|
|
2268
|
+
return encodeURIComponent(JSON.stringify(q));
|
|
2269
|
+
}
|
|
2270
|
+
class G {
|
|
2271
|
+
//MARK: コンストラクタ
|
|
2272
|
+
constructor(t, e, s, i, n, a, o, r, c) {
|
|
2273
|
+
this.cfg = t, this.hTag = e, this.appPixi = s, this.val = i, this.main = n, this.scrItr = a, this.sys = o;
|
|
2274
|
+
const f = () => {
|
|
2275
|
+
if (o.cvsResize(), this.cvsResizeDesign(), this.#x) for (const h of this.#b)
|
|
2276
|
+
this.#h[h].fore.cvsResizeChildren();
|
|
2277
|
+
else for (const h of this.#b)
|
|
2278
|
+
this.#h[h].fore.cvsResize();
|
|
2279
|
+
this.#r.cvsResize(), this.#f.cvsResize();
|
|
2280
|
+
};
|
|
2281
|
+
if (S.isMobile)
|
|
2282
|
+
this.#p.add(globalThis, "orientationchange", f, { passive: !0 });
|
|
2283
|
+
else {
|
|
2284
|
+
let h;
|
|
2285
|
+
this.#p.add(globalThis, "resize", () => {
|
|
2286
|
+
h || (h = setTimeout(() => {
|
|
2287
|
+
h = void 0, f();
|
|
2288
|
+
}, 1e3 / 60 * 10));
|
|
2289
|
+
}, { passive: !0 });
|
|
2290
|
+
}
|
|
2291
|
+
o.cvsResize(), this.#l = new Gt(this.cfg.oCfg, e, i), P.init(t, e, i, this.#l, (h) => this.#h[h.layname].fore === h, s), L.init(n, t, s, o, r, i), C.init(t, o, n), z.init(t), this.#r = new C(e, s, i), o.hFactoryCls.grp = () => new L(), o.hFactoryCls.txt = () => new P(), e.loadplugin = (h) => this.#w(h), e.snapshot = (h) => this.#g(h), this.#o = this.sys.isApp ? (h, u, x, v, y) => this.#I(h, u, x, v, y) : (h, u, x, v, y) => this.#k(h, u, x, v, y), e.add_lay = (h) => this.#v(h), e.clear_lay = (h) => this.#j(h), e.finish_trans = () => !1, e.lay = (h) => this.#F(h), e.trans = (h) => this.#W(h), e.wt = (h) => B.wt(h), e.quake = (h) => this.#M(h), e.stop_quake = e.finish_trans, e.wq = e.wt, e.pause_tsy = (h) => B.pause_tsy(h), e.resume_tsy = (h) => B.resume_tsy(h), e.stop_tsy = (h) => B.stop_tsy(h), e.tsy = (h) => this.#R(h), e.wait_tsy = (h) => B.wait_tsy(h), e.add_filter = (h) => this.#Q(h), e.clear_filter = (h) => this.#U(h), e.enable_filter = (h) => this.#J(h), e.ch = (h) => this.#T(h), e.clear_text = (h) => this.#A(h), e.current = (h) => this.#K(h), e.endlink = (h) => this.#tt(h), e.er = (h) => this.#et(h), e.graph = (h) => this.#st(h), e.link = (h) => this.#it(h), e.r = (h) => this.#nt(h), e.ruby2 = (h) => this.#at(h), e.span = (h) => this.#ot(h), e.tcy = (h) => this.#rt(h), e.add_face = (h) => m.add_face(h), e.wv = (h) => m.wv(h), e.dump_lay = (h) => this.#ht(h), e.enable_event = (h) => this.#lt(h), e.button = (h) => this.#ct(h), t.existsBreakline && (this.breakLine = (h) => {
|
|
2292
|
+
delete h.visible, h.id = "break", h.pic = "breakline", this.#a("grp|" + X(h));
|
|
2293
|
+
}), t.existsBreakpage && (this.breakPage = (h) => {
|
|
2294
|
+
delete h.visible, h.id = "break", h.pic = "breakpage", this.#a("grp|" + X(h));
|
|
2295
|
+
}), this.#t = Ot(String(t.oCfg.init.bg_color));
|
|
2296
|
+
const l = new U();
|
|
2297
|
+
l.beginFill(this.#t).lineStyle(0, this.#t).drawRect(0, 0, S.stageW, S.stageH).endFill(), this.#e.addChild(l.clone()), this.#n.addChild(l), this.#n.visible = !1, this.#e.name = "page:A", this.#n.name = "page:B", this.#s = s.stage, this.#s.addChild(this.#n), this.#s.addChild(this.#e), this.#s.addChild(this.#$), this.#s.addChild(this.#_), this.#s.name = "stage";
|
|
2298
|
+
const p = (h, u) => {
|
|
2299
|
+
this.#y(Number(u));
|
|
2300
|
+
};
|
|
2301
|
+
p("", i.getVal("sys:TextLayer.Back.Alpha", 1)), i.defValTrg("sys:TextLayer.Back.Alpha", p);
|
|
2302
|
+
const d = (h, u) => {
|
|
2303
|
+
z.fontFamily = u;
|
|
2304
|
+
};
|
|
2305
|
+
d("", i.getVal("tmp:sn.button.fontFamily", z.fontFamily)), i.defValTrg("tmp:sn.button.fontFamily", d), i.defTmp("const.sn.last_page_text", () => this.currentTxtlayFore?.pageText ?? ""), i.defTmp("const.sn.last_page_plain_text", () => this.currentTxtlayFore?.pagePlainText ?? ""), S.isDbg && (ut.init(s, o, a, c, t, this.#h), this.cvsResizeDesign = () => ut.cvsResizeDesign(), o.addHook((h, u) => {
|
|
2306
|
+
this.#u[h]?.(h, u) && delete this.#u[h];
|
|
2307
|
+
}));
|
|
2308
|
+
}
|
|
2309
|
+
#s;
|
|
2310
|
+
#e = new W();
|
|
2311
|
+
#n = new W();
|
|
2312
|
+
#r;
|
|
2313
|
+
#t;
|
|
2314
|
+
#l;
|
|
2315
|
+
#p = new kt();
|
|
2316
|
+
cvsResizeDesign() {
|
|
2317
|
+
}
|
|
2318
|
+
#u = {
|
|
2319
|
+
attach: (t) => !1,
|
|
2320
|
+
continue: (t) => !1,
|
|
2321
|
+
disconnect: (t) => !1,
|
|
2322
|
+
_enterDesign: (t) => {
|
|
2323
|
+
for (const e of this.#b) {
|
|
2324
|
+
const s = this.#h[e].fore;
|
|
2325
|
+
s.makeDesignCastChildren((i) => i.make()), s.makeDesignCast((i) => i.make());
|
|
2326
|
+
}
|
|
2327
|
+
return this.#i(this.#E), !1;
|
|
2328
|
+
},
|
|
2329
|
+
_replaceToken: (t, e) => !1,
|
|
2330
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
|
|
2331
|
+
_selectNode: (t, e) => (this.#i(e.node), !1)
|
|
2332
|
+
};
|
|
2333
|
+
#c = "";
|
|
2334
|
+
#x = "";
|
|
2335
|
+
#i(t) {
|
|
2336
|
+
[this.#c = "", this.#x = ""] = t.split("/");
|
|
2337
|
+
const e = this.#h[this.#c];
|
|
2338
|
+
e && (this.#x ? e.fore.showDesignCastChildren() : e.fore.showDesignCast());
|
|
2339
|
+
}
|
|
2340
|
+
getFrmDisabled = (t) => this.#r.getFrmDisabled(t);
|
|
2341
|
+
#d = void 0;
|
|
2342
|
+
cover(t, e = 0) {
|
|
2343
|
+
this.#d && (this.#s.removeChild(this.#d), this.#d.destroy(), this.#d = void 0), t && this.#s.addChild(
|
|
2344
|
+
(this.#d = new U()).beginFill(e).lineStyle(0, e).drawRect(0, 0, S.stageW, S.stageH).endFill()
|
|
2345
|
+
);
|
|
2346
|
+
}
|
|
2347
|
+
#f;
|
|
2348
|
+
setEvtMng(t) {
|
|
2349
|
+
this.#f = t, this.#r.setEvtMng(t), m.setEvtMng(t), B.init(t, this.appPixi);
|
|
2350
|
+
}
|
|
2351
|
+
destroy() {
|
|
2352
|
+
for (const t of Object.values(this.#h)) t.destroy();
|
|
2353
|
+
this.#p.clear(), L.destroy(), pt.destroy(), g.destroy(), P.destroy(), this.#r.destroy(), B.destroy(), G.#C = 10;
|
|
2354
|
+
}
|
|
2355
|
+
// 既存の全文字レイヤの実際のバック不透明度、を再計算
|
|
2356
|
+
#y(t) {
|
|
2357
|
+
for (const e of this.#b) {
|
|
2358
|
+
const { fore: s, back: i } = this.#h[e];
|
|
2359
|
+
s instanceof P && (s.chgBackAlpha(t), i.chgBackAlpha(t));
|
|
2360
|
+
}
|
|
2361
|
+
}
|
|
2362
|
+
#a = (t, e = this.currentTxtlayForeNeedErr, s = !0) => e.tagCh("| 《" + t + "》");
|
|
2363
|
+
goTxt = () => {
|
|
2364
|
+
};
|
|
2365
|
+
get needGoTxt() {
|
|
2366
|
+
return this.currentTxtlayFore?.needGoTxt ?? !1;
|
|
2367
|
+
}
|
|
2368
|
+
breakLine = (t) => {
|
|
2369
|
+
};
|
|
2370
|
+
breakPage = (t) => {
|
|
2371
|
+
};
|
|
2372
|
+
clearBreak() {
|
|
2373
|
+
this.currentTxtlayFore && (this.clearBreak = () => this.#a("del|break"), this.clearBreak());
|
|
2374
|
+
}
|
|
2375
|
+
clickTxtLay() {
|
|
2376
|
+
return this.currentTxtlayFore ? this.#b.map((t) => this.#h[t].fore).some((t) => t instanceof P && t.click()) : !1;
|
|
2377
|
+
}
|
|
2378
|
+
// // システム
|
|
2379
|
+
//MARK: スナップショット
|
|
2380
|
+
#g(t) {
|
|
2381
|
+
const e = Bt("-", "_", "", "_"), s = t.fn ? t.fn.startsWith(It) ? t.fn : `${_t + t.fn + e}.png` : `${_t}snapshot${e}.png`, i = this.cfg.searchPath(s), n = w(t, "width", S.stageW), a = w(t, "height", S.stageH);
|
|
2382
|
+
return this.#o(t, i, n, a, `snapshot dt:${e}`);
|
|
2383
|
+
}
|
|
2384
|
+
#o = () => !1;
|
|
2385
|
+
#I({ layer: t }, e, s, i, n) {
|
|
2386
|
+
if (this.#r.hideAllFrame(), F.beginProc(n), !t)
|
|
2387
|
+
return this.sys.capturePage(e, s, i, () => {
|
|
2388
|
+
this.#r.restoreAllFrame(), F.endProc(n);
|
|
2389
|
+
}), !0;
|
|
2390
|
+
const a = this.#b.map((o) => {
|
|
2391
|
+
const { ctn: r } = this.#h[o].fore, c = [r, r.visible];
|
|
2392
|
+
return r.visible = !1, c;
|
|
2393
|
+
});
|
|
2394
|
+
for (const o of this.#m(t)) this.#h[o].fore.ctn.visible = !0;
|
|
2395
|
+
return this.sys.capturePage(e, s, i, () => {
|
|
2396
|
+
for (const [o, r] of a) o.visible = r;
|
|
2397
|
+
this.#r.restoreAllFrame(), F.endProc(n);
|
|
2398
|
+
}), !0;
|
|
2399
|
+
}
|
|
2400
|
+
#k(t, e, s, i, n) {
|
|
2401
|
+
F.beginProc(n);
|
|
2402
|
+
const a = vt(t, "b_color", this.#t), o = Vt({
|
|
2403
|
+
width: s,
|
|
2404
|
+
height: i,
|
|
2405
|
+
backgroundAlpha: a > 16777216 && e.endsWith(".png") ? 0 : 1,
|
|
2406
|
+
antialias: R(t, "smoothing", !1),
|
|
2407
|
+
preserveDrawingBuffer: !0,
|
|
2408
|
+
backgroundColor: a & 16777215,
|
|
2409
|
+
autoDensity: !0
|
|
2410
|
+
}), r = t.page !== "back" ? "fore" : "back", { layer: c } = t;
|
|
2411
|
+
return Promise.allSettled(
|
|
2412
|
+
this.#m(c).map((f) => new Promise(
|
|
2413
|
+
(l) => this.#h[f][r].snapshot(o, l)
|
|
2414
|
+
))
|
|
2415
|
+
).then(async () => {
|
|
2416
|
+
const f = tt.create({ width: o.width, height: o.height });
|
|
2417
|
+
o.render(this.#s, { renderTexture: f }), await this.sys.savePic(
|
|
2418
|
+
e,
|
|
2419
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
|
|
2420
|
+
o.plugins.extract.base64(f)
|
|
2421
|
+
), f.destroy();
|
|
2422
|
+
for (const l of this.#m(c)) this.#h[l][r].snapshot_end();
|
|
2423
|
+
o.destroy(!0), F.endProc(n);
|
|
2424
|
+
}), !0;
|
|
2425
|
+
}
|
|
2426
|
+
//MARK: プラグインの読み込み
|
|
2427
|
+
#w(t) {
|
|
2428
|
+
const { fn: e } = t;
|
|
2429
|
+
if (!e) throw "fnは必須です";
|
|
2430
|
+
if (!e.endsWith(".css")) throw "サポートされない拡張子です";
|
|
2431
|
+
const s = R(t, "join", !0), i = F.procID + `loadplugin fn:${e}`;
|
|
2432
|
+
return s && F.beginProc(i), (async () => {
|
|
2433
|
+
const n = await fetch(e);
|
|
2434
|
+
if (!n.ok) throw new Error("Network response was not ok.");
|
|
2435
|
+
ot(await n.text()), s && F.endProc(i);
|
|
2436
|
+
})(), s;
|
|
2437
|
+
}
|
|
2438
|
+
// // レイヤ共通
|
|
2439
|
+
//MARK: レイヤを追加する
|
|
2440
|
+
#v(t) {
|
|
2441
|
+
const { layer: e, class: s } = t;
|
|
2442
|
+
if (!e) throw "layerは必須です";
|
|
2443
|
+
if (e.includes(",")) throw "layer名に「,」は使えません";
|
|
2444
|
+
if (e in this.#h) throw `layer【${e}】はすでにあります`;
|
|
2445
|
+
if (!s) throw "clsは必須です";
|
|
2446
|
+
const i = { isWait: !1 };
|
|
2447
|
+
switch (this.#h[e] = new et(e, s, this.#e, this.#n, t, this.sys, this.val, i), this.#b.push(e), s) {
|
|
2448
|
+
case "txt":
|
|
2449
|
+
this.#E || (this.#Z = () => {
|
|
2450
|
+
}, this.#P = (n) => this.#X(n), this.#K = (n) => this.#q(n), this.hTag.current({ layer: e }), this.goTxt = () => {
|
|
2451
|
+
this.#f.isSkipping ? G.#C = 0 : this.setNormalChWait();
|
|
2452
|
+
for (const n of this.#b) {
|
|
2453
|
+
const a = this.#h[n].fore;
|
|
2454
|
+
a instanceof P && this.#a("gotxt|", a, !1);
|
|
2455
|
+
}
|
|
2456
|
+
}), this.val.setVal_Nochk("save", "const.sn.layer." + e + ".enabled", !0);
|
|
2457
|
+
break;
|
|
2458
|
+
case "grp":
|
|
2459
|
+
if (this.#V) break;
|
|
2460
|
+
this.#V = e;
|
|
2461
|
+
break;
|
|
2462
|
+
}
|
|
2463
|
+
return this.scrItr.recodeDesign(t), i.isWait;
|
|
2464
|
+
}
|
|
2465
|
+
#h = {
|
|
2466
|
+
/* empty */
|
|
2467
|
+
};
|
|
2468
|
+
// しおりLoad時再読込
|
|
2469
|
+
#b = [];
|
|
2470
|
+
// 最適化用・重なり順つき全レイヤ名
|
|
2471
|
+
#E = "";
|
|
2472
|
+
#V = "";
|
|
2473
|
+
#F(t) {
|
|
2474
|
+
const e = this.#G(t), s = this.#h[e], i = s.back.ctn, n = s.fore.ctn;
|
|
2475
|
+
if (R(t, "float", !1))
|
|
2476
|
+
this.#n.setChildIndex(i, this.#n.children.length - 1), this.#e.setChildIndex(n, this.#e.children.length - 1), this.#z();
|
|
2477
|
+
else if (t.index)
|
|
2478
|
+
w(t, "index", 0) && (this.#n.setChildIndex(i, t.index), this.#e.setChildIndex(n, t.index), this.#z());
|
|
2479
|
+
else if (t.dive) {
|
|
2480
|
+
const { dive: a } = t;
|
|
2481
|
+
let o = 0;
|
|
2482
|
+
if (e === a) throw "[lay] 属性 layerとdiveが同じ【" + a + "】です";
|
|
2483
|
+
const r = this.#h[a];
|
|
2484
|
+
if (!r) throw "[lay] 属性 dive【" + a + "】が不正です。レイヤーがありません";
|
|
2485
|
+
const c = r.back, f = r.fore, l = this.#n.getChildIndex(c.ctn), p = this.#e.getChildIndex(f.ctn);
|
|
2486
|
+
o = l < p ? l : p, o > this.#n.getChildIndex(i) && --o, this.#e.setChildIndex(n, o), this.#n.setChildIndex(i, o), this.#z();
|
|
2487
|
+
}
|
|
2488
|
+
return t[":id_tag"] = s.fore.name.slice(0, -7), this.scrItr.recodeDesign(t), s.lay(t);
|
|
2489
|
+
}
|
|
2490
|
+
#z() {
|
|
2491
|
+
this.#b = this.#S();
|
|
2492
|
+
}
|
|
2493
|
+
//MARK: レイヤ設定の消去
|
|
2494
|
+
#j(t) {
|
|
2495
|
+
return this.#L(t, (e) => {
|
|
2496
|
+
const s = this.#h[this.#G({ layer: e })];
|
|
2497
|
+
if (t.page === "both") {
|
|
2498
|
+
s.fore.clearLay(t), s.back.clearLay(t);
|
|
2499
|
+
return;
|
|
2500
|
+
}
|
|
2501
|
+
s.getPage(t).clearLay(t);
|
|
2502
|
+
}), !1;
|
|
2503
|
+
}
|
|
2504
|
+
//===================================================
|
|
2505
|
+
//MARK: WebGL フラグメントシェーダー GLSL
|
|
2506
|
+
static #H = (
|
|
2507
|
+
/* glsl */
|
|
2508
|
+
`
|
|
2509
|
+
precision mediump float;
|
|
2510
|
+
|
|
2511
|
+
varying vec2 vTextureCoord;
|
|
2512
|
+
uniform sampler2D uSampler;
|
|
2513
|
+
|
|
2514
|
+
uniform sampler2D rule;
|
|
2515
|
+
uniform float vague;
|
|
2516
|
+
uniform float tick;
|
|
2517
|
+
|
|
2518
|
+
uniform vec4 inputPixel;
|
|
2519
|
+
uniform highp vec4 outputFrame;
|
|
2520
|
+
vec2 getUV(vec2 coord) {
|
|
2521
|
+
return coord * inputPixel.xy / outputFrame.zw;
|
|
2522
|
+
}
|
|
2523
|
+
|
|
2524
|
+
void main() {
|
|
2525
|
+
vec4 fg = texture2D(uSampler, vTextureCoord);
|
|
2526
|
+
vec4 ru = texture2D(rule, getUV(vTextureCoord));
|
|
2527
|
+
|
|
2528
|
+
float v = ru.r - tick;
|
|
2529
|
+
gl_FragColor = abs(v) < vague
|
|
2530
|
+
? vec4(fg.rgb, 1) *fg.a *(0.5 +v /vague *0.5)
|
|
2531
|
+
: 0.0 <= v ? fg : vec4(0);
|
|
2532
|
+
}`
|
|
2533
|
+
);
|
|
2534
|
+
/*
|
|
2535
|
+
末尾が読みづらいが、以下のif文を消して三項演算子にしている。
|
|
2536
|
+
|
|
2537
|
+
if (abs(v) < vague) {
|
|
2538
|
+
float f_a = fg.a *(0.5 +v /vague *0.5);
|
|
2539
|
+
gl_FragColor.rgb = fg.rgb *f_a;
|
|
2540
|
+
gl_FragColor.a = f_a;
|
|
2541
|
+
return;
|
|
2542
|
+
}
|
|
2543
|
+
gl_FragColor = v >= 0.0 ? fg : vec4(0);
|
|
2544
|
+
|
|
2545
|
+
★GLSL : don't use "if"|Nobu note.com/nobuhirosaijo/n/n606a3f5d8e89
|
|
2546
|
+
> if文はあまり使わない方がいいらしい (処理負荷が高い)
|
|
2547
|
+
*/
|
|
2548
|
+
#O = tt.create({
|
|
2549
|
+
width: S.stageW,
|
|
2550
|
+
height: S.stageH
|
|
2551
|
+
});
|
|
2552
|
+
#$ = new j(this.#O);
|
|
2553
|
+
#N = tt.create({
|
|
2554
|
+
width: S.stageW,
|
|
2555
|
+
height: S.stageH
|
|
2556
|
+
});
|
|
2557
|
+
#_ = new j(this.#N);
|
|
2558
|
+
//MARK: ページ裏表を交換
|
|
2559
|
+
#W(t) {
|
|
2560
|
+
const { layer: e } = t, s = /* @__PURE__ */ new Set(), i = this.#m(e).map((_) => (s.add(_), this.#h[_].fore)), n = () => {
|
|
2561
|
+
[this.#e, this.#n] = [this.#n, this.#e];
|
|
2562
|
+
const _ = [];
|
|
2563
|
+
for (const [T, $] of Object.entries(this.#h)) {
|
|
2564
|
+
if (s.has(T)) {
|
|
2565
|
+
$.transPage(_);
|
|
2566
|
+
continue;
|
|
2567
|
+
}
|
|
2568
|
+
const { fore: { ctn: k }, back: { ctn: N } } = $, O = this.#e.getChildIndex(N);
|
|
2569
|
+
this.#e.removeChild(N), this.#n.removeChild(k), this.#e.addChildAt(k, O), this.#n.addChildAt(N, O);
|
|
2570
|
+
}
|
|
2571
|
+
Promise.allSettled(_).then(() => {
|
|
2572
|
+
this.#e.visible = !0, this.#n.visible = !1, this.#$.visible = !1, this.#_.visible = !1, F.notifyEndProc(xt + A);
|
|
2573
|
+
});
|
|
2574
|
+
};
|
|
2575
|
+
if (this.#_.filters = [], this.#_.alpha = 1, w(t, "time", 0) === 0 || this.#f.isSkipping)
|
|
2576
|
+
return F.beginProc(xt + A, () => {
|
|
2577
|
+
}), queueMicrotask(() => n()), !0;
|
|
2578
|
+
const o = [], r = this.#b.map((_) => {
|
|
2579
|
+
const { fore: T, back: $ } = this.#h[_], k = s.has(_) ? $ : T;
|
|
2580
|
+
return k.ctn.visible && o.push(k.ctn), k;
|
|
2581
|
+
}), { ticker: c, renderer: f } = this.appPixi;
|
|
2582
|
+
f.render(this.#n, { renderTexture: this.#O });
|
|
2583
|
+
let l = () => {
|
|
2584
|
+
for (const _ of o) f.render(
|
|
2585
|
+
_,
|
|
2586
|
+
{ renderTexture: this.#O, clear: !1 }
|
|
2587
|
+
);
|
|
2588
|
+
};
|
|
2589
|
+
if (!r.some((_) => _.containMovement)) {
|
|
2590
|
+
const _ = l;
|
|
2591
|
+
l = () => {
|
|
2592
|
+
l = () => {
|
|
2593
|
+
}, _();
|
|
2594
|
+
};
|
|
2595
|
+
}
|
|
2596
|
+
const p = () => f.render(this.#e, { renderTexture: this.#N });
|
|
2597
|
+
p();
|
|
2598
|
+
let d = () => {
|
|
2599
|
+
this.#e.visible = !0, p(), this.#e.visible = !1;
|
|
2600
|
+
};
|
|
2601
|
+
if (!i.some((_) => _.containMovement)) {
|
|
2602
|
+
const _ = d;
|
|
2603
|
+
d = () => {
|
|
2604
|
+
d = () => {
|
|
2605
|
+
}, _();
|
|
2606
|
+
};
|
|
2607
|
+
}
|
|
2608
|
+
const h = () => {
|
|
2609
|
+
l(), this.#$.visible = !0, d(), this.#_.visible = !0;
|
|
2610
|
+
}, { glsl: u, rule: x } = t, v = () => {
|
|
2611
|
+
c.remove(h), n();
|
|
2612
|
+
};
|
|
2613
|
+
if (!u && !x)
|
|
2614
|
+
return B.tween(A, t, this.#_, { alpha: 0 }, () => {
|
|
2615
|
+
}, v, () => {
|
|
2616
|
+
}), c.add(h), !1;
|
|
2617
|
+
const y = {
|
|
2618
|
+
rule: J.EMPTY,
|
|
2619
|
+
vague: w(t, "vague", 0.04),
|
|
2620
|
+
tick: 0
|
|
2621
|
+
};
|
|
2622
|
+
this.#_.filters = [new jt(
|
|
2623
|
+
void 0,
|
|
2624
|
+
u ?? G.#H,
|
|
2625
|
+
y
|
|
2626
|
+
)];
|
|
2627
|
+
const b = B.tween(A, t, y, { tick: 1 }, () => {
|
|
2628
|
+
}, v, () => {
|
|
2629
|
+
}, !x);
|
|
2630
|
+
return x ? new m(x, void 0, (_) => {
|
|
2631
|
+
y.rule = _.texture, _.destroy(), b.start(), c.add(h);
|
|
2632
|
+
}, (_) => {
|
|
2633
|
+
_ && this.main.resume();
|
|
2634
|
+
}).ret : (c.add(h), !1);
|
|
2635
|
+
}
|
|
2636
|
+
#m(t = "") {
|
|
2637
|
+
return t ? t.split(",") : this.#b;
|
|
2638
|
+
}
|
|
2639
|
+
#L(t, e) {
|
|
2640
|
+
const s = this.#m(t.layer);
|
|
2641
|
+
for (const i of s) {
|
|
2642
|
+
const n = this.#h[i];
|
|
2643
|
+
if (!n) throw `存在しないlayer【${i}】です`;
|
|
2644
|
+
e(i, n);
|
|
2645
|
+
}
|
|
2646
|
+
return s;
|
|
2647
|
+
}
|
|
2648
|
+
#S(t = "") {
|
|
2649
|
+
return this.#m(t).sort((e, s) => {
|
|
2650
|
+
const i = this.#e.getChildIndex(this.#h[e].fore.ctn), n = this.#e.getChildIndex(this.#h[s].fore.ctn);
|
|
2651
|
+
return i < n ? -1 : i > n ? 1 : 0;
|
|
2652
|
+
});
|
|
2653
|
+
}
|
|
2654
|
+
setAllStyle2TxtLay(t) {
|
|
2655
|
+
for (const e of this.#b) {
|
|
2656
|
+
const s = this.#h[e].fore;
|
|
2657
|
+
s instanceof P && s.lay({ style: t });
|
|
2658
|
+
}
|
|
2659
|
+
}
|
|
2660
|
+
//MARK: 画面を揺らす
|
|
2661
|
+
#M(t) {
|
|
2662
|
+
if (w(t, "time", NaN) === 0) return !1;
|
|
2663
|
+
const e = this.#m(t.layer).map((f) => this.#h[f].fore.ctn), { renderer: s, ticker: i } = this.appPixi;
|
|
2664
|
+
this.#N.resize(S.stageW, S.stageH);
|
|
2665
|
+
const n = () => {
|
|
2666
|
+
this.#e.visible = !0;
|
|
2667
|
+
for (const f of e) s.render(
|
|
2668
|
+
f,
|
|
2669
|
+
{ renderTexture: this.#N, clear: !1 }
|
|
2670
|
+
);
|
|
2671
|
+
this.#e.visible = !1;
|
|
2672
|
+
};
|
|
2673
|
+
this.#_.visible = !0, this.#_.alpha = 1;
|
|
2674
|
+
const a = V(w(t, "hmax", 10)), o = V(w(t, "vmax", 10)), r = a === 0 ? () => {
|
|
2675
|
+
} : () => {
|
|
2676
|
+
this.#_.x = Math.round(Math.random() * a * 2) - a;
|
|
2677
|
+
}, c = o === 0 ? () => {
|
|
2678
|
+
} : () => {
|
|
2679
|
+
this.#_.y = Math.round(Math.random() * o * 2) - o;
|
|
2680
|
+
};
|
|
2681
|
+
return this.#_.filters = [], B.tween(A, t, this.#_, { x: 0, y: 0 }, () => {
|
|
2682
|
+
r(), c();
|
|
2683
|
+
}, () => {
|
|
2684
|
+
i.remove(n), this.#e.visible = !0, this.#_.visible = !1, this.#_.x = 0, this.#_.y = 0;
|
|
2685
|
+
}, () => {
|
|
2686
|
+
}), i.add(n), !1;
|
|
2687
|
+
}
|
|
2688
|
+
//MARK: トゥイーン開始
|
|
2689
|
+
#R(t) {
|
|
2690
|
+
const { layer: e, render: s, name: i } = t;
|
|
2691
|
+
if (!e) throw "layerは必須です";
|
|
2692
|
+
const n = this.#h[this.#G(t)], a = n.fore;
|
|
2693
|
+
let o = () => {
|
|
2694
|
+
};
|
|
2695
|
+
s && !this.#f.isSkipping && (a.renderStart(), o = () => a.renderEnd());
|
|
2696
|
+
const r = B.cnvTweenArg(t, a), c = R(t, "arrive", !1), f = R(t, "backlay", !1), l = n.back.ctn;
|
|
2697
|
+
return B.tween(i ?? e, t, a, B.cnvTweenArg(t, a), () => {
|
|
2698
|
+
}, o, () => {
|
|
2699
|
+
if (c && Object.assign(a, r), f) for (const p of Object.keys(B.hMemberCnt)) l[p] = a[p];
|
|
2700
|
+
}), "filter" in t && (a.ctn.filters = [H.bldFilters(t)], a.aFltHArg = [t]), !1;
|
|
2701
|
+
}
|
|
2702
|
+
//MARK: フィルター追加
|
|
2703
|
+
#Q(t) {
|
|
2704
|
+
return this.#L(t, (e) => {
|
|
2705
|
+
const s = this.#h[this.#G({ layer: e })];
|
|
2706
|
+
if (t.page === "both") {
|
|
2707
|
+
this.#Y(s.fore, t), this.#Y(s.back, t);
|
|
2708
|
+
return;
|
|
2709
|
+
}
|
|
2710
|
+
const i = s.getPage(t);
|
|
2711
|
+
this.#Y(i, t);
|
|
2712
|
+
}), !1;
|
|
2713
|
+
}
|
|
2714
|
+
#Y(t, e) {
|
|
2715
|
+
const s = t.ctn;
|
|
2716
|
+
s.filters ??= [], s.filters = [...s.filters, H.bldFilters(e)], t.aFltHArg.push(e);
|
|
2717
|
+
}
|
|
2718
|
+
//MARK: フィルター全削除
|
|
2719
|
+
#U(t) {
|
|
2720
|
+
return this.#L(t, (e) => {
|
|
2721
|
+
const s = this.#h[this.#G({ layer: e })];
|
|
2722
|
+
if (t.page === "both") {
|
|
2723
|
+
const n = s.fore, a = s.back;
|
|
2724
|
+
n.ctn.filters = null, a.ctn.filters = null, n.aFltHArg = [], a.aFltHArg = [];
|
|
2725
|
+
return;
|
|
2726
|
+
}
|
|
2727
|
+
const i = s.getPage(t);
|
|
2728
|
+
i.ctn.filters = null, i.aFltHArg = [];
|
|
2729
|
+
}), !1;
|
|
2730
|
+
}
|
|
2731
|
+
//MARK: フィルター個別切替
|
|
2732
|
+
#J(t) {
|
|
2733
|
+
return this.#L(t, (e) => {
|
|
2734
|
+
const s = this.#h[this.#G({ layer: e })];
|
|
2735
|
+
if (t.page === "both") {
|
|
2736
|
+
this.#B(s.fore, t), this.#B(s.back, t);
|
|
2737
|
+
return;
|
|
2738
|
+
}
|
|
2739
|
+
const i = s.getPage(t);
|
|
2740
|
+
this.#B(i, t);
|
|
2741
|
+
}), !1;
|
|
2742
|
+
}
|
|
2743
|
+
#B(t, e) {
|
|
2744
|
+
const s = t.ctn;
|
|
2745
|
+
if (!s.filters) throw "フィルターがありません";
|
|
2746
|
+
const i = V(w(e, "index", 0)), n = s.filters.length;
|
|
2747
|
+
if (n <= i) throw `フィルターの個数(${String(n)})を越えています`;
|
|
2748
|
+
t.aFltHArg[i].enabled = s.filters[i].enabled = R(e, "enabled", !0);
|
|
2749
|
+
}
|
|
2750
|
+
// // 文字・文字レイヤ
|
|
2751
|
+
static #C = 10;
|
|
2752
|
+
static get msecChWait() {
|
|
2753
|
+
return G.#C;
|
|
2754
|
+
}
|
|
2755
|
+
//MARK: 文字を追加する
|
|
2756
|
+
#T(t) {
|
|
2757
|
+
const { text: e } = t;
|
|
2758
|
+
if (!e) throw "textは必須です";
|
|
2759
|
+
const s = this.#P(t);
|
|
2760
|
+
delete t.text, this.setNormalChWait(), this.#f.isSkipping ? t.wait = 0 : "wait" in t && w(t, "wait", NaN), this.#a("add|" + X(t), s);
|
|
2761
|
+
const i = R(t, "record", !0), n = this.val.doRecLog();
|
|
2762
|
+
return i || this.val.setVal_Nochk("save", "sn.doRecLog", i), s.tagCh(e.replaceAll("[r]", `
|
|
2763
|
+
`)), this.val.setVal_Nochk("save", "sn.doRecLog", n), this.#a("add_close|", s), !1;
|
|
2764
|
+
}
|
|
2765
|
+
#P = (t) => {
|
|
2766
|
+
throw this.#Z(), 0;
|
|
2767
|
+
};
|
|
2768
|
+
#X(t) {
|
|
2769
|
+
const e = this.#G(t, this.#E), i = this.#h[e].getPage(t);
|
|
2770
|
+
if (!(i instanceof P)) throw e + "はTxtLayerではありません";
|
|
2771
|
+
return i;
|
|
2772
|
+
}
|
|
2773
|
+
setNormalChWait() {
|
|
2774
|
+
G.#C = this.scrItr.normalWait;
|
|
2775
|
+
}
|
|
2776
|
+
//MARK: 操作対象のメッセージレイヤの指定
|
|
2777
|
+
#K = (t) => {
|
|
2778
|
+
throw this.#Z(), 0;
|
|
2779
|
+
};
|
|
2780
|
+
#q(t) {
|
|
2781
|
+
const { layer: e } = t;
|
|
2782
|
+
if (!e) throw "[current] layerは必須です";
|
|
2783
|
+
const s = this.#h[e];
|
|
2784
|
+
if (!s || !(s.getPage(t) instanceof P)) throw `${e}はTxtLayerではありません`;
|
|
2785
|
+
this.#D = s, this.#l.pagebreak(), this.#E = e, this.val.setVal_Nochk("save", "const.sn.mesLayer", e);
|
|
2786
|
+
for (const i of this.#b) {
|
|
2787
|
+
const { fore: n, back: a } = this.#h[i];
|
|
2788
|
+
n instanceof P && (n.isCur = a.isCur = i === e);
|
|
2789
|
+
}
|
|
2790
|
+
return !1;
|
|
2791
|
+
}
|
|
2792
|
+
get currentTxtlayForeNeedErr() {
|
|
2793
|
+
return this.#Z(), this.currentTxtlayFore;
|
|
2794
|
+
}
|
|
2795
|
+
get currentTxtlayFore() {
|
|
2796
|
+
return this.#D ? this.#D.fore : null;
|
|
2797
|
+
}
|
|
2798
|
+
#D = void 0;
|
|
2799
|
+
// カレントテキストレイヤ
|
|
2800
|
+
#Z = () => {
|
|
2801
|
+
throw "文字レイヤーがありません。文字表示や操作する前に、[add_lay layer=(レイヤ名) class=txt]で文字レイヤを追加して下さい";
|
|
2802
|
+
};
|
|
2803
|
+
#G(t, e = "") {
|
|
2804
|
+
const s = t.layer ?? e;
|
|
2805
|
+
if (s.includes(",")) throw "layer名に「,」は使えません";
|
|
2806
|
+
if (!(s in this.#h)) throw "属性 layer【" + s + "】が不正です。レイヤーがありません";
|
|
2807
|
+
return t.layer = s, s;
|
|
2808
|
+
}
|
|
2809
|
+
recPagebreak() {
|
|
2810
|
+
this.#l.pagebreak();
|
|
2811
|
+
}
|
|
2812
|
+
//MARK: 文字消去
|
|
2813
|
+
#A(t) {
|
|
2814
|
+
const e = this.#P(t);
|
|
2815
|
+
return t.layer === this.#E && t.page === "fore" && this.#l.pagebreak(), e.clearText(), !1;
|
|
2816
|
+
}
|
|
2817
|
+
//MARK: ハイパーリンクの終了
|
|
2818
|
+
#tt(t) {
|
|
2819
|
+
return this.#a("endlink|", this.#P(t)), !1;
|
|
2820
|
+
}
|
|
2821
|
+
//MARK: ページ両面の文字消去
|
|
2822
|
+
#et(t) {
|
|
2823
|
+
return R(t, "rec_page_break", !0) && this.#l.pagebreak(), this.#D && (this.#D.fore.clearLay(t), this.#D.back.clearLay(t)), !1;
|
|
2824
|
+
}
|
|
2825
|
+
//MARK: インライン画像表示
|
|
2826
|
+
#st(t) {
|
|
2827
|
+
if (!t.pic) throw "[graph] picは必須です";
|
|
2828
|
+
return this.#a("grp|" + X(t), this.#P(t)), !1;
|
|
2829
|
+
}
|
|
2830
|
+
//MARK: ハイパーリンク
|
|
2831
|
+
#it(t) {
|
|
2832
|
+
if (!t.fn && !t.label && !t.url) throw "fn,label,url いずれかは必須です";
|
|
2833
|
+
return t.fn ??= this.scrItr.scriptFn, t.style ??= "background-color: rgba(255,0,0,0.5);", t.style_hover ??= "background-color: rgba(255,0,0,0.9);", t.style_clicked ??= t.style, this.#a("link|" + X(t), this.#P(t)), !1;
|
|
2834
|
+
}
|
|
2835
|
+
//MARK: 改行
|
|
2836
|
+
#nt(t) {
|
|
2837
|
+
return this.#T({ ...t, text: `
|
|
2838
|
+
` });
|
|
2839
|
+
}
|
|
2840
|
+
//MARK: 文字列と複数ルビの追加
|
|
2841
|
+
#at(t) {
|
|
2842
|
+
const { t: e, r: s } = t;
|
|
2843
|
+
if (!e) throw "[ruby2] tは必須です";
|
|
2844
|
+
if (!s) throw "[ruby2] rは必須です";
|
|
2845
|
+
return t.text = "|" + encodeURIComponent(e) + "《" + encodeURIComponent(s) + "》", delete t.t, delete t.r, this.#T(t);
|
|
2846
|
+
}
|
|
2847
|
+
//MARK: インラインスタイル設定
|
|
2848
|
+
#ot(t) {
|
|
2849
|
+
return this.#a("span|" + X(t), this.#P(t)), !1;
|
|
2850
|
+
}
|
|
2851
|
+
//MARK: tcy縦中横を表示する
|
|
2852
|
+
#rt(t) {
|
|
2853
|
+
if (!t.t) throw "[tcy] tは必須です";
|
|
2854
|
+
return this.#a("tcy|" + X(t), this.#P(t)), !1;
|
|
2855
|
+
}
|
|
2856
|
+
//MARK: レイヤのダンプ
|
|
2857
|
+
#ht({ layer: t }) {
|
|
2858
|
+
console.group("🥟 [dump_lay]");
|
|
2859
|
+
for (const e of this.#m(t)) {
|
|
2860
|
+
const { fore: s, back: i } = this.#h[e];
|
|
2861
|
+
try {
|
|
2862
|
+
console.info(
|
|
2863
|
+
`%c${s.name.slice(0, -7)} %o`,
|
|
2864
|
+
`color:#${S.isDarkMode ? "49F" : "05A"};`,
|
|
2865
|
+
JSON.parse(`{"back":{${i.dump()}}, "fore":{${s.dump()}}}`)
|
|
2866
|
+
);
|
|
2867
|
+
} catch (n) {
|
|
2868
|
+
console.error("dump_lay err:%o", n), console.error(` back:${i.dump()}`), console.error(` fore:${s.dump()}`);
|
|
2869
|
+
}
|
|
2870
|
+
}
|
|
2871
|
+
return console.groupEnd(), !1;
|
|
2872
|
+
}
|
|
2873
|
+
//MARK: イベント有無の切替
|
|
2874
|
+
#lt(t) {
|
|
2875
|
+
const e = this.#G(t, this.#E), s = R(t, "enabled", !0);
|
|
2876
|
+
return this.#P(t).enabled = s, this.val.setVal_Nochk("save", "const.sn.layer." + e + ".enabled", s), !1;
|
|
2877
|
+
}
|
|
2878
|
+
//MARK: ボタンを表示
|
|
2879
|
+
#ct(t) {
|
|
2880
|
+
return et.argChk_page(t, "back"), t.fn ??= this.scrItr.scriptFn, this.#P(t).addButton(t), this.scrItr.recodeDesign(t), !1;
|
|
2881
|
+
}
|
|
2882
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2883
|
+
record() {
|
|
2884
|
+
const t = {};
|
|
2885
|
+
for (const e of this.#b) {
|
|
2886
|
+
const s = this.#h[e];
|
|
2887
|
+
t[e] = {
|
|
2888
|
+
cls: s.cls,
|
|
2889
|
+
fore: s.fore.record(),
|
|
2890
|
+
back: s.back.record()
|
|
2891
|
+
};
|
|
2892
|
+
}
|
|
2893
|
+
return t;
|
|
2894
|
+
}
|
|
2895
|
+
playback(t) {
|
|
2896
|
+
this.#l.playback();
|
|
2897
|
+
const e = [], s = [];
|
|
2898
|
+
for (const [n, { fore: a, fore: { idx: o }, back: r, cls: c }] of Object.entries(t)) {
|
|
2899
|
+
s.push({ ln: n, idx: o });
|
|
2900
|
+
const f = this.#h[n] ??= new et(n, c, this.#e, this.#n, {}, this.sys, this.val, { isWait: !1 });
|
|
2901
|
+
f.fore.playback(a, e), f.back.playback(r, e);
|
|
2902
|
+
}
|
|
2903
|
+
const i = this.#e.children.length;
|
|
2904
|
+
return e.push(new Promise((n) => {
|
|
2905
|
+
for (const { ln: a, idx: o } of s.sort(({ idx: r }, { idx: c }) => r === c ? 0 : r < c ? -1 : 1)) {
|
|
2906
|
+
const r = this.#h[a];
|
|
2907
|
+
if (!r) continue;
|
|
2908
|
+
const c = i > o ? o : i - 1, { fore: f, back: l } = r;
|
|
2909
|
+
this.#e.setChildIndex(f.ctn, c), this.#n.setChildIndex(l.ctn, c);
|
|
2910
|
+
}
|
|
2911
|
+
n();
|
|
2912
|
+
})), e;
|
|
2913
|
+
}
|
|
2914
|
+
}
|
|
2915
|
+
const Zt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2916
|
+
__proto__: null,
|
|
2917
|
+
LayerMng: G
|
|
2918
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
2919
|
+
export {
|
|
2920
|
+
z as B,
|
|
2921
|
+
Zt as L,
|
|
2922
|
+
P as T
|
|
2923
|
+
};
|
|
2924
|
+
//# sourceMappingURL=LayerMng.js.map
|