You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
79 lines
3.1 KiB
79 lines
3.1 KiB
//#region 文件引入
|
|
import { _decorator, Button, Component, Label, Node, sp, Sprite,Animation, RichText } from "cc";
|
|
import BaseUIForm from "../../Mgr_UI/BaseUIForm";
|
|
import FrameScrollView from "../../CComEx/FrameScrollView";
|
|
import { Global } from "../../Global";
|
|
import StringUtils from "../../ExUtils/StringUtils";
|
|
import { GameTotalType } from "../../const/GameEnum";
|
|
import { IData } from "../../const/GameInterface";
|
|
//#endregion 文件引入
|
|
const {ccclass, property,menu} = _decorator;
|
|
@ccclass("TreasureDetailUI_Proxy")
|
|
export default class TreasureDetailUI_Proxy extends BaseUIForm{
|
|
//#region 节点自动生成
|
|
@property(Node)
|
|
n_treaslist: Node = null;
|
|
//#endregion 节点自动生成
|
|
|
|
@property(FrameScrollView)
|
|
protected mScrollViewFrame: FrameScrollView;
|
|
|
|
onButtonClick(button:Button){
|
|
|
|
/**点击事件触发*/
|
|
switch (button) {
|
|
default:
|
|
ConsoleEx.Log(button);
|
|
break;
|
|
}
|
|
}
|
|
|
|
addEvent(): void {
|
|
this.mScrollViewFrame.m_ItemRendererFuntion = this.ItemRenderer.bind(this)
|
|
}
|
|
|
|
protected start(): void {
|
|
this.refreshTreasureList();
|
|
this.reflashScrollView();
|
|
}
|
|
|
|
refreshTreasureList() {
|
|
for(let i = 0; i < Global.CsvMgr.Props_array_csv.length; i++){
|
|
let cfg = Global.CsvMgr.Props_array_csv[i];
|
|
let item = this.n_treaslist.children[i];
|
|
let name = item.getChildByName("name");
|
|
let lightbg = item.getChildByName("lightbg");
|
|
CNodeUtils.switchText(name, cfg.name);
|
|
if(this.mDataMgr.Treasure.getTreasureById(cfg.id)){
|
|
CNodeUtils.setActive(lightbg, true);
|
|
}else{
|
|
CNodeUtils.setActive(lightbg, false);
|
|
}
|
|
|
|
const icon: Node = item.getChildByName("icon");
|
|
const iData:IData = {
|
|
type: GameTotalType.TREAS,
|
|
id: cfg.id,
|
|
num:0,
|
|
}
|
|
CNodeUtils.SwitchTextureByData(icon, iData);
|
|
}
|
|
}
|
|
|
|
//#region 拥有的目标功法类型 列表
|
|
ItemRenderer(idx:number,tNode:Node){
|
|
const item = this.mDataMgr.Treasure.getTreasures()[idx];
|
|
const itemdata = this.mDataMgr.Treasure.getTreasureById(item.id);
|
|
const name: Node = tNode.getChildByName("name");
|
|
const display: Node = tNode.getChildByName("display");
|
|
CNodeUtils.switchText(name, itemdata.config.name);
|
|
const displaytxt = itemdata.config.prop2 === 0? StringUtils.format(itemdata.config.display, itemdata.prop1):StringUtils.format(itemdata.config.display, itemdata.prop1, itemdata.prop2)
|
|
CNodeUtils.switchText(display, displaytxt);
|
|
}
|
|
|
|
private reflashScrollView(){
|
|
this.mScrollViewFrame.m_ItemCount = this.mDataMgr.Treasure.getTreasures().length;
|
|
}
|
|
|
|
//#endregion
|
|
}
|