|
@@ -2,9 +2,12 @@ import Gamecfg from "../../../../common/gameCfg";
|
|
import GameDataCenter from "../../../../data/GameDataCenter";
|
|
import GameDataCenter from "../../../../data/GameDataCenter";
|
|
import { MergeItem } from "../../../../data/model/GridMap/GridMapModel";
|
|
import { MergeItem } from "../../../../data/model/GridMap/GridMapModel";
|
|
import ResSprite from "../../../../frameWork/compment/ResSprite";
|
|
import ResSprite from "../../../../frameWork/compment/ResSprite";
|
|
|
|
+import { ListUtil } from "../../../../frameWork/fgui/ListUtil";
|
|
import EventMng from "../../../../manager/EventMng";
|
|
import EventMng from "../../../../manager/EventMng";
|
|
import { HcType } from "../../../../shared/hc/PtlHcInfo";
|
|
import { HcType } from "../../../../shared/hc/PtlHcInfo";
|
|
|
|
+import { showTime } from "../../../../utils/Formula";
|
|
import { I18n } from "../../../../utils/I18nUtil";
|
|
import { I18n } from "../../../../utils/I18nUtil";
|
|
|
|
+import { uiCommon } from "../../../../utils/UICommon";
|
|
import { GridEvent } from "../../../gridMap/GridEvent";
|
|
import { GridEvent } from "../../../gridMap/GridEvent";
|
|
import { I_CubeData } from "../../../gridMap/UECube";
|
|
import { I_CubeData } from "../../../gridMap/UECube";
|
|
|
|
|
|
@@ -22,6 +25,9 @@ export default class HomeMergeDetailCom {
|
|
private TypeCtr: fgui.Controller;
|
|
private TypeCtr: fgui.Controller;
|
|
private ShowLvCtr: fgui.Controller;
|
|
private ShowLvCtr: fgui.Controller;
|
|
private NameLabel: fgui.GTextField;
|
|
private NameLabel: fgui.GTextField;
|
|
|
|
+ private ItemListUtil: ListUtil;
|
|
|
|
+ private SpeedBtn: fgui.GButton;
|
|
|
|
+ private TimeLabel: fgui.GTextField;
|
|
data: MergeSellData;
|
|
data: MergeSellData;
|
|
static instance: HomeMergeDetailCom;
|
|
static instance: HomeMergeDetailCom;
|
|
public constructor(vm: fgui.GComponent) {
|
|
public constructor(vm: fgui.GComponent) {
|
|
@@ -34,6 +40,9 @@ export default class HomeMergeDetailCom {
|
|
this.TypeCtr = vm.getController('TypeCtr');
|
|
this.TypeCtr = vm.getController('TypeCtr');
|
|
this.ShowLvCtr = vm.getController('ShowLvCtr');
|
|
this.ShowLvCtr = vm.getController('ShowLvCtr');
|
|
this.NameLabel = vm.getChild('NameLabel').asTextField;
|
|
this.NameLabel = vm.getChild('NameLabel').asTextField;
|
|
|
|
+ this.SpeedBtn = vm.getChild('SpeedBtn').asButton;
|
|
|
|
+ this.TimeLabel = this.SpeedBtn.getChild('TimeLabel').asTextField;
|
|
|
|
+ this.ItemListUtil = new ListUtil(vm.getChild('ItemList').asList);
|
|
}
|
|
}
|
|
|
|
|
|
public onEnable(): void {
|
|
public onEnable(): void {
|
|
@@ -61,44 +70,101 @@ export default class HomeMergeDetailCom {
|
|
this.data = data;
|
|
this.data = data;
|
|
this._vm.visible = data.isShow;
|
|
this._vm.visible = data.isShow;
|
|
if (data.isShow) {
|
|
if (data.isShow) {
|
|
- let quality = 0;
|
|
|
|
this.SellBtn.visible = false;
|
|
this.SellBtn.visible = false;
|
|
- if (data.item.type == HcType.emitter) {
|
|
|
|
- let mergePropCfg = Gamecfg.emitterInfo.getItem(data.item.id.toString());
|
|
|
|
- this.sp_item.setSpriteFrame('gridMap', `mergeProp/${mergePropCfg.icon}`);
|
|
|
|
- quality = mergePropCfg.quality;
|
|
|
|
- this.TypeCtr.selectedIndex = 1;
|
|
|
|
- this.ShowLvCtr.selectedIndex = 0;
|
|
|
|
- this.NameLabel.text = I18n.getI18nLang(mergePropCfg.name);
|
|
|
|
- } else if (data.item.type == HcType.material) {
|
|
|
|
- let mergePropCfg = Gamecfg.mergePropInfo.getItem(data.item.id.toString());
|
|
|
|
- this.sp_item.setSpriteFrame('gridMap', `mergeProp/${mergePropCfg.icon}`);
|
|
|
|
- quality = mergePropCfg.quality;
|
|
|
|
- this.SellBtn.title = mergePropCfg.price.toString();
|
|
|
|
- this.SellBtn.visible = true;
|
|
|
|
- this.TypeCtr.selectedIndex = 0;
|
|
|
|
- this.ShowLvCtr.selectedIndex = 1;
|
|
|
|
- this.NameLabel.text = I18n.getI18nLang(mergePropCfg.name);
|
|
|
|
- } else if (data.item.type == HcType.equip) {
|
|
|
|
- let mergePropCfg = Gamecfg.equipInfo.getItem(data.item.id.toString());
|
|
|
|
- this.sp_item.setSpriteFrame('gridMap', `mergeEquip/${mergePropCfg.icon}`);
|
|
|
|
- quality = mergePropCfg.quality;
|
|
|
|
- // this.SellBtn.title = mergePropCfg.price.toString();
|
|
|
|
- this.SellBtn.visible = true;
|
|
|
|
- this.TypeCtr.selectedIndex = 2;
|
|
|
|
- this.NameLabel.text = I18n.getI18nLang(mergePropCfg.name);
|
|
|
|
- } else if (data.item.type == HcType.user) {
|
|
|
|
-
|
|
|
|
- } else if (data.item.type == HcType.monster) {
|
|
|
|
|
|
+ if (data.item.info.type == HcType.emitter) {
|
|
|
|
+ this.ShowEmitterDetail();
|
|
|
|
+ } else if (data.item.info.type == HcType.material) {
|
|
|
|
+ this.ShowMateriaDetail();
|
|
|
|
+ } else if (data.item.info.type == HcType.equip) {
|
|
|
|
+ this.ShowEquipDetail();
|
|
|
|
+ } else if (data.item.info.type == HcType.user) {
|
|
|
|
+
|
|
|
|
+ } else if (data.item.info.type == HcType.monster) {
|
|
|
|
|
|
}
|
|
}
|
|
- if (quality > 0) {
|
|
|
|
- this.QualityLoad.url = `ui://Home/Img_zjm_xqpinzhi0${quality - 1}`;
|
|
|
|
- this.QualityLabel.text = `T${quality}`;
|
|
|
|
- } else {
|
|
|
|
- this.QualityLoad.url = ``;
|
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private ChangeQuality(quality: number) {
|
|
|
|
+ if (quality > 0) {
|
|
|
|
+ this.QualityLoad.url = `ui://Home/Img_zjm_xqpinzhi0${quality - 1}`;
|
|
|
|
+ this.QualityLabel.text = `T${quality}`;
|
|
|
|
+ } else {
|
|
|
|
+ this.QualityLoad.url = ``;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private ShowEmitterDetail(): void {
|
|
|
|
+ let cfg = Gamecfg.emitterInfo.getItem(this.data.item.info.correlationId.toString());
|
|
|
|
+ this.sp_item.setSpriteFrame('gridMap', `mergeProp/${cfg.icon}`);
|
|
|
|
+ let quality = cfg.quality;
|
|
|
|
+ this.ChangeQuality(quality);
|
|
|
|
+ this.TypeCtr.selectedIndex = 1;
|
|
|
|
+ this.ShowLvCtr.selectedIndex = 0;
|
|
|
|
+ this.NameLabel.text = I18n.getI18nLang(cfg.name);
|
|
|
|
+ if (cfg.dropId) {
|
|
|
|
+ let dropCfg = Gamecfg.dropData.getItem(cfg.dropId.toString());
|
|
|
|
+ let arr: MergeItem[] = [];
|
|
|
|
+ let chunks = uiCommon.SplitArrayIntoChunks(dropCfg.items, 4);
|
|
|
|
+ chunks.forEach(element => {
|
|
|
|
+ arr.push({
|
|
|
|
+ type: element[0],
|
|
|
|
+ id: element[1],
|
|
|
|
+ rate: element[3],
|
|
|
|
+ })
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ this.ItemListUtil.refreshItems(arr, { showRate: false });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.TimeLabel.text = showTime(this.data.item.info.emitter?.lastTime);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private ShowMateriaDetail() {
|
|
|
|
+ let mergePropCfg = Gamecfg.mergePropInfo.getItem(this.data.item.info.correlationId.toString());
|
|
|
|
+ this.sp_item.setSpriteFrame('gridMap', `mergeProp/${mergePropCfg.icon}`);
|
|
|
|
+ let quality = mergePropCfg.quality;
|
|
|
|
+ this.SellBtn.title = mergePropCfg.price.toString();
|
|
|
|
+ this.SellBtn.visible = true;
|
|
|
|
+ this.TypeCtr.selectedIndex = 0;
|
|
|
|
+ this.ShowLvCtr.selectedIndex = 1;
|
|
|
|
+ this.NameLabel.text = I18n.getI18nLang(mergePropCfg.name);
|
|
|
|
+ this.ChangeQuality(quality);
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ private ShowEquipDetail() {
|
|
|
|
+ let mergePropCfg = Gamecfg.equipInfo.getItem(this.data.item.info.correlationId.toString());
|
|
|
|
+ this.sp_item.setSpriteFrame('gridMap', `mergeEquip/${mergePropCfg.icon}`);
|
|
|
|
+ let quality = mergePropCfg.quality;
|
|
|
|
+ // this.SellBtn.title = mergePropCfg.price.toString();
|
|
|
|
+ this.SellBtn.visible = true;
|
|
|
|
+ this.TypeCtr.selectedIndex = 2;
|
|
|
|
+ this.NameLabel.text = I18n.getI18nLang(mergePropCfg.name);
|
|
|
|
+ this.ChangeQuality(quality);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public OnUpdate(dt: number) {
|
|
|
|
+ if (this.data?.isShow) {
|
|
|
|
+ if (this.data.item.info.type == HcType.emitter) {
|
|
|
|
+ let cfg = Gamecfg.emitterInfo.getItem(this.data.item.info.correlationId.toString());
|
|
|
|
+ if (cfg.restoreNum) {
|
|
|
|
+ if (cfg.upLimit && this.data.item.info.emitter.tili >= cfg.upLimit) {
|
|
|
|
+ this.TimeLabel.text = '已满';
|
|
|
|
+ this.SpeedBtn.grayed = true;
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ let leastTime = Date.now() / 1000 - this.data.item.info.emitter?.lastTime;
|
|
|
|
+
|
|
|
|
+ let time = cfg.restoreNum[0] - leastTime;
|
|
|
|
+ if (time > 0) {
|
|
|
|
+ this.TimeLabel.text = showTime(time, "3");
|
|
|
|
+ this.SpeedBtn.grayed = false;
|
|
|
|
+ } else {
|
|
|
|
+ this.TimeLabel.text = '已满';
|
|
|
|
+ this.SpeedBtn.grayed = true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|