@cc-component/cc-guide 1.0.9 → 1.1.1
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/assets/guide/guide/GuideCenter.ts +5 -0
- package/assets/guide/guide/model/GuideCommon.ts +0 -6
- package/assets/guide/guide/model/ITableGuide.ts +2 -0
- package/assets/guide/guide/view/GuideViewComp.ts +1 -0
- package/assets/guide/guide/view/GuideViewItem.ts +1 -1
- package/assets/guide/interface/GuideModule.ts +2 -0
- package/assets/guide/interface/Interface.ts +3 -12
- package/package.json +1 -1
- package/assets/guide/guide/model/ITableNPC.ts +0 -10
- package/assets/guide/guide/model/ITableNPC.ts.meta +0 -9
- package/assets/guide/guide/view/GuideTest.ts +0 -150
- package/assets/guide/guide/view/GuideTest.ts.meta +0 -9
|
@@ -27,6 +27,8 @@ export class GuideCenter {
|
|
|
27
27
|
return GuideCenter.instance;
|
|
28
28
|
}
|
|
29
29
|
callMessage: (param: ITableGuide) => void;
|
|
30
|
+
callMessageView: (param: ITableGuide) => void;
|
|
31
|
+
|
|
30
32
|
callMessageNet: (param: number, finish: Function) => void;
|
|
31
33
|
|
|
32
34
|
callClick: (step: number) => void;
|
|
@@ -310,6 +312,9 @@ export class GuideCenter {
|
|
|
310
312
|
OnMessageStep(call: (param: ITableGuide) => void) {
|
|
311
313
|
this.callMessage = call
|
|
312
314
|
}
|
|
315
|
+
OnMessageStepView(call: (param: ITableGuide) => void) {
|
|
316
|
+
this.callMessageView = call
|
|
317
|
+
}
|
|
313
318
|
OnMessageStepNet(call: (step: number, finish: Function) => void) {
|
|
314
319
|
this.callMessageNet = call
|
|
315
320
|
}
|
|
@@ -113,6 +113,7 @@ export class GuideViewComp extends Component {
|
|
|
113
113
|
else {
|
|
114
114
|
Log.log(`当前步骤:${this.model.step} 引导事件节点:${btn.name}--父节点:${btn.parent.name}`)
|
|
115
115
|
GuideModule.GuideCenter.callMessage?.(this.model.currentPrompt.data)
|
|
116
|
+
GuideModule.GuideCenter.callMessageView?.(this.model.currentPrompt.data)
|
|
116
117
|
|
|
117
118
|
GuideModule.GuideCenter.is_guide_week = false;
|
|
118
119
|
// const is_choose = this.model.step === 5 || this.model.step === 6
|
|
@@ -19,6 +19,8 @@ class GuideModule {
|
|
|
19
19
|
static get GuideCenter() { return GuideCenter.instance; }
|
|
20
20
|
static MoveTo(param: any, window_name: string): { window: string, value: any } { return GuideSDK.MoveTo(param, window_name) };
|
|
21
21
|
static OnMessageStep(call: (param: ITableGuide) => void) { GuideCenter.instance.OnMessageStep(call) }
|
|
22
|
+
static OnMessageStepView(call: (param: ITableGuide) => void) { GuideCenter.instance.OnMessageStepView(call) }
|
|
23
|
+
|
|
22
24
|
static OnMessageStepNet(call: (step: number, finish: Function) => void) { GuideCenter.instance.OnMessageStepNet(call) }
|
|
23
25
|
static OnMessageClick(call: (step: number) => void) { GuideCenter.instance.OnMessageClick(call) }
|
|
24
26
|
static OnMessageJumpWindow(call: (urls: string[]) => void) { GuideCenter.instance.OnMessageJumpWindow(call) }
|
|
@@ -18,7 +18,9 @@ declare global {
|
|
|
18
18
|
function MoveTo(param: any, window: string): { window: string, value: any };
|
|
19
19
|
/**必须实现该方法: 需要更新服务器的步骤*/
|
|
20
20
|
function OnMessageStepNet(call: (step: number, finish: Function) => void)
|
|
21
|
-
|
|
21
|
+
/**监听更新步骤-界面中监听 */
|
|
22
|
+
function OnMessageStepView(call: (param: ITableGuide) => void)
|
|
23
|
+
/**监听更新步骤-初始化时监听 */
|
|
22
24
|
function OnMessageStep(call: (param: ITableGuide) => void)
|
|
23
25
|
/**监听点击了引导事件 */
|
|
24
26
|
function OnMessageClick(call: (step: number) => void)
|
|
@@ -30,16 +32,5 @@ declare global {
|
|
|
30
32
|
function GuideShow(): boolean;
|
|
31
33
|
/**开启日志打印 */
|
|
32
34
|
function Debug(enable: boolean)
|
|
33
|
-
//任务
|
|
34
|
-
// const TaskCenter: TaskCenter;
|
|
35
|
-
// function TaskInit(node: Node, step?: number, step_week?: number)
|
|
36
|
-
// function CheckGroup(id: number, index: number);
|
|
37
|
-
// function TaskStartGuideGroup<T>(group_id: number): Promise<T>;
|
|
38
|
-
// function TaskGuideSDK(): any;
|
|
39
|
-
// /**移动到界面指定位置
|
|
40
|
-
// * window:界面名称
|
|
41
|
-
// * row :Task位置 大于0 为移动
|
|
42
|
-
// */
|
|
43
|
-
|
|
44
35
|
}
|
|
45
36
|
}
|
package/package.json
CHANGED
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
import { GraphicsComponent } from 'cc';
|
|
2
|
-
import { Graphics } from 'cc';
|
|
3
|
-
import { Color } from 'cc';
|
|
4
|
-
import { Mask } from 'cc';
|
|
5
|
-
import { _decorator, Component, Node } from 'cc';
|
|
6
|
-
|
|
7
|
-
const { ccclass, property } = _decorator;
|
|
8
|
-
|
|
9
|
-
@ccclass('GuideTest')
|
|
10
|
-
export class GuideTest extends Component {
|
|
11
|
-
@property(Mask)
|
|
12
|
-
mask: Mask = null!;
|
|
13
|
-
|
|
14
|
-
@property(Graphics)
|
|
15
|
-
graphics: Graphics = null!;
|
|
16
|
-
|
|
17
|
-
protected onLoad(): void {
|
|
18
|
-
this.drawCircleWithInnerBlur(0, 0, 500);
|
|
19
|
-
|
|
20
|
-
// this.drawRectWithGradient()
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/** 绘制带有透明度渐变的圆形遮罩 */
|
|
24
|
-
drawCircleWithGradient(centerX: number, centerY: number, radius: number, gradientWidth: number = 20): void {
|
|
25
|
-
// if (this.mask.type !== Mask.Type.GRAPHICS_STENCIL) {
|
|
26
|
-
// return;
|
|
27
|
-
// }
|
|
28
|
-
|
|
29
|
-
var g: Graphics = this.graphics;
|
|
30
|
-
g.clear();
|
|
31
|
-
|
|
32
|
-
// 绘制中心不透明圆形
|
|
33
|
-
g.fillColor = new Color(0, 0, 0, 255);
|
|
34
|
-
g.circle(centerX, centerY, radius);
|
|
35
|
-
g.fill();
|
|
36
|
-
|
|
37
|
-
// 创建渐变边缘(通过多个半透明圆环实现)
|
|
38
|
-
const steps = 15;
|
|
39
|
-
for (let i = 1; i <= steps; i++) {
|
|
40
|
-
const progress = i / steps;
|
|
41
|
-
const currentRadius = radius + gradientWidth * progress;
|
|
42
|
-
const alpha = Math.floor(255 * (1 - progress));
|
|
43
|
-
|
|
44
|
-
g.fillColor = new Color(0, 0, 0, alpha);
|
|
45
|
-
g.circle(centerX, centerY, currentRadius);
|
|
46
|
-
g.fill();
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/** 绘制带有从中心向边缘渐变的圆形遮罩 */
|
|
51
|
-
drawCircleWithInnerBlur2(centerX: number, centerY: number, radius: number, blurWidth: number = 20): void {
|
|
52
|
-
var g: Graphics = this.graphics;
|
|
53
|
-
g.clear();
|
|
54
|
-
|
|
55
|
-
// 从内向外绘制多个半透明圆环,实现向外渐变效果
|
|
56
|
-
const steps = 20;
|
|
57
|
-
for (let i = steps; i >= 1; i--) {
|
|
58
|
-
const progress = i / steps;
|
|
59
|
-
const currentRadius = radius * progress;
|
|
60
|
-
// 从中心到边缘,透明度逐渐增加
|
|
61
|
-
const alpha = Math.floor(255 * (1 - progress));
|
|
62
|
-
|
|
63
|
-
g.fillColor = new Color(0, 0, 0, alpha);
|
|
64
|
-
g.circle(centerX, centerY, currentRadius);
|
|
65
|
-
g.fill();
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
drawCircleWithInnerBlur(centerX: number, centerY: number, radius: number): void {
|
|
69
|
-
const g: Graphics = this.graphics;
|
|
70
|
-
g.clear(); // 清空之前的绘制
|
|
71
|
-
|
|
72
|
-
const steps = 3; // 渐变的步数,越高越平滑
|
|
73
|
-
const maxAlpha = 255; // 最大透明度
|
|
74
|
-
const minAlpha = 0; // 最小透明度
|
|
75
|
-
|
|
76
|
-
// 从内到外逐步绘制多个圆形,透明度逐渐增加
|
|
77
|
-
for (let i = 0; i < steps; i++) {
|
|
78
|
-
const progress = i / (steps - 1); // 计算每一步的进度(从 0 到 1)
|
|
79
|
-
const currentRadius = radius * progress; // 当前圆的半径
|
|
80
|
-
const alpha = Math.floor(maxAlpha * progress); // 计算透明度,越远离中心越不透明
|
|
81
|
-
|
|
82
|
-
// 设置每个圆的填充颜色,透明度逐渐增加
|
|
83
|
-
g.fillColor = new Color(0, 0, 0, 20); // 黑色,透明度渐变
|
|
84
|
-
g.circle(centerX, centerY, currentRadius); // 绘制圆形
|
|
85
|
-
g.fill(); // 填充当前圆形
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
/** 绘制带边缘渐变的矩形遮罩 */
|
|
95
|
-
drawRectWithGradient(x: number, y: number, width: number, height: number, gradientWidth: number = 20): void {
|
|
96
|
-
if (this.mask.type !== Mask.Type.GRAPHICS_STENCIL) {
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
var g: GraphicsComponent = this.graphics;
|
|
101
|
-
g.clear();
|
|
102
|
-
|
|
103
|
-
// 绘制中心不透明矩形
|
|
104
|
-
g.fillColor = new Color(0, 0, 0, 255);
|
|
105
|
-
g.rect(x, y, width, height);
|
|
106
|
-
g.fill();
|
|
107
|
-
|
|
108
|
-
// 绘制渐变边缘
|
|
109
|
-
const steps = 10;
|
|
110
|
-
for (let i = 1; i <= steps; i++) {
|
|
111
|
-
const progress = i / steps;
|
|
112
|
-
const alpha = Math.floor(255 * (1 - progress));
|
|
113
|
-
const currentColor = new Color(0, 0, 0, alpha);
|
|
114
|
-
|
|
115
|
-
// 上边缘
|
|
116
|
-
g.fillColor = currentColor;
|
|
117
|
-
g.rect(x - gradientWidth * progress, y + height, gradientWidth * progress * 2 + width, gradientWidth * progress);
|
|
118
|
-
g.fill();
|
|
119
|
-
|
|
120
|
-
// 下边缘
|
|
121
|
-
g.fillColor = currentColor;
|
|
122
|
-
g.rect(x - gradientWidth * progress, y - gradientWidth * progress, gradientWidth * progress * 2 + width, gradientWidth * progress);
|
|
123
|
-
g.fill();
|
|
124
|
-
|
|
125
|
-
// 左边缘
|
|
126
|
-
g.fillColor = currentColor;
|
|
127
|
-
g.rect(x - gradientWidth * progress, y, gradientWidth * progress, height);
|
|
128
|
-
g.fill();
|
|
129
|
-
|
|
130
|
-
// 右边缘
|
|
131
|
-
g.fillColor = currentColor;
|
|
132
|
-
g.rect(x + width, y, gradientWidth * progress, height);
|
|
133
|
-
g.fill();
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
yang() {
|
|
138
|
-
const g = this.graphics
|
|
139
|
-
g.lineWidth = 10;
|
|
140
|
-
g.fillColor.fromHEX('#00ccffff');
|
|
141
|
-
g.strokeColor = Color.GREEN
|
|
142
|
-
g.moveTo(-40, 0);
|
|
143
|
-
g.lineTo(0, -80);
|
|
144
|
-
g.lineTo(40, 0);
|
|
145
|
-
g.lineTo(0, 80);
|
|
146
|
-
g.close();
|
|
147
|
-
g.stroke();
|
|
148
|
-
g.fill();
|
|
149
|
-
}
|
|
150
|
-
}
|