Browse Source

Merge branch 'master' of http://git.mokasz.com/zouyong/tower_sanguo

zhengniehua 5 years ago
parent
commit
de6a302ede

+ 1 - 1
tower_sanguo/assets/MOKA/net/HttpManager.ts

@@ -79,7 +79,7 @@ export default class HttpManager {
                     }
                 }
                 else {
-                    GameController.errorM.dealError("httpStatusError:" + url, ERROR_DEAL.REQUEST);
+                    LogUtil.logAndroid("收到请求..." + httpRequest.status)
                 }
             }
         }

File diff suppressed because it is too large
+ 1440 - 187
tower_sanguo/assets/resources/module/fight/fight.prefab


BIN
tower_sanguo/assets/resources/module/fight/prefab_texture/add.png


+ 36 - 0
tower_sanguo/assets/resources/module/fight/prefab_texture/add.png.meta

@@ -0,0 +1,36 @@
+{
+  "ver": "2.3.4",
+  "uuid": "ddae9f4f-0071-4697-a276-9528691a24d2",
+  "type": "sprite",
+  "wrapMode": "clamp",
+  "filterMode": "bilinear",
+  "premultiplyAlpha": false,
+  "genMipmaps": false,
+  "packable": true,
+  "width": 47,
+  "height": 47,
+  "platformSettings": {},
+  "subMetas": {
+    "add": {
+      "ver": "1.0.4",
+      "uuid": "8e4d3018-7b10-4b78-b4d8-09b0e55cf2c4",
+      "rawTextureUuid": "ddae9f4f-0071-4697-a276-9528691a24d2",
+      "trimType": "auto",
+      "trimThreshold": 1,
+      "rotated": false,
+      "offsetX": 0,
+      "offsetY": 0,
+      "trimX": 0,
+      "trimY": 0,
+      "width": 47,
+      "height": 47,
+      "rawWidth": 47,
+      "rawHeight": 47,
+      "borderTop": 0,
+      "borderBottom": 0,
+      "borderLeft": 0,
+      "borderRight": 0,
+      "subMetas": {}
+    }
+  }
+}

+ 8 - 6
tower_sanguo/assets/resources/module/gm/gm.prefab

@@ -3967,8 +3967,8 @@
       }
     ],
     "_useOriginalSize": false,
-    "_string": "button",
-    "_N$string": "button",
+    "_string": "增加属性值",
+    "_N$string": "增加属性值",
     "_fontSize": 20,
     "_lineHeight": 40,
     "_enableWrapText": false,
@@ -4154,11 +4154,13 @@
   },
   {
     "__type__": "cc.ClickEvent",
-    "target": null,
+    "target": {
+      "__id__": 1
+    },
     "component": "",
-    "_componentId": "",
-    "handler": "",
-    "customEventData": ""
+    "_componentId": "03d84HbqihI1Ihyl7k79bNs",
+    "handler": "clickBtn",
+    "customEventData": "updateprop"
   },
   {
     "__type__": "cc.PrefabInfo",

+ 15 - 8
tower_sanguo/assets/scripts/data/GameData.ts

@@ -521,7 +521,8 @@ export default class GameData {
         }
         let data = response.data as PlayerProp;
 
-        console.log("PlayerInfo: ", data);
+        // console.log("PlayerInfo: ", data);
+        console.log('%cPlayerInfo:', 'color: green;', data);
 
         this.initPlayerPropsNoCheck(data.gameUserData);
         this.initPlayerProps(data);
@@ -542,7 +543,7 @@ export default class GameData {
                 let o = arr[i];
                 let id = o.id;
                 let vo: GeneralVO = this.createGeneralVO(id, 0, arr[i]);
-                if(!vo){
+                if (!vo) {
                     continue;
                 }
 
@@ -559,9 +560,10 @@ export default class GameData {
             this.updateSkillData();
         }
 
+        TaskModel.getTaskDataByPlayer();
+        let task_list = TaskModel.task_data.list_data;
+        if (!task_list || !task_list.length) TaskModel.ResetTaskData();// 无数据则重置
         GameController.loadMain();
-        TaskModel.ResetTaskData();// 重置任务数据 - 本地测试暂用
-        TaskModel.getServerTaskData();// 请求服务器任务数据
     }
 
     /** 初始化数据 */
@@ -581,7 +583,8 @@ export default class GameData {
         this.player.setProp(PLAYERPROP.TURNTABLE_TOTAL, data.turntableTotal);
         this.player.setProp(PLAYERPROP.USESKILL_TIME, data.skill_coolTime);
         this.player.setProp(PLAYERPROP.TASK_REDBAG_COUNT, data.taskRedBag);
-        
+        this.player.setProp(PLAYERPROP.USER_DAILY_ACTIVE_S_INFO, data.dailyTask);
+
         // this.player.setProp(PLAYERPROP.GENERAL_TRAIN_TIMES, data.general_train_times);
         // this.player.setProp(PLAYERPROP.INVEST_TIMES, data.invest_times);
         // this.player.setProp(PLAYERPROP.GENERAL_LUCK_TIMES, data.general_luck_times);
@@ -595,7 +598,12 @@ export default class GameData {
             return;
         }
         for (let i in gameUserData) {
-            this.player.setProp(parseInt(i), parseInt(gameUserData[i]));
+            let key = parseInt(i);
+            if (this.player.isObjByPLAYERPROP(key)) {
+                this.player.setProp(parseInt(i), gameUserData[i]);
+            } else {
+                this.player.setProp(parseInt(i), parseInt(gameUserData[i]));
+            }
         }
     }
 
@@ -646,7 +654,7 @@ export default class GameData {
     private createGeneralVO(id, type: number, arg = null): GeneralVO {
         let vo = new GeneralVO();
         let config = this.getGeneralByID(id);
-        if(!config){
+        if (!config) {
             return;
         }
         //配置
@@ -894,7 +902,6 @@ export default class GameData {
     updatePropNoCheck(type: PLAYERPROP, value, callback = null) {
         let self = this;
         GameController.http.savePlayerProp(() => {
-            self.player.setProp(type, value);
             if (callback) {
                 callback();
             }

+ 13 - 0
tower_sanguo/assets/scripts/data/GameDefinition.ts

@@ -37,6 +37,19 @@ export enum PLAYERPROP {
     LOOK_VIDEO_TIMES = 28,
     /** 可补领红包币数量 29*/
     TASK_REDBAG_COUNT = 29,
+    /** 任务活跃服务端通知的数据 30
+     * - USERDailyTaskINFO 活跃度信息 需要校验
+    */
+    USER_DAILY_ACTIVE_S_INFO = 30,
+    /** 任务活跃数据 31
+     * - 任务条信息 无需校验
+    */
+    USER_DAILY_TASK_INFO = 31,
+    /** 任务活跃数据 32
+     * - 任务活跃信息 无需校验
+     * - 数值以30的为准
+    */
+    USER_DAILY_ACTIVE_INFO = 32,
 }
 
 export enum ITEMTYPE {

+ 10 - 0
tower_sanguo/assets/scripts/module/fight/FightNode.ts

@@ -13,14 +13,19 @@ export default class FightNode extends cc.Component {
 	node_lbl: cc.Node;
 	img_suo1: cc.Node;
 	lbl_general1: cc.Node;
+	add_general_1: cc.Node;
 	img_suo2: cc.Node;
 	lbl_general2: cc.Node;
+	add_general_2: cc.Node;
 	img_suo3: cc.Node;
 	lbl_general3: cc.Node;
+	add_general_3: cc.Node;
 	img_suo4: cc.Node;
 	lbl_general4: cc.Node;
+	add_general_4: cc.Node;
 	img_suo5: cc.Node;
 	lbl_general5: cc.Node;
+	add_general_5: cc.Node;
 
     onLoad () {
 		this.fight = this.node;
@@ -34,14 +39,19 @@ export default class FightNode extends cc.Component {
 		this.node_lbl = this.fight.getChildByName("node_lbl");
 		this.img_suo1 = this.node_lbl.getChildByName("img_suo1");
 		this.lbl_general1 = this.node_lbl.getChildByName("lbl_general1");
+		this.add_general_1 = this.node_lbl.getChildByName("add_general_1");
 		this.img_suo2 = this.node_lbl.getChildByName("img_suo2");
 		this.lbl_general2 = this.node_lbl.getChildByName("lbl_general2");
+		this.add_general_2 = this.node_lbl.getChildByName("add_general_2");
 		this.img_suo3 = this.node_lbl.getChildByName("img_suo3");
 		this.lbl_general3 = this.node_lbl.getChildByName("lbl_general3");
+		this.add_general_3 = this.node_lbl.getChildByName("add_general_3");
 		this.img_suo4 = this.node_lbl.getChildByName("img_suo4");
 		this.lbl_general4 = this.node_lbl.getChildByName("lbl_general4");
+		this.add_general_4 = this.node_lbl.getChildByName("add_general_4");
 		this.img_suo5 = this.node_lbl.getChildByName("img_suo5");
 		this.lbl_general5 = this.node_lbl.getChildByName("lbl_general5");
+		this.add_general_5 = this.node_lbl.getChildByName("add_general_5");
 
     }
 }

+ 25 - 7
tower_sanguo/assets/scripts/module/fight/FightUI.ts

@@ -16,11 +16,13 @@ import AttackFlash from "./model/attack/AttackFlash";
 import AttackWJQF from "./model/attack/AttackWJQF";
 import { POPTYPE } from "../../component/PopMessage";
 import MissionUpdateResponse from "../../net/msg/MissionUpdateResponse";
-import { PLAYERPROP } from "../../data/GameDefinition";
+import { AUDIO_TYPE, PLAYERPROP } from "../../data/GameDefinition";
 import GeneralExpUpResponse from "../../net/msg/GeneralExpUpResponse";
 import AttackWall from "./model/attack/AttackWall";
 import TaskModel from "../task/TaskModel";
 import PiggyBankModel from "../piggyBank/PiggyBankModel";
+import GeneralUI from "../general/GeneralUI";
+import { ViewZorder } from "../../../MOKA/data/ViewZOrder";
 
 const { ccclass, property } = cc._decorator;
 
@@ -100,6 +102,8 @@ export default class FightUI extends BaseUI {
         for (let i = 1; i <= 5; i++) {
             let node_bg: cc.Node = this.ui['general_bg' + i];
             this.generalCroods.push(new cc.Vec2(node_bg.x, node_bg.y));
+            let bnt_add_general = this.ui['add_general_' + i].getComponent(cc.Button);
+            XXEvent.addClickEvent(bnt_add_general, this.onClickGotoZhenWei, this);
         }
 
         this.fightData = GameController.gameData.fightData;
@@ -166,13 +170,17 @@ export default class FightUI extends BaseUI {
      */
     private updateStage(i) {
         let open = GameController.gameData.player.mission_open[i];
-        let lbl: cc.Node = this.ui['lbl_general' + (i + 1)];
+        let index = i + 1;
+        let lbl: cc.Node = this.ui['lbl_general' + index];
         lbl.getComponent(cc.RichText).string = `<outline color=black width=2><color=#F1440B><b>${open}关</c><color=#ffffff><b>解锁</color></outline>`;
 
         let vo = GameController.gameData.player.generals[i];
         lbl.active = !vo && this.current_mission < open;
         this.updateGeneral(i, vo);
-        this.ui['img_suo' + (i + 1)].active = lbl.active;
+        this.ui['img_suo' + index].active = lbl.active;
+        // +号按钮显示逻辑
+        let add_general = this.ui['add_general_' + index];
+        add_general.active = !lbl.active && !vo;
     }
     /**
      * 
@@ -315,10 +323,15 @@ export default class FightUI extends BaseUI {
             this.createAttackSkillWall(vo);
         }
         else {//其他统帅技能
-            let rate = vo.skillValue[0] / 10000;
-            for (let i = 0; i < this.monster_arr.length; i++) {
-                let m: Monster = this.monster_arr[i];
-                this.createAttackSkill(vo, m.vo.type == 2 ? m.vo.maxhp * rate : 99999999, this.monster_arr[i]);
+            if (GameController.gameData.player.skill_default_id != -1) {
+                let lv = GameController.gameData.player.skill_lv_data.get(GameController.gameData.player.skill_default_id);
+                if (lv > 0) {
+                    let rate = vo.skillValue[lv - 1] / 10000;
+                    for (let i = 0; i < this.monster_arr.length; i++) {
+                        let m: Monster = this.monster_arr[i];
+                        this.createAttackSkill(vo, m.vo.type == 2 ? m.vo.maxhp * rate : 99999999, this.monster_arr[i]);
+                    }
+                }
             }
         }
         this.resumeGame();
@@ -1166,6 +1179,11 @@ export default class FightUI extends BaseUI {
         this.btn_skill.active = GameController.gameData.player.isExistMarshalGeneral();
         XXEvent.emit("MainUIUpdateQiPaoMarshal");
     }
+    /** 点击阵位+号,跳转武将-阵位界面 */
+    private onClickGotoZhenWei() {
+        GameController.audioM.playEffect(AUDIO_TYPE.button);
+        GameController.uiM.openUI(GeneralUI, null, ViewZorder.UI, null, null, { tab_type: 1 });
+    }
 }
 
 /** 技能伤害 */

+ 2 - 1
tower_sanguo/assets/scripts/module/fight/model/attack/AttackWall.ts

@@ -28,7 +28,8 @@ export default class AttackWall extends FightModel implements IPool {
     }
 
     init(vo: SkillVO, target: Monster) {
-        this.cd = vo.skillValue[0];
+        let lv = GameController.gameData.player.skill_lv_data.get(GameController.gameData.player.skill_default_id);
+        this.cd = vo.skillValue[lv - 1];
         let [x, y, x1, y1, src, type] = [0, 0, 0, 0, '', 1];
         if (target.moveStep < 3) {//左侧
             x = target.node.x;

+ 8 - 0
tower_sanguo/assets/scripts/module/gm/GmUI.ts

@@ -50,6 +50,9 @@ export default class GmUI extends BaseUI {
             case 'setmission':
                 this.setmission();
                 break;
+            case 'updateprop':
+                this.updatePlayerProp();
+                break;
         }
     }
 
@@ -61,6 +64,11 @@ export default class GmUI extends BaseUI {
         }
     }
 
+    private updatePlayerProp(){
+        let arr = this.lbl_input.string.split(":");
+        GameController.http.updateKeyValueDemo(null,arr[0],arr[1]);
+    }
+
     private addGeneral() {
         let id = parseInt(this.lbl_input.string);
         if(GameController.useLocalServer){

+ 1 - 3
tower_sanguo/assets/scripts/module/main/MainUI.ts

@@ -65,7 +65,7 @@ export default class MainUI extends BaseUI {
     lbl_pigback_count: cc.Label = null;
     @property({ type: cc.Button, displayName: '训练按钮' })
     btn_3: cc.Button = null;
-    
+
 
 
     @property({ type: cc.Node, displayName: "兵营红点" })
@@ -99,8 +99,6 @@ export default class MainUI extends BaseUI {
     private isPlayQipao_Marshal = false;
 
     onLoad() {
-        TaskModel.ResetTaskData();// 重置任务数据 - 本地测试暂用
-        TaskModel.getServerTaskData();// 请求服务器任务数据
 
         // this.btn_gm.node.active = false;
         this.ui = this.node.addComponent(MainNode);

+ 58 - 33
tower_sanguo/assets/scripts/module/task/TaskModel.ts

@@ -2,7 +2,7 @@ import { PLAYERPROP, RewardState } from "../../data/GameDefinition";
 import GameController from "../../GameController";
 import TaskProp from "../../net/msg/TaskProp";
 /** 任务条数据类型 */
-type TASKITEM = {
+export type TASKITEM = {
     //////////配置表数据//////////
     id: number;
     /** 任务描述 */
@@ -64,12 +64,22 @@ export default class TaskModel {
         /** 当前活跃值 */
         cur_active_value: 0,
         /** 总活跃值 */
-        max_active_value: 0,
+        max_active_value: 100,
         /** 活跃数据 */
         active_data: [],
         /** 任务列表数据 */
         list_data: [],
     }
+    /** 保存任务条数据 */
+    public static saveTaskData() {
+        let temp_str_list_data = JSON.stringify(this.task_data.list_data);
+        GameController.gameData.updatePropNoCheck(PLAYERPROP.USER_DAILY_TASK_INFO, temp_str_list_data);// 任务条数据
+    }
+    /** 保存活跃数据 */
+    public static saveActiveData() {
+        let temp_str_active_data = JSON.stringify(this.task_data.active_data);
+        GameController.gameData.updatePropNoCheck(PLAYERPROP.USER_DAILY_ACTIVE_INFO, temp_str_active_data);// 活跃数据
+    }
     /** 重置任务数据 */
     public static ResetTaskData() {
         this.task_data.cur_active_value = 0;
@@ -118,21 +128,47 @@ export default class TaskModel {
             this.task_data.list_data[i] = list_data;
             i++;
         }
+        console.log('%c每日任务数据已重置', 'color: green;');
+        // 通知服务端
+        this.saveTaskData();
+        this.saveActiveData();
     }
+    /** 获取数据 by player 
+     * - 登陆时会获取
+     * - 等待优化
+    */
+    public static getTaskDataByPlayer() {
+        // 任务条数据
+        let list_data = GameController.gameData.player.getProp(PLAYERPROP.USER_DAILY_TASK_INFO);
+        if (list_data) {
+            let temp_str_list_data = JSON.parse(list_data)
+            if (temp_str_list_data) this.task_data.list_data = temp_str_list_data;
+        }
 
-    /** 向服务端请求任务数据 */
-    public static getServerTaskData() {
-        GameController.http.getTaskInfo(TaskModel.serverTaskDataCall.bind(this));
-    }
-    /** 获取数据 */
-    private static serverTaskDataCall(s_data) {
-        cc.log('任务数据:%o', s_data);
-        // this.task_data.cur_active_value = s_data.task_active_data.cur_active_value;
-        // this.task_data.max_active_value = s_data.task_active_data.max_active_value;
-        // this.task_data.task_box_state = s_data.task_active_data.task_box_state || [];
-        // this.task_data.tv_box_state = s_data.task_active_data.tv_box_state || [];
-        // this.task_data.list_data = s_data.task_list;
-        XXEvent.emit(XXConst.UpdateTaskData, this.task_data);
+        // 活跃数据 - 需要服务端校验
+        let active_data = GameController.gameData.player.getProp(PLAYERPROP.USER_DAILY_ACTIVE_INFO);
+        if (active_data) {
+            let temp_str_active_data = JSON.parse(active_data);
+            if (temp_str_active_data) this.task_data.active_data = temp_str_active_data;
+        }
+        let active_s_data = GameController.gameData.player.getProp(PLAYERPROP.USER_DAILY_ACTIVE_S_INFO);
+        if (active_s_data) {
+            this.task_data.cur_active_value = active_s_data.activeToday;
+            for (let i = 0; i < this.task_data.active_data.length; i++) {
+                if (!active_s_data[i]) {
+                    this.task_data.active_data[i].task_box_state = RewardState.lock;
+                    this.task_data.active_data[i].tv_box_state = RewardState.lock;
+                } else if (active_s_data[i] === 1) {
+                    this.task_data.active_data[i].task_box_state = RewardState.unlock;
+                    this.task_data.active_data[i].tv_box_state = RewardState.lock;
+                } else if (active_s_data[i] === 2) {
+                    this.task_data.active_data[i].task_box_state = RewardState.unlock;
+                    this.task_data.active_data[i].tv_box_state = RewardState.unlock;
+                }
+                if (this.task_data.max_active_value < this.task_data.active_data[i].activevalue) this.task_data.max_active_value = this.task_data.active_data[i].activevalue;
+            }
+        }
+        console.log('%c每日任务数据_s:', 'color: green;', TaskModel.task_data);
     }
 
 
@@ -159,36 +195,19 @@ export default class TaskModel {
     /** 增加任务条进度 */
     public static addTaskItemBar(prop_id: PLAYERPROP) {
         if (prop_id === PLAYERPROP.GENERAL_TRAIN_TIMES) {
-            GameController.gameData.player.setProp(PLAYERPROP.GENERAL_TRAIN_TIMES, 1, true);
-            let times = GameController.gameData.player.getProp(PLAYERPROP.GENERAL_TRAIN_TIMES);
-            GameController.gameData.updatePropNoCheck(PLAYERPROP.GENERAL_TRAIN_TIMES, times);
             this.setListData(1);
         } else if (prop_id === PLAYERPROP.INVEST_TIMES) {
-            GameController.gameData.player.setProp(PLAYERPROP.INVEST_TIMES, 1, true);
-            let times = GameController.gameData.player.getProp(PLAYERPROP.INVEST_TIMES);
-            GameController.gameData.updatePropNoCheck(PLAYERPROP.INVEST_TIMES, times);
             this.setListData(2);
         } else if (prop_id === PLAYERPROP.GENERAL_LUCK_TIMES) {
-            GameController.gameData.player.setProp(PLAYERPROP.GENERAL_LUCK_TIMES, 1, true);
-            let times = GameController.gameData.player.getProp(PLAYERPROP.GENERAL_LUCK_TIMES);
-            GameController.gameData.updatePropNoCheck(PLAYERPROP.GENERAL_LUCK_TIMES, times);
             this.setListData(3);
         } else if (prop_id === PLAYERPROP.TURNTABLE_LUCK_TIMES) {
-            GameController.gameData.player.setProp(PLAYERPROP.TURNTABLE_LUCK_TIMES, 1, true);
-            let times = GameController.gameData.player.getProp(PLAYERPROP.TURNTABLE_LUCK_TIMES);
-            GameController.gameData.updatePropNoCheck(PLAYERPROP.TURNTABLE_LUCK_TIMES, times);
             this.setListData(4);
         } else if (prop_id === PLAYERPROP.USE_SKILLS_TIMES) {
-            GameController.gameData.player.setProp(PLAYERPROP.USE_SKILLS_TIMES, 1, true);
-            let times = GameController.gameData.player.getProp(PLAYERPROP.USE_SKILLS_TIMES);
-            GameController.gameData.updatePropNoCheck(PLAYERPROP.USE_SKILLS_TIMES, times);
             this.setListData(5);
         } else if (prop_id === PLAYERPROP.LOOK_VIDEO_TIMES) {
-            GameController.gameData.player.setProp(PLAYERPROP.LOOK_VIDEO_TIMES, 1, true);
-            let times = GameController.gameData.player.getProp(PLAYERPROP.LOOK_VIDEO_TIMES);
-            GameController.gameData.updatePropNoCheck(PLAYERPROP.LOOK_VIDEO_TIMES, times);
             this.setListData(6);
         }
+        this.saveTaskData();
         // 更新数据
         XXEvent.emit(XXConst.UpdateTaskData, this.task_data);
     }
@@ -216,6 +235,7 @@ export default class TaskModel {
                 break;
             }
         }
+        this.saveTaskData();
     }
 
     //////////////////////////////活跃相关//////////////////////////////
@@ -241,6 +261,10 @@ export default class TaskModel {
             }
             index++;
         }
+        // 通知服务端
+        let data2 = { addActiveToday: value }
+        GameController.http.scaveTaskActiveValue(data2);
+        this.saveActiveData();
     }
     /** 设置指定活跃宝箱状态 */
     public static setActiveBoxState(id, task_box_state, tv_box_state) {
@@ -252,6 +276,7 @@ export default class TaskModel {
                 break;
             }
         }
+        this.saveActiveData();
     }
 
     /** 获取任务数据 */

+ 0 - 5
tower_sanguo/assets/scripts/module/task/TaskUI.ts

@@ -96,8 +96,6 @@ export default class TaskUI extends BaseUI {
         this.spr_pro_bar1.fillRange = 0;
         this.spr_pro_bar2.fillRange = 0;
         // 请求数据
-        // GameController.http.getTaskInfo(this.getTaskData.bind(this));
-        TaskModel.getServerTaskData();
         this.initStyle();
     }
     start() {
@@ -110,9 +108,6 @@ export default class TaskUI extends BaseUI {
         // 测试请求 奖励内容
         // let data = { taskId: 0 }
         // GameController.http.openTreasureChest(data, this.onTreasureChest.bind(this));
-        // 测试请求 存活跃值
-        // let data2 = { addActiveToday: 100 }
-        // GameController.http.scaveTaskActiveValue(data2, this.onTreasureChest.bind(this));
     }
     /** 奖励内容数据 */
     private onTreasureChest(data) {

+ 18 - 6
tower_sanguo/assets/scripts/net/HttpCommand.ts

@@ -24,7 +24,7 @@ export default class HttpCommand {
             this.serverUrl = 'https://xiyou-test.duiweize.com/';
         }
         this.serverUrl = 'http://172.16.15.97:9092/';//李扬
-        //this.serverUrl = 'http://172.16.15.91:9092/';//悍国
+        // this.serverUrl = 'http://172.16.15.91:9092/';//悍国
     }
 
     httpM: any;
@@ -48,7 +48,8 @@ export default class HttpCommand {
     connectTest(callback) {
         GameController.commonData.ranKey = Utils.randomString()
         let data = {
-            "mac": "a5:65:e2:1c:b0:26,f6:60:e4:1a:b7:27",            
+            "mac": "c1:65:e2:1c:b0:26,f6:60:e4:1a:b7:27",
+            "mac": "a5:65:e2:1c:b0:26,f6:60:e4:1a:b7:27",
             "psk": GameController.commonData.ranKey,
             "appId": GameController.commonData.appid
         }
@@ -170,14 +171,23 @@ export default class HttpCommand {
         };
         this.sendData(HTTPTYPE.getInitGeneralDemo, data, callback);
     }
+    updateKeyValueDemo(callback, key, value) {
+        let data = {
+            key: key,
+            value: value
+        };
+        this.sendData(HTTPTYPE.updateKeyValueDemo, data, callback);
+    }
     /** 获取任务数据 */
     getTaskInfo(callback) {
         this.sendData(HTTPTYPE.task_data, 'POST', callback);
     }
-    /** 存活跃值 */
-    scaveTaskActiveValue(data = { addActiveToday: 0 }, callback) {
+    /** 存活跃值 
+     * - 增加的活跃值
+    */
+    scaveTaskActiveValue(data = { addActiveToday: 0 }) {
         let url = 'dailytask/saveActiveToday';
-        this.sendData(url, data, callback);
+        this.sendData(url, data);
     }
     /** 开启宝箱 */
     openTreasureChest(data = { taskId: 0 }, callback) {
@@ -309,7 +319,7 @@ export default class HttpCommand {
     /** 武将许愿
      * @param callback 回调
     */
-    prayGeneral(callback,data) {
+    prayGeneral(callback, data) {
         this.sendData(HTTPTYPE.prayGeneral, data, callback);
     }
 
@@ -428,6 +438,8 @@ export enum HTTPTYPE {
     // ZNH
     /** 武将许愿*/
     prayGeneral = 'general/prayGeneral',
+
+    updateKeyValueDemo = 'general/updateKeyValueDemo',
 }
 
 

+ 2 - 0
tower_sanguo/assets/scripts/net/msg/PlayerProp.ts

@@ -63,5 +63,7 @@ export default class PlayerProp {
     use_skills_times: number
     /** 今日观看视频广告次数 28*/
     look_video_times: number
+    /** 玩家属性值是对象而非数字,解析服务端数据不转num的集合 */
+    PLAYERPROP_is_obj: [PLAYERPROP.USER_DAILY_TASK_INFO, PLAYERPROP.USER_DAILY_ACTIVE_INFO];
 
 }

+ 29 - 1
tower_sanguo/assets/scripts/vo/PlayerVO.ts

@@ -4,6 +4,7 @@
 
 import { PLAYERPROP } from "../data/GameDefinition";
 import GameController from "../GameController";
+import { TASKITEM } from "../module/task/TaskModel";
 import CommanderSkillVO from "./CommanderSkillVO";
 import GeneralVO from "./GeneralVO";
 import Prop from "./Prop";
@@ -47,7 +48,13 @@ export default class PlayerVO {
         return this.props.get(cointype).value;
     }
 
-    setProp(cointype: PLAYERPROP, value: number, add: boolean = false) {
+    /**
+     * 
+     * @param cointype 
+     * @param value prop--number   propNoCheck--string
+     * @param add 
+     */
+    setProp(cointype: PLAYERPROP, value: any, add: boolean = false) {
         let prop = this.props.get(cointype);
         if (!prop) {
             prop = new Prop(cointype);
@@ -87,6 +94,27 @@ export default class PlayerVO {
     remaind_times: number = 3;
     /** 可补领红包币数量 登录时获取*/
     taskRedBag = 0;
+    /** 每日任务活跃数据 */
+    dailyTask = {
+        /** 今日活跃 */
+        activeToday: 0,
+        /** 今日视频数 */
+        activeVideoTimes: 0,
+        /** 已兑换Id */
+        dailyTaskReceives: [],
+        /** 活跃度更新时间 */
+        updateActiveTime: '',
+    };
+    /** 每日任务-任务条数据 
+     * - 无需校验,存在 gameUserData 内
+    */
+    task_list_data: Array<TASKITEM> = [];
+    /** 玩家属性值是对象而非数字,解析服务端数据不转num的集合 */
+    isObjByPLAYERPROP(id): boolean {
+        let arr = [PLAYERPROP.USER_DAILY_TASK_INFO, PLAYERPROP.USER_DAILY_ACTIVE_INFO];
+        let bool =  arr.includes(id);
+        return bool;
+    }
 
 
     /** 初始武将id */

+ 10 - 5
tower_sanguo/assets/scripts/vo/Prop.ts

@@ -6,18 +6,23 @@ import { PLAYERPROP } from "../data/GameDefinition";
 
 
 export default class Prop {
-    constructor(type: PLAYERPROP, value: number = null) {
+    constructor(type: PLAYERPROP, value: any = null) {
         this.type = type;
-        this.value = value | 0;
+        if(typeof value == 'number'){
+            this.value = value | 0;
+        }
+        else{
+            this.value = value ? value : 0;
+        }
     }
 
     type: PLAYERPROP;
-    _value: number;
-    set value(v: number) {
+    _value: any;
+    set value(v: any) {
         this._value = v;
         this.update();
     }
-    get value(): number {
+    get value(): any {
         return this._value;
     }
 

Some files were not shown because too many files changed in this diff