薛鸿潇 5 лет назад
Родитель
Сommit
d1f39ab92d

+ 13 - 1
assets/script/game/data/GameData.ts

@@ -162,6 +162,18 @@ export enum RewardState {
 }
 
 /**
+ * 奖励类型
+ */
+export enum RewardType {
+    /** 红包币 */
+    redBag = 1,
+    /** 毛币 */
+    rmb = 2,
+    /** 金猪币 */
+    pigRmb = 3,
+}
+
+/**
  * 音频路径
  */
 export enum AUDIO_TYPE {
@@ -170,4 +182,4 @@ export enum AUDIO_TYPE {
     turntableDraw = 'turntable1',           //转盘抽奖结束
     turntableDrawEnd = 'turntable_2',           //转盘抽奖音效
     getGold = 'Get_gold',       //获取金币音效
-}
+}

+ 9 - 0
assets/script/game/data/module/PigBankData.ts

@@ -1,5 +1,6 @@
 import { Data } from "../../../mk/data/Data";
 
+
 /**
  * 存钱罐数据
  * - 提现描述显示:
@@ -11,6 +12,14 @@ import { Data } from "../../../mk/data/Data";
  * @author 薛鸿潇
  */
 export class PigBankData extends Data {
+    /**
+     * 数据初始化
+     */
+    public init() {
+        // let piggyBank = gData.gameData.gameData.piggyBank;
+        // cc.log(piggyBank);
+    }
+
     /** 标志位:是否需要刷新数据 */
     public init_data: boolean = true;
     /** 是否可提现 */

+ 52 - 17
assets/script/game/data/module/SignData.ts

@@ -6,14 +6,37 @@ import { GameProp, RewardState } from "../GameData";
  * @author 邹勇 薛鸿潇
  */
 export class SignData extends Data {
+    /**
+     * 数据初始化
+     */
+    public init() {
+        // 签到配置表
+        if (gData.gameData.configs.SignIn) {
+            gData.gameData.configs.SignIn.forEach(item_data => {
+                for (const key in item_data) {
+                    item_data[key] = parseInt(item_data[key])
+                }
+            });
+            this.c_sign = gData.gameData.configs.SignIn;
+        }
+        // this.sign_last_bar = gData.gameData.
+    }
+
     /** 标志位:是否需要刷新数据 */
     public init_data: boolean = false;
 
     /** 配置数据 签到 */
-    public c_sign = [];
+    private _c_sign: Array<CSignType> = [];
+    set c_sign(value: Array<CSignType>) {
+        this._c_sign = value;
+        this.init_data = true;
+    }
+    get c_sign(): Array<CSignType> {
+        return this._c_sign;
+    }
 
     // 服务端数据 上次签到天数
-    private _sign_last_bar = 3;
+    private _sign_last_bar = 0;
     set sign_last_bar(value: number) {
         this._sign_last_bar = value;
         this.init_data = true;
@@ -36,7 +59,7 @@ export class SignData extends Data {
     public list_data = [];
     /** 初始化列表数据 */
     public initListData() {
-        if (!this.c_sign.length) this.c_sign = this.getSignConfig();
+        // if (!this.c_sign.length) this.c_sign = this.getSignConfig();
         let list_data = [];
         for (let i = 0; i < 30;) {
             let item_data = [];
@@ -51,20 +74,20 @@ export class SignData extends Data {
     }
 
     /** 客户端造的假配置 */
-    private getSignConfig() {
-        let c_sign = [];
-        for (let i = 0; i < 30; i++) {
-            const id = i + 1;
-            let data: any = {};
-            data.id = id;
-            data.reward_type = i % 3;
-            data.count = id;
-            data.login_day = id;
-            data.video_limit = 0;
-            c_sign.push(data);
-        }
-        return c_sign;
-    }
+    // private getSignConfig() {
+    //     let c_sign = [];
+    //     for (let i = 0; i < 30; i++) {
+    //         const id = i + 1;
+    //         let data: any = {};
+    //         data.id = id;
+    //         data.reward_type = i % 3;
+    //         data.count = id;
+    //         data.login_day = id;
+    //         data.video_limit = 0;
+    //         c_sign.push(data);
+    //     }
+    //     return c_sign;
+    // }
 
     /**
      * 获取奖励状态
@@ -114,4 +137,16 @@ export class SignData extends Data {
         gData.gameData.setProps(new_data);
     }
 
+}
+
+export type CSignType = {
+    id: number,
+    /** 天数 */
+    loginDay: number,
+    /** 奖励数量 */
+    rewardNum: number,
+    /** 奖励类型 */
+    rewardType: number,
+    /** 视频限制 */
+    videoNum: number,
 }

+ 2 - 0
assets/script/game/module/module/sign/Sign.ts

@@ -17,6 +17,8 @@ export default class Sign extends cc.Component {
     private scroll_view: cc.ScrollView = null!;
     @property({ type: cc.Animation, displayName: '按钮_动画' })
     private anim_btn: cc.Animation = null!;
+    @property({ type: cc.Integer, displayName: '11111' })
+    private anim_btn2: number[] = [];
 
     onLoad() {
 

+ 14 - 14
assets/script/game/module/module/sign/SignIconItem.ts

@@ -1,4 +1,5 @@
-import { RewardState } from "../../../data/GameData";
+import { RewardState, RewardType } from "../../../data/GameData";
+import { CSignType } from "../../../data/module/SignData";
 
 const { ccclass, property } = cc._decorator;
 /**
@@ -18,19 +19,18 @@ export default class SignIconItem extends cc.Component {
 
     @property({ displayName: '天数', type: cc.Label })
     private lbl_day: cc.Label = null!;
-    @property({ type: cc.Node, displayName: '蒙版' })
+    @property({ displayName: '蒙版', type: cc.Node })
     private node_mask: cc.Node = null!;
-    @property({ type: cc.Node, displayName: '勾' })
+    @property({ displayName: '勾', type: cc.Node })
     private node_gou: cc.Node = null!;
 
     /** 数据 */
-    private icon_data = {
+    private icon_data: CSignType = {
         id: 0,
-        reward_type: 0,
-        count: 0,
-        login_day: 0,
-        video_limit: 0,
-        state: RewardState.none,
+        rewardType: 0,
+        rewardNum: 0,
+        loginDay: 0,
+        videoNum: 0
     }
 
     /**
@@ -45,12 +45,13 @@ export default class SignIconItem extends cc.Component {
      * @param icon_data 数据
      */
     private initIcon(icon_data) {
-        if (!icon_data) {
+        this.icon_data = icon_data;
+        if (!this.icon_data) {
             this.node.active = false;
             return
         }
-        this.lbl_day.string = '第' + icon_data.login_day + '天';
-        if (icon_data.reward_type) {
+        this.lbl_day.string = '第' + this.icon_data.loginDay + '天';
+        if (this.icon_data.rewardType == RewardType.rmb || this.icon_data.rewardType == RewardType.pigRmb) {
             this.node_cash.active = true;
             this.node_redbag.active = false;
             this.lbl_day.node.getComponent(cc.LabelOutline).color = cc.color(DayOutLineColor.cash);
@@ -59,10 +60,9 @@ export default class SignIconItem extends cc.Component {
             this.node_redbag.active = true;
             this.lbl_day.node.getComponent(cc.LabelOutline).color = cc.color(DayOutLineColor.red_bag);
         }
-        this.icon_data = icon_data;
 
         // 状态样式
-        let state = gData.sign.getStateByDay(icon_data.login_day);
+        let state = gData.sign.getStateByDay(this.icon_data.loginDay);
         if (state == RewardState.none) {
             this.node_mask.active = true;
             this.node_gou.active = true;