@cc-component/cc-guide 1.1.0 → 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.
@@ -21,9 +21,3 @@ export interface IGuideData {
21
21
  tableGuide: Map<number, ITableGuide>;
22
22
  }
23
23
 
24
- export enum GuideStep {
25
- /**客户端:更新了引导步骤 */
26
- GuideEventStep = "GuideEventStep",
27
- /**服务器:需要你更新服务器的步骤 */
28
- GuideEventStepNet = "GuideEventStepNet",
29
- }
@@ -14,7 +14,7 @@ const { ccclass, property, menu } = _decorator;
14
14
 
15
15
  /** 新手引导数据(绑定到引导节点上) */
16
16
  @ccclass('GuideViewItem')
17
- @menu("引导组件/GuideViewItem")
17
+ @menu("引导组件/引导-GuideViewItem")
18
18
  export class GuideViewItem extends Component {
19
19
  @property({
20
20
  type: [CCInteger],
@@ -32,16 +32,5 @@ declare global {
32
32
  function GuideShow(): boolean;
33
33
  /**开启日志打印 */
34
34
  function Debug(enable: boolean)
35
- //任务
36
- // const TaskCenter: TaskCenter;
37
- // function TaskInit(node: Node, step?: number, step_week?: number)
38
- // function CheckGroup(id: number, index: number);
39
- // function TaskStartGuideGroup<T>(group_id: number): Promise<T>;
40
- // function TaskGuideSDK(): any;
41
- // /**移动到界面指定位置
42
- // * window:界面名称
43
- // * row :Task位置 大于0 为移动
44
- // */
45
-
46
35
  }
47
36
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cc-component/cc-guide",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "engine": ">=3.8.6",
5
5
  "description": "系统组件添加常用扩展方法",
6
6
  "main": "index.ts",
@@ -1,10 +0,0 @@
1
- export interface ITableNPC {
2
-
3
- /** 编号【KEY】 */
4
- id: number
5
-
6
- /** npc昵称 */
7
- npcname: string
8
- /** npc头像资源 */
9
- npcavator: string
10
- }
@@ -1,9 +0,0 @@
1
- {
2
- "ver": "4.0.24",
3
- "importer": "typescript",
4
- "imported": true,
5
- "uuid": "bdc2bbec-1dcb-4169-8dad-8b3a6b51218b",
6
- "files": [],
7
- "subMetas": {},
8
- "userData": {}
9
- }
@@ -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
- }
@@ -1,9 +0,0 @@
1
- {
2
- "ver": "4.0.24",
3
- "importer": "typescript",
4
- "imported": true,
5
- "uuid": "91d112dc-b6a3-4072-b5f5-ce7d74c86e44",
6
- "files": [],
7
- "subMetas": {},
8
- "userData": {}
9
- }