薛鸿潇 5 سال پیش
والد
کامیت
9868b03e12

+ 67 - 13
assets/resources/game/prefab/game.prefab

@@ -30,11 +30,11 @@
     "_active": true,
     "_components": [
       {
-        "__id__": 30
+        "__id__": 34
       }
     ],
     "_prefab": {
-      "__id__": 31
+      "__id__": 35
     },
     "_opacity": 255,
     "_color": {
@@ -276,11 +276,11 @@
     "_active": true,
     "_components": [
       {
-        "__id__": 28
+        "__id__": 32
       }
     ],
     "_prefab": {
-      "__id__": 29
+      "__id__": 33
     },
     "_opacity": 255,
     "_color": {
@@ -347,20 +347,20 @@
         "__id__": 19
       },
       {
-        "__id__": 22
+        "__id__": 24
       }
     ],
     "_active": true,
     "_components": [
       {
-        "__id__": 25
+        "__id__": 29
       },
       {
-        "__id__": 26
+        "__id__": 30
       }
     ],
     "_prefab": {
-      "__id__": 27
+      "__id__": 31
     },
     "_opacity": 255,
     "_color": {
@@ -689,10 +689,13 @@
     "_components": [
       {
         "__id__": 20
+      },
+      {
+        "__id__": 21
       }
     ],
     "_prefab": {
-      "__id__": 21
+      "__id__": 23
     },
     "_opacity": 255,
     "_color": {
@@ -774,6 +777,30 @@
     "_id": ""
   },
   {
+    "__type__": "b8d2cnq+GZLFK30xbLDqr/m",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 19
+    },
+    "_enabled": true,
+    "panel_name": "sign",
+    "open_type": 0,
+    "panel_type": 2,
+    "onComplete": {
+      "__id__": 22
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.ClickEvent",
+    "target": null,
+    "component": "",
+    "_componentId": "",
+    "handler": "",
+    "customEventData": ""
+  },
+  {
     "__type__": "cc.PrefabInfo",
     "root": {
       "__id__": 1
@@ -795,11 +822,14 @@
     "_active": true,
     "_components": [
       {
-        "__id__": 23
+        "__id__": 25
+      },
+      {
+        "__id__": 26
       }
     ],
     "_prefab": {
-      "__id__": 24
+      "__id__": 28
     },
     "_opacity": 255,
     "_color": {
@@ -853,7 +883,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 22
+      "__id__": 24
     },
     "_enabled": true,
     "_materials": [
@@ -881,6 +911,30 @@
     "_id": ""
   },
   {
+    "__type__": "b8d2cnq+GZLFK30xbLDqr/m",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 24
+    },
+    "_enabled": true,
+    "panel_name": "sign",
+    "open_type": 0,
+    "panel_type": 2,
+    "onComplete": {
+      "__id__": 27
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.ClickEvent",
+    "target": null,
+    "component": "",
+    "_componentId": "",
+    "handler": "",
+    "customEventData": ""
+  },
+  {
     "__type__": "cc.PrefabInfo",
     "root": {
       "__id__": 1
@@ -979,7 +1033,7 @@
       "__id__": 19
     },
     "btn4": {
-      "__id__": 22
+      "__id__": 24
     },
     "_id": ""
   },

+ 4 - 8
assets/script/game/data/module/SignData.ts

@@ -5,7 +5,7 @@ import { RewardState } from "../GameData";
  * @description 签到数据
  * @author 邹勇 薛鸿潇
  */
-export class SignData  extends Data{
+export class SignData extends Data {
     /** 标志位:是否需要刷新数据 */
     public init_data: boolean = false;
 
@@ -72,15 +72,11 @@ export class SignData  extends Data{
      * @returns 状态123
      */
     public getStateByDay(login_day: number) {
-        let _state = RewardState.none;
+        let _state = 0;
         if (login_day <= this.sign_last_bar) {
             _state = RewardState.none;
-        } else if (login_day == (this.sign_last_bar + 1)) {
-            if (!this.sign_can) {
-                _state = RewardState.none;
-            } else {
-                _state = RewardState.unlock;
-            }
+        } else if (this.sign_can && login_day == (this.sign_last_bar + 1)) {
+            _state = RewardState.unlock;
         } else {
             _state = RewardState.lock;
         }

+ 12 - 16
assets/script/game/module/module/sign/Sign.ts

@@ -22,7 +22,7 @@ export default class Sign extends cc.Component {
     }
 
     start() {
-        // gData.sign.sign_can = gData.gameData.getProp(GameProp.sign_can)
+        // gData.sign.sign_can = gData.gameData.getProp(GameProp.sign_can);
         gData.sign.initListData();
         gData.sign.init_data = true;
     }
@@ -42,20 +42,17 @@ export default class Sign extends cc.Component {
         if (!gData.sign.sign_can) return;
         gData.sign.sign_can = 0;
         gData.sign.sign_last_bar++;
-        let test = null;
-        // let data = [
-        //     {
-        //         key: GameProp.sign_can,
-        //         value: gData.sign.sign_can
-        //     },
-        //     {
-        //         key: GameProp.sign_last_bar,
-        //         value: gData.sign.sign_last_bar
-        //     }
-        // ]
-        // gData.gameData.setProps(data)
-        // gData.gameData.setProp(GameProp.sign_can, gData.sign.sign_can)
-        // gData.gameData.setProp(GameProp.sign_last_bar, gData.sign.sign_last_bar)
+        let new_data = [
+            {
+                key: GameProp.sign_can,
+                value: gData.sign.sign_can
+            },
+            {
+                key: GameProp.sign_last_bar,
+                value: gData.sign.sign_last_bar
+            }
+        ]
+        gData.gameData.setProps(new_data);
     }
 
     update(dt) {
@@ -63,7 +60,6 @@ export default class Sign extends cc.Component {
             gData.sign.init_data = false;
             this.initScollView();
             this.initBtnStyle();
-            cc.log(1)
         }
     }