@kkarum/framework 2.3.20 → 2.3.21
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/docs/FRAMEWORK_USAGE.md +41 -28
- package/package.json +1 -1
package/docs/FRAMEWORK_USAGE.md
CHANGED
|
@@ -55,9 +55,9 @@ assets/<bundle>/
|
|
|
55
55
|
config/<Bundle>AssetConfig.ts
|
|
56
56
|
data/<Bundle>Data.ts
|
|
57
57
|
logic/<Bundle>Logic.ts
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
<Bundle>Registry.ts
|
|
59
|
+
controller/<Feature>/<Feature>LayerController.ts
|
|
60
|
+
res/layer/<Feature>Layer.prefab
|
|
61
61
|
```
|
|
62
62
|
|
|
63
63
|
注册类示例:
|
|
@@ -181,7 +181,9 @@ export class ShopLayerController extends FW.LayerController {
|
|
|
181
181
|
isRepeatOpen = false;
|
|
182
182
|
|
|
183
183
|
get layerAssetProperty(): FW.AssetProperty {
|
|
184
|
-
return this.getConfig<ShopAssetConfig>().preLoad.prefab[
|
|
184
|
+
return this.getConfig<ShopAssetConfig>().preLoad.prefab[
|
|
185
|
+
"ShopLayer"
|
|
186
|
+
] as FW.AssetProperty;
|
|
185
187
|
}
|
|
186
188
|
|
|
187
189
|
onInit(args?: { tab?: string }) {
|
|
@@ -238,17 +240,21 @@ this.fw("SHOP_GOODS_CHANGED", this.renderGoods);
|
|
|
238
240
|
|
|
239
241
|
```ts
|
|
240
242
|
this.registerEvent({
|
|
241
|
-
CCEvent: [
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
243
|
+
CCEvent: [
|
|
244
|
+
{
|
|
245
|
+
target: buyButton,
|
|
246
|
+
eventName: cc.Node.EventType.TOUCH_END,
|
|
247
|
+
responseInterval: 500,
|
|
248
|
+
cb: this.onBuyClick,
|
|
249
|
+
},
|
|
250
|
+
],
|
|
251
|
+
FWEvent: [
|
|
252
|
+
{
|
|
253
|
+
eventName: "SHOP_REFRESH",
|
|
254
|
+
responseInterval: 200,
|
|
255
|
+
cb: this.onRefresh,
|
|
256
|
+
},
|
|
257
|
+
],
|
|
252
258
|
});
|
|
253
259
|
```
|
|
254
260
|
|
|
@@ -257,9 +263,13 @@ this.registerEvent({
|
|
|
257
263
|
## 定时器
|
|
258
264
|
|
|
259
265
|
```ts
|
|
260
|
-
const schedule = FW.Entry.timeMgr.scheduleOnce(
|
|
261
|
-
|
|
262
|
-
|
|
266
|
+
const schedule = FW.Entry.timeMgr.scheduleOnce(
|
|
267
|
+
() => {
|
|
268
|
+
this.refreshGoods();
|
|
269
|
+
},
|
|
270
|
+
1,
|
|
271
|
+
this,
|
|
272
|
+
);
|
|
263
273
|
|
|
264
274
|
FW.Entry.timeMgr.schedule(
|
|
265
275
|
() => this.tick(),
|
|
@@ -277,16 +287,19 @@ FW.Entry.timeMgr.unSchedule(this);
|
|
|
277
287
|
## Promise
|
|
278
288
|
|
|
279
289
|
```ts
|
|
280
|
-
const proxy = FW.Entry.promiseMgr.execute<string>(
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
+
const proxy = FW.Entry.promiseMgr.execute<string>(
|
|
291
|
+
(resolve, reject, signal) => {
|
|
292
|
+
// 异步操作
|
|
293
|
+
signal.addEventListener("abort", () => {
|
|
294
|
+
// 清理
|
|
295
|
+
});
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
timeout: 10000,
|
|
299
|
+
retryCount: 3,
|
|
300
|
+
retryInterval: 2,
|
|
301
|
+
},
|
|
302
|
+
);
|
|
290
303
|
|
|
291
304
|
const result = await proxy.promise;
|
|
292
305
|
```
|