Kaynağa Gözat

增加武将怪物

zouyong 5 yıl önce
ebeveyn
işleme
f7b0b2012d
24 değiştirilmiş dosya ile 1331 ekleme ve 167 silme
  1. BIN
      tower_sanguo/assets/resources/data/1.bin
  2. 2 2
      tower_sanguo/assets/resources/data/db_data.json
  3. 1 1
      tower_sanguo/assets/resources/data/mission_data.json
  4. 112 112
      tower_sanguo/assets/resources/data/monster_data.json
  5. 865 42
      tower_sanguo/assets/resources/module/fight/prefab/monster.prefab
  6. BIN
      tower_sanguo/assets/resources/module/fight/prefab_texture/belong_1.png
  7. 36 0
      tower_sanguo/assets/resources/module/fight/prefab_texture/belong_1.png.meta
  8. BIN
      tower_sanguo/assets/resources/module/fight/prefab_texture/belong_2.png
  9. 36 0
      tower_sanguo/assets/resources/module/fight/prefab_texture/belong_2.png.meta
  10. BIN
      tower_sanguo/assets/resources/module/fight/prefab_texture/belong_3.png
  11. 36 0
      tower_sanguo/assets/resources/module/fight/prefab_texture/belong_3.png.meta
  12. BIN
      tower_sanguo/assets/resources/module/fight/prefab_texture/belong_4.png
  13. 36 0
      tower_sanguo/assets/resources/module/fight/prefab_texture/belong_4.png.meta
  14. BIN
      tower_sanguo/assets/resources/module/fight/prefab_texture/icon_miaozhun.png
  15. 36 0
      tower_sanguo/assets/resources/module/fight/prefab_texture/icon_miaozhun.png.meta
  16. BIN
      tower_sanguo/assets/resources/module/fight/prefab_texture/jindu1.png
  17. 36 0
      tower_sanguo/assets/resources/module/fight/prefab_texture/jindu1.png.meta
  18. BIN
      tower_sanguo/assets/resources/module/fight/prefab_texture/jindu2.png
  19. 36 0
      tower_sanguo/assets/resources/module/fight/prefab_texture/jindu2.png.meta
  20. BIN
      tower_sanguo/assets/resources/module/fight/prefab_texture/jindu3.png
  21. 36 0
      tower_sanguo/assets/resources/module/fight/prefab_texture/jindu3.png.meta
  22. 12 0
      tower_sanguo/assets/scripts/component/ProgressBar.ts
  23. 13 0
      tower_sanguo/assets/scripts/module/fight/FightUI.ts
  24. 38 10
      tower_sanguo/assets/scripts/module/fight/model/monsters/Monster.ts

BIN
tower_sanguo/assets/resources/data/1.bin


+ 2 - 2
tower_sanguo/assets/resources/data/db_data.json

@@ -5,10 +5,10 @@
         "yb": 0,
         "redbag": 0,
         "barrack": 15,
-        "mission_arrive": 1,
+        "mission_arrive": 2,
         "mission_passed": 0,
         "prestige": 10000,
-        "useserver": 1
+        "useserver": 0
     },
     "generals": [
         {

+ 1 - 1
tower_sanguo/assets/resources/data/mission_data.json

@@ -11,7 +11,7 @@
 	"2": {
 		"id": 2,
 		"type": 2,
-		"monsterData": "2,1.11,1,1.08",
+		"monsterData": "5,1.11,1,1.08",
 		"award": "4:100;1:5000;10:111001:1;11:111001:10",
 		"recover": 3.33,
 		"maxCapacity": 10000,

Dosya farkı çok büyük olduğundan ihmal edildi
+ 112 - 112
tower_sanguo/assets/resources/data/monster_data.json


Dosya farkı çok büyük olduğundan ihmal edildi
+ 865 - 42
tower_sanguo/assets/resources/module/fight/prefab/monster.prefab


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


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

@@ -0,0 +1,36 @@
+{
+  "ver": "2.3.4",
+  "uuid": "f44d1c0d-cb68-43f8-8d6e-d94a5219de48",
+  "type": "sprite",
+  "wrapMode": "clamp",
+  "filterMode": "bilinear",
+  "premultiplyAlpha": false,
+  "genMipmaps": false,
+  "packable": true,
+  "width": 32,
+  "height": 32,
+  "platformSettings": {},
+  "subMetas": {
+    "belong_1": {
+      "ver": "1.0.4",
+      "uuid": "6fba0f52-a62f-4ccf-ac68-530b83d5ad2d",
+      "rawTextureUuid": "f44d1c0d-cb68-43f8-8d6e-d94a5219de48",
+      "trimType": "auto",
+      "trimThreshold": 1,
+      "rotated": false,
+      "offsetX": 0,
+      "offsetY": 0,
+      "trimX": 0,
+      "trimY": 0,
+      "width": 32,
+      "height": 32,
+      "rawWidth": 32,
+      "rawHeight": 32,
+      "borderTop": 0,
+      "borderBottom": 0,
+      "borderLeft": 0,
+      "borderRight": 0,
+      "subMetas": {}
+    }
+  }
+}

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


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

@@ -0,0 +1,36 @@
+{
+  "ver": "2.3.4",
+  "uuid": "ef6bc062-6a67-497e-836a-e442ee759baa",
+  "type": "sprite",
+  "wrapMode": "clamp",
+  "filterMode": "bilinear",
+  "premultiplyAlpha": false,
+  "genMipmaps": false,
+  "packable": true,
+  "width": 32,
+  "height": 32,
+  "platformSettings": {},
+  "subMetas": {
+    "belong_2": {
+      "ver": "1.0.4",
+      "uuid": "1a1f949f-0b2e-42da-8c4d-7ae25fd8c080",
+      "rawTextureUuid": "ef6bc062-6a67-497e-836a-e442ee759baa",
+      "trimType": "auto",
+      "trimThreshold": 1,
+      "rotated": false,
+      "offsetX": 0,
+      "offsetY": 0,
+      "trimX": 0,
+      "trimY": 0,
+      "width": 32,
+      "height": 32,
+      "rawWidth": 32,
+      "rawHeight": 32,
+      "borderTop": 0,
+      "borderBottom": 0,
+      "borderLeft": 0,
+      "borderRight": 0,
+      "subMetas": {}
+    }
+  }
+}

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


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

@@ -0,0 +1,36 @@
+{
+  "ver": "2.3.4",
+  "uuid": "2d152a59-3083-4f56-8892-90799b9a27d8",
+  "type": "sprite",
+  "wrapMode": "clamp",
+  "filterMode": "bilinear",
+  "premultiplyAlpha": false,
+  "genMipmaps": false,
+  "packable": true,
+  "width": 32,
+  "height": 32,
+  "platformSettings": {},
+  "subMetas": {
+    "belong_3": {
+      "ver": "1.0.4",
+      "uuid": "fe7701b0-ae90-4c74-a514-26fe2d24f38e",
+      "rawTextureUuid": "2d152a59-3083-4f56-8892-90799b9a27d8",
+      "trimType": "auto",
+      "trimThreshold": 1,
+      "rotated": false,
+      "offsetX": 0,
+      "offsetY": 0,
+      "trimX": 0,
+      "trimY": 0,
+      "width": 32,
+      "height": 32,
+      "rawWidth": 32,
+      "rawHeight": 32,
+      "borderTop": 0,
+      "borderBottom": 0,
+      "borderLeft": 0,
+      "borderRight": 0,
+      "subMetas": {}
+    }
+  }
+}

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


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

@@ -0,0 +1,36 @@
+{
+  "ver": "2.3.4",
+  "uuid": "7f9bb2b5-4511-49d4-bc78-9094c6a88b7a",
+  "type": "sprite",
+  "wrapMode": "clamp",
+  "filterMode": "bilinear",
+  "premultiplyAlpha": false,
+  "genMipmaps": false,
+  "packable": true,
+  "width": 32,
+  "height": 32,
+  "platformSettings": {},
+  "subMetas": {
+    "belong_4": {
+      "ver": "1.0.4",
+      "uuid": "04b2994c-1a64-4e59-b306-c00bc86ff98a",
+      "rawTextureUuid": "7f9bb2b5-4511-49d4-bc78-9094c6a88b7a",
+      "trimType": "auto",
+      "trimThreshold": 1,
+      "rotated": false,
+      "offsetX": 0,
+      "offsetY": 0,
+      "trimX": 0,
+      "trimY": 0,
+      "width": 32,
+      "height": 32,
+      "rawWidth": 32,
+      "rawHeight": 32,
+      "borderTop": 0,
+      "borderBottom": 0,
+      "borderLeft": 0,
+      "borderRight": 0,
+      "subMetas": {}
+    }
+  }
+}

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


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

@@ -0,0 +1,36 @@
+{
+  "ver": "2.3.4",
+  "uuid": "12f6ebfc-8bad-4888-9a32-87fc0a9c9407",
+  "type": "sprite",
+  "wrapMode": "clamp",
+  "filterMode": "bilinear",
+  "premultiplyAlpha": false,
+  "genMipmaps": false,
+  "packable": true,
+  "width": 47,
+  "height": 47,
+  "platformSettings": {},
+  "subMetas": {
+    "icon_miaozhun": {
+      "ver": "1.0.4",
+      "uuid": "b7ad0b07-4335-4f21-b42a-fe5471ce242a",
+      "rawTextureUuid": "12f6ebfc-8bad-4888-9a32-87fc0a9c9407",
+      "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": {}
+    }
+  }
+}

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


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

@@ -0,0 +1,36 @@
+{
+  "ver": "2.3.4",
+  "uuid": "ec55eeca-6086-4e6f-894c-4657a45c2fb5",
+  "type": "sprite",
+  "wrapMode": "clamp",
+  "filterMode": "bilinear",
+  "premultiplyAlpha": false,
+  "genMipmaps": false,
+  "packable": true,
+  "width": 108,
+  "height": 16,
+  "platformSettings": {},
+  "subMetas": {
+    "jindu1": {
+      "ver": "1.0.4",
+      "uuid": "2a4f5a67-6a62-4b49-8b14-834f0fbe1571",
+      "rawTextureUuid": "ec55eeca-6086-4e6f-894c-4657a45c2fb5",
+      "trimType": "auto",
+      "trimThreshold": 1,
+      "rotated": false,
+      "offsetX": 0,
+      "offsetY": 0,
+      "trimX": 0,
+      "trimY": 0,
+      "width": 108,
+      "height": 16,
+      "rawWidth": 108,
+      "rawHeight": 16,
+      "borderTop": 0,
+      "borderBottom": 0,
+      "borderLeft": 0,
+      "borderRight": 0,
+      "subMetas": {}
+    }
+  }
+}

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


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

@@ -0,0 +1,36 @@
+{
+  "ver": "2.3.4",
+  "uuid": "32e73a20-1037-45c3-a72d-d09d48fea58d",
+  "type": "sprite",
+  "wrapMode": "clamp",
+  "filterMode": "bilinear",
+  "premultiplyAlpha": false,
+  "genMipmaps": false,
+  "packable": true,
+  "width": 106,
+  "height": 14,
+  "platformSettings": {},
+  "subMetas": {
+    "jindu2": {
+      "ver": "1.0.4",
+      "uuid": "f8b0b061-386d-4dee-bd41-726e99f8c2e1",
+      "rawTextureUuid": "32e73a20-1037-45c3-a72d-d09d48fea58d",
+      "trimType": "auto",
+      "trimThreshold": 1,
+      "rotated": false,
+      "offsetX": 0,
+      "offsetY": 0,
+      "trimX": 0,
+      "trimY": 0,
+      "width": 106,
+      "height": 14,
+      "rawWidth": 106,
+      "rawHeight": 14,
+      "borderTop": 0,
+      "borderBottom": 0,
+      "borderLeft": 0,
+      "borderRight": 0,
+      "subMetas": {}
+    }
+  }
+}

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


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

@@ -0,0 +1,36 @@
+{
+  "ver": "2.3.4",
+  "uuid": "4bbc0de7-0603-4568-94ed-d6963fd1f157",
+  "type": "sprite",
+  "wrapMode": "clamp",
+  "filterMode": "bilinear",
+  "premultiplyAlpha": false,
+  "genMipmaps": false,
+  "packable": true,
+  "width": 106,
+  "height": 14,
+  "platformSettings": {},
+  "subMetas": {
+    "jindu3": {
+      "ver": "1.0.4",
+      "uuid": "d97529d3-e95c-42a4-a70a-c5471717fab5",
+      "rawTextureUuid": "4bbc0de7-0603-4568-94ed-d6963fd1f157",
+      "trimType": "auto",
+      "trimThreshold": 1,
+      "rotated": false,
+      "offsetX": 0,
+      "offsetY": 0,
+      "trimX": 0,
+      "trimY": 0,
+      "width": 106,
+      "height": 14,
+      "rawWidth": 106,
+      "rawHeight": 14,
+      "borderTop": 0,
+      "borderBottom": 0,
+      "borderLeft": 0,
+      "borderRight": 0,
+      "subMetas": {}
+    }
+  }
+}

+ 12 - 0
tower_sanguo/assets/scripts/component/ProgressBar.ts

@@ -11,6 +11,9 @@ export default class ProgressBar extends cc.Component {
     @property({ type: cc.Sprite, displayName: '进度条' })
     blood_3: cc.Sprite = null;
 
+    @property(cc.Label)
+    lbl_progress: cc.Label = null;
+
     private maxlen: number;
     private current: number;
     private max: number;
@@ -25,6 +28,7 @@ export default class ProgressBar extends cc.Component {
         this.max = max;
         this.blood_2.node.width = this.maxlen;
         this.blood_3.node.width = this.maxlen;
+        this.updateLabel();
     }
 
     setProgress(current, tween: boolean = false) {
@@ -39,5 +43,13 @@ export default class ProgressBar extends cc.Component {
         else {
             this.blood_2.node.width = w;
         }
+
+        this.updateLabel();
+    }
+
+    updateLabel() {
+        if (this.lbl_progress) {
+            this.lbl_progress.string = Math.floor(this.current) + "/" + Math.floor(this.max);
+        }
     }
 }

+ 13 - 0
tower_sanguo/assets/scripts/module/fight/FightUI.ts

@@ -28,6 +28,7 @@ import GameUtil from "../../../MOKA/util/GameUtil";
 import { MsgAddGeneralExp } from "../../net/HttpCommand";
 import GetLiangCaoModel from "../getLiangCao/GetLiangCaoModel";
 import ResultUI from "../result/ResultUI";
+import MonsterVO from "../../vo/MonsterVO";
 
 const { ccclass, property } = cc._decorator;
 
@@ -147,12 +148,24 @@ export default class FightUI extends BaseUI {
     private loadGeneralRes() {
         let playerInfo = GameController.gameData.player;
         let res = [];
+        //武将资源
         for (let i = 0; i < playerInfo.generals.length; i++) {
             let vo = playerInfo.generals[i];
             if (typeof vo == 'object') {
                 res.push("spine/person/" + vo.resource);
             }
         }
+        //怪物如果是武将,也需要加入列表
+        this.missionVO = GameController.gameData.getMissionByID(GameController.gameData.player.current_mission);
+        let arr = this.missionVO.rounds;
+        for(let i=0;i<arr.length;i++){
+            let vo:MonsterVO = GameController.gameData.getMonsterByID(arr[i].monster_Id);
+            if(typeof vo.resource == 'number'){
+                let g:GeneralVO = GameController.gameData.getGeneralByID(vo.resource);
+                res.push("spine/person/" + g.resource);
+            }
+        }
+
         cc.loader.loadResArray(res, sp.SkeletonData, this.initMissionData.bind(this));
     }
     /** 初始化关卡,武将 */

+ 38 - 10
tower_sanguo/assets/scripts/module/fight/model/monsters/Monster.ts

@@ -28,6 +28,14 @@ export default class Monster extends FightModel implements IPool {
 
     @property(ProgressBar)
     bar_boss: ProgressBar = null;
+    @property(ProgressBar)
+    bar_general: ProgressBar = null;
+    @property(cc.Label)
+    lbl_hp: cc.Label = null;
+    @property(cc.Label)
+    lbl_name: cc.Label = null;
+    @property(cc.Sprite)
+    img_belong: cc.Sprite = null;
 
     @property(sp.Skeleton)
     bing_die: sp.Skeleton = null;
@@ -68,7 +76,7 @@ export default class Monster extends FightModel implements IPool {
     isPause: boolean;
 
     /** 错位 */
-    dis:number;
+    dis: number;
 
 
     getAttachNodeCrood() {
@@ -94,14 +102,33 @@ export default class Monster extends FightModel implements IPool {
         this.node.x = this.moveCroods[0];
         this.node.y = this.moveCroods[1];
         this.isdead = false;
+        let src;
         if (v.type == 1) {
             this.hpbar = this.bar_monster;
             this.scaleRate = 0.57;
             this.img_select.node.y = 120;
             this.node_click.height = 140;
+            src = "module/fight/spine/" + v.resource;
         }
         else {
-            this.hpbar = this.bar_boss;
+            if (typeof v.resource == 'number') {
+                this.hpbar = this.bar_general;
+                let vo = GameController.gameData.getGeneralByID(v.resource);
+                if (vo) {
+                    src = vo.resource;
+                    this.img_belong.node.active = true;
+                    this.img_belong.spriteFrame = cc.loader.getRes("module/fight/prefab_texture/belong_" + vo.camp, cc.SpriteFrame);
+                    this.lbl_name.string = vo.name;
+                    src = "spine/person/" + vo.resource;
+                }
+                else {
+                    console.log("怪物resrouce错误:", v.resource);
+                }
+            }
+            else {
+                this.hpbar = this.bar_boss;
+                src = "module/fight/spine/" + v.resource;
+            }
             this.scaleRate = 0.9;
             this.img_select.node.y = 180;
             this.node_click.height = 200;
@@ -110,7 +137,7 @@ export default class Monster extends FightModel implements IPool {
         this.node_click.y = this.node_click.height / 2;
 
         this.lbl_id.string = v.id + "";
-        this.skeleton.skeletonData = cc.loader.getRes("module/fight/spine/" + v.resource , sp.SkeletonData);
+        this.skeleton.skeletonData = cc.loader.getRes(src, sp.SkeletonData);
 
         this.hpbar.init(v.hp, v.maxhp);
         this.skeleton.node.scaleX = -1 * this.scaleRate;
@@ -151,7 +178,7 @@ export default class Monster extends FightModel implements IPool {
             type = DAMAGE_TYPE.FATAL;
         }
 
-        this.popHpTips(hitstr, type,damage.isskill);
+        this.popHpTips(hitstr, type, damage.isskill);
 
         if (isHit && damage.debuff) {
             let debuff = GameController.gameData.getBuffByID(damage.debuff);
@@ -232,7 +259,7 @@ export default class Monster extends FightModel implements IPool {
      * @param type  
      * @returns 
      */
-    private popHpTips(str, type: DAMAGE_TYPE,isskill:boolean=false) {
+    private popHpTips(str, type: DAMAGE_TYPE, isskill: boolean = false) {
         if (!this.node || !this.vo) {
             return;
         }
@@ -242,7 +269,7 @@ export default class Monster extends FightModel implements IPool {
         let script = node_hp.getComponent(HpTips) as HpTips;
         let lbl: cc.Label = node_hp.getChildByName("lbl_hptips").getComponent(cc.Label);
         lbl.string = str;
-        script.play(type, this.vo.type,isskill);
+        script.play(type, this.vo.type, isskill);
         node_hp.parent = this.node;
         node_hp.zIndex = 0;
     }
@@ -309,7 +336,7 @@ export default class Monster extends FightModel implements IPool {
             let b = this.dis == null;
             if (stopWall.type == 1) {//左侧
                 if (this.node.y - 20 <= stopWall.y) {
-                    if(b){
+                    if (b) {
                         this.dis = (Math.random() * 60 - 30);
                         this.node.x += this.dis;
                     }
@@ -318,7 +345,7 @@ export default class Monster extends FightModel implements IPool {
             }
             else if (stopWall.type == 2) {//下面
                 if (this.node.x + 100 >= stopWall.x) {
-                    if(b){
+                    if (b) {
                         this.dis = (Math.random() * 60 - 30);
                         this.node.y += this.dis;
                     }
@@ -327,7 +354,7 @@ export default class Monster extends FightModel implements IPool {
             }
             else {//右侧
                 if (this.node.y + 50 >= stopWall.y) {
-                    if(b){
+                    if (b) {
                         this.dis = (Math.random() * 60 - 30);
                         this.node.x += this.dis;
                     }
@@ -335,7 +362,7 @@ export default class Monster extends FightModel implements IPool {
                 }
             }
         }
-        else{
+        else {
             this.dis = null;
         }
         let srcV = cc.v2(this.node.x, this.node.y);
@@ -381,6 +408,7 @@ export default class Monster extends FightModel implements IPool {
         this.bing_die.node.active = false;
         this.bar_monster.node.active = false;
         this.bar_boss.node.active = false;
+        this.bar_general.node.active = false;
         this.img_stop.node.active = false;
         this.knife_light.removeAllChildren();
 

Bu fark içinde çok fazla dosya değişikliği olduğu için bazı dosyalar gösterilmiyor