|
@@ -25,7 +25,7 @@ import {
|
|
|
GAME_TYPE,
|
|
|
GAME_WIN_TYPE,
|
|
|
LANGUAGE_TYPE,
|
|
|
- MASTER_TYPE,
|
|
|
+ MONSTER_TYPE,
|
|
|
RELIC_EVENT_NTY,
|
|
|
ROLE_TYPE,
|
|
|
SKILL_DIR_TYPE,
|
|
@@ -185,6 +185,8 @@ export default class GameUI extends BaseUI {
|
|
|
private rechargePb: cc.Node
|
|
|
@node('recharge/rechargeNumPb')
|
|
|
private rechargeNumPb: cc.Node
|
|
|
+ @node('bossHP')
|
|
|
+ private bossHPNode: cc.Node
|
|
|
public roleTipPool: Map<string, cc.NodePool>
|
|
|
public dropPool: Map<number, cc.NodePool> = new Map()
|
|
|
public getDrop: Map<number, number> = new Map()
|
|
@@ -280,6 +282,7 @@ export default class GameUI extends BaseUI {
|
|
|
this.initSkillCards()
|
|
|
this.friendBase.active = true
|
|
|
this.enemyBase.active = true
|
|
|
+ this.bossHPNode.active = false
|
|
|
this.bossNum = 0
|
|
|
this.eliteNum = 0
|
|
|
this.monsterNum = 0
|
|
@@ -911,7 +914,7 @@ export default class GameUI extends BaseUI {
|
|
|
if (drops.length > 0) {
|
|
|
//过滤掉boss,去头尾
|
|
|
for (let i = 1; i < allRoles.length - 1; i++) {
|
|
|
- if (this.getRoleCfgByCfgID(allRoles[i]).type != MASTER_TYPE.boss) dropRolesPos.push(i)
|
|
|
+ if (this.getRoleCfgByCfgID(allRoles[i]).type != MONSTER_TYPE.boss) dropRolesPos.push(i)
|
|
|
}
|
|
|
//N组随机
|
|
|
let count = Math.ceil(dropRolesPos.length / drops.length)
|
|
@@ -1514,6 +1517,79 @@ export default class GameUI extends BaseUI {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+ flyCostNode(addNum, startPos: cc.Vec3) {
|
|
|
+ let costPool = this.dropPool.get(GOODS.cost)
|
|
|
+ if (!costPool) {
|
|
|
+ costPool = new cc.NodePool()
|
|
|
+ this.dropPool.set(GOODS.cost, costPool)
|
|
|
+ }
|
|
|
+ let nodes = []
|
|
|
+ let costNode = cc.find('cost', this.node)
|
|
|
+ for (let i = 0; i < addNum; i++) {
|
|
|
+ let node = costPool.get()
|
|
|
+ if (!node) node = cc.instantiate(cc.find('icon', costNode))
|
|
|
+ node.scale = 1
|
|
|
+ nodes.push(node)
|
|
|
+ }
|
|
|
+ ccUtils.circleFlyNodes(
|
|
|
+ nodes,
|
|
|
+ this.node,
|
|
|
+ startPos,
|
|
|
+ costNode.position,
|
|
|
+ node => {
|
|
|
+ costPool.put(node)
|
|
|
+ },
|
|
|
+ () => {
|
|
|
+ this.cost += addNum
|
|
|
+ },
|
|
|
+ )
|
|
|
+ }
|
|
|
+
|
|
|
+ showRechargeChange(rechargeTime: number, curLeftNum: number) {
|
|
|
+ let baseBulletCfg = CastleSkillConfig[Data.user.useCastleSkillID]
|
|
|
+ this.rechargePb.active = rechargeTime > 0
|
|
|
+ if (rechargeTime > 0) ccUtils.setProgress(1 - rechargeTime / baseBulletCfg.rechargeCD, this.rechargePb)
|
|
|
+ this.rechargeNumPb.active = curLeftNum > 0
|
|
|
+ if (curLeftNum > 0) ccUtils.setProgress(curLeftNum / baseBulletCfg.rechargeNum, this.rechargeNumPb)
|
|
|
+ }
|
|
|
+
|
|
|
+ showBossHP(comRole: ComRole) {
|
|
|
+ this.bossHPNode.active = true
|
|
|
+ let maxBars = 6
|
|
|
+ let healthPerBar = Math.floor(comRole.HP / maxBars) // 每管血量
|
|
|
+ let currentBars =
|
|
|
+ comRole.nowHP > healthPerBar * (maxBars - 1) ? maxBars : Math.ceil(comRole.nowHP / healthPerBar)
|
|
|
+ let lastBars =
|
|
|
+ comRole.lastHP > healthPerBar * (maxBars - 1) ? maxBars : Math.ceil(comRole.lastHP / healthPerBar)
|
|
|
+ // 更新标签
|
|
|
+ ccUtils.setLabel(`x${currentBars}`, this.bossHPNode, 'label')
|
|
|
+ let getImageNum = index => {
|
|
|
+ if (index > 0) {
|
|
|
+ return index % 5 ? index % 5 : 5
|
|
|
+ }
|
|
|
+ return 0
|
|
|
+ }
|
|
|
+ if (currentBars != lastBars || comRole.nowHP == comRole.HP) {
|
|
|
+ if (currentBars > 1) {
|
|
|
+ this.loadTexImg(`GameUI/boss_blood_${getImageNum(currentBars - 1)}`, this.bossHPNode, 'bg')
|
|
|
+ } else {
|
|
|
+ ccUtils.setSpriteFrame(null, this.bossHPNode, 'bg')
|
|
|
+ }
|
|
|
+ this.loadTexImg(`GameUI/boss_blood_${getImageNum(currentBars)}`, this.bossHPNode, 'pb/bar')
|
|
|
+ }
|
|
|
+ ccUtils.setProgress(
|
|
|
+ currentBars == maxBars
|
|
|
+ ? (comRole.nowHP - healthPerBar * (maxBars - 1)) / (healthPerBar + (comRole.HP % healthPerBar))
|
|
|
+ : (comRole.nowHP % healthPerBar) / healthPerBar,
|
|
|
+ this.bossHPNode,
|
|
|
+ 'pb',
|
|
|
+ )
|
|
|
+ }
|
|
|
+
|
|
|
+ hideBossHP() {
|
|
|
+ this.bossHPNode.active = false
|
|
|
+ }
|
|
|
+
|
|
|
onClickAdAddCost() {
|
|
|
Mgr.platform.playVideoAD(AD_ID.energy, () => {
|
|
|
this.adCost.active = false
|
|
@@ -1551,42 +1627,6 @@ export default class GameUI extends BaseUI {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- flyCostNode(addNum, startPos: cc.Vec3) {
|
|
|
- let costPool = this.dropPool.get(GOODS.cost)
|
|
|
- if (!costPool) {
|
|
|
- costPool = new cc.NodePool()
|
|
|
- this.dropPool.set(GOODS.cost, costPool)
|
|
|
- }
|
|
|
- let nodes = []
|
|
|
- let costNode = cc.find('cost', this.node)
|
|
|
- for (let i = 0; i < addNum; i++) {
|
|
|
- let node = costPool.get()
|
|
|
- if (!node) node = cc.instantiate(cc.find('icon', costNode))
|
|
|
- node.scale = 1
|
|
|
- nodes.push(node)
|
|
|
- }
|
|
|
- ccUtils.circleFlyNodes(
|
|
|
- nodes,
|
|
|
- this.node,
|
|
|
- startPos,
|
|
|
- costNode.position,
|
|
|
- node => {
|
|
|
- costPool.put(node)
|
|
|
- },
|
|
|
- () => {
|
|
|
- this.cost += addNum
|
|
|
- },
|
|
|
- )
|
|
|
- }
|
|
|
-
|
|
|
- showRechargeChange(rechargeTime: number, curLeftNum: number) {
|
|
|
- let baseBulletCfg = CastleSkillConfig[Data.user.useCastleSkillID]
|
|
|
- this.rechargePb.active = rechargeTime > 0
|
|
|
- if (rechargeTime > 0) ccUtils.setProgress(1 - rechargeTime / baseBulletCfg.rechargeCD, this.rechargePb)
|
|
|
- this.rechargeNumPb.active = curLeftNum > 0
|
|
|
- if (curLeftNum > 0) ccUtils.setProgress(curLeftNum / baseBulletCfg.rechargeNum, this.rechargeNumPb)
|
|
|
- }
|
|
|
-
|
|
|
//触发事件=======================================
|
|
|
@render
|
|
|
showSpeed() {
|