import SKUIUtil from "./gear_2.3.4/util/SKUIUtil"; import GameModel from "./core/GameModel"; import FGUtil from "./gear_2.3.4/fgui/FGUtil"; import SkillUtil from "./game/skill/core/SkillUtil"; import SKDataUtil from "./gear_2.3.4/util/SKDataUtil"; import MsgAlert from "./game/msg/MsgAlert"; import FactionTalentData from "./FactionTalentData"; import Bag from "./bag/Bag"; import AudioUtil from "./core/AudioUtil"; import Transformation from "./transformation/Transformation"; import ItemUtil from "./core/ItemUtil"; import FGAlert from "./gear_2.3.4/fgui/FGAlert"; const { ccclass, property } = cc._decorator; @ccclass export default class FactionTalent extends cc.Component { /** * 單例實例 */ public static Instance: FactionTalent = null; factionTalentPanel: fgui.GComponent = null; factionTalentLevelUpPanel: fgui.GComponent = null; fcBagPanel: fgui.GComponent = null; composePanel: fgui.GComponent = null; identifyMorePanel: fgui.GComponent = null; identifyPanel: fgui.GComponent = null; factionTalentList: any = null; factionTalentLevel: number = 0; upLevelNeed: any = {}; selectFuIdx: number = 0; identifyType: number = 0; identifyRes: any = []; identifyShowRes: any = []; usePos: number = 0; fcFuList: any = null; unUsefcFuList: any = null; canUseFuList: any = null; stopTap: boolean = false; moreUnComposeMode: boolean = false; selectedObj: any = {}; prefabObject: any = {}; /** * 當前瀏覽類型 1千鈞 2載物 3禦獸 */ currentType: number = 1; onLoad() { if (FactionTalent.Instance === null) { FactionTalent.Instance = this; this.loadPrefab(); } else { this.destroy(); return; } } /** * 加載預製體 */ loadPrefab() { // 加載所需的預製體 var prefabList = [ { url: "Prefabs/SkillDetail", name: "SkillDetail" }, ] this.prefabObject = {} for (let item of prefabList) { cc.loader.loadRes(item.url, cc.Prefab, (err, prefab) => { if (err) console.warn(err); else { this.prefabObject[item.name] = prefab; } }) } } openFactionTalentPanel() { if (!SKUIUtil.isFGUIValid(this.factionTalentPanel)) { this.factionTalentPanel = FGUtil.create("main_ui", "faction_talent_panel"); FGUtil.root().addChild(this.factionTalentPanel); this.factionTalentPanel.makeFullScreen(); } var mask = FGUtil.getComponent(this.factionTalentPanel, "mask"); var close = FGUtil.getButton(this.factionTalentPanel, "alert/close"); this.pushCloseEvent(mask, this.factionTalentPanel); this.pushCloseEvent(close, this.factionTalentPanel); FGUtil.getButton(this.factionTalentPanel, "alert/n34").onClick(this.switchLeft, this); FGUtil.getButton(this.factionTalentPanel, "alert/n35").onClick(this.switchLeft, this); FGUtil.getButton(this.factionTalentPanel, "alert/n36").onClick(this.switchRight, this); FGUtil.getButton(this.factionTalentPanel, "alert/n37").onClick(this.switchRight, this); FGUtil.getButton(this.factionTalentPanel, "alert/bottom/levelUpBtn").onClick(this.openLevelUpPanel, this); var mainView = FGUtil.getComponent(this.factionTalentPanel, "alert/main"); FGUtil.getTextField(mainView, "floor1/floor").text = "第\n一\n層"; FGUtil.getTextField(mainView, "floor2/floor").text = "第\n二\n層"; FGUtil.getTextField(mainView, "floor3/floor").text = "第\n三\n層"; FGUtil.getTextField(mainView, "floor4/floor").text = "第\n四\n層"; FGUtil.getTextField(mainView, "floor5/floor").text = "第\n五\n層"; FGUtil.getComponent(mainView, "useMask").onClick(this.hideUseView, this) FGUtil.getComponent(mainView, "commonItem").onClick(this.useCommonFu, this) var useList = FGUtil.getList(mainView, "useView/list"); useList.itemRenderer = this.initUseFuItem.bind(this); // 虛擬列表 useList.setVirtual(); GameModel.send("c2s_ofuda_list", { roleid: GameModel.player.roleid }) } useCommonFu() { var list1 = this.getCanUseFu(this.currentType, 1) var list2 = this.getCanUseFu(this.currentType, 2) var list3 = this.getCanUseFu(this.currentType, 3) var list4 = this.getCanUseFu(this.currentType, 4) var list5 = this.getCanUseFu(this.currentType, 5) var list = list1.concat(list2) list = list.concat(list3) list = list.concat(list4) list = list.concat(list5) this.canUseFuList = list; this.usePos = 3; FGUtil.getRichTextField(this.factionTalentPanel, "alert/main/useView/title").text = `可裝備[color=#E86425]任意層[/color]天策符` FGUtil.getControl(this.factionTalentPanel, "alert/main/use").selectedIndex = 1; var useList = FGUtil.getList(this.factionTalentPanel, "alert/main/useView/list"); useList.numItems = this.canUseFuList.length } initUseFuItem(idx, obj: fairygui.GObject) { var item = obj.asCom; var info = this.canUseFuList[idx]; FGUtil.getRichTextField(item, "title").text = `${info.name}[color=#00CC00](+${info.addition})[/color]`; var skill = SkillUtil.getSkill(info.skillid) FGUtil.getLoader(item, "icon").url = `ui://main_ui/${skill.icon}` item.node["ofudaid"] = info.ofudaid; item.onClick(this.useFuById, this) } useFuById(e: Event) { if (!SKDataUtil.hasProperty(e.target, "ofudaid")) return GameModel.send("c2s_use_ofuda", { roleid: GameModel.player.roleid, usestate: this.usePos, // 正在使用的天策符 沒有 為0 ofudaid: e.target["ofudaid"] }) this.hideUseView() } initWithType(type: number = 1, refreshUse: boolean = false) { if (!SKUIUtil.isFGUIValid(this.factionTalentPanel)) return; var iconPathArr = ["qianjun", "zaiwu", "yushou"]; // 圖標初始化 if (type == 1) { FGUtil.getLoader(this.factionTalentPanel, "alert/main/title").url = `ui://main_ui/title_tianfu_${iconPathArr[0]}` FGUtil.getLoader(this.factionTalentPanel, "alert/n35/icon").url = `ui://main_ui/icon_tianfu_${iconPathArr[2]}` FGUtil.getLoader(this.factionTalentPanel, "alert/n36/icon").url = `ui://main_ui/icon_tianfu_${iconPathArr[1]}` } else if (type == 2) { FGUtil.getLoader(this.factionTalentPanel, "alert/main/title").url = `ui://main_ui/title_tianfu_${iconPathArr[1]}` FGUtil.getLoader(this.factionTalentPanel, "alert/n35/icon").url = `ui://main_ui/icon_tianfu_${iconPathArr[0]}` FGUtil.getLoader(this.factionTalentPanel, "alert/n36/icon").url = `ui://main_ui/icon_tianfu_${iconPathArr[2]}` } else if (type == 3) { FGUtil.getLoader(this.factionTalentPanel, "alert/main/title").url = `ui://main_ui/title_tianfu_${iconPathArr[2]}` FGUtil.getLoader(this.factionTalentPanel, "alert/n35/icon").url = `ui://main_ui/icon_tianfu_${iconPathArr[1]}` FGUtil.getLoader(this.factionTalentPanel, "alert/n36/icon").url = `ui://main_ui/icon_tianfu_${iconPathArr[0]}` } var tempList = []; for (let i in this.factionTalentList) { if (this.factionTalentList[i].oftype == type) tempList.push(this.factionTalentList[i]); } var mainView = FGUtil.getComponent(this.factionTalentPanel, "alert/main"); FGUtil.getTextField(this.factionTalentPanel, "alert/bottom/addEff").text = `${(this.factionTalentLevel / 5).toFixed(1)}%`; FGUtil.getTextField(this.factionTalentPanel, "alert/bottom/level").text = this.factionTalentLevel.toString(); var floorArr = [ null, FGUtil.getComponent(mainView, "floor1"), FGUtil.getComponent(mainView, "floor2"), FGUtil.getComponent(mainView, "floor3"), FGUtil.getComponent(mainView, "floor4"), FGUtil.getComponent(mainView, "floor5") ] // 隱藏第五層的最後一個項目 FGUtil.getControl(floorArr[5], "floor5").selectedIndex = 1; for (let n = 1; n < 6; n++) { // 清空技能列表 FGUtil.getList(floorArr[n], "list").removeChildrenToPool(); // 開啟及使用狀態 var openLevel = FactionTalentData.openLevel[type - 1]; for (let m = 0; m < openLevel[n - 1].length; m++) { var item = FGUtil.getComponent(floorArr[n], `item${m + 1}`); item.node["type"] = type - 1; item.node["floor"] = n - 1; item.node["idx"] = m + 1; item.onClick(this.addFu, this); if (this.factionTalentLevel < openLevel[n - 1][m]) { // 未開啟 FGUtil.getControl(item, `use`).selectedIndex = 0; FGUtil.getControl(item, `open`).selectedIndex = 0; item.asButton.title = `${openLevel[n - 1][m]}級\n開啟`; item.clearClick(); } else if (this.factionTalentLevel >= openLevel[n - 1][m]) { // 開啟未使用 FGUtil.getControl(item, `open`).selectedIndex = 1; FGUtil.getControl(item, `use`).selectedIndex = 0; item.asButton.title = `${openLevel[n - 1][m]}級\n新開啟` } } } // 添加技能 var floor; var list: fairygui.GList; for (let i in tempList) { // 跳過未定義 // if (tempList[i].skillid == 10088 || tempList[i].skillid == 10166) continue floor = floorArr[tempList[i].tier]; list = FGUtil.getList(floor, "list") var item = list.addItemFromPool().asCom; FGUtil.getLoader(item, "icon").url = `ui://main_ui/${SkillUtil.getSkill(tempList[i].skillid).icon}`; // FGUtil.getControl(item, "active").selectedIndex = 0; item.node["skillId"] = tempList[i].skillid; item.clearClick(); item.onClick(this.showInfo, this); } if (!this.fcFuList) { //沒有數據則請求 GameModel.send("c2s_own_ofuda", { roleid: GameModel.player.roleid }) } else if (refreshUse) { this.initUsedFu() } } initUsedFu() { if (!SKUIUtil.isFGUIValid(this.factionTalentPanel)) return; var mainView = FGUtil.getComponent(this.factionTalentPanel, "alert/main"); var floorArr = [ null, FGUtil.getComponent(mainView, "floor1"), FGUtil.getComponent(mainView, "floor2"), FGUtil.getComponent(mainView, "floor3"), FGUtil.getComponent(mainView, "floor4"), FGUtil.getComponent(mainView, "floor5") ] var activeList = {}; for (let n = 1; n < 6; n++) { // 開啟及使用狀態 var openLevel = FactionTalentData.openLevel[this.currentType - 1]; for (let m = 0; m < openLevel[n - 1].length; m++) { if (this.factionTalentLevel >= openLevel[n - 1][m]) { // 開啟 var useIdx = this.getUsedFu(this.currentType, n, m + 1) if (useIdx >= 0) { var item = FGUtil.getComponent(floorArr[n], `item${m + 1}`); FGUtil.getControl(item, `open`).selectedIndex = 1; FGUtil.getControl(item, `use`).selectedIndex = 1; var useInfo = this.fcFuList[useIdx] var skill = SkillUtil.getSkill(useInfo.skillid) FGUtil.getLoader(item, `icon`).url = `ui://main_ui/${skill.icon}`; var floor = floorArr[n]; var list = FGUtil.getList(floor, "list") for (let j = 0; j < list.numChildren; j++) { var baseSkillId = list.getChildAt(j).node["skillId"]; if (useInfo.skillid == baseSkillId || useInfo.skillid == baseSkillId + 1 || useInfo.skillid == baseSkillId + 2) { if (!activeList[`${n}`]) activeList[`${n}`] = {} activeList[`${n}`][`${j}`] = true; // FGUtil.getControl(list.getChildAt(j).asCom, "active").selectedIndex = 1; FGUtil.getTextField(list.getChildAt(j).asCom, "level").text = "+" + useInfo.addition } } } } } } // 通用符 var useCommonIdx = this.getCommonUsedFu(this.currentType); var commonFuSkillId = 0; if (useCommonIdx >= 0) { var item = FGUtil.getComponent(mainView, "commonItem"); var useCommonInfo = this.fcFuList[useCommonIdx] var skill = SkillUtil.getSkill(useCommonInfo.skillid) commonFuSkillId = useCommonInfo.skillid; FGUtil.getLoader(item, "icon").url = `ui://main_ui/${skill.icon}` FGUtil.getControl(item, `use`).selectedIndex = 1; for (let n = 1; n < 6; n++) { var floor = floorArr[n]; var list = FGUtil.getList(floor, "list") for (let j = 0; j < list.numChildren; j++) { var baseSkillId = list.getChildAt(j).node["skillId"]; if (commonFuSkillId == baseSkillId || commonFuSkillId == baseSkillId + 1 || commonFuSkillId == baseSkillId + 2) { // FGUtil.getControl(list.getChildAt(j).asCom, "active").selectedIndex = 1; if (!activeList[`${n}`]) activeList[`${n}`] = {} activeList[`${n}`][`${j}`] = true; FGUtil.getTextField(list.getChildAt(j).asCom, "level").text = "+" + useCommonInfo.addition; break; } } } } else { var item = FGUtil.getComponent(mainView, "commonItem"); FGUtil.getControl(item, `use`).selectedIndex = 0; } for (let n = 1; n < 6; n++) { var floor = floorArr[n]; var list = FGUtil.getList(floor, "list") for (let j = 0; j < list.numChildren; j++) { if (activeList[`${n}`]) { if (activeList[`${n}`][`${j}`]) { FGUtil.getControl(list.getChildAt(j).asCom, "active").selectedIndex = 1; } else { FGUtil.getControl(list.getChildAt(j).asCom, "active").selectedIndex = 0; } } else { FGUtil.getControl(list.getChildAt(j).asCom, "active").selectedIndex = 0; } } } } addFu(e: Event) { if (!e) return if (!SKDataUtil.hasProperty(e.target, "type")) return; if (!SKDataUtil.hasProperty(e.target, "floor")) return; if (!SKDataUtil.hasProperty(e.target, "idx")) return; if (!SKUIUtil.isFGUIValid(this.factionTalentPanel)) return; var type = e.target["type"]; var floor = e.target["floor"]; var idx = e.target["idx"]; this.usePos = idx var list = this.getCanUseFu(type + 1, floor + 1) this.canUseFuList = list; var floorWord = ["一", "二", "三", "四", "五"] FGUtil.getRichTextField(this.factionTalentPanel, "alert/main/useView/title").text = `可裝備[color=#E86425]第${floorWord[floor]}層[/color]天策符` FGUtil.getControl(this.factionTalentPanel, "alert/main/use").selectedIndex = 1; var useList = FGUtil.getList(this.factionTalentPanel, "alert/main/useView/list"); useList.numItems = this.canUseFuList.length } hideUseView() { if (!SKUIUtil.isFGUIValid(this.factionTalentPanel)) return; FGUtil.getControl(this.factionTalentPanel, "alert/main/use").selectedIndex = 0; } getCanUseFu(type, floor) { var list = []; for (let i = 0; i < this.fcFuList.length; i++) { if (this.fcFuList[i].oftype == type) { if (this.fcFuList[i].tier == floor) { if (this.fcFuList[i].usestate == 0) list.push(this.fcFuList[i]) } } } list.sort((a, b) => { return b.addition - a.addition; }) return list; } getUsedFu(type, floor, idx): number { for (let i = 0; i < this.fcFuList.length; i++) { if (this.fcFuList[i].oftype == type) { if (this.fcFuList[i].tier == floor) { if (this.fcFuList[i].usestate == idx) return i; } } } return -1; } getIsUsed(skill): any { for (let i = 0; i < this.fcFuList.length; i++) { if (this.fcFuList[i].skillid >= skill && this.fcFuList[i].skillid <= skill + 3 && this.fcFuList[i].usestate != 0) { return this.fcFuList[i]; } } return null; } getCommonUsedFu(type): number { for (let i = 0; i < this.fcFuList.length; i++) { if (this.fcFuList[i].oftype == type) if (this.fcFuList[i].usestate == 3) return i; } return -1; } switchRight() { if (!SKUIUtil.isFGUIValid(this.factionTalentPanel)) return; var item = FGUtil.getComponent(this.factionTalentPanel, "alert"); if (!item) return; var right: fgui.Transition = item.getTransition("right"); right.play(); this.currentType++; if (this.currentType == 4) this.currentType = 1; this.initWithType(this.currentType, true); } switchLeft() { if (!SKUIUtil.isFGUIValid(this.factionTalentPanel)) return; var item = FGUtil.getComponent(this.factionTalentPanel, "alert"); if (!item) return; var left: fgui.Transition = item.getTransition("left"); left.play(); this.currentType--; if (this.currentType == 0) this.currentType = 3; this.initWithType(this.currentType, true); } openLevelUpPanel() { if (GameModel.player.bangid == 0) { MsgAlert.addMsg("請先加入幫派"); return } if (!SKUIUtil.isFGUIValid(this.factionTalentLevelUpPanel)) { this.factionTalentLevelUpPanel = FGUtil.create("main_ui", "faction_talent_up_panel"); FGUtil.root().addChild(this.factionTalentLevelUpPanel); this.factionTalentLevelUpPanel.makeFullScreen(); } var mask = FGUtil.getComponent(this.factionTalentLevelUpPanel, "mask"); var close = FGUtil.getButton(this.factionTalentLevelUpPanel, "alert/close"); this.pushCloseEvent(mask, this.factionTalentLevelUpPanel); this.pushCloseEvent(close, this.factionTalentLevelUpPanel); FGUtil.getTextField(this.factionTalentLevelUpPanel, "alert/n58/title").fontSize = 20; FGUtil.getTextField(this.factionTalentLevelUpPanel, "alert/n58/title").text = `Lv.${this.factionTalentLevel}/Lv.150`; FGUtil.getButton(this.factionTalentLevelUpPanel, "alert/n40").onClick(this.upFactionTalentLevel, this); FGUtil.getButton(this.factionTalentLevelUpPanel, "alert/add").onClick(this.addSliderValueLevelUp, this); FGUtil.getButton(this.factionTalentLevelUpPanel, "alert/reduce").onClick(this.reduceSliderValueLevelUp, this); var slider = FGUtil.getComponent(this.factionTalentLevelUpPanel, "alert/slider").asSlider; if (this.factionTalentLevel >= 150) FGUtil.getControl(this.factionTalentLevelUpPanel, "alert/max").selectedIndex = 1 else FGUtil.getControl(this.factionTalentLevelUpPanel, "alert/max").selectedIndex = 0 // 設置滑動條的最大值和默認值 slider.max = 150 - this.factionTalentLevel; if (slider.max >= 1) slider.value = 1; else slider.value = 0; slider.on(fgui.Event.STATUS_CHANGED, this.onSliderChangedLevelUp, this); FGUtil.getTextField(this.factionTalentLevelUpPanel, "alert/num").text = `1`; // 等級進度條 var levelBar = FGUtil.getProgressBar(this.factionTalentLevelUpPanel, "alert/n58"); levelBar.max = 150; levelBar.value = this.factionTalentLevel; GameModel.send("c2s_open_levelup", { roleid: GameModel.player.roleid }) // 恢復可以發送請求 this.stopTap = false } recoverOnce() { if (!SKUIUtil.isFGUIValid(this.factionTalentLevelUpPanel)) return; if (this.factionTalentLevel < 150) { FGUtil.getTextField(this.factionTalentLevelUpPanel, "alert/num").text = `1次`; var slider = FGUtil.getComponent(this.factionTalentLevelUpPanel, "alert/slider").asSlider; slider.max = 150 - this.factionTalentLevel slider.value = 1 FGUtil.getControl(this.factionTalentLevelUpPanel, "alert/max").selectedIndex = 0 } else { FGUtil.getControl(this.factionTalentLevelUpPanel, "alert/max").selectedIndex = 1 FGUtil.getTextField(this.factionTalentLevelUpPanel, "alert/num").text = `0次`; var slider = FGUtil.getComponent(this.factionTalentLevelUpPanel, "alert/slider").asSlider; slider.max = 150 - this.factionTalentLevel slider.value = 0 } } refreshLevelUpPanel() { if (!SKUIUtil.isFGUIValid(this.factionTalentLevelUpPanel)) return; var levelBar = FGUtil.getProgressBar(this.factionTalentLevelUpPanel, "alert/n58"); levelBar.value = this.factionTalentLevel; FGUtil.getTextField(this.factionTalentLevelUpPanel, "alert/n58/title").text = `Lv.${this.factionTalentLevel}/Lv.150`; FGUtil.getTextField(this.factionTalentLevelUpPanel, "alert/yy").text = `${GameModel.player.gameData.bangscore}`; FGUtil.getTextField(this.factionTalentLevelUpPanel, "alert/yyxy").text = `${GameModel.player.gameData.jade}`; var need = this.getNeedMoney(); this.upLevelNeed = need; FGUtil.getTextField(this.factionTalentLevelUpPanel, "alert/xh").text = `${need.silver}`; FGUtil.getTextField(this.factionTalentLevelUpPanel, "alert/xhxy").text = `${need.jade}`; this.stopTap = false } getNeedMoney() { var slider = FGUtil.getComponent(this.factionTalentLevelUpPanel, "alert/slider").asSlider; var max = slider.value + this.factionTalentLevel; var jade = 0, silver = 0; for (let i = this.factionTalentLevel; i < max; i++) { jade += 1000 + i * 1888 + 2357; silver += 888 + i * 1688 + 123; } return { jade: jade, silver: silver }; } /** * 滑動改變升級次數 */ onSliderChangedLevelUp(e) { var value = e._value; FGUtil.getTextField(this.factionTalentLevelUpPanel, "alert/num").text = `${value}次`; this.refreshLevelUpPanel(); } /** * 減少升級等級數 */ reduceSliderValueLevelUp() { if (SKUIUtil.isFGUIValid(this.factionTalentLevelUpPanel)) { var slider = FGUtil.getComponent(this.factionTalentLevelUpPanel, "alert/slider").asSlider; if (slider.value > 0) { slider.value--; FGUtil.getTextField(this.factionTalentLevelUpPanel, "alert/num").text = `${slider.value}次`; this.refreshLevelUpPanel(); } } } /** * 增加升級等級數 */ addSliderValueLevelUp() { if (SKUIUtil.isFGUIValid(this.factionTalentLevelUpPanel)) { var slider = FGUtil.getComponent(this.factionTalentLevelUpPanel, "alert/slider").asSlider; if (slider.value < slider.max) { slider.value++; FGUtil.getTextField(this.factionTalentLevelUpPanel, "alert/num").text = `${slider.value}次`; this.refreshLevelUpPanel(); } } } upFactionTalentLevel() { if (this.factionTalentLevel >= 150) { MsgAlert.addMsg("已經升到滿級"); return; } if (!SKUIUtil.isFGUIValid(this.factionTalentLevelUpPanel)) return var slider = FGUtil.getComponent(this.factionTalentLevelUpPanel, "alert/slider").asSlider; if (slider.value <= 0) { MsgAlert.addMsg("請提升大於0的次數"); return; } if (!this.upLevelNeed.silver || !this.upLevelNeed.jade) { MsgAlert.addMsg("數據錯誤"); return } if (this.stopTap) { MsgAlert.addMsg("您點擊太快了"); return; } this.stopTap = true; GameModel.send("c2s_ofuda_levelup", { roleid: GameModel.player.roleid, jade: this.upLevelNeed.jade, score: this.upLevelNeed.silver, level: slider.value }) this.upLevelNeed.silver = 0; this.upLevelNeed.jade = 0; this.scheduleOnce(() => { this.stopTap = false }, 0.3); } /** * 打開天演符面板 */ openFcBagPanel() { if (!SKUIUtil.isFGUIValid(this.fcBagPanel)) { this.fcBagPanel = FGUtil.create("main_ui", "faction_talent_bag_panel"); FGUtil.root().addChild(this.fcBagPanel); this.fcBagPanel.makeFullScreen(); FGUtil.getControl(this.fcBagPanel, "alert/page").selectedIndex = 2; } var mask = FGUtil.getComponent(this.fcBagPanel, "mask"); var close = FGUtil.getButton(this.fcBagPanel, "alert/close"); this.pushCloseEvent(mask, this.fcBagPanel, () => { Transformation.Instance.closeTransPanel(); Bag.Instance.closeBagPanel(); }); this.pushCloseEvent(close, this.fcBagPanel, () => { Transformation.Instance.closeTransPanel(); Bag.Instance.closeBagPanel(); }); // 變身卡按鈕 FGUtil.getButton(this.fcBagPanel, "alert/n56").onClick(this.openTransCardPanel, this); // 背包按鈕 FGUtil.getButton(this.fcBagPanel, "alert/n57").onClick(this.openBagPanel, this); // 先都不顯示 FGUtil.getControl(this.fcBagPanel, "alert/noCard").selectedIndex = 2; // 打開天演策 FGUtil.getButton(this.fcBagPanel, "alert/tianyan").onClick(this.openFactionPanleByBag, this); // 打開合成 FGUtil.getButton(this.fcBagPanel, "alert/compose").onClick(this.openComposePanel, this); // 鑑定 FGUtil.getButton(this.fcBagPanel, "alert/jianding").onClick(this.doIdentifyOnce, this); // 批量鑑定 FGUtil.getButton(this.fcBagPanel, "alert/jiandingMore").onClick(this.openIdentifyMorePanel, this); // 分解 FGUtil.getButton(this.fcBagPanel, "alert/decompose").onClick(this.decomposeFu, this); // 開啟批量分解 FGUtil.getButton(this.fcBagPanel, "alert/decomposeMore").onClick(this.openDecomposeFuMore, this); // 關閉批量分解 FGUtil.getButton(this.fcBagPanel, "alert/closeMoreMode").onClick(this.closeDecomposeFuMore, this); // 執行批量分解 FGUtil.getButton(this.fcBagPanel, "alert/doMoreDecompose").onClick(this.decomposeFuMore, this); // 使用 FGUtil.getButton(this.fcBagPanel, "alert/useBtn").onClick(this.useFu, this); // // 卸下 // FGUtil.getButton(this.fcBagPanel, "alert/useBtn").onClick(this.unUseFu, this); // 顯示排序 FGUtil.getComponent(this.fcBagPanel, "alert/sort_switch_btn").onClick(this.showSortView, this); GameModel.send("c2s_own_ofuda", { roleid: GameModel.player.roleid }) // 設置物品列表初始化方法 var FuList = FGUtil.getList(this.fcBagPanel, "alert/fu_list"); FuList.itemRenderer = this.initFuItem.bind(this); // 虛擬列表 FuList.setVirtual(); } /** * 使用天演符 */ useFu() { if (this.unUsefcFuList.length <= 0) return; if (this.selectFuIdx < 0 || this.selectFuIdx >= this.unUsefcFuList.length) return; var info = this.unUsefcFuList[this.selectFuIdx]; var typeInfo = FactionTalentData.openLevel[info.oftype - 1] if (typeInfo && info.tier != null) { var level = typeInfo[info.tier - 1][0]; if (level >= this.factionTalentLevel) { MsgAlert.addMsg("天演策等級不夠") return; } } else { MsgAlert.addMsg("天演符信息錯誤") return; } GameModel.send("c2s_use_ofuda", { roleid: GameModel.player.roleid, usestate: 1, // 正在使用的天策符 沒有 為0 ofudaid: this.unUsefcFuList[this.selectFuIdx].ofudaid }) } unUseFu() { if (this.unUsefcFuList.length <= 0) return; if (this.selectFuIdx < 0 || this.selectFuIdx >= this.unUsefcFuList.length) return; GameModel.send("c2s_use_ofuda", { roleid: GameModel.player.roleid, usestate: 1, // 正在使用的天策符 沒有 為0 ofudaid: 0 }) } decomposeFu() { if (this.unUsefcFuList.length <= 0) return; if (this.selectFuIdx < 0 || this.selectFuIdx >= this.unUsefcFuList.length) return; FGAlert.show("確定分解該天策符麼?", () => { FGAlert.hide(); }, () => { GameModel.send("c2s_resolve_ofuda", { roleid: GameModel.player.roleid, ofudaid: this.unUsefcFuList[this.selectFuIdx].ofudaid }) FGAlert.hide(); }) } openDecomposeFuMore() { if (this.unUsefcFuList.length <= 0) return; this.moreUnComposeMode = true; this.selectedObj = {}; if (!SKUIUtil.isFGUIValid(this.fcBagPanel)) return; FGUtil.getList(this.fcBagPanel, "alert/fu_list").refreshVirtualList(); FGUtil.getControl(this.fcBagPanel, "alert/type").selectedIndex = 4; } closeDecomposeFuMore() { if (this.unUsefcFuList.length <= 0) return; this.moreUnComposeMode = false; this.selectedObj = {}; if (!SKUIUtil.isFGUIValid(this.fcBagPanel)) return; FGUtil.getList(this.fcBagPanel, "alert/fu_list").refreshVirtualList(); this.clickFuItem(null, 0) } decomposeFuMore() { if (Object.keys(this.selectedObj).length <= 0) { MsgAlert.addMsg("請選擇需要分解的天策符"); return; } FGAlert.show("確定分解這些天策符麼?", () => { FGAlert.hide(); }, () => { var list = [] for (let key in this.selectedObj) { list.push(this.selectedObj[key].ofudaid) } GameModel.send("c2s_batchResolve_ofuda", { roleid: GameModel.player.roleid, ofudalist: JSON.stringify(list) }) FGAlert.hide(); this.closeDecomposeFuMore() }) } /** * 打開排序面板 */ showSortView() { if (this.fcBagPanel && this.fcBagPanel.node) { var view = FGUtil.getComponent(this.fcBagPanel, "alert/sort"); var mask = FGUtil.getComponent(view, "mask"); mask.onClick(this.hideSortView, this); var list = FGUtil.getList(view, "sort_list"); for (let i = 0; i < list.numChildren; i++) { list.getChildAt(i).data = i; } list.on(fgui.Event.CLICK_ITEM, this.onClickTypeItem, this); FGUtil.getControl(this.fcBagPanel, "alert/showSortView").selectedIndex = 1; } } /** * 關閉排序面板 */ hideSortView() { if (this.fcBagPanel && this.fcBagPanel.node) { FGUtil.getControl(this.fcBagPanel, "alert/showSortView").selectedIndex = 0; } } /** * 點擊變身卡分類子按鈕 */ onClickTypeItem(item: fgui.GObject) { var list = FGUtil.getList(this.fcBagPanel, "alert/sort/sort_list"); for (let i = 0; i < 4; i++) { list.getChildAt(i).asCom.getController("selected").selectedIndex = i == item.data ? 1 : 0; } this.sortFu(item.data); this.hideSortView(); } /** * 打開合成符面板 */ openComposePanel() { this.closeFCBagPanel(); Transformation.Instance.closeTransPanel(); Bag.Instance.closeBagPanel(); this.openComposeFcFuPanel(ItemUtil.getBagItemCount(100320), true); } /** * 關閉背包並打開天演策 */ openFactionPanleByBag() { if (GameModel.player.bangid == 0) { MsgAlert.addMsg("請先加入幫派"); return } this.closeFCBagPanel(); Transformation.Instance.closeTransPanel(); Bag.Instance.closeBagPanel(); this.openFactionTalentPanel(); } /** * 初始化符 */ initFuItem(idx, obj: fairygui.GObject) { var item = obj.asCom; var info = this.unUsefcFuList[idx]; var iconArr = [ ["1003200", "100321", "100322", "100323"], ["", "100324", "100325", "100326"], ["", "100327", "100328", "100329"], ["", "100331", "100332", "100333"], ] FGUtil.getLoader(item, "icon").url = `ui://main_ui/${iconArr[info.oftype][info.grade]}`; FGUtil.getTextField(item, "name").text = info.name; item.node["idx"] = idx; var check = FGUtil.getButton(item, "check"); check.node["idx"] = idx; check.onClick(this.clickFuCheck, this) // 是否選中 FGUtil.getControl(item, "selected").selectedIndex = this.selectFuIdx == idx ? 1 : 0; if (this.moreUnComposeMode && info.oftype > 0) { // 是否批量模式 FGUtil.getControl(item, "checkMode").selectedIndex = 1; // 是否批量模式并选中 if (this.selectedObj[`${idx}`]) { FGUtil.getControl(item, "check/selected").selectedIndex = 1; } else FGUtil.getControl(item, "check/selected").selectedIndex = 0; } else { FGUtil.getControl(item, "checkMode").selectedIndex = 0; } if (info.oftype == 0) { // 天策符碎片和未鑑定 if (SKDataUtil.hasProperty(info, "number") && info.number > 0) { FGUtil.getTextField(item, "num").text = info.number; } } else { // 天策符 FGUtil.getTextField(item, "num").text = `+${info.addition}`; } item.onClick(this.clickFuItem, this); } clickFuCheck(e: Event, idx: number = 0) { e.stopPropagation() var id = idx; if (e && e.target && SKDataUtil.hasProperty(e.target, "idx")) id = e.target["idx"]; var info = this.unUsefcFuList[id]; if (this.moreUnComposeMode) { // 多選模式 if (this.selectedObj[`${id}`]) { delete this.selectedObj[`${id}`] } else { if (Object.keys(this.selectedObj).length >= 10) { MsgAlert.addMsg("最多可以選擇10個") return; } this.selectedObj[`${id}`] = info; } FGUtil.getList(this.fcBagPanel, "alert/fu_list").refreshVirtualList(); } } /** * 點擊天策符,顯示信息和操作 * @param e * @param idx */ clickFuItem(e: Event, idx: number = 0) { var id = idx; if (e && e.target && SKDataUtil.hasProperty(e.target, "idx")) id = e.target["idx"]; this.selectFuIdx = id; var info = this.unUsefcFuList[id]; var infoBox = FGUtil.getComponent(this.fcBagPanel, "alert/info"); FGUtil.getTextField(infoBox, "name").text = info.name; var iconArr = [ ["1003200", "100321", "100322", "100323"], ["", "100324", "100325", "100326"], ["", "100327", "100328", "100329"], ["", "100331", "100332", "100333"], ] var colorArr = ["", "#60d566", "#5fd5d6", "#b94bd1"] // 天策符碎片和未鑑定的符 if (info.oftype == 0) { FGUtil.getTextField(infoBox, "type").text = "物品"; FGUtil.getLoader(infoBox, "icon").url = `ui://main_ui/${iconArr[info.oftype][info.grade]}`; FGUtil.getRichTextField(infoBox, "des/skillDes").text = ""; FGUtil.getLoader(infoBox, "des/skillIcon").texture = null; var itemData = ItemUtil.getItemData(info.itemid); FGUtil.getRichTextField(infoBox, "des/fuDes").text = `${itemData.description}\n[color=#00CC00]數量*${info.number}[/color]`; } else { var typeWordArr = ["", "千鈞符", "載物符", "禦獸符"]; var gradeWordArr = ["", "把玩", "珍藏", "無價"]; FGUtil.getTextField(infoBox, "type").text = "天策符"; FGUtil.getLoader(infoBox, "icon").url = `ui://main_ui/${iconArr[info.oftype][info.grade]}`; FGUtil.getRichTextField(infoBox, "des/fuDes").text = `描述\n【類型】${typeWordArr[info.oftype]}\n【品階】[color=${colorArr[info.grade]}]${gradeWordArr[info.grade]}[/color]\n【技能】`; var skillData = SkillUtil.getSkill(info.skillid); if (skillData) { FGUtil.getLoader(infoBox, "des/skillIcon").url = `ui://main_ui/${skillData.icon}`; FGUtil.getRichTextField(infoBox, "des/skillDes").text = `[color=#00CC00]${skillData.name}(+${info.addition})[/color]${skillData.effectDesc}`; } } // 操作 if (this.moreUnComposeMode) { FGUtil.getControl(this.fcBagPanel, "alert/type").selectedIndex = 4; } else { if (info.oftype == 0) { if (info.grade == 0) { // 碎片 FGUtil.getControl(this.fcBagPanel, "alert/type").selectedIndex = 1; } else // 未鑑定 FGUtil.getControl(this.fcBagPanel, "alert/type").selectedIndex = 2; } else { // 天策符 if (info.usestate == 0) FGUtil.getControl(this.fcBagPanel, "alert/type").selectedIndex = 0; else if (info.usestate == 1) FGUtil.getControl(this.fcBagPanel, "alert/type").selectedIndex = 3; } } FGUtil.getList(this.fcBagPanel, "alert/fu_list").refreshVirtualList(); } /** * 刷新符面板 * @returns */ refreshFcBagPanel() { if (!SKUIUtil.isFGUIValid(this.fcBagPanel)) return; this.unUsefcFuList = []; for (let i in this.fcFuList) { if (this.fcFuList[i].usestate == 0 || this.fcFuList[i].oftype == 0) this.unUsefcFuList.push(this.fcFuList[i]) } if (this.unUsefcFuList.length == 0) { FGUtil.getControl(this.fcBagPanel, "alert/noCard").selectedIndex = 1; return; } this.sortFu() FGUtil.getControl(this.fcBagPanel, "alert/noCard").selectedIndex = 0; FGUtil.getList(this.fcBagPanel, "alert/fu_list").numItems = this.unUsefcFuList.length; this.clickFuItem(null, 0) } sortFu(type: number = 0) { this.unUsefcFuList.sort((a, b) => { if (a.oftype == 0 && b.oftype == 0) return 0; if (a.oftype == 0 && b.oftype != 0) return -1; if (a.oftype != 0 && b.oftype == 0) return 1; if (type == 0) { return b.addition - a.addition } // 符分類優先 if (a.oftype == type && b.oftype != type) { return -1 } if (a.oftype == type && b.oftype == type) { return 0 } }) var sortArr = ["按技能排序", "千鈞符優先", "載物符優先", "禦獸符優先"] FGUtil.getButton(this.fcBagPanel, "alert/sort_switch_btn").title = sortArr[type]; FGUtil.getList(this.fcBagPanel, "alert/fu_list").refreshVirtualList(); this.clickFuItem(null, 0) } /** * 隱藏天演符面板 * @returns */ hideFcBagPanel() { if (!SKUIUtil.isFGUIValid(this.fcBagPanel)) return; this.fcBagPanel.visible = false; } /** * 打開背包 */ openBagPanel() { AudioUtil.playFenyeAudio(); Bag.Instance.openBagPanelByTrans(); this.hideFcBagPanel(); } /** * 打開變身卡 */ openTransCardPanel() { AudioUtil.playFenyeAudio(); Transformation.Instance.openTransPanelByBag(); this.hideFcBagPanel(); } /** * 背包/天演界面打開變身卡 */ openFcBagByOther() { if (SKUIUtil.isFGUIValid(this.fcBagPanel)) { this.fcBagPanel.visible = true; FGUtil.getControl(this.fcBagPanel, "alert/page").selectedIndex = 2; return; } this.openFcBagPanel(); } /** * 打開合成天演符面板 */ openComposeFcFuPanel(count: number, flag: boolean = false) { if (!SKUIUtil.isFGUIValid(this.composePanel)) { this.composePanel = FGUtil.create("main_ui", "faction_compose_panel"); FGUtil.root().addChild(this.composePanel); this.composePanel.makeFullScreen(); } // 關閉按鈕 let mask = FGUtil.getButton(this.composePanel, "mask") let closeBtn = FGUtil.getComponent(this.composePanel, "alert/close") if (!flag) { this.pushCloseEvent(closeBtn, this.composePanel); this.pushCloseEvent(mask, this.composePanel); } else { this.pushCloseEvent(closeBtn, this.composePanel, () => { this.openFcBagPanel() }); this.pushCloseEvent(mask, this.composePanel, () => { this.openFcBagPanel() }); } var decomposeBtn = FGUtil.getButton(this.composePanel, "alert/do"); var addBtn = FGUtil.getButton(this.composePanel, "alert/add"); var reduceBtn = FGUtil.getButton(this.composePanel, "alert/reduce"); var slider = FGUtil.getComponent(this.composePanel, "alert/slider").asSlider; // 設置滑動條的最大值和默認值 slider.max = Math.floor(count / 10); slider.max = slider.max > 10 ? 10 : slider.max; slider.value = slider.max; slider.on(fgui.Event.STATUS_CHANGED, this.onSliderChangedCompose, this); FGUtil.getTextField(this.composePanel, "alert/num").text = `數量:${slider.max}張`; reduceBtn.clearClick(); reduceBtn.onClick(this.reduceSliderValueCompose, this); addBtn.clearClick(); addBtn.onClick(this.addSliderValueCompose, this); decomposeBtn.clearClick(); decomposeBtn.onClick(this.composeCard, this); } /** * 滑動改變合成數量 */ onSliderChangedCompose(e) { var value = e._value; FGUtil.getTextField(this.composePanel, "alert/num").text = `數量:${value}張`; } /** * 減少合成數量 */ reduceSliderValueCompose() { if (this.composePanel && this.composePanel.node) { var slider = FGUtil.getComponent(this.composePanel, "alert/slider").asSlider; if (slider.value > 0) { slider.value--; FGUtil.getTextField(this.composePanel, "alert/num").text = `數量:${slider.value}張`; } } } /** * 增加合成數量 */ addSliderValueCompose() { if (this.composePanel && this.composePanel.node) { var slider = FGUtil.getComponent(this.composePanel, "alert/slider").asSlider; if (slider.value < slider.max) { slider.value++; FGUtil.getTextField(this.composePanel, "alert/num").text = `數量:${slider.value}張`; } } } composeCard() { if (this.stopTap) { MsgAlert.addMsg("您點擊太快了"); return; } if (this.composePanel && this.composePanel.node) { var slider = FGUtil.getComponent(this.composePanel, "alert/slider").asSlider; var value = slider.value; if (value == 0) { MsgAlert.addMsg("請合成大於0數量的天演符"); return; } this.stopTap = true; GameModel.send("c2s_compound_ofuda", { roleid: GameModel.player.roleid, itemid: 100320, count: value }) FGUtil.dispose(this.composePanel); this.scheduleOnce(() => { this.stopTap = false }, 0.3); } } /** * 打開鑑定面板 */ openIdentifyPanel() { if (!SKUIUtil.isFGUIValid(this.identifyPanel)) { this.identifyPanel = FGUtil.create("main_ui", "faction_talent_identify_panel"); FGUtil.root().addChild(this.identifyPanel); this.identifyPanel.makeFullScreen(); FGUtil.getComponent(this.identifyPanel, "skip").onClick(this.skipIdenifty, this); FGUtil.getComponent(this.identifyPanel, "res/sure").onClick(this.closeIdenifty, this); var list = FGUtil.getList(this.identifyPanel, "res/list"); list.itemRenderer = this.initIdneiftyFuItem.bind(this); // 虛擬列表 list.setVirtual(); } FGUtil.getControl(this.identifyPanel, "more").selectedIndex = this.identifyRes.length > 1 ? 1 : 0 var iconArr = [ ["1003200", "100321", "100322", "100323"], ["", "100324", "100325", "100326"], ["", "100327", "100328", "100329"], ["", "100331", "100332", "100333"] ] var info = this.identifyRes.pop() var alert = FGUtil.getComponent(this.identifyPanel, "alert") FGUtil.getLoader(alert, "fu/icon").url = `ui://main_ui/${iconArr[info.ofudatype][info.grade]}`; var skillData = SkillUtil.getSkill(info.skillid); if (skillData) {//有可能找不到技能 FGUtil.getLoader(alert, "skill/icon").url = `ui://main_ui/${skillData.icon}`; } FGUtil.getTextField(alert, "grade/title").fontSize = 20; FGUtil.getLoader(alert, "level").url = `ui://main_ui/accessory_level_${info.grade + 1}`; var trans: fgui.Transition = alert.getTransition("load"); trans.play(); let progress: fairygui.GProgressBar = FGUtil.getProgressBar(alert, "grade"); progress.value = 0; this.scheduleOnce(() => { progress.tweenValue(info.addition, 0.25); }, 0.25) this.scheduleOnce(() => { if (this.identifyRes.length > 0) { this.openIdentifyPanel() } else { this.identifyType = 0; this.showIdeniftyResult(); } }, 1.0) } closeIdenifty() { FGUtil.dispose(this.identifyPanel) this.openFcBagPanel(); } skipIdenifty() { this.unscheduleAllCallbacks(); this.showIdeniftyResult(); } showIdeniftyResult() { if (!SKUIUtil.isFGUIValid(this.identifyPanel)) return FGUtil.getControl(this.identifyPanel, "showResult").selectedIndex = 1; var list = FGUtil.getList(this.identifyPanel, "res/list"); list.numItems = this.identifyShowRes.length; } initIdneiftyFuItem(idx, obj: fairygui.GObject) { var item = obj.asCom; var skill = SkillUtil.getSkill(this.identifyShowRes[idx].skillid) FGUtil.getLoader(item, "icon").url = `ui://main_ui/${skill.icon}`; var name = this.identifyShowRes[idx].name; FGUtil.getTextField(item, "name").text = name.substr(0, name.length - 1); FGUtil.getTextField(item, "num").text = `+${this.identifyShowRes[idx].addition}`; } /** * 打開批量鑑定面板 */ openIdentifyMorePanel() { if (!SKUIUtil.isFGUIValid(this.identifyMorePanel)) { this.identifyMorePanel = FGUtil.create("main_ui", "faction_identify_more_panel"); FGUtil.root().addChild(this.identifyMorePanel); this.identifyMorePanel.makeFullScreen(); } // 關閉按鈕 let mask = FGUtil.getButton(this.identifyMorePanel, "mask") let closeBtn = FGUtil.getComponent(this.identifyMorePanel, "alert/close") this.pushCloseEvent(closeBtn, this.identifyMorePanel, () => { this.identifyType = 0; }); this.pushCloseEvent(mask, this.identifyMorePanel, () => { this.identifyType = 0; }); var iconArr = ["", "100321", "100322", "100323"] FGUtil.getLoader(this.identifyMorePanel, "alert/n17/icon").url = `ui://main_ui/${iconArr[this.unUsefcFuList[this.selectFuIdx].grade]}`; this.identifyType = this.unUsefcFuList[this.selectFuIdx].grade; var decomposeBtn = FGUtil.getButton(this.identifyMorePanel, "alert/do"); var addBtn = FGUtil.getButton(this.identifyMorePanel, "alert/add"); var reduceBtn = FGUtil.getButton(this.identifyMorePanel, "alert/reduce"); var slider = FGUtil.getComponent(this.identifyMorePanel, "alert/slider").asSlider; // 設置滑動條的最大值和默認值 var count = ItemUtil.getBagItemCount(parseInt(iconArr[this.unUsefcFuList[this.selectFuIdx].grade])) slider.max = count; slider.max = slider.max > 10 ? 10 : slider.max; slider.min = 1; slider.value = slider.max; slider.on(fgui.Event.STATUS_CHANGED, this.onSliderChangedIdentify, this); FGUtil.getTextField(this.identifyMorePanel, "alert/num").text = `數量:${slider.max}張`; reduceBtn.onClick(this.reduceSliderValueIdentify, this); addBtn.onClick(this.addSliderValueIdentify, this); decomposeBtn.onClick(this.doIdentify, this); } /** * 滑動改變鑑定數量 */ onSliderChangedIdentify(e) { var value = e._value; FGUtil.getTextField(this.identifyMorePanel, "alert/num").text = `數量:${value}張`; } /** * 減少鑑定數量 */ reduceSliderValueIdentify() { if (this.identifyMorePanel && this.identifyMorePanel.node) { var slider = FGUtil.getComponent(this.identifyMorePanel, "alert/slider").asSlider; if (slider.value > 1) { slider.value--; FGUtil.getTextField(this.identifyMorePanel, "alert/num").text = `數量:${slider.value}張`; } } } /** * 增加鑑定數量 */ addSliderValueIdentify() { if (this.identifyMorePanel && this.identifyMorePanel.node) { var slider = FGUtil.getComponent(this.identifyMorePanel, "alert/slider").asSlider; if (slider.value < slider.max) { slider.value++; FGUtil.getTextField(this.identifyMorePanel, "alert/num").text = `數量:${slider.value}張`; } } } /** * 執行批量鑑定 */ doIdentify() { Bag.Instance.closeBagPanel(); Transformation.Instance.closeTransPanel(); this.closeFCBagPanel() var slider = FGUtil.getComponent(this.identifyMorePanel, "alert/slider").asSlider; if (!slider.value) return; GameModel.send("c2s_authenticate_ofuda", { roleid: GameModel.player.roleid, ofudatype: this.identifyType, count: slider.value }) FGUtil.dispose(this.identifyMorePanel) } /** * 鑑定單個符 */ doIdentifyOnce() { this.identifyType = 0; if (this.unUsefcFuList.length <= 0) return; if (this.selectFuIdx < 0 || this.selectFuIdx >= this.unUsefcFuList.length) return; GameModel.send("c2s_authenticate_ofuda", { roleid: GameModel.player.roleid, ofudatype: this.unUsefcFuList[this.selectFuIdx].grade, count: 1 }) } /** * 添加關閉事件 */ pushCloseEvent(item: fairygui.GComponent, target: fairygui.GComponent, call: Function = null) { item.clearClick(); item.onClick(() => { call && call() FGUtil.dispose(target); target = null; }, this) } showInfo(e: Event) { if (!e || !SKDataUtil.hasProperty(e.target, "skillId")) return; var skillId = e.target["skillId"]; var itemInfo = SkillUtil.getSkill(skillId); if (itemInfo != null && this.prefabObject["SkillDetail"] != null) { let detail = cc.instantiate(this.prefabObject["SkillDetail"]); detail.parent = this.factionTalentPanel.node; detail.setPosition(this.factionTalentPanel.node.width / 2, -this.factionTalentPanel.node.height / 2) detail.name = 'SkillDetail'; var useInfo = this.getIsUsed(skillId) if (useInfo != null) detail.getComponent('SkillDetail').loadInfo(skillId, false, useInfo); else detail.getComponent('SkillDetail').loadInfo(skillId, true); } } /** * 關閉背包天演符面板 */ closeFCBagPanel() { if (!SKUIUtil.isFGUIValid(this.fcBagPanel)) return; FGUtil.dispose(this.fcBagPanel) this.fcBagPanel = null; } }