|
@@ -1,4 +1,4 @@
|
|
|
-import { Widget, _decorator, Node, Sprite, Label } from 'cc';
|
|
|
+import { Widget, _decorator, Node, Sprite, Label, SpriteFrame } from 'cc';
|
|
|
import { SkillType } from '../enum/SkillType';
|
|
|
import { SkillMgr } from '../manager/SkillMgr';
|
|
|
import { GameMgr } from '../manager/GameMgr';
|
|
@@ -14,25 +14,55 @@ const { ccclass, property, requireComponent } = _decorator;
|
|
|
@requireComponent(Widget)
|
|
|
export class UIGetSkill extends UIBase {
|
|
|
|
|
|
+ private skill0Bg: Node = null
|
|
|
+ private skill1Bg: Node = null
|
|
|
+ private skill2Bg: Node = null
|
|
|
private icon: Sprite = null
|
|
|
private lbTitle: Label = null
|
|
|
private lbDesc: Label = null
|
|
|
+ private btnGet: Sprite = null
|
|
|
|
|
|
private skill: SkillType = null
|
|
|
|
|
|
protected onLoad(): void {
|
|
|
+ this.skill0Bg = this.findNode('skill0_bg')
|
|
|
+ this.skill1Bg = this.findNode('skill1_bg')
|
|
|
+ this.skill2Bg = this.findNode('skill2_bg')
|
|
|
this.icon = this.findComp('Icon', Sprite)
|
|
|
- this.lbTitle = this.findComp('LbTitle', Label)
|
|
|
- this.lbDesc = this.findComp('LbDesc', Label)
|
|
|
+ this.btnGet = this.findComp('BtnGet', Sprite)
|
|
|
+ // this.lbTitle = this.findComp('LbTitle', Label)
|
|
|
+ // this.lbDesc = this.findComp('LbDesc', Label)
|
|
|
}
|
|
|
|
|
|
public onOpen(data?: unknown): void {
|
|
|
GameMgr.Pause = true
|
|
|
this.skill = data as SkillType
|
|
|
const skillInfo = CfgSkillInfo[this.skill]
|
|
|
- this.lbTitle.string = skillInfo.name
|
|
|
- this.lbDesc.string = skillInfo.desc
|
|
|
- this.icon.spriteFrame = ResMgr.getSpriteFrame(Bundle.Icon, skillInfo.icon)
|
|
|
+ // this.lbTitle.string = skillInfo.name
|
|
|
+ // this.lbDesc.string = skillInfo.desc
|
|
|
+ // this.icon.spriteFrame = ResMgr.getSpriteFrame(Bundle.Icon, skillInfo.icon)
|
|
|
+
|
|
|
+ let currentBg = null;
|
|
|
+ if (this.skill == SkillType.FreezeTime) {
|
|
|
+ this.skill0Bg.active = true
|
|
|
+ this.skill1Bg.active = false
|
|
|
+ this.skill2Bg.active = false
|
|
|
+ currentBg = this.skill0Bg
|
|
|
+ } else if (this.skill == SkillType.EraseGroup) {
|
|
|
+ this.skill0Bg.active = false
|
|
|
+ this.skill1Bg.active = true
|
|
|
+ this.skill2Bg.active = false
|
|
|
+ currentBg = this.skill1Bg
|
|
|
+ } else {
|
|
|
+ this.skill0Bg.active = false
|
|
|
+ this.skill1Bg.active = false
|
|
|
+ this.skill2Bg.active = true
|
|
|
+ currentBg = this.skill2Bg
|
|
|
+ }
|
|
|
+
|
|
|
+ currentBg.getChildByName('LbTitle').getComponent(Label).string = CfgSkillInfo[this.skill].name
|
|
|
+ currentBg.getChildByName('LbDesc').getComponent(Label).string = CfgSkillInfo[this.skill].desc
|
|
|
+ this.btnGet.spriteFrame = ResMgr.getSpriteFrame(Bundle.UI, skillInfo.btnIcon)
|
|
|
}
|
|
|
|
|
|
public onClose(data?: unknown): void {
|