import DataMgr from "../data/DataMgr"; import UIBase from "../fgui/core/UIBase"; import ui_skillItem from "../fgui/res/game/ui_skillItem"; import ui_UISkill from "../fgui/res/game/ui_UISkill"; import { xGame } from "../xGame"; import MoneyNode from "./item/MoneyNode"; import SkillDisplay from "./item/SkillDisplay"; import { UIGame } from "./UIGame"; import UIMain from "./UIMain"; import UIMatching from "./UIMatching"; export default class UISkill extends UIBase { public ui: ui_UISkill; public skillData = []; public moneyNode: MoneyNode; public constructor() { super(); } protected onConstructor(): void { this.ui = ui_UISkill.createInstance(); this.contentPane = this.ui; this.isEject = false; // this.moneyNode = new MoneyNode(this.ui.moneyNode); // this.initSkillData(); console.log('zh:aaaaaa1111111111') this.addUIClick(this.ui.closeNode.closeBtn, this.returnUIMain); this.ui.skillNode.skillList.itemRenderer = Laya.Handler.create(this, this.updateSkillItem, null, false); console.log('zh:aaaaaa22222222') // this.displayList = []; //this.ui.skillNode.skillList.numItems = 4; OLD this.ui.skillNode.skillList.numItems = 3; // this.addUIClick(this.ui, this.interuptSecretary); this.addUIClick(this.ui.guideNode.guideBtn, this.enterGuideLevel); this.ui.talkNode.visible = false; if (Moyu.isKs) this.ui.closeNode.closeBtn.x += 100; } public show(): void { super.show(); this.playSecretaryIdle(); this.moneyNode.ui.c1.selectedIndex = 1; // Laya.timer.clearAll(this); xGame.soundMgr.playSound("s_start"); xGame.common.showGirlTalkPop(13, this.ui.talkNode, this.ui.talkNode.womanTxt); // let guide = DataMgr.getSkillGuide(); this.ui.guideNode.visible = guide == 0; let item = this.getSkillItemByUIIndex(0); if (guide == 0) { item.ui.c1.selectedIndex = 1; } else { item.ui.c1.selectedIndex = 0; } this.ui.guideNode.guideBtn.visible = guide == 0; // for (let index = 0; index < this.displayList.length; index++) { this.displayList[index].checkTry(); } } getSkillItemByUIIndex(cur) { for (let index = 0; index < this.displayList.length; index++) { if (this.displayList[index].index == cur) { return this.displayList[index]; } } } enterGuideLevel() { let item = this.getSkillItemByUIIndex(0); item.startGame(); if (DataMgr.getNewUser()) Moyu.sendDataEvent("gameStart1"); } initSkillData() { // let nameList = ["从天而降", "横扫千军", "冰冻杆法"]; // let iconList = ["gf_jn1", "gf_jn2", "gf_jn4"]; // let describeList = [ // "跳杆击球后,球高高跃起,砸在桌面上,直接打进额外1颗球", // "普通击球后,球杆向随机方向—扫,将杆子范围内1颗可击打球扫入球袋", // "我方击球后,在场地上将随机1颗球冻结,敌方无法击打冰冻球,且其他球碰到冰冻球会弹开" // ]; this.skillData = []; let nameList = xGame.common.skillNameList; let iconList = xGame.common.skillIconList; let describeList = [ "A strike from the sky, like a meteor tearing through the heavens—delivering a thunderous blow! ", "A break shot surging like a raging tide—powerful, explosive, and straight into the pocket!",//击球后球高高跃起召唤神龙,利用神龙之力令额外1颗球移动起来产生撞击 "The power of frost descends—freezing the flow and taking full control of the game!" ]; console.log('zh:initSkillData 111111111') // let data: any; for (let index = 0; index < nameList.length; index++) { data = {}; data.name = nameList[index]; data.icon = iconList[index]; data.describe = describeList[index]; data.index = index; this.skillData.push(data); } } displayList: SkillDisplay[]; private updateSkillItem(index: number, target: ui_skillItem) { if (this.displayList[index] == null) { let uiIndex; switch (index) { case 0: uiIndex = 1; break; case 1: uiIndex = 0; break; case 2: uiIndex = 2; break; case 3: uiIndex = 3; break; default: break; } let temp = new SkillDisplay(target, this.skillData[uiIndex], uiIndex); this.displayList.push(temp); } } playSecretaryIdle() { let parent = this.ui.secretary.displayObject; parent.destroyChildren(); let xx = this.ui.secretary.width / 2 let yy = this.ui.secretary.height; let scale = xGame.common.getSecretaryScale(); let data = { x: xx, y: yy, scaleX: scale, scaleY: scale }; // xGame.common.secretary.play(data, 1, true, parent); xGame.common.secretary.play(data, 0, true, parent); } returnUIMain() { this.hide(); xGame.common.stopGirlPop(this.ui.talkNode) // xGame.uiMgr.Show(UIMain); } interuptSecretary() { Laya.timer.clearAll(this); this.playSecretaryRandomSound(); } //主界面和技能选择界面45-60秒未操作随机播放秘书音效 playSecretaryRandomSound() { if (this.isHide) return; let time = xGame.common.randomNum(45000, 60000); Laya.timer.once(time, this, () => { if (this.isHide) return; let index = xGame.common.randomNum(4, 7); xGame.soundMgr.playSound("s_main0" + index); // let words = 1; switch (index) { case 4: words = 5; break; case 5: words = 3; break; case 6: words = 6; break; case 7: words = 7; break; default: break; } xGame.common.showGirlTalkPop(words, this.ui.talkNode, this.ui.talkNode.womanTxt); // this.playSecretaryRandomSound(); }) } } UISkill.uiName = "UISkill";