|
@@ -239,6 +239,8 @@ export default class GameUI extends BaseUI {
|
|
private timeRolesPos: number[]
|
|
private timeRolesPos: number[]
|
|
private timeRolesDrop: idNum[]
|
|
private timeRolesDrop: idNum[]
|
|
private createEnemyNum: number
|
|
private createEnemyNum: number
|
|
|
|
+ private addEnemyArr: boolean[]
|
|
|
|
+ private rightAreaFriend: number[] = []
|
|
|
|
|
|
protected onLoad() {
|
|
protected onLoad() {
|
|
this.skillArea = cc.find('skillArea', this.node)
|
|
this.skillArea = cc.find('skillArea', this.node)
|
|
@@ -295,6 +297,7 @@ export default class GameUI extends BaseUI {
|
|
this.skillPop.active = false
|
|
this.skillPop.active = false
|
|
this.createEnemyNum = 0
|
|
this.createEnemyNum = 0
|
|
this.curStage = Data.game.stageID
|
|
this.curStage = Data.game.stageID
|
|
|
|
+ this.rightAreaFriend.length = 0
|
|
ccUtils.setLabel('0', this.goods, 'lb')
|
|
ccUtils.setLabel('0', this.goods, 'lb')
|
|
let cfg = this.getStageInfoCfg()
|
|
let cfg = this.getStageInfoCfg()
|
|
this.stageInfo = cfg
|
|
this.stageInfo = cfg
|
|
@@ -669,7 +672,7 @@ export default class GameUI extends BaseUI {
|
|
showGameResult(result: IGameResult) {
|
|
showGameResult(result: IGameResult) {
|
|
this.scheduleOnce(() => {
|
|
this.scheduleOnce(() => {
|
|
Mgr.ui.show(UI.GameResultUI, result)
|
|
Mgr.ui.show(UI.GameResultUI, result)
|
|
- }, 1)
|
|
|
|
|
|
+ }, 0.5)
|
|
}
|
|
}
|
|
|
|
|
|
async getGameResSync(url, type) {
|
|
async getGameResSync(url, type) {
|
|
@@ -763,6 +766,16 @@ export default class GameUI extends BaseUI {
|
|
return cfg
|
|
return cfg
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ getRolePos(pos: number) {
|
|
|
|
+ if (pos == 0) {
|
|
|
|
+ return Math.randomRangeInt(1, 19)
|
|
|
|
+ } else if (pos == 100) {
|
|
|
|
+ return Math.randomRangeInt(101, 109)
|
|
|
|
+ } else {
|
|
|
|
+ return pos
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
startStageGame() {
|
|
startStageGame() {
|
|
let cfg = this.getRoundCfg()
|
|
let cfg = this.getRoundCfg()
|
|
if (this.curStage > 0 && cfg) {
|
|
if (this.curStage > 0 && cfg) {
|
|
@@ -985,13 +998,7 @@ export default class GameUI extends BaseUI {
|
|
for (let k = 0; k < tmpRoles.length; k++) {
|
|
for (let k = 0; k < tmpRoles.length; k++) {
|
|
let cfgPos = this.curRoundCfg.rolesPos[i][k]
|
|
let cfgPos = this.curRoundCfg.rolesPos[i][k]
|
|
for (let j = 0; j < this.curRoundCfg.rolesTime[i][k]; j++) {
|
|
for (let j = 0; j < this.curRoundCfg.rolesTime[i][k]; j++) {
|
|
- let pos = cfgPos
|
|
|
|
- if (cfgPos == 0) {
|
|
|
|
- pos = Math.randomRangeInt(1, 19)
|
|
|
|
- }
|
|
|
|
- if (cfgPos == 100) {
|
|
|
|
- pos = Math.randomRangeInt(101, 109)
|
|
|
|
- }
|
|
|
|
|
|
+ let pos = this.getRolePos(cfgPos)
|
|
tmpObj.push({
|
|
tmpObj.push({
|
|
id: tmpRoles[k],
|
|
id: tmpRoles[k],
|
|
pos,
|
|
pos,
|
|
@@ -1016,6 +1023,9 @@ export default class GameUI extends BaseUI {
|
|
}
|
|
}
|
|
|
|
|
|
this.roundNextRoleTime = this.timeRolesTime[this.curRoundCreateIndex]
|
|
this.roundNextRoleTime = this.timeRolesTime[this.curRoundCreateIndex]
|
|
|
|
+ if ('additional' in this.curRoundCfg) {
|
|
|
|
+ this.addEnemyArr = new Array(this.curRoundCfg.additional.map(v => v).length).fill(false)
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
startNextSmallRound() {
|
|
startNextSmallRound() {
|
|
@@ -1473,6 +1483,11 @@ export default class GameUI extends BaseUI {
|
|
let comTransform = this.world.getComponent(entity, ComTransform)
|
|
let comTransform = this.world.getComponent(entity, ComTransform)
|
|
this.dropClickGoods(cc.v3(comTransform.x, comTransform.y, 0), comRole.drop)
|
|
this.dropClickGoods(cc.v3(comTransform.x, comTransform.y, 0), comRole.drop)
|
|
}
|
|
}
|
|
|
|
+ //移除右半场已经死亡的友军
|
|
|
|
+ if (comRole.group == Data.game.gFriend) {
|
|
|
|
+ let inRightIndex = this.rightAreaFriend.indexOf(entity)
|
|
|
|
+ if (inRightIndex >= 0) this.rightAreaFriend.splice(inRightIndex, 1)
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
initGameSpeed() {
|
|
initGameSpeed() {
|
|
@@ -1596,6 +1611,30 @@ export default class GameUI extends BaseUI {
|
|
this.bossHPNode.active = false
|
|
this.bossHPNode.active = false
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ //我方右半区友军大于一定数量增加刷怪
|
|
|
|
+ addRightAreaFriendNum(entity) {
|
|
|
|
+ //处理下容错,刚好这一帧死亡,下一次推入新的友军可以过滤掉
|
|
|
|
+ this.rightAreaFriend = this.rightAreaFriend.filter(v => !this.world.isDie(v))
|
|
|
|
+ this.rightAreaFriend.push(entity)
|
|
|
|
+ if ('extraRoles' in this.curRoundCfg) {
|
|
|
|
+ for (let i = 0; i < this.addEnemyArr.length; i++) {
|
|
|
|
+ if (!this.addEnemyArr[i] && this.rightAreaFriend.length >= this.curRoundCfg.additional[i]) {
|
|
|
|
+ for (let j = 0; j < this.curRoundCfg.addNum[i]; j++) {
|
|
|
|
+ this.world.createRoleEntity(
|
|
|
|
+ this.getRoleCfgByCfgID(this.curRoundCfg.extraRoles[i]),
|
|
|
|
+ true,
|
|
|
|
+ this.getRolePos(this.curRoundCfg.position[i]),
|
|
|
|
+ null,
|
|
|
|
+ null,
|
|
|
|
+ true,
|
|
|
|
+ )
|
|
|
|
+ }
|
|
|
|
+ this.addEnemyArr[i] = true
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
onClickAdAddCost() {
|
|
onClickAdAddCost() {
|
|
Mgr.platform.playVideoAD(AD_ID.energy, () => {
|
|
Mgr.platform.playVideoAD(AD_ID.energy, () => {
|
|
this.adCost.active = false
|
|
this.adCost.active = false
|