@ives_xxz/framework 1.1.9 → 1.2.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/FW.d.ts +2 -2
- package/item/FWVirtualListItem.ts +0 -8
- package/language/FWLanguageLabelLocalize.ts +1 -1
- package/manager/FWAudioManager.ts +2 -2
- package/manager/FWLanguageManager.ts +1 -2
- package/manager/FWLayerManager.ts +2 -0
- package/package.json +1 -1
- package/service/http/FWHttp.ts +33 -45
- package/utils/FWTask.ts +4 -4
package/FW.d.ts
CHANGED
|
@@ -1795,12 +1795,12 @@ declare namespace FW {
|
|
|
1795
1795
|
* 任务开始
|
|
1796
1796
|
* @param generator
|
|
1797
1797
|
*/
|
|
1798
|
-
start(generator: TaskFunction):
|
|
1798
|
+
start(generator: TaskFunction): Task;
|
|
1799
1799
|
/**
|
|
1800
1800
|
* 添加任务
|
|
1801
1801
|
* @param generator
|
|
1802
1802
|
*/
|
|
1803
|
-
add(generator: TaskFunction):
|
|
1803
|
+
add(generator: TaskFunction): Task;
|
|
1804
1804
|
/**
|
|
1805
1805
|
* 任务暂停
|
|
1806
1806
|
*/
|
|
@@ -1,14 +1,6 @@
|
|
|
1
1
|
import FWVirtualViewComponent from '../component/FWVirtualViewComponent';
|
|
2
2
|
import FWObject from '../utils/FWObject';
|
|
3
3
|
|
|
4
|
-
/******************************************
|
|
5
|
-
* @author kL <klk0@qq.com>
|
|
6
|
-
* @date 2019/6/6
|
|
7
|
-
* @doc 列表Item组件.
|
|
8
|
-
* 说明:
|
|
9
|
-
* 1、此组件须配合List组件使用。(配套的配套的..)
|
|
10
|
-
* @end
|
|
11
|
-
******************************************/
|
|
12
4
|
const { ccclass, property, disallowMultiple, menu, executionOrder } = cc._decorator;
|
|
13
5
|
|
|
14
6
|
enum SelectedType {
|
|
@@ -9,7 +9,7 @@ const { ccclass, property, executeInEditMode, menu, requireComponent } = cc._dec
|
|
|
9
9
|
@executeInEditMode
|
|
10
10
|
export default class FWLanguageLabelLocalize extends FWLanguage {
|
|
11
11
|
@property({
|
|
12
|
-
type: FWLodash.CCEnum(['
|
|
12
|
+
type: FWLodash.CCEnum(['请选择语言']),
|
|
13
13
|
displayName: 'bundle',
|
|
14
14
|
visible: true,
|
|
15
15
|
})
|
|
@@ -76,8 +76,8 @@ export default class FWAudioManager extends FWManager implements FW.AudioManager
|
|
|
76
76
|
);
|
|
77
77
|
if (!data) return;
|
|
78
78
|
const clip = data.clip;
|
|
79
|
-
const volume = data.volume === undefined ? this.soundVolume :
|
|
80
|
-
const loop = data.loop === undefined ? false :
|
|
79
|
+
const volume = data.volume === undefined ? this.soundVolume : data.volume;
|
|
80
|
+
const loop = data.loop === undefined ? false : data.loop;
|
|
81
81
|
const id = cc.audioEngine.play(clip, loop, volume);
|
|
82
82
|
cc.audioEngine.setFinishCallback(id, () => {
|
|
83
83
|
data.cb?.(id);
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import FWLog from '../log/FWLog';
|
|
2
1
|
import { FWEventDefine } from '../define/FWEventDefine';
|
|
3
2
|
import { FWManager } from './FWManager';
|
|
4
3
|
|
|
@@ -103,7 +102,7 @@ export default class FWLanguageManager extends FWManager implements FW.LanguageM
|
|
|
103
102
|
* 获取支持的所有语言
|
|
104
103
|
*/
|
|
105
104
|
getSupportedLanguages(): string[] {
|
|
106
|
-
return [...this.supportedLanguages];
|
|
105
|
+
return [...this.supportedLanguages];
|
|
107
106
|
}
|
|
108
107
|
|
|
109
108
|
/**
|
|
@@ -274,6 +274,7 @@ export class FWLayerManager extends FWManager implements FW.LayerManager {
|
|
|
274
274
|
node.resumeSystemEvents(true);
|
|
275
275
|
|
|
276
276
|
FW.Entry.evtMgr.targetResume(ctr);
|
|
277
|
+
FW.Entry.timeMgr.pauseSchedule(ctr);
|
|
277
278
|
}
|
|
278
279
|
|
|
279
280
|
/**
|
|
@@ -295,6 +296,7 @@ export class FWLayerManager extends FWManager implements FW.LayerManager {
|
|
|
295
296
|
node.opacity = 0;
|
|
296
297
|
node.pauseSystemEvents(true);
|
|
297
298
|
FW.Entry.evtMgr.targetPause(ctr);
|
|
299
|
+
FW.Entry.timeMgr.resumeSchedule(ctr);
|
|
298
300
|
}
|
|
299
301
|
|
|
300
302
|
/**
|
package/package.json
CHANGED
package/service/http/FWHttp.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { FWSystemDefine } from
|
|
2
|
-
import FWLog from
|
|
3
|
-
import FWService from
|
|
1
|
+
import { FWSystemDefine } from '../../define/FWSystemDefine';
|
|
2
|
+
import FWLog from '../../log/FWLog';
|
|
3
|
+
import FWService from '../FWService';
|
|
4
4
|
|
|
5
5
|
export default class FWHttp extends FWService {
|
|
6
6
|
public initialize(): void {}
|
|
@@ -9,62 +9,50 @@ export default class FWHttp extends FWService {
|
|
|
9
9
|
protected async getMessage(
|
|
10
10
|
url: string,
|
|
11
11
|
params?: string,
|
|
12
|
-
cb?: (response: string) => void
|
|
12
|
+
cb?: (response: string) => void,
|
|
13
13
|
): Promise<string> {
|
|
14
|
-
return this.dataProcessing(
|
|
15
|
-
url,
|
|
16
|
-
params,
|
|
17
|
-
cb,
|
|
18
|
-
FWSystemDefine.FWHttpRequestType.GET
|
|
19
|
-
);
|
|
14
|
+
return this.dataProcessing(url, params, cb, FWSystemDefine.FWHttpRequestType.GET);
|
|
20
15
|
}
|
|
21
16
|
|
|
22
17
|
protected async postMessage(
|
|
23
18
|
url: string,
|
|
24
19
|
params?: string,
|
|
25
|
-
cb?: (response: string) => void
|
|
20
|
+
cb?: (response: string) => void,
|
|
26
21
|
): Promise<string> {
|
|
27
|
-
return this.dataProcessing(
|
|
28
|
-
url,
|
|
29
|
-
params,
|
|
30
|
-
cb,
|
|
31
|
-
FWSystemDefine.FWHttpRequestType.POST
|
|
32
|
-
);
|
|
22
|
+
return this.dataProcessing(url, params, cb, FWSystemDefine.FWHttpRequestType.POST);
|
|
33
23
|
}
|
|
34
24
|
|
|
35
25
|
private dataProcessing(
|
|
36
26
|
url: string,
|
|
37
27
|
params: string,
|
|
38
28
|
cb: (response: any) => void,
|
|
39
|
-
type: FWSystemDefine.FWHttpRequestType
|
|
29
|
+
type: FWSystemDefine.FWHttpRequestType,
|
|
40
30
|
): Promise<string> {
|
|
41
|
-
return new Promise(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
xhr.
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
);
|
|
31
|
+
return new Promise((resolve: (msg: string) => void, reject: (error: string) => void) => {
|
|
32
|
+
const xhr = new XMLHttpRequest();
|
|
33
|
+
xhr.onreadystatechange = () => {
|
|
34
|
+
if (xhr.readyState == 4 && xhr.status === 200) {
|
|
35
|
+
cb?.(xhr.response);
|
|
36
|
+
resolve(xhr.response);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
xhr.onerror = (err: any) => {
|
|
41
|
+
FWLog.error(err);
|
|
42
|
+
this.onError(err);
|
|
43
|
+
reject(`http request error:${err}`);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
xhr.ontimeout = () => {
|
|
47
|
+
this.onTimeout();
|
|
48
|
+
reject(`http request timeout!`);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
xhr.open(type, url, true);
|
|
52
|
+
xhr.send(params);
|
|
53
|
+
});
|
|
66
54
|
}
|
|
67
55
|
|
|
68
|
-
onError(err: any)
|
|
69
|
-
onTimeout()
|
|
56
|
+
onError?(err: any);
|
|
57
|
+
onTimeout?();
|
|
70
58
|
}
|
package/utils/FWTask.ts
CHANGED
|
@@ -34,7 +34,7 @@ export default class FWTask implements FW.Task {
|
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
start(generator: FW.TaskFunction): FW.Task {
|
|
38
38
|
this.reset();
|
|
39
39
|
const taskId = `TaskId:${this.id}->TaskCounter${this.taskCounter++}`;
|
|
40
40
|
const gen = generator();
|
|
@@ -47,11 +47,11 @@ export default class FWTask implements FW.Task {
|
|
|
47
47
|
taskId,
|
|
48
48
|
});
|
|
49
49
|
this.taskStartTime = FW.Entry.timeMgr.getTime();
|
|
50
|
-
|
|
50
|
+
this.executeFrame();
|
|
51
51
|
return this;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
add(generator: FW.TaskFunction): FW.Task {
|
|
55
55
|
const taskId = `TaskId:${this.id}->TaskCounter${this.taskCounter++}`;
|
|
56
56
|
const gen = generator();
|
|
57
57
|
(gen as any).taskId = taskId;
|
|
@@ -63,7 +63,7 @@ export default class FWTask implements FW.Task {
|
|
|
63
63
|
});
|
|
64
64
|
if (this.status !== FWSystemDefine.FWTaskStatus.RUNNING && !this.isPaused) {
|
|
65
65
|
this.status = FWSystemDefine.FWTaskStatus.RUNNING;
|
|
66
|
-
|
|
66
|
+
this.executeFrame();
|
|
67
67
|
}
|
|
68
68
|
return this;
|
|
69
69
|
}
|