|
@@ -384,6 +384,7 @@ export class TowerUI extends BaseView {
|
|
|
})
|
|
|
|
|
|
let winStr = attackData.bWin ? "胜利" : "失败";
|
|
|
+ this.touchCancel();
|
|
|
console.log(winStr)
|
|
|
|
|
|
let battlesConf = BattlesConf.data[this.battlesID];
|
|
@@ -440,6 +441,7 @@ export class TowerUI extends BaseView {
|
|
|
},()=>{
|
|
|
// this.reStartBattle(this.battlesID)
|
|
|
})
|
|
|
+
|
|
|
}
|
|
|
else{
|
|
|
if(this.battlesID%5 != 1){
|
|
@@ -556,6 +558,10 @@ export class TowerUI extends BaseView {
|
|
|
}
|
|
|
|
|
|
onTouchCancel(event: EventTouch) {
|
|
|
+ this.touchCancel()
|
|
|
+ }
|
|
|
+
|
|
|
+ touchCancel() {
|
|
|
this.radiusNode.active = false;
|
|
|
if (this.touchStart) {
|
|
|
this.resetHeroPos(this.touchStart)
|
|
@@ -618,7 +624,9 @@ export class TowerUI extends BaseView {
|
|
|
}
|
|
|
}
|
|
|
else{
|
|
|
- return
|
|
|
+ //没数据就认为是第一关
|
|
|
+ this.bStart = true
|
|
|
+ this.battlesID = 1
|
|
|
}
|
|
|
|
|
|
this.battleControl.init(this.battlesID)
|
|
@@ -708,7 +716,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);
|
|
|
+
|
|
|
+ heroData.init(battleLayoutData.typeID,battleLayoutData.level,-1)
|
|
|
+ hero.resetData(heroData);
|
|
|
+ }
|
|
|
+ }
|
|
|
for (let i = 0; i < BattleUtil.AttackListSize; i++) {
|
|
|
let node = attackChildren[i];
|
|
|
if(!node){
|
|
@@ -737,11 +757,18 @@ export class TowerUI extends BaseView {
|
|
|
this.attackPosList.push(posData);
|
|
|
}
|
|
|
else{
|
|
|
+
|
|
|
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);
|
|
|
+
|
|
|
+ heroData.init(battleLayoutData.typeID,battleLayoutData.level,posNumber)
|
|
|
+ hero.resetData(heroData);
|
|
|
}
|
|
|
}
|
|
|
this.attackPosMap.set(posNumber, posData);
|
|
@@ -761,6 +788,7 @@ export class TowerUI extends BaseView {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+ HeroDataPool.putObject(heroData);
|
|
|
|
|
|
let path = "texture/tower/"+mapConf.Background+"/spriteFrame"
|
|
|
|
|
@@ -779,14 +807,16 @@ export class TowerUI extends BaseView {
|
|
|
|
|
|
|
|
|
|
|
|
- this.bStart = false;
|
|
|
+ // this.bStart = false;
|
|
|
// this.waitTime = 5;
|
|
|
+ this.operateList = [];
|
|
|
this.gameTime = 0;
|
|
|
this.powerCur = UserData.status.food
|
|
|
this.radiusNode.active = false;
|
|
|
this.damageCountData.clear()
|
|
|
this.resultNode.active = false
|
|
|
this.updateDamageCount()
|
|
|
+ this.powerLabel.string = `${this.powerCur}/${this.powerMax}`;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -1054,14 +1084,6 @@ export class TowerUI extends BaseView {
|
|
|
|
|
|
}
|
|
|
|
|
|
- onClickStart() {
|
|
|
- this.bStart = true;
|
|
|
- }
|
|
|
-
|
|
|
- onClickStop() {
|
|
|
- this.bStart = false;
|
|
|
- }
|
|
|
-
|
|
|
onClickAddHero() {
|
|
|
Framework.audio.playEffect(AudioID.Click);
|
|
|
this.addHero();
|
|
@@ -1106,6 +1128,7 @@ export class TowerUI extends BaseView {
|
|
|
if(newPosIndex < BattleUtil.BagListSize){
|
|
|
this.bagPosList[newPosIndex].hero = hero;
|
|
|
hero.position = this.bagPosList[newPosIndex].pos;
|
|
|
+ hero.scale = new Vec3(1,1,1);
|
|
|
}
|
|
|
else if(newPosIndex < BattleUtil.BagListSize + this.attackPosList.length){
|
|
|
let index = newPosIndex - BattleUtil.BagListSize;
|
|
@@ -1113,6 +1136,7 @@ export class TowerUI extends BaseView {
|
|
|
hero.position = this.attackPosList[index].pos;
|
|
|
let heroObj = hero.getComponent(Hero)
|
|
|
this.battleControl.addHeroInPos(heroObj.typeID,heroObj.level,index)
|
|
|
+ hero.scale = new Vec3(1.2,1.2,1);
|
|
|
}
|
|
|
hero.getComponent(Hero).posIndex = newPosIndex
|
|
|
}
|
|
@@ -1173,6 +1197,7 @@ export class TowerUI extends BaseView {
|
|
|
if(posIndex1 < BattleUtil.BagListSize){
|
|
|
hero2.position = this.bagPosList[posIndex1].pos;
|
|
|
this.bagPosList[posIndex1].hero = hero2;
|
|
|
+ hero2.scale = new Vec3(1,1,1);
|
|
|
}
|
|
|
else if(posIndex1 < BattleUtil.BagListSize + this.attackPosList.length){
|
|
|
hero2.position = this.attackPosList[posIndex1 - BattleUtil.BagListSize].pos;
|
|
@@ -1180,6 +1205,7 @@ export class TowerUI extends BaseView {
|
|
|
this.attackPosList[index].hero = hero2;
|
|
|
let heroObj = hero2.getComponent(Hero)
|
|
|
this.battleControl.addHeroInPos(heroObj.typeID,heroObj.level,index)
|
|
|
+ hero2.scale = new Vec3(1.2,1.2,1);
|
|
|
}
|
|
|
hero2.getComponent(Hero).stand()
|
|
|
}
|
|
@@ -1188,6 +1214,7 @@ export class TowerUI extends BaseView {
|
|
|
if(posIndex2 < BattleUtil.BagListSize){
|
|
|
hero1.position = this.bagPosList[posIndex2].pos;
|
|
|
this.bagPosList[posIndex2].hero = hero1;
|
|
|
+ hero1.scale = new Vec3(1,1,1);
|
|
|
}
|
|
|
else if(posIndex2 < BattleUtil.BagListSize + this.attackPosList.length){
|
|
|
hero1.position = this.attackPosList[posIndex2 - BattleUtil.BagListSize].pos;
|
|
@@ -1195,6 +1222,7 @@ export class TowerUI extends BaseView {
|
|
|
this.attackPosList[index].hero = hero1;
|
|
|
let heroObj = hero1.getComponent(Hero)
|
|
|
this.battleControl.addHeroInPos(heroObj.typeID,heroObj.level,index)
|
|
|
+ hero1.scale = new Vec3(1.2,1.2,1);
|
|
|
}
|
|
|
hero1.getComponent(Hero).stand()
|
|
|
|