@ives_xxz/framework 1.6.5 → 2.0.0
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/Framework.ts +9 -13
- package/FrameworkAutoInitialize.ts +58 -0
- package/{CC.d.ts.meta → FrameworkAutoInitialize.ts.meta} +1 -1
- package/FrameworkBase.ts +24 -23
- package/animation/FWSkeleton.ts +5 -6
- package/component/FWVirtualViewComponent.ts +42 -45
- package/config/FWAssetConfig.ts +2 -2
- package/controller/FWLayerController.ts +3 -7
- package/data/FWData.ts +2 -3
- package/define/FWEventDefine.ts +24 -21
- package/define/FWSystemDefine.ts +127 -132
- package/define/FWSystemDefine.ts.meta +1 -1
- package/entry/FWEntry.ts +2 -3
- package/expand/FWDecorator.ts +56 -114
- package/expand/FWRollingViewNesting.ts +3 -5
- package/item/FWVirtualListItem.ts +1 -1
- package/language/FWLanguage.ts +15 -19
- package/layer/FWLayer.ts +1 -1
- package/log/FWLog.ts +30 -35
- package/logic/FWLogic.ts +2 -4
- package/machine/FWStateMachine.ts +1 -2
- package/manager/FWAnimationManager.ts +6 -8
- package/manager/FWAssetManager.ts +22 -23
- package/manager/FWAudioManager.ts +30 -52
- package/manager/FWBundleManager.ts +2 -4
- package/manager/FWComponentManager.ts +0 -1
- package/manager/FWEngineManager.ts +10 -14
- package/manager/FWEventManager.ts +4 -7
- package/manager/FWHotUpdateManager.ts +32 -33
- package/manager/FWLanguageManager.ts +1 -2
- package/manager/FWLayerManager.ts +88 -138
- package/manager/FWManager.ts +1 -3
- package/manager/FWObjectManager.ts +7 -9
- package/manager/FWPerformanceManager.ts +2 -3
- package/manager/FWPromiseManager.ts +29 -28
- package/manager/FWResManager.ts +1 -3
- package/manager/FWSocketManager.ts +2 -5
- package/manager/FWStateManager.ts +2 -4
- package/manager/FWTimeManager.ts +14 -15
- package/manager/FWUiManager.ts +3 -4
- package/package.json +1 -1
- package/{register → registry}/FWRegistry.ts +8 -8
- package/service/http/FWHttp.ts +5 -7
- package/service/socket/FWSocket.ts +28 -43
- package/service/socket/FWSocketHandle.ts +3 -6
- package/service/socket/FWSocketSender.ts +5 -9
- package/types/Creator.d.ts.meta +6 -0
- package/{FW.d.ts → types/FW.d.ts} +407 -153
- package/types/Global.d.ts +21 -0
- package/{render/FWAssembler.ts.meta → types/Global.d.ts.meta} +1 -1
- package/types.meta +13 -0
- package/utils/FWObjectPool.ts +5 -7
- package/utils/FWTask.ts +18 -22
- package/render/FWAssembler.ts +0 -11
- /package/{register → registry}/FWRegistry.ts.meta +0 -0
- /package/{register.meta → registry.meta} +0 -0
- /package/{CC.d.ts → types/Creator.d.ts} +0 -0
- /package/{FW.d.ts.meta → types/FW.d.ts.meta} +0 -0
package/Framework.ts
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import 'reflect-metadata';
|
|
2
2
|
import { Container, interfaces } from 'inversify';
|
|
3
|
-
import { FWSystemDefine } from './define/FWSystemDefine';
|
|
4
|
-
import FWLog from './log/FWLog';
|
|
5
|
-
import { FWEventDefine } from './define/FWEventDefine';
|
|
6
|
-
import { FrameworkBase } from './FrameworkBase';
|
|
7
3
|
|
|
8
4
|
export class Framework implements FW.Framework {
|
|
9
5
|
private container: Container;
|
|
@@ -37,11 +33,11 @@ export class Framework implements FW.Framework {
|
|
|
37
33
|
}
|
|
38
34
|
|
|
39
35
|
const suffixMap = {
|
|
40
|
-
Logic:
|
|
41
|
-
Data:
|
|
42
|
-
Config:
|
|
43
|
-
Sender:
|
|
44
|
-
Handle:
|
|
36
|
+
Logic: FW.SystemDefine.FWBindTag.LOGIC,
|
|
37
|
+
Data: FW.SystemDefine.FWBindTag.DATA,
|
|
38
|
+
Config: FW.SystemDefine.FWBindTag.CONFIG,
|
|
39
|
+
Sender: FW.SystemDefine.FWBindTag.SENDER,
|
|
40
|
+
Handle: FW.SystemDefine.FWBindTag.HANDLE,
|
|
45
41
|
};
|
|
46
42
|
|
|
47
43
|
const [suffix] = Object.entries(suffixMap).find(([key]) => className.endsWith(key)) || [];
|
|
@@ -151,10 +147,10 @@ export class Framework implements FW.Framework {
|
|
|
151
147
|
classes.forEach((cls) => {
|
|
152
148
|
if (cls && this.container.isBound(cls)) {
|
|
153
149
|
try {
|
|
154
|
-
const instance = this.container.get(cls) as FrameworkBase;
|
|
150
|
+
const instance = this.container.get(cls) as FW.FrameworkBase;
|
|
155
151
|
instance?.initializeDependencies?.();
|
|
156
152
|
} catch (error) {
|
|
157
|
-
|
|
153
|
+
FW.Log.warn(`Error initializing dependencies for ${cls.name}:`, error);
|
|
158
154
|
}
|
|
159
155
|
}
|
|
160
156
|
});
|
|
@@ -239,7 +235,7 @@ export class Framework implements FW.Framework {
|
|
|
239
235
|
instance?.['onDestroy']?.();
|
|
240
236
|
}
|
|
241
237
|
} catch (e) {
|
|
242
|
-
|
|
238
|
+
FW.Log.warn(`Error destroying component ${key}:`, e);
|
|
243
239
|
}
|
|
244
240
|
}
|
|
245
241
|
}
|
|
@@ -261,7 +257,7 @@ export class Framework implements FW.Framework {
|
|
|
261
257
|
return new Map(this.registeredComponents);
|
|
262
258
|
}
|
|
263
259
|
|
|
264
|
-
private getKey(bundleName: string, tag:
|
|
260
|
+
private getKey(bundleName: string, tag: FW.SystemDefine.FWBindTag) {
|
|
265
261
|
return `${bundleName}${tag}`;
|
|
266
262
|
}
|
|
267
263
|
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export function autoInitialize() {
|
|
2
|
+
const WD = window as any;
|
|
3
|
+
const SD = require('./define/FWSystemDefine');
|
|
4
|
+
const ED = require('./define/FWEventDefine');
|
|
5
|
+
WD.FW = {};
|
|
6
|
+
|
|
7
|
+
globalThis.FWPropertyNode = require('./expand/FWDecorator').FWPropertyNode;
|
|
8
|
+
globalThis.searchChild = require('./expand/FWDecorator').searchChild;
|
|
9
|
+
globalThis.FWPropertyNode = require('./expand/FWDecorator').FWPropertyNode;
|
|
10
|
+
globalThis.FWPropertyNodes = require('./expand/FWDecorator').FWPropertyNodes;
|
|
11
|
+
globalThis.FWPropertyComponent = require('./expand/FWDecorator').FWPropertyComponent;
|
|
12
|
+
globalThis.FWPropertyComponents = require('./expand/FWDecorator').FWPropertyComponents;
|
|
13
|
+
globalThis.PerformanceMonitor = require('./expand/FWDecorator').PerformanceMonitor;
|
|
14
|
+
globalThis.FWDeprecated = require('./expand/FWDecorator').FWDeprecated;
|
|
15
|
+
globalThis.FWSocketAutoProcessPause = require('./expand/FWDecorator').FWSocketAutoProcessPause;
|
|
16
|
+
globalThis.FWSocketAutoProcessResume = require('./expand/FWDecorator').FWSocketAutoProcessResume;
|
|
17
|
+
globalThis.RegisterEvents = require('./expand/FWDecorator').RegisterEvents;
|
|
18
|
+
globalThis.AutoRegisterCCEvent = require('./expand/FWDecorator').AutoRegisterCCEvent;
|
|
19
|
+
globalThis.AutoRegisterFWEvent = require('./expand/FWDecorator').AutoRegisterFWEvent;
|
|
20
|
+
|
|
21
|
+
(FW.SystemDefine as any) = {};
|
|
22
|
+
(FW.EventDefine as any) = {};
|
|
23
|
+
|
|
24
|
+
FW.EventDefine.CCEvent = new ED.CCEvent();
|
|
25
|
+
FW.EventDefine.LanguageEvent = new ED.LanguageEvent();
|
|
26
|
+
FW.EventDefine.SystemEvent = new ED.SystemEvent();
|
|
27
|
+
FW.EventDefine.TaskEvent = new ED.TaskEvent();
|
|
28
|
+
FW.SystemDefine.FWBindTag = new SD.FWBindTag();
|
|
29
|
+
FW.SystemDefine.FWObjectType = new SD.FWObjectType();
|
|
30
|
+
FW.SystemDefine.FWLayerRenderOrder = new SD.FWLayerRenderOrder();
|
|
31
|
+
FW.SystemDefine.FWLayerType = new SD.FWLayerType();
|
|
32
|
+
FW.SystemDefine.FWTaskStatus = new SD.FWTaskStatus();
|
|
33
|
+
FW.SystemDefine.FWPriorityOrder = new SD.FWPriorityOrder();
|
|
34
|
+
FW.SystemDefine.FWLogType = new SD.FWLogType();
|
|
35
|
+
FW.SystemDefine.FWHttpRequestType = new SD.FWHttpRequestType();
|
|
36
|
+
FW.SystemDefine.FWAnimationMachineType = new SD.FWAnimationMachineType();
|
|
37
|
+
FW.SystemDefine.FWScrollViewTemplateType = new SD.FWScrollViewTemplateType();
|
|
38
|
+
FW.SystemDefine.FWScrollViewSlideType = new SD.FWScrollViewSlideType();
|
|
39
|
+
FW.SystemDefine.FWScrollViewSelectedType = new SD.FWScrollViewSelectedType();
|
|
40
|
+
FW.SystemDefine.FWLanguageAssetType = new SD.FWLanguageAssetType();
|
|
41
|
+
FW.SystemDefine.FWPromiseStatus = new SD.FWPromiseStatus();
|
|
42
|
+
FW.SystemDefine.FWLayerState = new SD.FWLayerState();
|
|
43
|
+
FW.SystemDefine.FWAudioType = new SD.FWAudioType();
|
|
44
|
+
FW.Registry = require('./registry/FWRegistry').FWRegistry;
|
|
45
|
+
FW.Framework = new (require('./Framework').Framework)();
|
|
46
|
+
FW.FrameworkBase = require('./FrameworkBase').FrameworkBase;
|
|
47
|
+
FW.Entry = new (require('./entry/FWEntry').FWEntry)();
|
|
48
|
+
FW.Logic = require('./logic/FWLogic').FWLogic;
|
|
49
|
+
FW.Data = require('./data/FWData').FWData;
|
|
50
|
+
FW.Sender = require('./service/socket/FWSocketSender').FWSocketSender;
|
|
51
|
+
FW.Handle = require('./service/socket/FWSocketHandle').FWSocketHandle;
|
|
52
|
+
FW.AssetConfig = require('./config/FWAssetConfig').FWAssetConfig;
|
|
53
|
+
FW.Log = new (require('./log/FWLog').FWLog)();
|
|
54
|
+
FW.Layer = require('./layer/FWLayer').FWLayer;
|
|
55
|
+
FW.LayerController = require('./controller/FWLayerController').FWLayerController;
|
|
56
|
+
FW.Framework.initialize();
|
|
57
|
+
FW.Entry.initialize();
|
|
58
|
+
}
|
package/FrameworkBase.ts
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import { injectable } from 'inversify';
|
|
2
|
-
import { FWEventDefine } from './define/FWEventDefine';
|
|
3
|
-
import FWLog from './log/FWLog';
|
|
4
|
-
import { FWSystemDefine } from './define/FWSystemDefine';
|
|
5
2
|
import FWLogic from './logic/FWLogic';
|
|
6
3
|
import FWData from './data/FWData';
|
|
4
|
+
|
|
7
5
|
@injectable()
|
|
8
6
|
export abstract class FrameworkBase {
|
|
9
|
-
public readonly entry: FW.Entry = FW.Entry;
|
|
10
7
|
public logic?: FW.Logic;
|
|
11
8
|
public data?: FW.Data;
|
|
12
9
|
public config?: FW.Config;
|
|
@@ -17,9 +14,13 @@ export abstract class FrameworkBase {
|
|
|
17
14
|
protected abstract initialize?(): void;
|
|
18
15
|
protected abstract onDestroy?(): void;
|
|
19
16
|
protected onRestart?(): void;
|
|
17
|
+
get entry() {
|
|
18
|
+
return FW.Entry;
|
|
19
|
+
}
|
|
20
|
+
|
|
20
21
|
constructor() {
|
|
21
22
|
this.initialize?.();
|
|
22
|
-
this.entry.evtMgr.register(
|
|
23
|
+
// this.entry.evtMgr.register(FW.EventDefine.SystemEvent.SYSTEM_RESTART, this.onRestart, this);
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
protected get moduleName(): string {
|
|
@@ -57,33 +58,33 @@ export abstract class FrameworkBase {
|
|
|
57
58
|
|
|
58
59
|
const tag = this.getClassTag();
|
|
59
60
|
|
|
60
|
-
if (tag !==
|
|
61
|
+
if (tag !== FW.SystemDefine.FWBindTag.LOGIC) {
|
|
61
62
|
this.logic = FW.Framework.getComponent<FW.Logic>(
|
|
62
|
-
`${bundleName}${
|
|
63
|
+
`${bundleName}${FW.SystemDefine.FWBindTag.LOGIC}`,
|
|
63
64
|
);
|
|
64
65
|
}
|
|
65
66
|
|
|
66
|
-
if (tag !==
|
|
67
|
+
if (tag !== FW.SystemDefine.FWBindTag.DATA) {
|
|
67
68
|
this.data = FW.Framework.getComponent<FW.Data>(
|
|
68
|
-
`${bundleName}${
|
|
69
|
+
`${bundleName}${FW.SystemDefine.FWBindTag.DATA}`,
|
|
69
70
|
);
|
|
70
71
|
}
|
|
71
72
|
|
|
72
|
-
if (tag !==
|
|
73
|
+
if (tag !== FW.SystemDefine.FWBindTag.CONFIG) {
|
|
73
74
|
this.config = FW.Framework.getComponent<FW.Config>(
|
|
74
|
-
`${bundleName}${
|
|
75
|
+
`${bundleName}${FW.SystemDefine.FWBindTag.CONFIG}`,
|
|
75
76
|
);
|
|
76
77
|
}
|
|
77
78
|
|
|
78
|
-
if (tag !==
|
|
79
|
+
if (tag !== FW.SystemDefine.FWBindTag.SENDER) {
|
|
79
80
|
this.sender = FW.Framework.getComponent<FW.SocketSender>(
|
|
80
|
-
`${bundleName}${
|
|
81
|
+
`${bundleName}${FW.SystemDefine.FWBindTag.SENDER}`,
|
|
81
82
|
);
|
|
82
83
|
}
|
|
83
84
|
|
|
84
|
-
if (tag !==
|
|
85
|
+
if (tag !== FW.SystemDefine.FWBindTag.HANDLE) {
|
|
85
86
|
this.handle = FW.Framework.getComponent<FW.SocketHandle>(
|
|
86
|
-
`${bundleName}${
|
|
87
|
+
`${bundleName}${FW.SystemDefine.FWBindTag.HANDLE}`,
|
|
87
88
|
);
|
|
88
89
|
}
|
|
89
90
|
}
|
|
@@ -110,7 +111,7 @@ export abstract class FrameworkBase {
|
|
|
110
111
|
const shouldWarn = duration > 1000;
|
|
111
112
|
|
|
112
113
|
if (FW.Entry.engineMgr.debug || shouldWarn) {
|
|
113
|
-
const log = shouldWarn ?
|
|
114
|
+
const log = shouldWarn ? FW.Log.warn : FW.Log.debug;
|
|
114
115
|
log(`[${this.moduleName?.toUpperCase()}] Operation ${operationName} took ${duration}ms`);
|
|
115
116
|
}
|
|
116
117
|
}
|
|
@@ -123,7 +124,7 @@ export abstract class FrameworkBase {
|
|
|
123
124
|
stack: error?.stack,
|
|
124
125
|
};
|
|
125
126
|
|
|
126
|
-
|
|
127
|
+
FW.Log.error(`Error in ${this.moduleName}.${operation}:`, errorInfo);
|
|
127
128
|
}
|
|
128
129
|
|
|
129
130
|
protected getCurrentTime(): number {
|
|
@@ -150,16 +151,16 @@ export abstract class FrameworkBase {
|
|
|
150
151
|
return classNameLower.includes(bundleNameLower);
|
|
151
152
|
}
|
|
152
153
|
|
|
153
|
-
private getClassTag():
|
|
154
|
+
private getClassTag(): FW.SystemDefine.FWBindTag {
|
|
154
155
|
const className = this.moduleName;
|
|
155
|
-
if (className.endsWith('Logic')) return
|
|
156
|
-
if (className.endsWith('Data')) return
|
|
156
|
+
if (className.endsWith('Logic')) return FW.SystemDefine.FWBindTag.LOGIC;
|
|
157
|
+
if (className.endsWith('Data')) return FW.SystemDefine.FWBindTag.DATA;
|
|
157
158
|
if (className.endsWith('Config') || className.endsWith('AssetConfig'))
|
|
158
|
-
return
|
|
159
|
+
return FW.SystemDefine.FWBindTag.CONFIG;
|
|
159
160
|
if (className.endsWith('Sender') || className.endsWith('SocketSender'))
|
|
160
|
-
return
|
|
161
|
+
return FW.SystemDefine.FWBindTag.SENDER;
|
|
161
162
|
if (className.endsWith('Handle') || className.endsWith('SocketHandle'))
|
|
162
|
-
return
|
|
163
|
+
return FW.SystemDefine.FWBindTag.HANDLE;
|
|
163
164
|
return;
|
|
164
165
|
}
|
|
165
166
|
}
|
package/animation/FWSkeleton.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import FWLog from '../log/FWLog';
|
|
2
1
|
import { FWAnimation } from './FWAnimation';
|
|
3
2
|
|
|
4
3
|
export class FWSkeleton extends FWAnimation implements FW.Skeleton {
|
|
@@ -36,12 +35,12 @@ export class FWSkeleton extends FWAnimation implements FW.Skeleton {
|
|
|
36
35
|
animationName = animationName || skeletonNames?.[0];
|
|
37
36
|
|
|
38
37
|
if (!animationName) {
|
|
39
|
-
|
|
38
|
+
FW.Log.warn(`not find animationName,please check:${animationName}`);
|
|
40
39
|
return;
|
|
41
40
|
}
|
|
42
41
|
|
|
43
42
|
if (!this.hasAnimation(animationName)) {
|
|
44
|
-
|
|
43
|
+
FW.Log.warn(`not find animationName,please check:${animationName}`);
|
|
45
44
|
return;
|
|
46
45
|
}
|
|
47
46
|
|
|
@@ -52,7 +51,7 @@ export class FWSkeleton extends FWAnimation implements FW.Skeleton {
|
|
|
52
51
|
);
|
|
53
52
|
|
|
54
53
|
if (!this.animation.isAnimationCached() && trackEntry === null) {
|
|
55
|
-
|
|
54
|
+
FW.Log.warn('cache mode no have callback!');
|
|
56
55
|
args.cb?.();
|
|
57
56
|
resolve();
|
|
58
57
|
return;
|
|
@@ -141,7 +140,7 @@ export class FWSkeleton extends FWAnimation implements FW.Skeleton {
|
|
|
141
140
|
// 取第一个骨骼作为挂点
|
|
142
141
|
let boneNode = boneNodes[0];
|
|
143
142
|
if (!boneNode) {
|
|
144
|
-
|
|
143
|
+
FW.Log.warn('bone node is null');
|
|
145
144
|
}
|
|
146
145
|
node.parent = boneNode;
|
|
147
146
|
}
|
|
@@ -158,7 +157,7 @@ export class FWSkeleton extends FWAnimation implements FW.Skeleton {
|
|
|
158
157
|
const boneNodes = this.getBones(boneName);
|
|
159
158
|
let boneNode: cc.Node = boneNodes[0];
|
|
160
159
|
if (!boneNode) {
|
|
161
|
-
|
|
160
|
+
FW.Log.error('boneNode is null');
|
|
162
161
|
return cc.v3(0, 0, 0);
|
|
163
162
|
}
|
|
164
163
|
return boneNode.convertToWorldSpaceAR(cc.v3(0, 0, 0));
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { FWSystemDefine } from '../define/FWSystemDefine';
|
|
2
1
|
import FWListItem from '../item/FWVirtualListItem';
|
|
3
|
-
import FWLog from '../log/FWLog';
|
|
4
2
|
|
|
5
3
|
const { ccclass, property, disallowMultiple, menu, executionOrder, requireComponent } =
|
|
6
4
|
cc._decorator;
|
|
@@ -37,17 +35,17 @@ export default class FWVirtualViewComponent
|
|
|
37
35
|
|
|
38
36
|
//模板类型
|
|
39
37
|
@property({
|
|
40
|
-
type: cc.Enum(
|
|
38
|
+
type: cc.Enum(FW.SystemDefine.FWScrollViewTemplateType),
|
|
41
39
|
tooltip: CC_DEV && '模板类型',
|
|
42
40
|
})
|
|
43
|
-
private templateType:
|
|
44
|
-
|
|
41
|
+
private templateType: FW.SystemDefine.FWScrollViewTemplateType =
|
|
42
|
+
FW.SystemDefine.FWScrollViewTemplateType.PREFAB;
|
|
45
43
|
//模板Item(Node)
|
|
46
44
|
@property({
|
|
47
45
|
type: cc.Node,
|
|
48
46
|
tooltip: CC_DEV && '模板Item',
|
|
49
47
|
visible() {
|
|
50
|
-
return this.templateType ==
|
|
48
|
+
return this.templateType == FW.SystemDefine.FWScrollViewTemplateType.NODE;
|
|
51
49
|
},
|
|
52
50
|
})
|
|
53
51
|
tmpNode: cc.Node = null;
|
|
@@ -56,19 +54,19 @@ export default class FWVirtualViewComponent
|
|
|
56
54
|
type: cc.Prefab,
|
|
57
55
|
tooltip: CC_DEV && '模板Item',
|
|
58
56
|
visible() {
|
|
59
|
-
return this.templateType ==
|
|
57
|
+
return this.templateType == FW.SystemDefine.FWScrollViewTemplateType.PREFAB;
|
|
60
58
|
},
|
|
61
59
|
})
|
|
62
60
|
tmpPrefab: cc.Prefab = null;
|
|
63
61
|
//滑动模式
|
|
64
62
|
@property()
|
|
65
|
-
private _slideMode:
|
|
66
|
-
|
|
63
|
+
private _slideMode: FW.SystemDefine.FWScrollViewSlideType =
|
|
64
|
+
FW.SystemDefine.FWScrollViewSlideType.NORMAL;
|
|
67
65
|
@property({
|
|
68
|
-
type: cc.Enum(
|
|
66
|
+
type: cc.Enum(FW.SystemDefine.FWScrollViewSlideType),
|
|
69
67
|
tooltip: CC_DEV && '滑动模式',
|
|
70
68
|
})
|
|
71
|
-
set slideMode(val:
|
|
69
|
+
set slideMode(val: FW.SystemDefine.FWScrollViewSlideType) {
|
|
72
70
|
this._slideMode = val;
|
|
73
71
|
}
|
|
74
72
|
get slideMode() {
|
|
@@ -81,7 +79,7 @@ export default class FWVirtualViewComponent
|
|
|
81
79
|
tooltip: CC_DEV && '翻页作用距离',
|
|
82
80
|
slide: true,
|
|
83
81
|
visible() {
|
|
84
|
-
return this._slideMode ==
|
|
82
|
+
return this._slideMode == FW.SystemDefine.FWScrollViewSlideType.PAGE;
|
|
85
83
|
},
|
|
86
84
|
})
|
|
87
85
|
public pageDistance: number = 0.3;
|
|
@@ -107,7 +105,7 @@ export default class FWVirtualViewComponent
|
|
|
107
105
|
tooltip: CC_DEV && '是否为循环列表',
|
|
108
106
|
visible() {
|
|
109
107
|
let val: boolean =
|
|
110
|
-
/*this.virtual &&*/ this.slideMode ==
|
|
108
|
+
/*this.virtual &&*/ this.slideMode == FW.SystemDefine.FWScrollViewSlideType.NORMAL;
|
|
111
109
|
if (!val) this.cyclic = false;
|
|
112
110
|
return val;
|
|
113
111
|
},
|
|
@@ -159,15 +157,14 @@ export default class FWVirtualViewComponent
|
|
|
159
157
|
|
|
160
158
|
//选择模式
|
|
161
159
|
@property({
|
|
162
|
-
type: cc.Enum(
|
|
160
|
+
type: cc.Enum(FW.SystemDefine.FWScrollViewSelectedType),
|
|
163
161
|
tooltip: CC_DEV && '选择模式',
|
|
164
162
|
})
|
|
165
|
-
public selectedMode:
|
|
166
|
-
FWSystemDefine.FWScrollViewSelectedType.NONE;
|
|
163
|
+
public selectedMode: FW.SystemDefine.FWScrollViewSelectedType = 0;
|
|
167
164
|
@property({
|
|
168
165
|
tooltip: CC_DEV && '是否重复响应单选事件',
|
|
169
166
|
visible() {
|
|
170
|
-
return this.selectedMode ==
|
|
167
|
+
return this.selectedMode == FW.SystemDefine.FWScrollViewSelectedType.SINGLE;
|
|
171
168
|
},
|
|
172
169
|
})
|
|
173
170
|
public repeatEventSingle: boolean = false;
|
|
@@ -183,7 +180,7 @@ export default class FWVirtualViewComponent
|
|
|
183
180
|
let t: FWVirtualViewComponent = this;
|
|
184
181
|
let item: any;
|
|
185
182
|
switch (t.selectedMode) {
|
|
186
|
-
case
|
|
183
|
+
case FW.SystemDefine.FWScrollViewSelectedType.SINGLE: {
|
|
187
184
|
if (!t.repeatEventSingle && val == t._selectedId) return;
|
|
188
185
|
item = t.getItemByListId(val);
|
|
189
186
|
|
|
@@ -205,7 +202,7 @@ export default class FWVirtualViewComponent
|
|
|
205
202
|
);
|
|
206
203
|
break;
|
|
207
204
|
}
|
|
208
|
-
case
|
|
205
|
+
case FW.SystemDefine.FWScrollViewSelectedType.MULTIPLE: {
|
|
209
206
|
item = t.getItemByListId(val);
|
|
210
207
|
if (!item) return;
|
|
211
208
|
let listItem = item.getComponent(FWListItem);
|
|
@@ -256,7 +253,7 @@ export default class FWVirtualViewComponent
|
|
|
256
253
|
let t = this;
|
|
257
254
|
if (!t.checkInited(false)) return;
|
|
258
255
|
if (val == null || val < 0) {
|
|
259
|
-
|
|
256
|
+
FW.Log.error('numItems set the wrong::', val);
|
|
260
257
|
return;
|
|
261
258
|
}
|
|
262
259
|
t._actualNumItems = t._numItems = val;
|
|
@@ -268,7 +265,7 @@ export default class FWVirtualViewComponent
|
|
|
268
265
|
t._numItems = t._cyclicNum * t._numItems;
|
|
269
266
|
}
|
|
270
267
|
t._onScrolling();
|
|
271
|
-
if (!t.frameByFrameRenderNum && t.slideMode ==
|
|
268
|
+
if (!t.frameByFrameRenderNum && t.slideMode == FW.SystemDefine.FWScrollViewSlideType.PAGE)
|
|
272
269
|
t.curPageNum = t.nearestListId;
|
|
273
270
|
} else {
|
|
274
271
|
if (t.cyclic) {
|
|
@@ -446,7 +443,7 @@ export default class FWVirtualViewComponent
|
|
|
446
443
|
|
|
447
444
|
t.content = t._scrollView.content;
|
|
448
445
|
if (!t.content) {
|
|
449
|
-
|
|
446
|
+
FW.Log.error(t.node.name + "'s cc.ScrollView unset content!");
|
|
450
447
|
return;
|
|
451
448
|
}
|
|
452
449
|
|
|
@@ -471,14 +468,14 @@ export default class FWVirtualViewComponent
|
|
|
471
468
|
|
|
472
469
|
t.setTemplateItem(
|
|
473
470
|
cc.instantiate(
|
|
474
|
-
t.templateType ==
|
|
471
|
+
t.templateType == FW.SystemDefine.FWScrollViewTemplateType.PREFAB ? t.tmpPrefab : t.tmpNode,
|
|
475
472
|
),
|
|
476
473
|
);
|
|
477
474
|
|
|
478
475
|
// 特定的滑动模式处理
|
|
479
476
|
if (
|
|
480
|
-
t._slideMode ==
|
|
481
|
-
t._slideMode ==
|
|
477
|
+
t._slideMode == FW.SystemDefine.FWScrollViewSlideType.ADHERING ||
|
|
478
|
+
t._slideMode == FW.SystemDefine.FWScrollViewSlideType.PAGE
|
|
482
479
|
) {
|
|
483
480
|
t._scrollView.inertia = false;
|
|
484
481
|
t._scrollView._onMouseWheel = function () {
|
|
@@ -630,13 +627,13 @@ export default class FWVirtualViewComponent
|
|
|
630
627
|
// }
|
|
631
628
|
// }
|
|
632
629
|
if (remove) {
|
|
633
|
-
t.selectedMode =
|
|
630
|
+
t.selectedMode = FW.SystemDefine.FWScrollViewSelectedType.NONE;
|
|
634
631
|
}
|
|
635
632
|
com = item.getComponent(cc.Widget);
|
|
636
633
|
if (com && com.enabled) {
|
|
637
634
|
t._needUpdateWidget = true;
|
|
638
635
|
}
|
|
639
|
-
if (t.selectedMode ==
|
|
636
|
+
if (t.selectedMode == FW.SystemDefine.FWScrollViewSelectedType.MULTIPLE) t.multSelected = [];
|
|
640
637
|
|
|
641
638
|
t._resetColumn();
|
|
642
639
|
}
|
|
@@ -678,7 +675,7 @@ export default class FWVirtualViewComponent
|
|
|
678
675
|
*/
|
|
679
676
|
checkInited(printLog: boolean = true) {
|
|
680
677
|
if (!this._inited) {
|
|
681
|
-
if (printLog)
|
|
678
|
+
if (printLog) FW.Log.error('List initialization not completed!');
|
|
682
679
|
return false;
|
|
683
680
|
}
|
|
684
681
|
return true;
|
|
@@ -1335,10 +1332,10 @@ export default class FWVirtualViewComponent
|
|
|
1335
1332
|
}
|
|
1336
1333
|
t._onScrolling();
|
|
1337
1334
|
|
|
1338
|
-
if (t._slideMode ==
|
|
1335
|
+
if (t._slideMode == FW.SystemDefine.FWScrollViewSlideType.ADHERING && !t.adhering) {
|
|
1339
1336
|
//cc.log(t.adhering, t._scrollView.isAutoScrolling(), t._scrollView.isScrolling());
|
|
1340
1337
|
t.adhere();
|
|
1341
|
-
} else if (t._slideMode ==
|
|
1338
|
+
} else if (t._slideMode == FW.SystemDefine.FWScrollViewSlideType.PAGE) {
|
|
1342
1339
|
if (t._beganPos != null && t.curScrollIsTouch) {
|
|
1343
1340
|
this._pageAdhere();
|
|
1344
1341
|
} else {
|
|
@@ -1361,10 +1358,10 @@ export default class FWVirtualViewComponent
|
|
|
1361
1358
|
_onTouchUp() {
|
|
1362
1359
|
let t: any = this;
|
|
1363
1360
|
t._scrollPos = null;
|
|
1364
|
-
if (t._slideMode ==
|
|
1361
|
+
if (t._slideMode == FW.SystemDefine.FWScrollViewSlideType.ADHERING) {
|
|
1365
1362
|
if (this.adhering) this._adheringBarrier = true;
|
|
1366
1363
|
t.adhere();
|
|
1367
|
-
} else if (t._slideMode ==
|
|
1364
|
+
} else if (t._slideMode == FW.SystemDefine.FWScrollViewSlideType.PAGE) {
|
|
1368
1365
|
if (t._beganPos != null) {
|
|
1369
1366
|
this._pageAdhere();
|
|
1370
1367
|
} else {
|
|
@@ -1380,10 +1377,10 @@ export default class FWVirtualViewComponent
|
|
|
1380
1377
|
return;
|
|
1381
1378
|
|
|
1382
1379
|
t._scrollPos = null;
|
|
1383
|
-
if (t._slideMode ==
|
|
1380
|
+
if (t._slideMode == FW.SystemDefine.FWScrollViewSlideType.ADHERING) {
|
|
1384
1381
|
if (t.adhering) t._adheringBarrier = true;
|
|
1385
1382
|
t.adhere();
|
|
1386
|
-
} else if (t._slideMode ==
|
|
1383
|
+
} else if (t._slideMode == FW.SystemDefine.FWScrollViewSlideType.PAGE) {
|
|
1387
1384
|
if (t._beganPos != null) {
|
|
1388
1385
|
t._pageAdhere();
|
|
1389
1386
|
} else {
|
|
@@ -1504,7 +1501,7 @@ export default class FWVirtualViewComponent
|
|
|
1504
1501
|
this._delRedundantItem();
|
|
1505
1502
|
this._forceUpdate = false;
|
|
1506
1503
|
this._calcNearestItem();
|
|
1507
|
-
if (this.slideMode ==
|
|
1504
|
+
if (this.slideMode == FW.SystemDefine.FWScrollViewSlideType.PAGE)
|
|
1508
1505
|
this.curPageNum = this.nearestListId;
|
|
1509
1506
|
}
|
|
1510
1507
|
} else {
|
|
@@ -1523,7 +1520,7 @@ export default class FWVirtualViewComponent
|
|
|
1523
1520
|
} else {
|
|
1524
1521
|
this._updateDone = true;
|
|
1525
1522
|
this._calcNearestItem();
|
|
1526
|
-
if (this.slideMode ==
|
|
1523
|
+
if (this.slideMode == FW.SystemDefine.FWScrollViewSlideType.PAGE)
|
|
1527
1524
|
this.curPageNum = this.nearestListId;
|
|
1528
1525
|
}
|
|
1529
1526
|
}
|
|
@@ -1775,10 +1772,10 @@ export default class FWVirtualViewComponent
|
|
|
1775
1772
|
let t: any = this;
|
|
1776
1773
|
|
|
1777
1774
|
if (!t.checkInited() || t.cyclic || !t._virtual)
|
|
1778
|
-
return
|
|
1775
|
+
return FW.Log.error('This function is not allowed to be called!');
|
|
1779
1776
|
|
|
1780
1777
|
if (!callFunc)
|
|
1781
|
-
return
|
|
1778
|
+
return FW.Log.error(
|
|
1782
1779
|
'CallFunc are not allowed to be NULL, You need to delete the corresponding index in the data array in the CallFunc!',
|
|
1783
1780
|
);
|
|
1784
1781
|
|
|
@@ -1812,9 +1809,9 @@ export default class FWVirtualViewComponent
|
|
|
1812
1809
|
if (t._virtual) t._createOrUpdateItem(newData);
|
|
1813
1810
|
else t._createOrUpdateItem2(newId);
|
|
1814
1811
|
} else t._numItems--;
|
|
1815
|
-
if (t.selectedMode ==
|
|
1812
|
+
if (t.selectedMode == FW.SystemDefine.FWScrollViewSelectedType.SINGLE) {
|
|
1816
1813
|
} else if (
|
|
1817
|
-
t.selectedMode ==
|
|
1814
|
+
t.selectedMode == FW.SystemDefine.FWScrollViewSelectedType.MULTIPLE &&
|
|
1818
1815
|
t.multSelected.length
|
|
1819
1816
|
) {
|
|
1820
1817
|
let sub: number = t.multSelected.indexOf(listId);
|
|
@@ -1893,7 +1890,7 @@ export default class FWVirtualViewComponent
|
|
|
1893
1890
|
|
|
1894
1891
|
let pos = t.getItemPos(listId);
|
|
1895
1892
|
if (!pos) {
|
|
1896
|
-
return CC_DEV &&
|
|
1893
|
+
return CC_DEV && FW.Log.error('pos is null', listId);
|
|
1897
1894
|
}
|
|
1898
1895
|
let targetX: number, targetY: number;
|
|
1899
1896
|
|
|
@@ -2048,8 +2045,8 @@ export default class FWVirtualViewComponent
|
|
|
2048
2045
|
skipPage(pageNum: number, timeInSecond: number) {
|
|
2049
2046
|
let t: any = this;
|
|
2050
2047
|
if (!t.checkInited()) return;
|
|
2051
|
-
if (t._slideMode !=
|
|
2052
|
-
return
|
|
2048
|
+
if (t._slideMode != FW.SystemDefine.FWScrollViewSlideType.PAGE)
|
|
2049
|
+
return FW.Log.error('This function is not allowed to be called, Must SlideMode = PAGE!');
|
|
2053
2050
|
if (pageNum < 0 || pageNum >= t._numItems) return;
|
|
2054
2051
|
if (t.curPageNum == pageNum) return;
|
|
2055
2052
|
// cc.log(pageNum);
|
|
@@ -2061,8 +2058,8 @@ export default class FWVirtualViewComponent
|
|
|
2061
2058
|
calcCustomSize(numItems: number) {
|
|
2062
2059
|
let t: any = this;
|
|
2063
2060
|
if (!t.checkInited()) return;
|
|
2064
|
-
if (!t._itemTmp) return
|
|
2065
|
-
if (!t.renderEvent) return
|
|
2061
|
+
if (!t._itemTmp) return FW.Log.error('Unset template item!');
|
|
2062
|
+
if (!t.renderEvent) return FW.Log.error('Unset Render-Event!');
|
|
2066
2063
|
t._customSize = {};
|
|
2067
2064
|
let temp: any = cc.instantiate(t._itemTmp);
|
|
2068
2065
|
t.content.addChild(temp);
|
package/config/FWAssetConfig.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { injectable } from
|
|
1
|
+
import { injectable } from 'inversify';
|
|
2
2
|
|
|
3
3
|
@injectable()
|
|
4
|
-
export
|
|
4
|
+
export abstract class FWAssetConfig {
|
|
5
5
|
abstract preLoad: FW.LoadConfig;
|
|
6
6
|
abstract demandLoad: FW.LoadConfig;
|
|
7
7
|
}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import { FWSystemDefine } from '../define/FWSystemDefine';
|
|
2
|
-
import FWLayer from '../layer/FWLayer';
|
|
3
1
|
import { FWLayerData } from '../manager/FWLayerManager';
|
|
4
|
-
|
|
5
|
-
export abstract class FWLayerController extends FrameworkBase implements FW.LayerController {
|
|
6
|
-
readonly entry: FW.Entry = FW.Entry;
|
|
2
|
+
export abstract class FWLayerController extends FW.FrameworkBase implements FW.LayerController {
|
|
7
3
|
/** layer数据 */
|
|
8
4
|
layerData: FWLayerData;
|
|
9
5
|
/** uuid */
|
|
@@ -11,9 +7,9 @@ export abstract class FWLayerController extends FrameworkBase implements FW.Laye
|
|
|
11
7
|
/** 渲染顺序 */
|
|
12
8
|
abstract renderOrder: number;
|
|
13
9
|
/** 当前layer */
|
|
14
|
-
abstract layer:
|
|
10
|
+
abstract layer: FW.Layer;
|
|
15
11
|
/** layer类型 */
|
|
16
|
-
abstract layerType:
|
|
12
|
+
abstract layerType: FW.SystemDefine.FWLayerType;
|
|
17
13
|
/** 资源地址 */
|
|
18
14
|
abstract get layerAssetProperty(): FW.AssetProperty;
|
|
19
15
|
/** 关闭后是否自动释放资源 */
|
package/data/FWData.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { injectable } from
|
|
2
|
-
import { FrameworkBase } from "../FrameworkBase";
|
|
1
|
+
import { injectable } from 'inversify';
|
|
3
2
|
@injectable()
|
|
4
|
-
export
|
|
3
|
+
export class FWData extends FW.FrameworkBase implements FW.Data {
|
|
5
4
|
public initialize?(): void;
|
|
6
5
|
public onDestroy?(): void;
|
|
7
6
|
}
|
package/define/FWEventDefine.ts
CHANGED
|
@@ -1,24 +1,27 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
export class LanguageEvent {
|
|
2
|
+
/** 语言变更 */
|
|
3
|
+
LANGUAGE_CHANGE = 'LANGUAGE_CHANGE';
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export class TaskEvent {
|
|
7
|
+
START = 'START';
|
|
8
|
+
PROGRESS = 'PROGRESS';
|
|
9
|
+
COMPLETE = 'COMPLETE';
|
|
10
|
+
YIELDED = 'YIELDED';
|
|
11
|
+
PAUSE = 'PAUSE';
|
|
12
|
+
RESUME = 'RESUME';
|
|
13
|
+
FRAME_START = 'FRAME_START';
|
|
14
|
+
FRAME_END = 'FRAME_END';
|
|
15
|
+
QUEUE = 'QUEUE';
|
|
16
|
+
ALL_COMPLETE = 'ALL_COMPLETE';
|
|
17
|
+
ERROR = 'ERROR';
|
|
18
|
+
}
|
|
6
19
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
YIELDED = 'YIELDED',
|
|
12
|
-
PAUSE = 'PAUSE',
|
|
13
|
-
RESUME = 'RESUME',
|
|
14
|
-
FRAME_START = 'FRAME_START',
|
|
15
|
-
FRAME_END = 'FRAME_END',
|
|
16
|
-
QUEUE = 'QUEUE',
|
|
17
|
-
ALL_COMPLETE = 'ALL_COMPLETE',
|
|
18
|
-
ERROR = 'ERROR',
|
|
19
|
-
}
|
|
20
|
+
export class CCEvent {
|
|
21
|
+
ON_SHOW = 'ON_SHOW';
|
|
22
|
+
ON_HIDE = 'ON_HIDE';
|
|
23
|
+
}
|
|
20
24
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
25
|
+
export class SystemEvent {
|
|
26
|
+
SYSTEM_RESTART = 0;
|
|
24
27
|
}
|