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

Merge branch 'master' of http://118.178.135.110:3000/fish/tower_client

# Conflicts:
#	assets/script/game/manager/RoleManager.ts
添加音效
txq 6 месяцев назад
Родитель
Сommit
62d7a2754c

BIN
assets/package/audio/tututu.mp3


+ 2 - 2
assets/package/audio/tututu.wav.meta → assets/package/audio/tututu.mp3.meta

@@ -2,10 +2,10 @@
   "ver": "1.0.0",
   "importer": "audio-clip",
   "imported": true,
-  "uuid": "7d669d5f-ce0a-4962-8e77-c096086481ce",
+  "uuid": "cf9f1434-7833-48d0-8f3a-5df937d897bb",
   "files": [
     ".json",
-    ".wav"
+    ".mp3"
   ],
   "subMetas": {},
   "userData": {

BIN
assets/package/audio/tututu.wav


+ 0 - 1
assets/package/prefab/ui/tower/hero/bullet.prefab

@@ -239,7 +239,6 @@
     "__prefab": {
       "__id__": 11
     },
-    "modelSpine": null,
     "_id": ""
   },
   {

+ 184 - 44
assets/package/prefab/ui/tower/hero/role101.prefab

@@ -25,26 +25,26 @@
         "__id__": 23
       },
       {
-        "__id__": 29
+        "__id__": 35
       },
       {
-        "__id__": 33
+        "__id__": 39
       },
       {
-        "__id__": 37
+        "__id__": 43
       }
     ],
     "_active": true,
     "_components": [
       {
-        "__id__": 43
+        "__id__": 49
       },
       {
-        "__id__": 45
+        "__id__": 51
       }
     ],
     "_prefab": {
-      "__id__": 47
+      "__id__": 53
     },
     "_lpos": {
       "__type__": "cc.Vec3",
@@ -518,29 +518,83 @@
   },
   {
     "__type__": "cc.Node",
-    "_name": "fightforce",
+    "_name": "btn_bg",
     "_objFlags": 0,
     "__editorExtras__": {},
     "_parent": {
       "__id__": 1
     },
+    "_children": [
+      {
+        "__id__": 24
+      }
+    ],
+    "_active": true,
+    "_components": [
+      {
+        "__id__": 30
+      },
+      {
+        "__id__": 32
+      }
+    ],
+    "_prefab": {
+      "__id__": 34
+    },
+    "_lpos": {
+      "__type__": "cc.Vec3",
+      "x": 27.475000000000023,
+      "y": 2.576000000000022,
+      "z": 0
+    },
+    "_lrot": {
+      "__type__": "cc.Quat",
+      "x": 0,
+      "y": 0,
+      "z": 0,
+      "w": 1
+    },
+    "_lscale": {
+      "__type__": "cc.Vec3",
+      "x": 1.5,
+      "y": 1.5,
+      "z": 1
+    },
+    "_mobility": 0,
+    "_layer": 33554432,
+    "_euler": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "fightforce",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "_parent": {
+      "__id__": 23
+    },
     "_children": [],
     "_active": true,
     "_components": [
       {
-        "__id__": 24
+        "__id__": 25
       },
       {
-        "__id__": 26
+        "__id__": 27
       }
     ],
     "_prefab": {
-      "__id__": 28
+      "__id__": 29
     },
     "_lpos": {
       "__type__": "cc.Vec3",
-      "x": 30,
-      "y": -30,
+      "x": -0.10200000000008913,
+      "y": -0.3520000000000323,
       "z": 0
     },
     "_lrot": {
@@ -572,15 +626,15 @@
     "_objFlags": 0,
     "__editorExtras__": {},
     "node": {
-      "__id__": 23
+      "__id__": 24
     },
     "_enabled": true,
     "__prefab": {
-      "__id__": 25
+      "__id__": 26
     },
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 18.69,
+      "width": 18,
       "height": 40
     },
     "_anchorPoint": {
@@ -600,11 +654,11 @@
     "_objFlags": 0,
     "__editorExtras__": {},
     "node": {
-      "__id__": 23
+      "__id__": 24
     },
     "_enabled": true,
     "__prefab": {
-      "__id__": 27
+      "__id__": 28
     },
     "_customMaterial": null,
     "_srcBlendFactor": 2,
@@ -616,18 +670,18 @@
       "b": 255,
       "a": 255
     },
-    "_string": "1",
+    "_string": "99",
     "_horizontalAlign": 1,
     "_verticalAlign": 1,
-    "_actualFontSize": 26,
-    "_fontSize": 26,
+    "_actualFontSize": 11,
+    "_fontSize": 20,
     "_fontFamily": "Arial",
     "_lineHeight": 40,
-    "_overflow": 0,
-    "_enableWrapText": true,
+    "_overflow": 2,
+    "_enableWrapText": false,
     "_font": {
-      "__uuid__": "65941af8-fc7e-447d-a557-0406909c778c",
-      "__expectedType__": "cc.BitmapFont"
+      "__uuid__": "20e32a4b-c53f-43f1-afa0-30a906b3e3e8",
+      "__expectedType__": "cc.TTFFont"
     },
     "_isSystemFontUsed": false,
     "_spacingX": 0,
@@ -636,7 +690,7 @@
     "_isUnderline": false,
     "_underlineHeight": 2,
     "_cacheMode": 0,
-    "_enableOutline": false,
+    "_enableOutline": true,
     "_outlineColor": {
       "__type__": "cc.Color",
       "r": 0,
@@ -678,6 +732,92 @@
     "targetOverrides": null,
     "nestedPrefabInstanceRoots": null
   },
+  {
+    "__type__": "cc.UITransform",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 23
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 31
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 22,
+      "height": 22
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "01eNriUlRIqI4YW1dij2AG"
+  },
+  {
+    "__type__": "cc.Sprite",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 23
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 33
+    },
+    "_customMaterial": null,
+    "_srcBlendFactor": 2,
+    "_dstBlendFactor": 4,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_spriteFrame": {
+      "__uuid__": "2ef432e1-e5ce-46c9-9965-3ce7389cf07a@f9941",
+      "__expectedType__": "cc.SpriteFrame"
+    },
+    "_type": 0,
+    "_fillType": 0,
+    "_sizeMode": 1,
+    "_fillCenter": {
+      "__type__": "cc.Vec2",
+      "x": 0,
+      "y": 0
+    },
+    "_fillStart": 0,
+    "_fillRange": 0,
+    "_isTrimmedMode": true,
+    "_useGrayscale": false,
+    "_atlas": null,
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "daA4gJIRBBopwyIO1aJ0Sd"
+  },
+  {
+    "__type__": "cc.PrefabInfo",
+    "root": {
+      "__id__": 1
+    },
+    "asset": {
+      "__id__": 0
+    },
+    "fileId": "5aSezbY4BNwrP19Qm7NDIf",
+    "instance": null,
+    "targetOverrides": null,
+    "nestedPrefabInstanceRoots": null
+  },
   {
     "__type__": "cc.Node",
     "_name": "Node",
@@ -690,11 +830,11 @@
     "_active": true,
     "_components": [
       {
-        "__id__": 30
+        "__id__": 36
       }
     ],
     "_prefab": {
-      "__id__": 32
+      "__id__": 38
     },
     "_lpos": {
       "__type__": "cc.Vec3",
@@ -731,11 +871,11 @@
     "_objFlags": 0,
     "__editorExtras__": {},
     "node": {
-      "__id__": 29
+      "__id__": 35
     },
     "_enabled": true,
     "__prefab": {
-      "__id__": 31
+      "__id__": 37
     },
     "_contentSize": {
       "__type__": "cc.Size",
@@ -778,11 +918,11 @@
     "_active": true,
     "_components": [
       {
-        "__id__": 34
+        "__id__": 40
       }
     ],
     "_prefab": {
-      "__id__": 36
+      "__id__": 42
     },
     "_lpos": {
       "__type__": "cc.Vec3",
@@ -819,11 +959,11 @@
     "_objFlags": 0,
     "__editorExtras__": {},
     "node": {
-      "__id__": 33
+      "__id__": 39
     },
     "_enabled": true,
     "__prefab": {
-      "__id__": 35
+      "__id__": 41
     },
     "_contentSize": {
       "__type__": "cc.Size",
@@ -866,14 +1006,14 @@
     "_active": false,
     "_components": [
       {
-        "__id__": 38
+        "__id__": 44
       },
       {
-        "__id__": 40
+        "__id__": 46
       }
     ],
     "_prefab": {
-      "__id__": 42
+      "__id__": 48
     },
     "_lpos": {
       "__type__": "cc.Vec3",
@@ -910,11 +1050,11 @@
     "_objFlags": 0,
     "__editorExtras__": {},
     "node": {
-      "__id__": 37
+      "__id__": 43
     },
     "_enabled": true,
     "__prefab": {
-      "__id__": 39
+      "__id__": 45
     },
     "_contentSize": {
       "__type__": "cc.Size",
@@ -938,11 +1078,11 @@
     "_objFlags": 0,
     "__editorExtras__": {},
     "node": {
-      "__id__": 37
+      "__id__": 43
     },
     "_enabled": true,
     "__prefab": {
-      "__id__": 41
+      "__id__": 47
     },
     "_customMaterial": null,
     "_srcBlendFactor": 2,
@@ -1023,7 +1163,7 @@
     },
     "_enabled": true,
     "__prefab": {
-      "__id__": 44
+      "__id__": 50
     },
     "_contentSize": {
       "__type__": "cc.Size",
@@ -1051,13 +1191,13 @@
     },
     "_enabled": true,
     "__prefab": {
-      "__id__": 46
+      "__id__": 52
     },
     "modelSpine": {
       "__id__": 17
     },
     "levelLabel": {
-      "__id__": 26
+      "__id__": 27
     },
     "gunNode1": {
       "__id__": 3
@@ -1069,7 +1209,7 @@
       "__id__": 11
     },
     "clickBox": {
-      "__id__": 34
+      "__id__": 40
     },
     "_id": ""
   },

+ 14 - 14
assets/package/prefab/ui/tower/hurt.prefab

@@ -266,8 +266,8 @@
     },
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 14,
-      "height": 52.4
+      "width": 28.75,
+      "height": 40
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -298,39 +298,39 @@
     "_color": {
       "__type__": "cc.Color",
       "r": 255,
-      "g": 0,
-      "b": 0,
+      "g": 255,
+      "b": 255,
       "a": 255
     },
     "_string": "0",
     "_horizontalAlign": 1,
     "_verticalAlign": 1,
-    "_actualFontSize": 20,
-    "_fontSize": 20,
+    "_actualFontSize": 40,
+    "_fontSize": 40,
     "_fontFamily": "Arial",
     "_lineHeight": 40,
     "_overflow": 0,
     "_enableWrapText": true,
     "_font": {
-      "__uuid__": "20e32a4b-c53f-43f1-afa0-30a906b3e3e8",
-      "__expectedType__": "cc.TTFFont"
+      "__uuid__": "65941af8-fc7e-447d-a557-0406909c778c",
+      "__expectedType__": "cc.BitmapFont"
     },
     "_isSystemFontUsed": false,
     "_spacingX": 0,
     "_isItalic": false,
-    "_isBold": false,
+    "_isBold": true,
     "_isUnderline": false,
     "_underlineHeight": 2,
     "_cacheMode": 0,
-    "_enableOutline": true,
+    "_enableOutline": false,
     "_outlineColor": {
       "__type__": "cc.Color",
-      "r": 163,
-      "g": 76,
-      "b": 76,
+      "r": 0,
+      "g": 0,
+      "b": 0,
       "a": 255
     },
-    "_outlineWidth": 1,
+    "_outlineWidth": 2,
     "_enableShadow": false,
     "_shadowColor": {
       "__type__": "cc.Color",

+ 6 - 6
assets/package/prefab/ui/tower/tower.prefab

@@ -5418,8 +5418,8 @@
     },
     "_lscale": {
       "__type__": "cc.Vec3",
-      "x": 0.5,
-      "y": 0.5,
+      "x": 1,
+      "y": 1,
       "z": 1
     },
     "_mobility": 0,
@@ -5446,8 +5446,8 @@
     },
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 323.9100036621094,
-      "height": 474
+      "width": 1061.550048828125,
+      "height": 335.8599853515625
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -5483,11 +5483,11 @@
       "a": 255
     },
     "_skeletonData": {
-      "__uuid__": "e467e1c9-92d1-4e68-81aa-22571424ff2a",
+      "__uuid__": "3edda31b-9168-43f9-a212-1df27f56441d",
       "__expectedType__": "sp.SkeletonData"
     },
     "defaultSkin": "default",
-    "defaultAnimation": "stand",
+    "defaultAnimation": "stand_right",
     "_premultipliedAlpha": false,
     "_timeScale": 1,
     "_preCacheMode": 0,

+ 2 - 0
assets/script/game/data/GameEvent.ts

@@ -32,6 +32,8 @@ let event = {
 	EquipWearChange: "EquipWearChange",									//穿戴装备变化
 	FateChange: "FateChange",											//羁绊变化
 
+	RoleAttrChange: "RoleAttrChange",									//角色属性变化
+
 }
 
 export let GameEvent = event;

+ 4 - 0
assets/script/game/manager/EquipManager.ts

@@ -167,6 +167,8 @@ export class EquipManager {
             if (data.equip) {
                 this.parseDataByServer(data.equip);
             }
+            let changeRoles = Framework.unionManager.getRoleGroupByRace(args.race)
+            Framework.unionManager.UpdateRoleAttr(changeRoles);
             Framework.event.fireEvent(GameEvent.EquipWearChange, args.race);
             callback();
         }, args)
@@ -198,6 +200,8 @@ export class EquipManager {
             if (data.equip) {
                 this.parseDataByServer(data.equip);
             }
+            let changeRoles = Framework.unionManager.getRoleGroupByRace(args.race)
+            Framework.unionManager.UpdateRoleAttr(changeRoles);
             Framework.event.fireEvent(GameEvent.EquipWearChange, args.race);
             callback();
         }, args)

+ 8 - 2
assets/script/game/manager/RoleManager.ts

@@ -28,7 +28,7 @@ export class RoleManager {
                         let role: Role = <Role>data[id];
                         role.conf = rConf[id];
                         role.type = ItemEnum.role;
-                        role.attr = this.getRoleAttr(data[id]);
+                        role.attr = this.CalcRoleAttr(data[id]);
                         roles[data[id].id] = role;
                         // console.log(`ID: ${id}, Name: ${role.name}, Level: ${role.level}`);
                     }
@@ -38,7 +38,12 @@ export class RoleManager {
         RoleData.setData(roles);
     }
 
-    static getRoleAttr(role): AttrBaseData {
+    static GetRoleAttr(rId){
+        let role = RoleData.getRoleDataByID(rId);
+        return role.attr;
+    }
+
+    static CalcRoleAttr(role:RoleServer) {
         let attrs:AttrBaseData = {
             [AttrEnum.attack]: 0,
             [AttrEnum.defence]: 0,
@@ -95,6 +100,7 @@ export class RoleManager {
             RoleData.setRoleDataByID(args.hid, rData)
             if (data.awards) {
                 Framework.unionManager.parseServerAwards(data.awards);
+                Framework.unionManager.UpdateRoleAttr([args.hid]);
             }
             callback();
         }, args)

+ 44 - 17
assets/script/game/manager/UnionManager.ts

@@ -7,6 +7,9 @@ import { GoodsData } from "../data/GoodsData";
 import { MailData } from "../data/MailData";
 import { RoleData } from "../data/RoleData";
 import { UserData } from "../data/UserData";
+import { BattleEventManager } from "../ui/tower/base/BattleEventManager";
+import { BattleEventTarget } from "../ui/tower/base/BattleEventUtil";
+import { RoleConf } from "../ui/tower/conf/RoleConf";
 import { EquipManager } from "./EquipManager";
 import { GoodsManager } from "./GoodsManager";
 import { RoleManager } from "./RoleManager";
@@ -15,23 +18,23 @@ import { RoleManager } from "./RoleManager";
 //所有manager的连接器
 export class UnionManager {
     // 解析奖励数据
-    static parseServerAwards(data:{[key:string]:AwardData}) {
-        let awards:Array<BaseItem> = [];
+    static parseServerAwards(data: { [key: string]: AwardData }) {
+        let awards: Array<BaseItem> = [];
         for (const key in Object.keys(data)) {
             const element = data[key];
             console.log(element[0]);
             if (element[0] == ItemEnum.material) {
-                let item = GoodsManager.addGoodsById(element[1].toString() , element[2]);
+                let item = GoodsManager.addGoodsById(element[1].toString(), element[2]);
                 awards.push(item);
             } else if (element[0] == ItemEnum.equip) {
-            }else if (element[0] == ItemEnum.user) {
+            } else if (element[0] == ItemEnum.user) {
                 let item: BaseItem = {
                     conf: {},
                     count: element[2],
                     id: element[1].toString(),
                     type: ItemEnum.user
                 };
-                
+
                 let statu = UserData.status[element[1]]
                 if (statu) {
                     statu += element[2];
@@ -47,22 +50,22 @@ export class UnionManager {
     }
 
     // 触发物品刷新事件
-    static fireEventWithItem(itemList:[BaseItem]){
+    static fireEventWithItem(itemList: [BaseItem]) {
         let updateEvent = [];
-        for(let i in itemList){
+        for (let i in itemList) {
             let item = itemList[i];
-            if(item.type == ItemEnum.user){
-                if(!updateEvent[GameEvent.StatusUpdate]){
+            if (item.type == ItemEnum.user) {
+                if (!updateEvent[GameEvent.StatusUpdate]) {
                     Framework.event.fireEvent(GameEvent.StatusUpdate);
                 }
                 updateEvent[GameEvent.StatusUpdate] = true
-            }else if(item.type == ItemEnum.equip){
-                if(!updateEvent[GameEvent.EquipChange]){
+            } else if (item.type == ItemEnum.equip) {
+                if (!updateEvent[GameEvent.EquipChange]) {
                     Framework.event.fireEvent(GameEvent.EquipChange);
                 }
                 updateEvent[GameEvent.EquipChange] = true
-            }else if(item.type == ItemEnum.material){
-                if(!updateEvent[GameEvent.MaterialChange]){
+            } else if (item.type == ItemEnum.material) {
+                if (!updateEvent[GameEvent.MaterialChange]) {
                     Framework.event.fireEvent(GameEvent.MaterialChange);
                 }
                 updateEvent[GameEvent.MaterialChange] = true
@@ -70,8 +73,8 @@ export class UnionManager {
         }
     }
 
-    static showItemTips(awards:Array<BaseItem>) {
-        let tipsStr:string = "";
+    static showItemTips(awards: Array<BaseItem>) {
+        let tipsStr: string = "";
         for (const key in awards) {
             const element = awards[key];
             tipsStr += element.count + "*" + element.id + "  ";
@@ -102,7 +105,7 @@ export class UnionManager {
         if (data.role_bag && data.role_bag.roles) {
             RoleManager.setData(data.role_bag.roles)
         }
-        
+
         BattleData.setLoginData(data)
 
         if (data.inventory) {
@@ -112,5 +115,29 @@ export class UnionManager {
         }
 
     }
-    
+
+    // 更新角色属性
+    static UpdateRoleAttr(data: []) {
+        for (const rId of data) {
+            let role = RoleData.getRoleDataByID(rId);
+            let newAttr = RoleManager.CalcRoleAttr(role);
+            role.attr = newAttr;
+            BattleEventManager.instance.fireEvent(BattleEventTarget.HeroAttr,role)
+            Framework.event.fireEvent(GameEvent.RoleAttrChange, role)
+        }
+    }
+
+    //根据种族获取所属英雄id
+    static getRoleGroupByRace(race) {
+        let rGroup = [];
+        for (const key in RoleConf.data) {
+            if (Object.prototype.hasOwnProperty.call(RoleConf.data, key)) {
+                const element = RoleConf.data[key];
+                if (element.Race == race) {
+                    rGroup.push(element.Id);
+                }
+            }
+        }
+        return rGroup;
+    }
 }

+ 27 - 24
assets/script/game/ui/tower/TowerUI.ts

@@ -200,7 +200,6 @@ export class TowerUI extends BaseView {
 		
 		this.battleControl = BattleControl.GetInstance()
 		BattleEventManager.instance.addEvent(BattleEventTarget.Update, this.updateDataEvent.bind(this), TowerUUID);
-
 		Framework.event.addEvent(GameEvent.BossUpdate, this.bossUpdate.bind(this),this)
 		
 		
@@ -392,7 +391,6 @@ export class TowerUI extends BaseView {
 				console.log(winStr)
 				this.bBattleOverAnimBack = false
 				this.bBattleOverMessageBack = false
-				
 				let battlesConf = BattlesConf.data[this.battlesID];
 				if(attackData.bWin &&(this.battlesID==battlesConf.BossProcess)){
 					this.changeChapterNode.getComponent(ChangeChapter).show(()=>{
@@ -431,9 +429,11 @@ export class TowerUI extends BaseView {
 				for(let index = 0; index < BattleUtil.BagListSize; index++){
 					let posData = this.attackPosList[index]
 					let key = BattleLayoutPos[index+BattleUtil.BagListSize]
+					console.log(key,index)
 					if(key){
 						if(posData && posData.hero){
 							let heroData = posData.hero.getComponent(Hero)
+							console.log(heroData.level,heroData.raceID)
 							let value = heroData.level + heroData.raceID *BattleLayoutScale
 							layout[key] = value
 						}
@@ -736,19 +736,19 @@ export class TowerUI extends BaseView {
 			}
 		}
 
-		let heroData = HeroDataPool.getObject();
-		for (let i = 0; i < BattleUtil.BagListSize; i++) {
-			let bagPos = this.bagPosList[i];
-			if(bagPos.hero){
-				let value = BattleData.layout[i];
-				let battleLayoutData = BattleManager.getDataWithLayoutValue(value)
-				bagPos.hero.position = bagPos.pos;
-				let hero = bagPos.hero.getComponent(Hero);
+		//let heroData = HeroDataPool.getObject();
+		// for (let i = 0; i < BattleUtil.BagListSize; i++) {
+		// 	let bagPos = this.bagPosList[i];
+		// 	if(bagPos.hero){
+		// 		let value = BattleData.layout[i];
+		// 		let battleLayoutData = BattleManager.getDataWithLayoutValue(value)
+		// 		bagPos.hero.position = bagPos.pos;
+		// 		let hero = bagPos.hero.getComponent(Hero);
 				
-				heroData.init(RoleData.getRoleDataByID(battleLayoutData.typeID),battleLayoutData.level,-1)
-				hero.resetData(heroData);
-			}
-		}
+		// 		heroData.init(RoleData.getRoleDataByID(battleLayoutData.typeID),battleLayoutData.level,-1)
+		// 		hero.resetData(heroData);
+		// 	}
+		// }
 		for (let i = 0; i < BattleUtil.AttackListSize; i++) {
 			let node = attackChildren[i];
 			if(!node){
@@ -781,15 +781,15 @@ export class TowerUI extends BaseView {
 						posData.posIndex = BattleUtil.BagListSize+i;
 						posData.pos = new Vec3(pos.x, pos.y, 0);
 						posData.posNumber = posNumber;
-						if(posData.hero){
-							let value = BattleData.layout[i+BattleUtil.BagListSize];
-							let battleLayoutData = BattleManager.getDataWithLayoutValue(value)
-							posData.hero.position = posData.pos;
-							let hero = posData.hero.getComponent(Hero);
+						// if(posData.hero){
+						// 	let value = BattleData.layout[i+BattleUtil.BagListSize];
+						// 	let battleLayoutData = BattleManager.getDataWithLayoutValue(value)
+						// 	posData.hero.position = posData.pos;
+						// 	let hero = posData.hero.getComponent(Hero);
 							
-							heroData.init(RoleData.getRoleDataByID(battleLayoutData.typeID),battleLayoutData.level,posNumber)
-							hero.resetData(heroData);
-						}
+						// 	heroData.init(RoleData.getRoleDataByID(battleLayoutData.typeID),battleLayoutData.level,posNumber)
+						// 	hero.resetData(heroData);
+						// }
 					}
 					this.attackPosMap.set(posNumber, posData);
 				}
@@ -808,7 +808,9 @@ export class TowerUI extends BaseView {
 			}
 			
 		}
-		HeroDataPool.putObject(heroData);
+		//HeroDataPool.putObject(heroData);
+
+		this.resetBattleLayout()
 
 		let path = "texture/tower/"+mapConf.Background+"/spriteFrame"
 
@@ -1282,7 +1284,7 @@ export class TowerUI extends BaseView {
 			node.parent = this.roleNode;
 		}
 		
-		node.position = pos;
+		node.position = v3(pos.x,pos.y+40,pos.z);
 		this.hurtList.push(node);
 		node.getComponent(Hurt).hurt(value,()=>{
 			this.hurtList.splice(this.hurtList.indexOf(node), 1)
@@ -1412,6 +1414,7 @@ export class TowerUI extends BaseView {
 				break;
 		}
 	}
+	
 
 	private loadHeroModel(){
 		let fightRole = RoleData.fightRole

+ 3 - 0
assets/script/game/ui/tower/base/BattleEventUtil.ts

@@ -4,7 +4,10 @@ export const TowerUUID = -1;
 //战斗消息工具类
 export enum BattleEventTarget{
     Update = "update",
+    //攻击动作事件
     HeroAction = "hero_action",
+    //英雄属性变化
+    HeroAttr = "hero_Attr",
     
 }
 export enum BattleEventType{

+ 17 - 1
assets/script/game/ui/tower/control/HeroControl.ts

@@ -1,3 +1,4 @@
+import { Role } from "../../../common/InterfaceAddEnum";
 import { BattleBase } from "../base/BattleBase";
 import { BattleEventManager } from "../base/BattleEventManager";
 import { BattleEventData_EnemyHurt, BattleEventData_HeroAction, BattleEventData_HeroAttack, BattleEventData_HeroAttackBullet, BattleEventHeroAction, BattleEventTarget, BattleEventType, HeroActionType, HurtEventState } from "../base/BattleEventUtil";
@@ -24,7 +25,9 @@ export class HeroControl extends BattleBase{
     constructor(){
         super();
         this.battleEventManager = BattleEventManager.instance
-        BattleEventManager.instance.addEvent(BattleEventTarget.HeroAction, this.heroActionEvent.bind(this), -1);
+        BattleEventManager.instance.addEvent(BattleEventTarget.HeroAction, this.heroActionEvent.bind(this), this);
+        BattleEventManager.instance.addEvent(BattleEventTarget.HeroAttr, this.heroAttrEvent.bind(this), this);
+        
     }
 
     init(){
@@ -170,4 +173,17 @@ export class HeroControl extends BattleBase{
     }
 
     
+    //属性变化事件
+    heroAttrEvent(role:Role){
+        let rid = Number(role.id)
+        this.attackPosDataMap.forEach((posData:PosData)=>{
+            let hero = posData.hero
+
+            if(hero && hero.typeID == rid){
+                hero.updateRole(role)
+            }
+        })
+    }
+
+    
 }

+ 18 - 5
assets/script/game/ui/tower/data/HeroData.ts

@@ -78,7 +78,7 @@ export class HeroData extends DataBase{
         this.level = level;
         this.typeID = Number(role.id);
         this.posID = posID;
-        this._raceID = role.conf.race
+        this._raceID = role.conf.Race
         // let roleData = RoleData.getRoleDataByID(this.typeID)
         //读地图
         this.position = new BattleUtil.Vector2(0, 0);
@@ -113,7 +113,7 @@ export class HeroData extends DataBase{
 
             }
 
-            this.upDataLevel()
+            this.updataLevel()
             return this;
         }
         return null;
@@ -160,13 +160,13 @@ export class HeroData extends DataBase{
 
     levelUp() {
         this.level++;
-        this.upDataLevel()
+        this.updataLevel()
     }
     levelTo(newLevel: number){
         this.level = newLevel;   
-        this.upDataLevel()
+        this.updataLevel()
     }
-    upDataLevel() {
+    updataLevel() {
 
         let conf = UptypeConf.data
         this._speedCur = this._speed / (conf.HeroSpeedColArr[this.level]||1);
@@ -176,6 +176,19 @@ export class HeroData extends DataBase{
         this._criticalDamageCur = this._criticalDamage;
     }
 
+    updateRole(role:Role){
+        let heroConf = role.conf
+        if (heroConf) {
+            this._speed = role.attr.speed;
+            this._attackDamage = role.attr.attack;
+            this._critical = role.attr.crite;
+            this._criticalDamage = role.attr.critedamage;
+            this.updataLevel()
+            return this;
+        }
+        return null;
+    }
+
     removeBuff(ID: number) {
         for (let i = 0; i < this.buffList.length; i++) {
             let buff = this.buffList[i];

+ 38 - 26
assets/script/game/ui/tower/node/Hero.ts

@@ -63,6 +63,8 @@ export class Hero extends BattleNodeBase {
 
     battleEventManager: BattleEventManager;
 
+    private _nextAnimName: string = "idle";
+
 
     set posIndex(posIndx:number){
         this._posIndex = posIndx;
@@ -76,6 +78,7 @@ export class Hero extends BattleNodeBase {
     }
 
     protected onLoad(): void {
+         this.modelSpine.setStartListener(this.actionStart.bind(this))
          this.modelSpine.setCompleteListener(this.actionComplete.bind(this))
         this.modelSpine.setEventListener(this.actionCallback.bind(this))
 
@@ -156,41 +159,30 @@ export class Hero extends BattleNodeBase {
             this.attackBone2.rotation = 0
             this.attackBone3.rotation = 0
             this.attackBone4.rotation = 0
-            let bChange = false
+            let curAnimName = this.modelSpine.animation
             if(rotationAngleDegrees<67.5 || rotationAngleDegrees > 292.5){
                 let rotationAngle = this.getRotationAngle(this.gunNode1,pos)
                 this.attackBone1.rotation = (rotationAngle+this.attackAngle1)
-                if(this.modelSpine.animation != "atk_right"){
-                    this.modelSpine.setAnimation(0, 'atk_right', true);
-                    bChange = true
-                }
+                this._nextAnimName = "atk_right"
             }
             else if(rotationAngleDegrees < 112.5){
                 let rotationAngle = this.getRotationAngle(this.gunNode3,pos)
                 this.attackBone3.rotation = rotationAngle+this.attackAngle3-90
-                if(this.modelSpine.animation != "atk_up"){
-                    this.modelSpine.setAnimation(0, 'atk_up', true);
-                    bChange = true
-                }
+                this._nextAnimName = "atk_up"
             }
             else if(rotationAngleDegrees < 247.5){
                 let rotationAngle = this.getRotationAngle(this.gunNode1,pos)
                 this.attackBone4.rotation = 180-rotationAngle+this.attackAngle4
-                if(this.modelSpine.animation != "atk_left"){
-                    this.modelSpine.setAnimation(0, 'atk_left', true);
-                    bChange = true
-                }
+                this._nextAnimName = "atk_left"
             }
             else if(rotationAngleDegrees < 292.5){
                 let rotationAngle = this.getRotationAngle(this.gunNode2,pos)
                 this.attackBone2.rotation = rotationAngle+this.attackAngle2-270
-                if(this.modelSpine.animation != "atk_down"){
-                    this.modelSpine.setAnimation(0, 'atk_down', true);
-                    bChange = true
-                }
+                this._nextAnimName = "atk_down"
             }
 
-            if(bChange){
+            if(!curAnimName.includes("atk_") && this._nextAnimName.includes("atk_")){
+                this.modelSpine.setAnimation(0,this._nextAnimName, true);
                 let conf = UptypeConf.data
                 let speedScale = conf.HeroSpeedColArr[this.level]
                 this.modelSpine.timeScale = speedScale;
@@ -213,12 +205,11 @@ export class Hero extends BattleNodeBase {
     attack(attackNode:Node){
         if(!this.modelSpine.node.active) return;
         
+        
+        this.attackNode = attackNode;
+        
         // if(this._bAttackAnimation) return; 
         this._bAttackAnimation = true;
-
-        this.attackNode = attackNode;
-
-        Framework.audio.playEffect(AudioID.Tututu);
     }
 
     stand() {
@@ -235,23 +226,29 @@ export class Hero extends BattleNodeBase {
         if(animationName.includes("idle")) return; 
         switch(animationName){
             case "atk_right":
+                this._nextAnimName = "atk_right";
                 this.modelSpine.setAnimation(0, 'idle_right', true);
                 break;
             case "atk_left":
+                this._nextAnimName = "atk_left";
                 this.modelSpine.setAnimation(0, 'idle_left', true);
                 break;
             case "atk_up":
+                this._nextAnimName = "atk_up";
                 this.modelSpine.setAnimation(0, 'idle_up', true);
                 break;
             case "atk_down":
+                this._nextAnimName = "atk_down";
                 this.modelSpine.setAnimation(0, 'idle_down', true);
                 break;
             default:
+                this._nextAnimName = "idk_right";
                 this.modelSpine.setAnimation(0, 'idle_right', true);
                 break;
         }
         this.modelSpine.timeScale = 1;
-        // if(this.modelSpine.node.scale.x < 0)
+                // this.modelSpine.setAnimation(0, 'idle_up', true);
+                // if(this.modelSpine.node.scale.x < 0)
         //     this.modelSpine.node.scale = new Vec3(-this.modelSpine.node.scale.x,this.modelSpine.node.scale.y,this.modelSpine.node.scale.z);
 
     }
@@ -261,8 +258,8 @@ export class Hero extends BattleNodeBase {
         this.levelLabel.string = this.level.toString();
     }
 
-    actionCallback(trackEntry){
-        //  console.log("动作回调:",trackEntry.animation.name)
+    actionCallback(trackEntry: sp.spine.TrackEntry,ev: sp.spine.Event){
+         console.log("动作回调:",trackEntry.animation.name,ev)
         if (trackEntry.animation.name && trackEntry.animation.name.includes("atk")) {
 
             // if (this._attackCallback) {
@@ -279,10 +276,25 @@ export class Hero extends BattleNodeBase {
         } 
     }
 
+    actionStart(trackEntry:sp.spine.TrackEntry){
+        // console.log("动作完成:",trackEntry.animation.name,this._posID)
+        if (trackEntry.animation.name && trackEntry.animation.name.includes("atk_")) {
+
+            Framework.audio.playEffect(AudioID.Tututu);
+           
+        } 
+    }
+
     actionComplete(trackEntry:sp.spine.TrackEntry){
         // console.log("动作完成:",trackEntry.animation.name,this._posID)
-        if (trackEntry.animation.name && trackEntry.animation.name.includes("fire")) {
+        if (trackEntry.animation.name && trackEntry.animation.name.includes("atk_")) {
 
+            if( this._nextAnimName.includes("atk_")){
+                this.modelSpine.setAnimation(0,this._nextAnimName, true);
+                let conf = UptypeConf.data
+                let speedScale = conf.HeroSpeedColArr[this.level]
+                this.modelSpine.timeScale = speedScale;
+            }
             // this._bAttackAnimation = false;
             // // this.gunNode.angle = 0;
             // // this.gunNode.active = false;

+ 2 - 2
assets/script/game/ui/tower/node/Hurt.ts

@@ -16,8 +16,8 @@ export class Hurt extends BattleNodeBase {
     }
     hurt(hurt:number,onComplete:Function){
         this.node.active = true;
-        this.label.string = hurt.toFixed(0);
-        this.label.node.qtJumpPosition(new Vec3(Math.random()*60-30, Math.random()*20+10, 0), 20, 1, 0.5,{onComplete : ()=>{
+        this.label.string = (hurt*100).toFixed(0);
+        this.label.node.qtJumpPosition(new Vec3(Math.random()*10, Math.random()*10+80, 0), 20, 1, 0.5,{onComplete : ()=>{
             this.node.active = false;
             onComplete&&onComplete()
         }}).start()

+ 1 - 1
assets/script/game/ui/zombie/data/ZombieHeroData.ts

@@ -34,7 +34,7 @@ export class ZombieHeroData extends HeroData{
                 this.skillDataList.push(skillData);
             }
 
-            this.upDataLevel()
+            this.updataLevel()
             return this;
         }
         return null;

+ 0 - 4
assets/sub_bundle/hero/prefab/HeroAttr.prefab

@@ -345,8 +345,6 @@
       "__id__": 0
     },
     "fileId": "c9fhluvfVKyKBbrSDpvXph",
-    "instance": null,
-    "targetOverrides": null,
     "nestedPrefabInstanceRoots": null
   },
   {
@@ -16129,8 +16127,6 @@
       "__id__": 0
     },
     "fileId": "16osAoBkdHlKLt3lxNjBsc",
-    "instance": null,
-    "targetOverrides": null,
     "nestedPrefabInstanceRoots": null
   },
   {