@cc-component/cc-core 1.0.7 → 1.0.9

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.
@@ -3,7 +3,7 @@ import { _decorator, CCString, Component, Enum, instantiate, Node, Prefab } from
3
3
  import { ISceneParam } from '../interface/ISceneParam';
4
4
  import { DEBUG } from 'cc/env';
5
5
  import { ResourceManager } from './ResourceManager';
6
- import { ProgessView } from './ProgessView';
6
+ import { ProgessView } from './ProgessWindow';
7
7
  import { AssetType, BundleConfig, BundleConfigName, GetAssetType } from '../config/CommonEnum';
8
8
  import { LanguageData } from '../lib/language/LanguageData';
9
9
  const { ccclass, property } = _decorator;
@@ -16,16 +16,17 @@ const { ccclass, property, menu } = _decorator;
16
16
  *
17
17
  */
18
18
 
19
- @ccclass('ProgessView')
20
- @menu('组件进度条/ProgessView')
21
- export class ProgessView extends Component {
19
+ @ccclass('ProgessWindow')
20
+ @menu('组件进度条/ProgessWindow')
21
+ export class ProgessWindow extends Component {
22
22
 
23
- // static Ins:ProgessView;
23
+ // static Ins:ProgessWindow;
24
24
  @property({
25
25
  type: ProgressBar,
26
26
  displayName: "进度条"
27
27
  })
28
28
  pro_bar!: ProgressBar;
29
+ stop = false
29
30
 
30
31
  protected onLoad(): void {
31
32
 
@@ -35,33 +36,29 @@ export class ProgessView extends Component {
35
36
  this.pro_bar.node.active = isShow
36
37
  }
37
38
 
38
- stop = false
39
- async SetProgessAuto(isOk) {
39
+ /***更新进度--假的进度 */
40
+ async ProgessValueAuto(isOk) {
40
41
  this.stop = isOk
41
42
  if (isOk) {
42
43
  for (var i = 90; i < 101; i++) {
43
44
  await MainModule.timeManager.AwaitMS(1);
44
- this.SetProgessValue((i));
45
+ this.ProgessValue((i));
45
46
  }
46
47
  this.Hide()
47
48
  } else {
48
49
  for (var i = 0; i < 90; i++) {
49
50
  if (this.stop) { return }
50
51
  await MainModule.timeManager.AwaitMS(1);
51
- this.SetProgessValue((i));
52
+ this.ProgessValue((i));
52
53
  }
53
54
  }
54
55
  }
55
56
 
56
- async SetProgessValue(value: number) {
57
+ /***更新进度 */
58
+ public ProgessValue(value: number) {
57
59
  if (this.pro_bar) {
58
- this.pro_bar.SetValue(value);
59
- // console.log(value);
60
- if (value >= 100) {
61
- // this.Hide();
62
- }
60
+ this.pro(this.pro_bar, value, 100);
63
61
  }
64
-
65
62
  }
66
63
 
67
64
  Show() {
@@ -73,24 +70,19 @@ export class ProgessView extends Component {
73
70
  }
74
71
 
75
72
 
76
- pro(this: ProgressBar, progress: number, max: number, anim_time?: number): void {
77
-
78
- const com_max_pro = this.totalLength//getComponent(UITransform).width
73
+ pro(proBar: ProgressBar, progress: number, max: number, anim_time?: number): void {
74
+ const com_max_pro = proBar.totalLength//getComponent(UITransform).width
79
75
  const max_progress = com_max_pro;
80
76
  const s = max_progress / max;
81
77
  const pro = progress * s / max_progress;
82
-
83
78
  if (anim_time) {
84
- tween(this).to(anim_time, {
79
+ tween(proBar).to(anim_time, {
85
80
  progress: pro
86
81
  }).start();
87
82
 
88
83
  } else {
89
- this.progress = pro;
90
-
84
+ proBar.progress = pro;
91
85
  }
92
86
  }
93
-
94
-
95
87
  }
96
88
 
@@ -107,6 +107,14 @@ declare global {
107
107
  //MainModule.On(SystemMessage.OpenWindow)
108
108
  /**✅✅✅监听窗口的关闭 */
109
109
  //MainModule.On(SystemMessage.CloseWindow)
110
+ /**获取所有已打开的窗口名称 */
111
+ function GetOpenedWindowNames(): string[]
112
+ /**获取已打开的窗口实例*/
113
+ function GetOpenWindow<T extends Component>(config: IBundleConfig): T;
114
+ // 获取已打开的窗口实例-对象
115
+ function GetOpenWindows<T extends Component>(): T[]
116
+ // 获取已打开的窗口实例-配置
117
+ function GetOpenWindowsConfig(): IBundleConfig[];
110
118
  /**
111
119
  * 显示加载转圈
112
120
  */
@@ -16,8 +16,6 @@ import { TimeManager } from "../home/TimeManager";
16
16
  import { LanguageManager } from "../lib/language/Language";
17
17
  import { BundleConfigName, HttpType, IBundleConfig, IExtData, IHttpConfig, IInitConfig, IWindowParam, SystemMessage } from "../config/CommonEnum";
18
18
  import { LayerType } from "../config/LayerType";
19
- import { Logger } from "../lib/Logger";
20
- import { Main } from "electron";
21
19
 
22
20
 
23
21
  // const { keepClassName } = keepClass;
@@ -942,12 +940,21 @@ export class MainModule {
942
940
  }
943
941
 
944
942
  // 获取已打开的窗口实例
945
- static GetOpenWindow<T extends Component>(config: IBundleConfig): T | null {
943
+ static GetOpenWindow<T extends Component>(config: IBundleConfig): T {
946
944
  const className = config.path.split('/').pop();
947
945
  const window = MainModule.Ins.openedWindows.get(className);
948
946
  return window ? window as T : null;
949
947
  }
948
+ // 获取已打开的窗口实例
949
+ static GetOpenWindows<T extends Component>(): T[] {
950
+ return Array.from(MainModule.Ins.openedWindows.values()) as T[];
950
951
 
952
+ }
953
+ // 获取已打开的窗口实例
954
+ static GetOpenWindowsConfig(): IBundleConfig[] {
955
+ return Array.from(MainModule.Ins.openedWindowsConfig.values());
956
+
957
+ }
951
958
  // 获取所有已打开的窗口名称
952
959
  static GetOpenedWindowNames(): string[] {
953
960
  return Array.from(MainModule.Ins.openedWindows.keys());
package/index.ts CHANGED
@@ -8,7 +8,7 @@ export * from './assets/core/config/IConfig';
8
8
  //基类
9
9
  export * from './assets/core/home/BaseLaunchComponent';
10
10
  export * from './assets/core/home/BaseLoading';
11
- export * from './assets/core/home/ProgessView';
11
+ export * from './assets/core/home/ProgessWindow';
12
12
  //日志
13
13
  export * from './assets/core/lib/logger/ELoggerLevel';
14
14
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cc-component/cc-core",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "engine": ">=3.8.6",
5
5
  "description": "系统组件添加常用扩展方法",
6
6
  "main": "index.ts",