Просмотр исходного кода

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

# Conflicts:
#	tower_sanguo/assets/scripts/net/HttpCommand.ts
薛鸿潇 5 лет назад
Родитель
Сommit
f888504867

+ 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)
                 }
             }
         }

+ 58 - 58
tower_sanguo/assets/resources/module/drawRecruit/drawWish.prefab

@@ -528,16 +528,16 @@
         "__id__": 25
       },
       {
-        "__id__": 33
+        "__id__": 32
       },
       {
-        "__id__": 43
+        "__id__": 42
       },
       {
-        "__id__": 46
+        "__id__": 45
       },
       {
-        "__id__": 50
+        "__id__": 49
       },
       {
         "__id__": 58
@@ -997,7 +997,7 @@
       }
     ],
     "_prefab": {
-      "__id__": 32
+      "__id__": 31
     },
     "_opacity": 255,
     "_color": {
@@ -1199,11 +1199,7 @@
     "_grayMaterial": null,
     "duration": 0.1,
     "zoomScale": 1.2,
-    "clickEvents": [
-      {
-        "__id__": 31
-      }
-    ],
+    "clickEvents": [],
     "_N$interactable": true,
     "_N$enableAutoGrayEffect": false,
     "_N$transition": 0,
@@ -1260,16 +1256,6 @@
     "_id": ""
   },
   {
-    "__type__": "cc.ClickEvent",
-    "target": {
-      "__id__": 1
-    },
-    "component": "",
-    "_componentId": "23952w10H9AVoJzYhG6B5M5",
-    "handler": "click_WishBtn",
-    "customEventData": ""
-  },
-  {
     "__type__": "cc.PrefabInfo",
     "root": {
       "__id__": 1
@@ -1289,20 +1275,20 @@
     },
     "_children": [
       {
-        "__id__": 34
+        "__id__": 33
       },
       {
-        "__id__": 37
+        "__id__": 36
       }
     ],
     "_active": true,
     "_components": [
       {
-        "__id__": 41
+        "__id__": 40
       }
     ],
     "_prefab": {
-      "__id__": 42
+      "__id__": 41
     },
     "_opacity": 255,
     "_color": {
@@ -1356,17 +1342,17 @@
     "_name": "txt_name",
     "_objFlags": 0,
     "_parent": {
-      "__id__": 33
+      "__id__": 32
     },
     "_children": [],
     "_active": true,
     "_components": [
       {
-        "__id__": 35
+        "__id__": 34
       }
     ],
     "_prefab": {
-      "__id__": 36
+      "__id__": 35
     },
     "_opacity": 255,
     "_color": {
@@ -1420,7 +1406,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 34
+      "__id__": 33
     },
     "_enabled": true,
     "_materials": [
@@ -1465,20 +1451,20 @@
     "_name": "tip_rate",
     "_objFlags": 0,
     "_parent": {
-      "__id__": 33
+      "__id__": 32
     },
     "_children": [],
     "_active": true,
     "_components": [
       {
-        "__id__": 38
+        "__id__": 37
       },
       {
-        "__id__": 39
+        "__id__": 38
       }
     ],
     "_prefab": {
-      "__id__": 40
+      "__id__": 39
     },
     "_opacity": 255,
     "_color": {
@@ -1532,7 +1518,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 37
+      "__id__": 36
     },
     "_enabled": true,
     "_materials": [
@@ -1566,7 +1552,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 37
+      "__id__": 36
     },
     "_enabled": true,
     "_color": {
@@ -1600,7 +1586,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 33
+      "__id__": 32
     },
     "_enabled": true,
     "_layoutSize": {
@@ -1649,11 +1635,11 @@
     "_active": true,
     "_components": [
       {
-        "__id__": 44
+        "__id__": 43
       }
     ],
     "_prefab": {
-      "__id__": 45
+      "__id__": 44
     },
     "_opacity": 255,
     "_color": {
@@ -1707,7 +1693,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 43
+      "__id__": 42
     },
     "_enabled": true,
     "_materials": [
@@ -1754,14 +1740,14 @@
     "_active": true,
     "_components": [
       {
-        "__id__": 47
+        "__id__": 46
       },
       {
-        "__id__": 48
+        "__id__": 47
       }
     ],
     "_prefab": {
-      "__id__": 49
+      "__id__": 48
     },
     "_opacity": 255,
     "_color": {
@@ -1815,7 +1801,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 46
+      "__id__": 45
     },
     "_enabled": true,
     "_materials": [
@@ -1849,7 +1835,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 46
+      "__id__": 45
     },
     "_enabled": true,
     "_color": {
@@ -1887,16 +1873,16 @@
     },
     "_children": [
       {
-        "__id__": 51
+        "__id__": 50
       }
     ],
     "_active": true,
     "_components": [
       {
-        "__id__": 55
+        "__id__": 54
       },
       {
-        "__id__": 56
+        "__id__": 55
       }
     ],
     "_prefab": {
@@ -1954,20 +1940,20 @@
     "_name": "New Label",
     "_objFlags": 0,
     "_parent": {
-      "__id__": 50
+      "__id__": 49
     },
     "_children": [],
     "_active": true,
     "_components": [
       {
-        "__id__": 52
+        "__id__": 51
       },
       {
-        "__id__": 53
+        "__id__": 52
       }
     ],
     "_prefab": {
-      "__id__": 54
+      "__id__": 53
     },
     "_opacity": 255,
     "_color": {
@@ -2021,7 +2007,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 51
+      "__id__": 50
     },
     "_enabled": true,
     "_materials": [
@@ -2055,7 +2041,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 51
+      "__id__": 50
     },
     "_enabled": true,
     "_color": {
@@ -2084,7 +2070,7 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 50
+      "__id__": 49
     },
     "_enabled": true,
     "_materials": [
@@ -2116,14 +2102,18 @@
     "_name": "",
     "_objFlags": 0,
     "node": {
-      "__id__": 50
+      "__id__": 49
     },
     "_enabled": true,
     "_normalMaterial": null,
     "_grayMaterial": null,
     "duration": 0.1,
     "zoomScale": 1.2,
-    "clickEvents": [],
+    "clickEvents": [
+      {
+        "__id__": 56
+      }
+    ],
     "_N$interactable": true,
     "_N$enableAutoGrayEffect": false,
     "_N$transition": 0,
@@ -2180,6 +2170,16 @@
     "_id": ""
   },
   {
+    "__type__": "cc.ClickEvent",
+    "target": {
+      "__id__": 1
+    },
+    "component": "",
+    "_componentId": "23952w10H9AVoJzYhG6B5M5",
+    "handler": "click_AdSureBtn",
+    "customEventData": ""
+  },
+  {
     "__type__": "cc.PrefabInfo",
     "root": {
       "__id__": 1
@@ -4509,13 +4509,13 @@
     "close_effect": 0,
     "close_toPoint": "",
     "img_wish": {
-      "__id__": 44
+      "__id__": 43
     },
     "txt_name": {
-      "__id__": 35
+      "__id__": 34
     },
     "txt_rate": {
-      "__id__": 47
+      "__id__": 46
     },
     "content": {
       "__id__": 60

Разница между файлами не показана из-за своего большого размера
+ 112 - 126
tower_sanguo/assets/scenes/Test_Znh.fire


+ 14 - 3
tower_sanguo/assets/scripts/data/GameData.ts

@@ -543,6 +543,9 @@ export default class GameData {
                 let o = arr[i];
                 let id = o.id;
                 let vo: GeneralVO = this.createGeneralVO(id, 0, arr[i]);
+                if(!vo){
+                    continue;
+                }
 
                 if (vo.pos >= 0 && vo.pos < 5) {
                     this.player.generals[vo.pos] = vo;
@@ -646,6 +649,9 @@ export default class GameData {
     private createGeneralVO(id, type: number, arg = null): GeneralVO {
         let vo = new GeneralVO();
         let config = this.getGeneralByID(id);
+        if(!config){
+            return;
+        }
         //配置
         vo.id = config.id;
         vo.camp = config.camp;
@@ -670,7 +676,7 @@ export default class GameData {
             vo.pos = g.pos;
             vo.star = g.star;
             vo.fragment = g.fragment;
-            if (g.status == GENERALSTATUS.GET) {
+            if (g.status == 1) {
                 vo.status = GENERALSTATUS.GET;
             }
             else {
@@ -769,7 +775,7 @@ export default class GameData {
      * 增加武将
      * @param id 武将id
      * @param type 0服务器数据  1整卡(只有整卡可以无视兵营) 2碎片
-     * @param arg type=0表示服务器数据 type=2表示碎片数量
+     * @param arg type=0表示服务器数据 type=2表示碎片数量 type=3在服务器获取武将 type=4表示在服务器获取武将碎片
      */
     addGeneral(id, type: number = 1, arg = null) {
         if (type == 1) {
@@ -778,6 +784,12 @@ export default class GameData {
         else if (type == 2) {
             GameController.http.addItem(this.addItem.bind(this), ITEMTYPE.GENERAL_FRAGMENT, id, arg);
         }
+        else if (type == 3) {
+            GameController.http.getInitGeneralDemo(this.addItem.bind(this), id, ITEMTYPE.GENERAL, 1);
+        }
+        else if (type == 4) {
+            GameController.http.getInitGeneralDemo(this.addItem.bind(this), id, ITEMTYPE.GENERAL_FRAGMENT, arg);
+        }
     }
     addItem(msg: AddItemResponse) {
         if (msg.errorcode != 0) {
@@ -885,7 +897,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();
             }

+ 2 - 0
tower_sanguo/assets/scripts/module/drawRecruit/DrawResultUI.ts

@@ -6,4 +6,6 @@ const {ccclass, property} = cc._decorator;
 export default class DrawResultUI extends BaseUI {    
     protected static prefabUrl = "module/drawRecruit/drawResult";
     protected static className = "DrawResultUI";
+
+    
 }

+ 9 - 2
tower_sanguo/assets/scripts/module/drawRecruit/DrawWishUI.ts

@@ -58,13 +58,13 @@ export default class DrawWishUI extends BaseUI {
         for (let i = 0; i < tempGenerals.length; i++) {
             let grl = tempGenerals[i];
             console.log("Color: " + grl.color + " Star: " + grl.star + " Camp: " + grl.camp);
-            if (grl.status == 3) {
+            //if (grl.status == 3) {
                 let tempscr = cc.instantiate(this.wishItem.node).getComponent(WishItem);
                 tempscr.Init(grl);
                 tempscr.node.active = true;
                 this.content.addChild(tempscr.node);
                 this.wishItemMap.set(grl.id, tempscr);
-            }
+            //}
         }
 
         //心愿武将接口
@@ -96,6 +96,13 @@ export default class DrawWishUI extends BaseUI {
         console.log("you click wishui wish btn");
     }
 
+    click_AdSureBtn() {
+        console.log("GeneralBag: ",GameController.gameData.player.generals_bag);
+        GameController.http.prayGeneral((data) => {
+            console.log("-->Data: ", data);
+        }, { generalId: 112005 });
+    }
+
     onDestroy() {
         XXEvent.off("UpdateDrawWishState", this.updateDrawWishState, this);
     }

+ 9 - 4
tower_sanguo/assets/scripts/module/fight/FightUI.ts

@@ -315,10 +315,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();

+ 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;

+ 12 - 2
tower_sanguo/assets/scripts/module/gm/GmUI.ts

@@ -63,7 +63,12 @@ export default class GmUI extends BaseUI {
 
     private addGeneral() {
         let id = parseInt(this.lbl_input.string);
-        GameController.gameData.addGeneral(id, 1);
+        if(GameController.useLocalServer){
+            GameController.gameData.addGeneral(id, 1);
+        }
+        else{
+            GameController.gameData.addGeneral(id,3);
+        }
     }
     private addAllGeneral() {
         let all_general = GameController.gameData.getAllGeneral();
@@ -76,7 +81,12 @@ export default class GmUI extends BaseUI {
 
     private addFragment() {
         let arr = this.lbl_input.string.split(":");
-        GameController.gameData.addGeneral(parseInt(arr[0]), 2, parseInt(arr[1]));
+        if(GameController.useLocalServer){
+            GameController.gameData.addGeneral(parseInt(arr[0]), 2, parseInt(arr[1]));
+        }
+        else{
+            GameController.gameData.addGeneral(parseInt(arr[0]), 4, parseInt(arr[1]));
+        }
     }
 
     private setBarrack() {

+ 36 - 5
tower_sanguo/assets/scripts/net/HttpCommand.ts

@@ -48,7 +48,7 @@ export default class HttpCommand {
     connectTest(callback) {
         GameController.commonData.ranKey = Utils.randomString()
         let data = {
-            "mac": "a5:65:e2:1c:b0:94,f6:60:e4:1a:b7:27",//94//26
+            "mac": "a5:65:e2:1c:b0:26,f6:60:e4:1a:b7:27",
             "psk": GameController.commonData.ranKey,
             "appId": GameController.commonData.appid
         }
@@ -155,6 +155,21 @@ export default class HttpCommand {
         };
         this.sendData(HTTPTYPE.getInitGeneral, data, callback);
     }
+    /**
+     * 初始化获取武将
+     * @param callback 
+     * @param id 武将id
+     * @param type 类型 10武将 11碎片
+     * @param num 数量
+     */
+    getInitGeneralDemo(callback, id, type, num) {
+        let data = {
+            id: id,
+            type: type,
+            num: num
+        };
+        this.sendData(HTTPTYPE.getInitGeneralDemo, data, callback);
+    }
     /** 获取任务数据 */
     getTaskInfo(callback) {
         this.sendData(HTTPTYPE.task_data, 'POST', callback);
@@ -226,7 +241,7 @@ export default class HttpCommand {
         let data = {
             playPropList: arr
         };
-        this.sendData(HTTPTYPE.updateProp, data, callback);
+        // this.sendData(HTTPTYPE.updateProp, data, callback);
     }
 
     /**
@@ -265,7 +280,7 @@ export default class HttpCommand {
             max: max,
             last: last
         };
-        this.sendData(HTTPTYPE.updateMission, data, callback);
+        // this.sendData(HTTPTYPE.updateMission, data, callback);
     }
 
     addGeneralExp(callback) {
@@ -291,6 +306,18 @@ export default class HttpCommand {
         this.httpM.sendRequest(HTTPTYPE.addItem, 'POST', str, callback);
     }
 
+    //--------------------------ZNH------------------------
+
+    /** 武将许愿
+     * @param callback 回调
+    */
+    prayGeneral(callback,data) {
+        this.sendData(HTTPTYPE.prayGeneral, data, callback);
+    }
+
+
+    //--------------------------ZNH------------------------
+
     /**
      * 获取邀请人uin
      * @param sendReport 
@@ -391,6 +418,7 @@ export enum HTTPTYPE {
     barracksLvUp = 'barracksLvUp',
     addItem = 'addItem',
     getInitGeneral = 'general/getInitGeneral',
+    getInitGeneralDemo = 'general/getInitGeneralDemo',
     /** 投资数据 */
     getInvestInfo = 'invest/getInvestInfo',
     /** 更新投资数据 */
@@ -399,6 +427,9 @@ export enum HTTPTYPE {
     reduceTimeInvestProject = 'invest/reduceTimeInvestProject',
 
     updateADLog = 'updateADLog',
+    // ZNH
+    /** 武将许愿*/
+    prayGeneral = 'general/prayGeneral',
 }
 
 
@@ -408,6 +439,6 @@ export interface UpdatePlayerProps {
     proptype: number,    //需要更新的属性
     propvalue: number,   //更新后的属性
 
-    propType:number,//服务器不根据文档改字段名字,仅用于发送给服务器
-    propValue:number,//服务器不根据文档改字段名字,仅用于发送给服务器
+    propType: number,//服务器不根据文档改字段名字,仅用于发送给服务器
+    propValue: number,//服务器不根据文档改字段名字,仅用于发送给服务器
 }

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

@@ -48,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);

+ 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;
     }
 

Некоторые файлы не были показаны из-за большого количества измененных файлов