Ver Fonte

1,完善新手引导穿透问题
2,更新引导形象

zouyong há 5 anos atrás
pai
commit
76b6eb6ae2

+ 100 - 151
assets/resources/module/guide/guide.prefab

@@ -21,29 +21,26 @@
         "__id__": 2
       },
       {
-        "__id__": 9
+        "__id__": 10
       },
       {
-        "__id__": 11
-      },
-      {
-        "__id__": 16
+        "__id__": 15
       },
       {
-        "__id__": 18
+        "__id__": 17
       }
     ],
     "_active": true,
     "_components": [
       {
-        "__id__": 36
+        "__id__": 35
       },
       {
-        "__id__": 37
+        "__id__": 36
       }
     ],
     "_prefab": {
-      "__id__": 38
+      "__id__": 37
     },
     "_opacity": 255,
     "_color": {
@@ -107,11 +104,11 @@
     "_active": true,
     "_components": [
       {
-        "__id__": 7
+        "__id__": 8
       }
     ],
     "_prefab": {
-      "__id__": 8
+      "__id__": 9
     },
     "_opacity": 255,
     "_color": {
@@ -175,10 +172,13 @@
       },
       {
         "__id__": 5
+      },
+      {
+        "__id__": 6
       }
     ],
     "_prefab": {
-      "__id__": 6
+      "__id__": 7
     },
     "_opacity": 120,
     "_color": {
@@ -289,6 +289,16 @@
     "_id": ""
   },
   {
+    "__type__": "cc.BlockInputEvents",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 3
+    },
+    "_enabled": true,
+    "_id": ""
+  },
+  {
     "__type__": "cc.PrefabInfo",
     "root": {
       "__id__": 1
@@ -332,77 +342,6 @@
   },
   {
     "__type__": "cc.Node",
-    "_name": "block",
-    "_objFlags": 0,
-    "_parent": {
-      "__id__": 1
-    },
-    "_children": [],
-    "_active": true,
-    "_components": [],
-    "_prefab": {
-      "__id__": 10
-    },
-    "_opacity": 255,
-    "_color": {
-      "__type__": "cc.Color",
-      "r": 255,
-      "g": 255,
-      "b": 255,
-      "a": 255
-    },
-    "_contentSize": {
-      "__type__": "cc.Size",
-      "width": 0,
-      "height": 0
-    },
-    "_anchorPoint": {
-      "__type__": "cc.Vec2",
-      "x": 0.5,
-      "y": 0.5
-    },
-    "_trs": {
-      "__type__": "TypedArray",
-      "ctor": "Float64Array",
-      "array": [
-        0,
-        0,
-        0,
-        0,
-        0,
-        0,
-        1,
-        1,
-        1,
-        1
-      ]
-    },
-    "_eulerAngles": {
-      "__type__": "cc.Vec3",
-      "x": 0,
-      "y": 0,
-      "z": 0
-    },
-    "_skewX": 0,
-    "_skewY": 0,
-    "_is3DNode": false,
-    "_groupIndex": 0,
-    "groupIndex": 0,
-    "_id": ""
-  },
-  {
-    "__type__": "cc.PrefabInfo",
-    "root": {
-      "__id__": 1
-    },
-    "asset": {
-      "__uuid__": "5f53c125-7a14-4ca0-986a-0e0d2d665268"
-    },
-    "fileId": "d1tHk7Gm9LbbyyLPLu75Vs",
-    "sync": false
-  },
-  {
-    "__type__": "cc.Node",
     "_name": "点击区域",
     "_objFlags": 0,
     "_parent": {
@@ -412,14 +351,14 @@
     "_active": true,
     "_components": [
       {
-        "__id__": 12
+        "__id__": 11
       },
       {
-        "__id__": 13
+        "__id__": 12
       }
     ],
     "_prefab": {
-      "__id__": 15
+      "__id__": 14
     },
     "_opacity": 0,
     "_color": {
@@ -473,7 +412,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 11
+      "__id__": 10
     },
     "_enabled": true,
     "_materials": [
@@ -505,7 +444,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 11
+      "__id__": 10
     },
     "_enabled": true,
     "_normalMaterial": null,
@@ -514,7 +453,7 @@
     "zoomScale": 1.2,
     "clickEvents": [
       {
-        "__id__": 14
+        "__id__": 13
       }
     ],
     "_N$interactable": true,
@@ -602,7 +541,7 @@
       "__id__": 1
     },
     "_prefab": {
-      "__id__": 17
+      "__id__": 16
     },
     "_name": "hand",
     "_active": true,
@@ -633,7 +572,7 @@
   {
     "__type__": "cc.PrefabInfo",
     "root": {
-      "__id__": 16
+      "__id__": 15
     },
     "asset": {
       "__uuid__": "73bde1e5-ca53-420e-9f68-ca130e46fc49"
@@ -650,26 +589,26 @@
     },
     "_children": [
       {
-        "__id__": 19
+        "__id__": 18
       },
       {
-        "__id__": 22
+        "__id__": 21
       },
       {
-        "__id__": 25
+        "__id__": 24
       },
       {
-        "__id__": 28
+        "__id__": 27
       }
     ],
     "_active": true,
     "_components": [
       {
-        "__id__": 34
+        "__id__": 33
       }
     ],
     "_prefab": {
-      "__id__": 35
+      "__id__": 34
     },
     "_opacity": 255,
     "_color": {
@@ -723,17 +662,17 @@
     "_name": "bg",
     "_objFlags": 0,
     "_parent": {
-      "__id__": 18
+      "__id__": 17
     },
     "_children": [],
     "_active": true,
     "_components": [
       {
-        "__id__": 20
+        "__id__": 19
       }
     ],
     "_prefab": {
-      "__id__": 21
+      "__id__": 20
     },
     "_opacity": 255,
     "_color": {
@@ -787,7 +726,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 19
+      "__id__": 18
     },
     "_enabled": true,
     "_materials": [
@@ -830,17 +769,17 @@
     "_name": "panda",
     "_objFlags": 0,
     "_parent": {
-      "__id__": 18
+      "__id__": 17
     },
     "_children": [],
     "_active": true,
     "_components": [
       {
-        "__id__": 23
+        "__id__": 22
       }
     ],
     "_prefab": {
-      "__id__": 24
+      "__id__": 23
     },
     "_opacity": 255,
     "_color": {
@@ -852,8 +791,8 @@
     },
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 190,
-      "height": 264
+      "width": 485.48,
+      "height": 443.28
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -864,15 +803,15 @@
       "__type__": "TypedArray",
       "ctor": "Float64Array",
       "array": [
-        248.359,
-        50,
+        214.959,
+        -75.893,
         0,
         0,
         0,
         0,
         1,
-        1,
-        1,
+        0.8,
+        0.8,
         1
       ]
     },
@@ -890,35 +829,45 @@
     "_id": ""
   },
   {
-    "__type__": "cc.Sprite",
+    "__type__": "sp.Skeleton",
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 22
+      "__id__": 21
     },
     "_enabled": true,
     "_materials": [
       {
-        "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
+        "__uuid__": "7afd064b-113f-480e-b793-8817d19f63c3"
       }
     ],
-    "_srcBlendFactor": 770,
-    "_dstBlendFactor": 771,
-    "_spriteFrame": {
-      "__uuid__": "cff81677-0727-4cd3-869c-39b593e999f2"
-    },
-    "_type": 0,
-    "_sizeMode": 1,
-    "_fillType": 0,
-    "_fillCenter": {
-      "__type__": "cc.Vec2",
-      "x": 0,
-      "y": 0
-    },
-    "_fillStart": 0,
-    "_fillRange": 0,
-    "_isTrimmedMode": true,
-    "_atlas": null,
+    "paused": false,
+    "defaultSkin": "default",
+    "defaultAnimation": "yingdao2",
+    "_preCacheMode": 0,
+    "_cacheMode": 0,
+    "loop": true,
+    "premultipliedAlpha": true,
+    "timeScale": 1,
+    "_accTime": 0,
+    "_playCount": 0,
+    "_frameCache": null,
+    "_curFrame": null,
+    "_skeletonCache": null,
+    "_animationName": "yingdao2",
+    "_animationQueue": [],
+    "_headAniInfo": null,
+    "_playTimes": 0,
+    "_isAniComplete": true,
+    "_N$skeletonData": {
+      "__uuid__": "8f090d5d-cfa1-40d6-bcce-014cc1aa881e"
+    },
+    "_N$_defaultCacheMode": 0,
+    "_N$debugSlots": false,
+    "_N$debugBones": false,
+    "_N$debugMesh": false,
+    "_N$useTint": false,
+    "_N$enableBatch": false,
     "_id": ""
   },
   {
@@ -937,17 +886,17 @@
     "_name": "head",
     "_objFlags": 0,
     "_parent": {
-      "__id__": 18
+      "__id__": 17
     },
     "_children": [],
     "_active": false,
     "_components": [
       {
-        "__id__": 26
+        "__id__": 25
       }
     ],
     "_prefab": {
-      "__id__": 27
+      "__id__": 26
     },
     "_opacity": 255,
     "_color": {
@@ -1001,7 +950,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 25
+      "__id__": 24
     },
     "_enabled": true,
     "_materials": [
@@ -1044,21 +993,21 @@
     "_name": "文本",
     "_objFlags": 0,
     "_parent": {
-      "__id__": 18
+      "__id__": 17
     },
     "_children": [
       {
-        "__id__": 29
+        "__id__": 28
       }
     ],
     "_active": true,
     "_components": [
       {
-        "__id__": 32
+        "__id__": 31
       }
     ],
     "_prefab": {
-      "__id__": 33
+      "__id__": 32
     },
     "_opacity": 255,
     "_color": {
@@ -1112,17 +1061,17 @@
     "_name": "RICHTEXT_CHILD",
     "_objFlags": 1024,
     "_parent": {
-      "__id__": 28
+      "__id__": 27
     },
     "_children": [],
     "_active": true,
     "_components": [
       {
-        "__id__": 30
+        "__id__": 29
       }
     ],
     "_prefab": {
-      "__id__": 31
+      "__id__": 30
     },
     "_opacity": 255,
     "_color": {
@@ -1177,7 +1126,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 29
+      "__id__": 28
     },
     "_enabled": true,
     "_materials": [
@@ -1215,7 +1164,7 @@
     "asset": {
       "__uuid__": "5f53c125-7a14-4ca0-986a-0e0d2d665268"
     },
-    "fileId": "d5G49QSiVBX6Z1eyDm+K5J",
+    "fileId": "dbN3oWWehNqovhIw60cRq1",
     "sync": false
   },
   {
@@ -1223,7 +1172,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 28
+      "__id__": 27
     },
     "_enabled": true,
     "_fontFamily": "Arial",
@@ -1257,7 +1206,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 18
+      "__id__": 17
     },
     "_enabled": true,
     "alignMode": 1,
@@ -1304,25 +1253,25 @@
       "__id__": 2
     },
     "node_click": {
-      "__id__": 11
+      "__id__": 10
     },
     "node_bg": {
       "__id__": 3
     },
     "node_dialog": {
-      "__id__": 18
+      "__id__": 17
     },
     "node_finger": {
-      "__id__": 16
+      "__id__": 15
     },
     "node_head": {
-      "__id__": 26
+      "__id__": 25
     },
     "node_person": {
-      "__id__": 23
+      "__id__": 22
     },
     "rich_dialog": {
-      "__id__": 32
+      "__id__": 31
     },
     "_id": ""
   },

Diff do ficheiro suprimidas por serem muito extensas
+ 2 - 2
assets/resources/spine/game/pandan.json


+ 1 - 3
assets/script/game/game/Game.ts

@@ -53,9 +53,7 @@ export default class Game extends cc.Component {
         this.autoOpenPanel();
         this.runGuideWeak();
 
-        if (gData.gameData.getProp(GameProp.guideID) < 11111111) {
-            mk.guide.open(1);
-        }
+        mk.guide.open(1);
         // // 测试代码
         // this.schedule(() => {
 

+ 42 - 22
assets/script/game/module/guide/Guide.ts

@@ -21,8 +21,8 @@ export default class Guide extends cc.Component {
     node_finger: cc.Node = null;
     @property({ type: cc.Sprite, displayName: "头像" })
     node_head: cc.Sprite = null;
-    @property({ type: cc.Sprite, displayName: "形象" })
-    node_person: cc.Sprite = null;
+    @property({ type: sp.Skeleton, displayName: "形象" })
+    node_person: sp.Skeleton = null;
     @property({ type: cc.RichText, displayName: "对话内容" })
     rich_dialog: cc.RichText = null;
 
@@ -61,13 +61,15 @@ export default class Guide extends cc.Component {
             this.close();
         }
         else {
+            this.node_finger.opacity = 255;
+            this.node_dialog.opacity = 255;
             this.targetNode = null;
             this.event_name = null;
+            let [x, y, w, h] = [null, null, null, null];
 
             //点击全屏下一步,显示区域不显示,点击区域全屏
             if (this.crtGuide.click_rect == "all") {
-                this.node_display.width = 0;
-                this.node_display.height = 0;
+                this.node_display.width = this.node_display.height = 0;
                 this.node_click.x = 0;
                 this.node_click.y = 0;
                 this.node_click.width = this.node.width;
@@ -76,17 +78,22 @@ export default class Guide extends cc.Component {
             else if (this.crtGuide.click_rect.indexOf("event") != -1) {//点击区域下一步,并发送事件,显示区域读配置,点击区域=显示区域
                 this.event_name = "event_guide_" + this.crtGuide.id + "_" + this.crtStep;
                 let arr = this.crtGuide.display_rect.split(":");
-                this.node_display.x = this.node_click.x = parseInt(arr[0]);
-                this.node_display.y = this.node_click.y = parseInt(arr[1]);
-                this.node_display.width = this.node_click.width = parseInt(arr[2]);
-                this.node_display.height = this.node_click.height = parseInt(arr[3]);
+                x = parseInt(arr[0]);
+                y = parseInt(arr[1]);
+                w = parseInt(arr[2]);
+                h = parseInt(arr[3]);
+                this.node_click.x = x;
+                this.node_click.y = y;
+                this.node_click.width = w;
+                this.node_click.height = h;
             }
             else {//点击按钮下一步,显示区域为配置的node,点击区域=显示区域
                 this.targetNode = cc.find("Canvas/" + this.crtGuide.click_rect);
-                this.node_display.width = this.targetNode.width;
-                this.node_display.height = this.targetNode.height;
+                w = this.targetNode.width;
+                h = this.targetNode.height;
                 let pos = mk.game.getWorldPos(this.targetNode);
-                this.node_display.setPosition(pos);
+                x = pos.x;
+                y = pos.y;
 
                 //穿透点击目标节点时增加一个事件触发下一步,触发后移除
                 this.node_click.width = this.node_click.height = 0;
@@ -97,6 +104,18 @@ export default class Guide extends cc.Component {
                 this.targetNode.getComponent(cc.Button).clickEvents.push(eventHandler);
             }
 
+            //显示区域由大到小动画
+            if (x != null && y != null && w != null && h != null) {
+                cc.tween(this.node_display)
+                    .to(0.3, { x: x, y: y, width: w, height: h }, {
+                        onUpdate: () => {
+                            this.node_bg.x = -this.node_display.x;
+                            this.node_bg.y = -this.node_display.y;
+                        }
+                    })
+                    .start();
+            }
+
             //对话框位置
             ////全屏对齐
             if (this.crtGuide.dialog_pos != null && this.crtGuide.dialog_pos.length > 0) {
@@ -107,9 +126,9 @@ export default class Guide extends cc.Component {
                 }
             }
             else {//显示区域偏移
-                let arr = this.crtGuide.dialog_pos1.split(":");
-                this.node_dialog.x = this.node_display.x + parseInt(arr[0]);
-                this.node_dialog.y = this.node_display.y + parseInt(arr[1]);
+                let arr = this.crtGuide.dialog_pos1.split(",");
+                this.node_dialog.x = x + parseInt(arr[0]);
+                this.node_dialog.y = y + parseInt(arr[1]);
             }
 
             //对话文字对齐方式
@@ -122,8 +141,8 @@ export default class Guide extends cc.Component {
             else {
                 this.node_finger.active = true;
                 let arr = this.crtGuide.finger.split(":");
-                this.node_finger.x = this.node_display.x + parseInt(arr[0]);
-                this.node_finger.y = this.node_display.y + parseInt(arr[1]);
+                this.node_finger.x = x + parseInt(arr[0]);
+                this.node_finger.y = y + parseInt(arr[1]);
             }
 
             if (this.crtGuide.tr_form == 1) {
@@ -135,35 +154,36 @@ export default class Guide extends cc.Component {
                 this.node_person.node.active = true;
             }
 
-            this.node_bg.x = -this.node_display.x;
-            this.node_bg.y = -this.node_display.y;
-
             this.rich_dialog.string = this.crtGuide.dialog;
         }
     }
 
     async clickNodeClick() {
+        cc.Tween.stopAllByTarget(this.node_display);
         console.log("clickNodeClick");
-        if(this.targetNode){
+        if (this.targetNode) {
             this.targetNode.getComponent(cc.Button).clickEvents.pop();
         }
         if (this.event_name) {
             //event_guide_1_2 (1_2为新手引导的id)
             mk.event.emit(this.event_name);
         }
+        this.reset();
         if (this.crtGuide.lag_next > 0) {
-            this.wait();
             await mk.time.WaitForSeconds(this.crtGuide.lag_next);
         }
         this.nextStep();
     }
 
     /** 等待状态 透明不可点击 */
-    private wait() {
+    private reset() {
         this.node_display.width = this.node.width;
         this.node_display.height = this.node.height;
+        this.node_bg.x = this.node_bg.y = 0;
         this.node_click.width = 0
         this.node_click.height = 0;
+        this.node_finger.opacity = 0;
+        this.node_dialog.opacity = 0;
     }
 
 

+ 3 - 2
assets/script/mk/system/GuideSystem.ts

@@ -10,8 +10,8 @@ export default class GuideSystem {
 
     public open(id) {
         this.crtGuideID = gData.gameData.getProp(GameProp.guideID);
-        this.setGuideID(this.crtGuideID++);
-        if (id == 9999) {
+        // this.crtGuideID = 0;//测试无限新手引导
+        if (this.crtGuideID >= 9999) {
             mk.console.log("新手引导已做完");
             return;
         }
@@ -22,6 +22,7 @@ export default class GuideSystem {
         gData.guideData.crtID = id;
         this.crtGuideID = id;
         mk.ui.openPanel("module/guide/guide");
+        this.setGuideID(this.crtGuideID++);
     }
 
     /** 开启一个引导后直接默认已完成 */

Alguns ficheiros não foram mostrados porque muitos ficheiros mudaram neste diff