@ives_xxz/framework 2.0.0 → 2.0.2
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/FrameworkAutoInitialize.ts +1 -0
- package/FrameworkBase.ts +11 -13
- package/package.json +1 -1
- package/scene/FWScene.ts +1 -1
- package/types/FW.d.ts +9 -6
|
@@ -45,6 +45,7 @@ export function autoInitialize() {
|
|
|
45
45
|
FW.Framework = new (require('./Framework').Framework)();
|
|
46
46
|
FW.FrameworkBase = require('./FrameworkBase').FrameworkBase;
|
|
47
47
|
FW.Entry = new (require('./entry/FWEntry').FWEntry)();
|
|
48
|
+
FW.Scene = require('./scene/FWScene').FWScene;
|
|
48
49
|
FW.Logic = require('./logic/FWLogic').FWLogic;
|
|
49
50
|
FW.Data = require('./data/FWData').FWData;
|
|
50
51
|
FW.Sender = require('./service/socket/FWSocketSender').FWSocketSender;
|
package/FrameworkBase.ts
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { injectable } from 'inversify';
|
|
2
|
-
import FWLogic from './logic/FWLogic';
|
|
3
|
-
import FWData from './data/FWData';
|
|
4
2
|
|
|
5
3
|
@injectable()
|
|
6
4
|
export abstract class FrameworkBase {
|
|
7
5
|
public logic?: FW.Logic;
|
|
8
6
|
public data?: FW.Data;
|
|
9
|
-
public config?: FW.
|
|
10
|
-
public sender?: FW.
|
|
11
|
-
public handle?: FW.
|
|
7
|
+
public config?: FW.AssetConfig;
|
|
8
|
+
public sender?: FW.Sender;
|
|
9
|
+
public handle?: FW.Handle;
|
|
12
10
|
private dependenciesInjected: boolean = false;
|
|
13
11
|
private isInitialized: boolean = false;
|
|
14
12
|
protected abstract initialize?(): void;
|
|
@@ -27,23 +25,23 @@ export abstract class FrameworkBase {
|
|
|
27
25
|
return this.constructor.name;
|
|
28
26
|
}
|
|
29
27
|
|
|
30
|
-
public getLogic<T extends FW.Logic =
|
|
28
|
+
public getLogic<T extends FW.Logic = FW.Logic>() {
|
|
31
29
|
return this.logic as T;
|
|
32
30
|
}
|
|
33
31
|
|
|
34
|
-
public getData<T extends FW.Data =
|
|
32
|
+
public getData<T extends FW.Data = FW.Data>() {
|
|
35
33
|
return this.data as T;
|
|
36
34
|
}
|
|
37
35
|
|
|
38
|
-
public getSender<T extends FW.
|
|
36
|
+
public getSender<T extends FW.Sender>() {
|
|
39
37
|
return this.sender as T;
|
|
40
38
|
}
|
|
41
39
|
|
|
42
|
-
public getHandle<T extends FW.
|
|
40
|
+
public getHandle<T extends FW.Handle>() {
|
|
43
41
|
return this.handle as T;
|
|
44
42
|
}
|
|
45
43
|
|
|
46
|
-
public getConfig<T extends FW.
|
|
44
|
+
public getConfig<T extends FW.AssetConfig>() {
|
|
47
45
|
return this.config as T;
|
|
48
46
|
}
|
|
49
47
|
|
|
@@ -71,19 +69,19 @@ export abstract class FrameworkBase {
|
|
|
71
69
|
}
|
|
72
70
|
|
|
73
71
|
if (tag !== FW.SystemDefine.FWBindTag.CONFIG) {
|
|
74
|
-
this.config = FW.Framework.getComponent<FW.
|
|
72
|
+
this.config = FW.Framework.getComponent<FW.AssetConfig>(
|
|
75
73
|
`${bundleName}${FW.SystemDefine.FWBindTag.CONFIG}`,
|
|
76
74
|
);
|
|
77
75
|
}
|
|
78
76
|
|
|
79
77
|
if (tag !== FW.SystemDefine.FWBindTag.SENDER) {
|
|
80
|
-
this.sender = FW.Framework.getComponent<FW.
|
|
78
|
+
this.sender = FW.Framework.getComponent<FW.Sender>(
|
|
81
79
|
`${bundleName}${FW.SystemDefine.FWBindTag.SENDER}`,
|
|
82
80
|
);
|
|
83
81
|
}
|
|
84
82
|
|
|
85
83
|
if (tag !== FW.SystemDefine.FWBindTag.HANDLE) {
|
|
86
|
-
this.handle = FW.Framework.getComponent<FW.
|
|
84
|
+
this.handle = FW.Framework.getComponent<FW.Handle>(
|
|
87
85
|
`${bundleName}${FW.SystemDefine.FWBindTag.HANDLE}`,
|
|
88
86
|
);
|
|
89
87
|
}
|
package/package.json
CHANGED
package/scene/FWScene.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { FWSocketAutoProcessResume } from '../expand/FWDecorator';
|
|
|
3
3
|
const { ccclass, property } = cc._decorator;
|
|
4
4
|
|
|
5
5
|
@ccclass
|
|
6
|
-
export
|
|
6
|
+
export abstract class FWScene extends cc.Component {
|
|
7
7
|
readonly entry: FW.Entry = FW.Entry;
|
|
8
8
|
|
|
9
9
|
@FWSocketAutoProcessResume()
|
package/types/FW.d.ts
CHANGED
|
@@ -98,10 +98,6 @@ declare namespace FW {
|
|
|
98
98
|
bindVirtualViewComponent(args: FW.VirtualViewComponentArgs);
|
|
99
99
|
};
|
|
100
100
|
|
|
101
|
-
type Scene = {
|
|
102
|
-
node: cc.Node;
|
|
103
|
-
};
|
|
104
|
-
|
|
105
101
|
type ObjectManager = {
|
|
106
102
|
/** 创建一个对象池 */
|
|
107
103
|
createObjectPool<T extends FWObject = FWObject>(
|
|
@@ -2258,6 +2254,13 @@ declare namespace FW {
|
|
|
2258
2254
|
|
|
2259
2255
|
declare namespace FW {
|
|
2260
2256
|
export const SystemConfig;
|
|
2257
|
+
|
|
2258
|
+
export class Scene extends cc.Component {
|
|
2259
|
+
onLoad(): void;
|
|
2260
|
+
update(dt: number);
|
|
2261
|
+
onDestroy(): void;
|
|
2262
|
+
}
|
|
2263
|
+
|
|
2261
2264
|
export class Logic extends FrameworkBase {
|
|
2262
2265
|
public initialize?(): void;
|
|
2263
2266
|
public onDestroy?(): void;
|
|
@@ -2278,8 +2281,8 @@ declare namespace FW {
|
|
|
2278
2281
|
onDestroy?();
|
|
2279
2282
|
sendHeart();
|
|
2280
2283
|
onHeart?(msg: any): Promise<boolean>;
|
|
2281
|
-
|
|
2282
|
-
|
|
2284
|
+
onBeforeSendingMessage?(msg: any): Promise<FW.SocketMessage>;
|
|
2285
|
+
getProtocolKey?(msg: any): string;
|
|
2283
2286
|
send(msg: any);
|
|
2284
2287
|
}
|
|
2285
2288
|
|