hzengine-core 0.1.2-dev → 0.1.3
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/dist/async/index.js +150 -162
- package/dist/audio/index.js +249 -260
- package/dist/config/index.js +57 -57
- package/dist/debug/index.js +9 -8
- package/dist/index.js +108 -103
- package/dist/plugins/basic_command/img.js +247 -249
- package/dist/plugins/basic_command/menu.js +140 -140
- package/dist/plugins/transform/animation.js +430 -440
- package/dist/plugins/transform/hz_anime.js +196 -211
- package/dist/plugins/transform/index.js +94 -93
- package/dist/script/index.js +537 -537
- package/dist/storage/index.js +447 -440
- package/dist/system/index.js +131 -144
- package/dist/ui/index.js +525 -535
- package/package.json +1 -1
- package/src/platform/index.ts +14 -12
- package/src/plugins/transform/animation.ts +1 -1
- package/src/script/index.ts +13 -0
- package/src/storage/index.ts +47 -47
- package/tsconfig.json +1 -1
- package/types/platform/index.d.ts +137 -134
- package/types/script/index.d.ts +129 -123
- package/types/script/strtools.d.ts +31 -31
package/dist/system/index.js
CHANGED
|
@@ -1,144 +1,131 @@
|
|
|
1
|
-
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
2
|
-
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
3
|
-
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
4
|
-
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
5
|
-
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
6
|
-
var _, done = false;
|
|
7
|
-
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
8
|
-
var context = {};
|
|
9
|
-
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
10
|
-
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
11
|
-
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
12
|
-
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
13
|
-
if (kind === "accessor") {
|
|
14
|
-
if (result === void 0) continue;
|
|
15
|
-
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
16
|
-
if (_ = accept(result.get)) descriptor.get = _;
|
|
17
|
-
if (_ = accept(result.set)) descriptor.set = _;
|
|
18
|
-
if (_ = accept(result.init)) initializers.unshift(_);
|
|
19
|
-
}
|
|
20
|
-
else if (_ = accept(result)) {
|
|
21
|
-
if (kind === "field") initializers.unshift(_);
|
|
22
|
-
else descriptor[key] = _;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
26
|
-
done = true;
|
|
27
|
-
};
|
|
28
|
-
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
29
|
-
var useValue = arguments.length > 2;
|
|
30
|
-
for (var i = 0; i < initializers.length; i++) {
|
|
31
|
-
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
32
|
-
}
|
|
33
|
-
return useValue ? value : void 0;
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
})(),
|
|
133
|
-
_a;
|
|
134
|
-
})();
|
|
135
|
-
export { System };
|
|
136
|
-
(function (System) {
|
|
137
|
-
let Condition;
|
|
138
|
-
(function (Condition) {
|
|
139
|
-
Condition[Condition["Free"] = 0] = "Free";
|
|
140
|
-
Condition[Condition["Pause"] = 1] = "Pause";
|
|
141
|
-
Condition[Condition["Blocked"] = 2] = "Blocked";
|
|
142
|
-
Condition[Condition["Gaming"] = 3] = "Gaming";
|
|
143
|
-
})(Condition = System.Condition || (System.Condition = {}));
|
|
144
|
-
})(System || (System = {}));
|
|
1
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
2
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
3
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
4
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
5
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
6
|
+
var _, done = false;
|
|
7
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
8
|
+
var context = {};
|
|
9
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
10
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
11
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
12
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
13
|
+
if (kind === "accessor") {
|
|
14
|
+
if (result === void 0) continue;
|
|
15
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
16
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
17
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
18
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
19
|
+
}
|
|
20
|
+
else if (_ = accept(result)) {
|
|
21
|
+
if (kind === "field") initializers.unshift(_);
|
|
22
|
+
else descriptor[key] = _;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
26
|
+
done = true;
|
|
27
|
+
};
|
|
28
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
29
|
+
var useValue = arguments.length > 2;
|
|
30
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
31
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
32
|
+
}
|
|
33
|
+
return useValue ? value : void 0;
|
|
34
|
+
};
|
|
35
|
+
import { Save } from "../storage/decorator.js";
|
|
36
|
+
let System = (() => {
|
|
37
|
+
let _condition_decorators;
|
|
38
|
+
let _condition_initializers = [];
|
|
39
|
+
let _condition_extraInitializers = [];
|
|
40
|
+
return class System {
|
|
41
|
+
static {
|
|
42
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
43
|
+
_condition_decorators = [Save("system.condition")];
|
|
44
|
+
__esDecorate(this, null, _condition_decorators, { kind: "accessor", name: "condition", static: false, private: false, access: { has: obj => "condition" in obj, get: obj => obj.condition, set: (obj, value) => { obj.condition = value; } }, metadata: _metadata }, _condition_initializers, _condition_extraInitializers);
|
|
45
|
+
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
46
|
+
}
|
|
47
|
+
_core;
|
|
48
|
+
constructor(_core) {
|
|
49
|
+
this._core = _core;
|
|
50
|
+
_core.on("system.continue", () => {
|
|
51
|
+
this._pauseTimer = null;
|
|
52
|
+
this.continue();
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
#condition_accessor_storage = __runInitializers(this, _condition_initializers, System.Condition.Free);
|
|
56
|
+
get condition() { return this.#condition_accessor_storage; }
|
|
57
|
+
set condition(value) { this.#condition_accessor_storage = value; }
|
|
58
|
+
_pauseTimer = (__runInitializers(this, _condition_extraInitializers), null);
|
|
59
|
+
/**
|
|
60
|
+
* 暂停(可指定一段时间)
|
|
61
|
+
* 后调用的会覆盖之前pause的设定时间
|
|
62
|
+
* @param delayMs
|
|
63
|
+
*/
|
|
64
|
+
pause(delayMs) {
|
|
65
|
+
this._core.debug.log(`Pause`);
|
|
66
|
+
if (this.condition === System.Condition.Gaming) {
|
|
67
|
+
this.condition = System.Condition.Pause;
|
|
68
|
+
}
|
|
69
|
+
else
|
|
70
|
+
throw `pause but condition error (todo)`; // TODO
|
|
71
|
+
if (this._pauseTimer) {
|
|
72
|
+
this._core.async.removeTask(this._pauseTimer);
|
|
73
|
+
this._pauseTimer = null;
|
|
74
|
+
}
|
|
75
|
+
if (delayMs !== undefined) {
|
|
76
|
+
this._pauseTimer = this._core.async.addDelayTask("system.continue", [], delayMs);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* 继续由于pause中断的游戏
|
|
81
|
+
*/
|
|
82
|
+
continue() {
|
|
83
|
+
if (this.condition !== System.Condition.Pause)
|
|
84
|
+
return;
|
|
85
|
+
this.condition = System.Condition.Gaming;
|
|
86
|
+
this.run();
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* 阻塞
|
|
90
|
+
*/
|
|
91
|
+
block() {
|
|
92
|
+
if (this.condition !== System.Condition.Gaming)
|
|
93
|
+
throw `block but condition error (todo)`;
|
|
94
|
+
this.condition = System.Condition.Blocked;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* 取消阻塞
|
|
98
|
+
*/
|
|
99
|
+
unBlock() {
|
|
100
|
+
if (this.condition !== System.Condition.Blocked)
|
|
101
|
+
return;
|
|
102
|
+
this.condition = System.Condition.Gaming;
|
|
103
|
+
this.run();
|
|
104
|
+
}
|
|
105
|
+
run() {
|
|
106
|
+
this.condition = System.Condition.Gaming;
|
|
107
|
+
while (this.condition === System.Condition.Gaming) {
|
|
108
|
+
// console.log("Run Single Line");
|
|
109
|
+
this._core.script.runSingleLine();
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
start(initLabel = "start") {
|
|
113
|
+
// 初始化存档
|
|
114
|
+
this._core.storage.archiveData;
|
|
115
|
+
this._core.debug.log("Game Start");
|
|
116
|
+
this._core.script.clear();
|
|
117
|
+
this._core.script.jumpLabel(initLabel);
|
|
118
|
+
this.run();
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
})();
|
|
122
|
+
export { System };
|
|
123
|
+
(function (System) {
|
|
124
|
+
let Condition;
|
|
125
|
+
(function (Condition) {
|
|
126
|
+
Condition[Condition["Free"] = 0] = "Free";
|
|
127
|
+
Condition[Condition["Pause"] = 1] = "Pause";
|
|
128
|
+
Condition[Condition["Blocked"] = 2] = "Blocked";
|
|
129
|
+
Condition[Condition["Gaming"] = 3] = "Gaming";
|
|
130
|
+
})(Condition = System.Condition || (System.Condition = {}));
|
|
131
|
+
})(System || (System = {}));
|