@cc-component/cc-guide 1.1.8 → 1.1.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.
@@ -34,6 +34,8 @@ export class GuideCenter {
34
34
  callClick: (step: number) => void;
35
35
  callJumpWindow: (urls: string[]) => void;
36
36
  callFinishGroup: (param: ITableGuide) => void;
37
+
38
+ callButtonClick: (node: Node) => boolean
37
39
  /** 游戏初始化模块 */
38
40
  guide: Guide = null!;
39
41
  node: Node;
@@ -328,6 +330,10 @@ export class GuideCenter {
328
330
  this.callFinishGroup = call
329
331
  }
330
332
 
333
+ OnButtonClick(finish: (node: Node) => boolean) {
334
+ this.callButtonClick = finish
335
+ }
336
+
331
337
  LoadSprite(sp: Sprite, param: string, callback?: () => void) {
332
338
  const path = param + '/spriteFrame'
333
339
  const bundleName = this.param.bundleName
@@ -191,13 +191,10 @@ export class GuideViewComp extends Component {
191
191
  });
192
192
 
193
193
  } else {
194
- //@ts-ignore
195
- const mbutton_event = button?.onClick;//自定义事件
196
- if (mbutton_event) {
197
- mbutton_event.dispatch()
194
+ const isCust = GuideModule.GuideCenter.callButtonClick(btn)
195
+ if (isCust) {
198
196
  this.onClick()
199
- }
200
- else {
197
+ } else {
201
198
  button.clickEvents.forEach((e, index) => {
202
199
  if (button.interactable)
203
200
  e.emit([event]);
@@ -206,6 +203,15 @@ export class GuideViewComp extends Component {
206
203
  }
207
204
  });
208
205
  }
206
+ //@ts-ignore
207
+ // const mbutton_event = button?.onClick;//自定义事件
208
+ // if (mbutton_event) {
209
+ // mbutton_event.dispatch()
210
+ // this.onClick()
211
+ // }
212
+ // else {
213
+
214
+ // }
209
215
  }
210
216
  } else {
211
217
  const item = this.model.current
@@ -213,10 +219,9 @@ export class GuideViewComp extends Component {
213
219
  const view = item.getComponent(GuideViewItem)
214
220
  //按钮
215
221
  let target_button = view.findButton()
216
- //@ts-ignore
217
- const mbutton_event = target_button?.onClick;//自定义事件
218
- if (mbutton_event) {
219
- mbutton_event.dispatch()
222
+ const isCust = GuideModule.GuideCenter.callButtonClick(target_button.node)
223
+ if (isCust) {
224
+
220
225
  } else {
221
226
  const clickEvents = target_button?.clickEvents ?? [];
222
227
  if (target_button?.interactable) {
@@ -240,19 +245,15 @@ export class GuideViewComp extends Component {
240
245
  } else {
241
246
  btn.dispatchEvent(event)
242
247
  }
243
-
244
248
  }
245
249
  }
246
250
  }
247
251
  this.onClick()
248
252
  }
249
-
250
253
  this.next();
251
254
  } catch (error) {
252
-
253
255
  Log.error('报错了:', error)
254
256
  }
255
-
256
257
  }
257
258
 
258
259
  /** 刷新引导位置 */
@@ -25,32 +25,12 @@ class GuideModule {
25
25
  static OnMessageClick(call: (step: number) => void) { GuideCenter.instance.OnMessageClick(call) }
26
26
  static OnMessageJumpWindow(call: (urls: string[]) => void) { GuideCenter.instance.OnMessageJumpWindow(call) }
27
27
  static OnMessageFinishGroup(call: (param: ITableGuide) => void) { GuideCenter.instance.OnMessageFinishGroup(call) }
28
- /**是否引导中 */
29
- static GuideShow(): boolean { return GuideSDK.GuideShow() };
30
-
31
28
 
32
- // //#region 任务引导
33
- // static get TaskCenter(): TaskCenter { return TaskCenter.instance; }
34
- // static TaskInit(node: Node, step?: number, step_week?: number) { return TaskSDK.init(node, step, step_week); }
29
+ static OnButtonClick(finish: (node: Node) => boolean) { GuideCenter.instance.OnButtonClick(finish) }
35
30
 
36
- //#region 任务引导
37
- // static TaskInit(node: Node, step?: number, step_week?: number) { return TaskSDK.init(node, step, step_week); }
38
- // static CheckGroup(id: number, index: number) { TaskSDK.CheckGroup(id, index); }
39
- // static TaskStartGuideGroup<T>(group_id: number): Promise<T> { return TaskSDK.startTaskGroup(group_id); }
31
+ /**是否引导中 */
32
+ static GuideShow(): boolean { return GuideSDK.GuideShow() };
40
33
 
41
- // static TaskGuideSDK() { return TaskCenter.instance; }
42
- // static TaskMoveTo(param: any, window_name: string): { window: string, row: number } { return TaskSDK.MoveTo(param, window_name) };
43
- // /**是否Task引导中 */
44
- // static TaskGuideShow(): boolean { return TaskSDK.TaskShow() };
45
- // static HideAll() { TaskSDK.HideAll() };
46
- // static GetPromptView() { return TaskSDK.GetPromptView() }
47
- // static GetCurrentHard() { return TaskCenter.instance.GetCurrentHard() }
48
- // static FinishTaskHard(ground_id: number, step: number) { TaskCenter.instance.guide.TaskView.FinishTaskHard(ground_id, step) }
49
- // static GetGroup(id: number) { return TaskCenter.instance.guide.TaskModel?.guide_group.get(id) ?? [] }
50
- // static Step(value: number) { TaskSDK.step(value) }
51
- // static GetWindowNmaeStep(id: number, class_name: string) { return TaskCenter.instance.guide.TaskModel.GetWindowNmaeStep(id, class_name) }
52
- // static HideGroupAll(id: number) { TaskCenter.instance.HideGroupAll(id) }
53
- // static ResetMinStep() { TaskCenter.instance.guide.TaskModel.ResetMinStep() }
54
34
  }
55
35
  window.GuideModule = GuideModule;
56
36
 
@@ -28,6 +28,8 @@ declare global {
28
28
  function OnMessageJumpWindow(call: (urls: string[]) => void)
29
29
  /**监听完成引导组引导 */
30
30
  function OnMessageFinishGroup(call: (param: ITableGuide) => void)
31
+ /**引导按钮点击事件 */
32
+ function OnButtonClick(finish: (node: Node) => boolean)
31
33
  /**是否引导中 */
32
34
  function GuideShow(): boolean;
33
35
  /**开启日志打印 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cc-component/cc-guide",
3
- "version": "1.1.8",
3
+ "version": "1.1.9",
4
4
  "engine": ">=3.8.6",
5
5
  "description": "系统组件添加常用扩展方法",
6
6
  "main": "index.ts",