@cc-component/cc-ex-component 1.9.0 → 1.9.3

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,7 +34,7 @@ interface IBindingDataEvents {
34
34
  reset?: (this: any, value: any, com: Component) => void;
35
35
  event?: (this: any) => void;
36
36
  /**动态加载spine的 sp.SkeletonData完成 */
37
- spineFinish?: (this: any) => void;
37
+ spineFinish?: (this: any, value: { path: string, bundle: string, param?: { name: string, loop?: boolean, call?: (name?: string) => void, event?: (name?: string) => void }[] }) => void;
38
38
  touchStart?: (this: any, event: EventTouch) => void;
39
39
  touchMove?: (this: any, event: EventTouch) => void;
40
40
  touchEnd?: (this: any, event: EventTouch) => void;
@@ -590,13 +590,17 @@ function updateStatus(data: IBindingData, com: Component, value: any, self: any)
590
590
  else {
591
591
  const dataSpine = ExComponentModule.EmitGetSpine?.(value)
592
592
  if (dataSpine) {
593
- (com as sp.Skeleton).skeletonData = value;
594
- data.spineFinish.call(self)
593
+ (com as sp.Skeleton).skeletonData = dataSpine;
594
+ if (data.spineFinish) {
595
+ data.spineFinish.call(self, value)
596
+ } else ExComponentModule.EmitSpinePlay({ spine: (com as sp.Skeleton), value: value })
595
597
  }
596
598
  else {
597
599
  ExComponentModule.EmitLoadSpine?.(value).then(sprite => {
598
600
  if (sprite) { if (com && com.isValid) (com as sp.Skeleton).skeletonData = sprite; }
599
- data.spineFinish.call(self)
601
+ if (data.spineFinish) {
602
+ data.spineFinish.call(self, value)
603
+ } else ExComponentModule.EmitSpinePlay({ spine: (com as sp.Skeleton), value: value })
600
604
  }).catch(() => { });
601
605
  }
602
606
  }
@@ -24,7 +24,7 @@ declare global {
24
24
  /**添加描边 -富文本*/
25
25
  addOutline(colorHex: string, font: number): string
26
26
  /**添加粗体 -富文本*/
27
- addBold(text: string): string
27
+ addBold(): string
28
28
  }
29
29
 
30
30
  interface Any {
@@ -787,11 +787,11 @@ String.prototype.addSize = function (font: number): string {
787
787
  };
788
788
  // 实现字符串扩展方法
789
789
  String.prototype.addOutline = function (colorHex: string, font: number): string {
790
- return `<outline color=${colorHex} width=${font}>描边</outline>`
790
+ return `<outline color=${colorHex} width=${font}>${this}</outline>`
791
791
  };
792
792
  // 实现字符串扩展方法
793
- String.prototype.addBold = function (text): string {
794
- return `<b>${text}</b>`
793
+ String.prototype.addBold = function (): string {
794
+ return `<b>${this}</b>`
795
795
  };
796
796
  Label.prototype.fromHEX = function (this: Label, hex: string): void {
797
797
  const label = this;
@@ -1,6 +1,7 @@
1
1
  import { sp } from "cc";
2
2
  import { SpriteFrame } from "cc";
3
3
  import { Button } from "cc";
4
+ import { ISpinePlayData } from "./Interface";
4
5
 
5
6
 
6
7
  export class ExComponentModule {
@@ -16,6 +17,9 @@ export class ExComponentModule {
16
17
  paramAnim: { enable: boolean }
17
18
  paramSprite: { loadSprite: (param: { bundle: string, path: string }) => Promise<SpriteFrame>, getSprite: (param: { bundle: string, path: string }) => SpriteFrame }
18
19
  paramSpine: { loadSpine: (param: { bundle: string, path: string }) => Promise<sp.SkeletonData>, getSpine: (param: { bundle: string, path: string }) => sp.SkeletonData }
20
+ paramSpinePlay: { play: (param: { spine: sp.Skeleton, value: { path: string, bundle: string, param?: ISpinePlayData[] } }) => void }
21
+
22
+
19
23
  paramUIWindow: { onLoad: (config: any, viewModel: any) => void }
20
24
  paramClose: { close: (openParam: any, closeParam: any) => void }
21
25
 
@@ -52,7 +56,9 @@ export class ExComponentModule {
52
56
  static OnLoadSpine(param: { loadSpine: (param: { bundle: string, path: string }) => Promise<sp.SkeletonData>, getSpine: (param: { bundle: string, path: string }) => sp.SkeletonData }) {
53
57
  ExComponentModule.Ins.paramSpine = param
54
58
  }
55
-
59
+ static OnPlaySpine(param: { play: (param: { spine: sp.Skeleton, value: { path: string, bundle: string, param?: ISpinePlayData[] } }) => void }) {
60
+ ExComponentModule.Ins.paramSpinePlay = param
61
+ }
56
62
 
57
63
  static Emit(btn: Button) {
58
64
  ExComponentModule.Ins.param.click(btn)
@@ -74,6 +80,9 @@ export class ExComponentModule {
74
80
  static EmitGetSpine(param: any): sp.SkeletonData {
75
81
  return ExComponentModule.Ins.paramSpine?.getSpine?.(param)
76
82
  }
83
+ static EmitSpinePlay(param: any): void {
84
+ ExComponentModule.Ins.paramSpinePlay?.play?.(param)
85
+ }
77
86
 
78
87
  static EmitUIWindow(param: any, viewModel: any) {
79
88
  return ExComponentModule.Ins.paramUIWindow?.onLoad?.(param, viewModel)
@@ -2,6 +2,7 @@ import { SpriteFrame } from "cc";
2
2
  import { sp } from "cc";
3
3
  import { Sprite } from "cc";
4
4
  import { Button } from "cc";
5
+ import * as exp from "constants";
5
6
  interface IConfig {
6
7
  module: string,
7
8
  layer: string,
@@ -13,6 +14,8 @@ interface IConfig {
13
14
  /**是否记录-不记录可重复打开窗口 */
14
15
  is_record?: boolean,
15
16
  }
17
+ /**骨骼动画播放参数 */
18
+ export interface ISpinePlayData { name: string, loop?: boolean, call?: (name?: string) => void, event?: (name?: string) => void }
16
19
  declare global {
17
20
  namespace ExComponentModule {
18
21
  /**开启打印日志 */
@@ -28,6 +31,7 @@ declare global {
28
31
  /**监听加载图片 */
29
32
  function OnLoadSprite(param: { loadSprite: (param: { bundle: string, path: string }) => Promise<SpriteFrame>, getSprite: (param: { bundle: string, path: string }) => SpriteFrame });
30
33
  function OnLoadSpine(param: { loadSpine: (param: { bundle: string, path: string }) => Promise<sp.SkeletonData>, getSpine: (param: { bundle: string, path: string }) => sp.SkeletonData });
34
+ function OnPlaySpine(param: { play: (param: { spine: sp.Skeleton, value: { path: string, bundle: string, param?: ISpinePlayData[] } }) => void }): void;
31
35
  /**重置基础窗口 */
32
36
  function ResetBaseWindow(name?: string, isGet?: boolean);
33
37
  /**监听UI onLoad 给模块manager 赋值 */
@@ -42,5 +46,6 @@ declare global {
42
46
  function EmitGetSpine(param: any): sp.SkeletonData;
43
47
  function EmitUIWindow(param: IConfig, viewModel: any);
44
48
  function EmitCloseWindow(openParam: any, closeParam: any);
49
+ function EmitSpinePlay(param: { spine: sp.Skeleton, value: { path: string, bundle: string, param?: ISpinePlayData[] } });
45
50
  }
46
51
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cc-component/cc-ex-component",
3
- "version": "1.9.0",
3
+ "version": "1.9.3",
4
4
  "engine": ">=3.8.6",
5
5
  "description": "系统组件添加常用扩展方法",
6
6
  "main": "index.ts",