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
2.8 KiB
79 lines
2.8 KiB
//#region 文件引入
|
|
import { _decorator, Button, Component, Label, Node, sp, Sprite,Animation, RichText, SpriteFrame } from "cc";
|
|
import UIParse from "../../Mgr_UI/UIParse";
|
|
import FrameLayout from "../../CComEx/FrameLayout";
|
|
import { GameTotalType, PropType } from "../../const/GameEnum";
|
|
import rewardItem_Proxy from "./rewardItem_Proxy";
|
|
import { IData } from "../../const/GameInterface";
|
|
import UIMgr from "../../Mgr_UI/UIMgr";
|
|
import { EUIForms } from "../../const/UIFormCnf";
|
|
//#endregion 文件引入
|
|
const {ccclass, property,menu} = _decorator;
|
|
@ccclass("rewardrankitem_Proxy")
|
|
export default class rewardrankitem_Proxy extends UIParse{
|
|
//#region 节点自动生成
|
|
|
|
@property(Sprite)
|
|
spr_bg: Sprite = null;
|
|
@property(Sprite)
|
|
spr_rankbg: Sprite = null;
|
|
@property(Label)
|
|
lab_rank: Label = null;
|
|
//#endregion 节点自动生成
|
|
|
|
@property({type:[SpriteFrame]})
|
|
protected mBgs: SpriteFrame[] = [];
|
|
@property({type:[SpriteFrame]})
|
|
protected mRankBgs: SpriteFrame[] = [];
|
|
@property(FrameLayout)
|
|
protected mRewardItems: FrameLayout;
|
|
|
|
private _tokentype = PropType.eJXStone;
|
|
private _tokennum = 0;
|
|
|
|
//
|
|
private readonly strRank: string[] = ["","","","4-10","11-100","100+"]
|
|
onButtonClick(button:Button){
|
|
|
|
/**点击事件触发*/
|
|
switch (button) {
|
|
default:
|
|
ConsoleEx.Log(button);
|
|
break;
|
|
}
|
|
}
|
|
|
|
addEvent(): void {
|
|
this.mRewardItems.m_ItemRendererFuntion = this.ItemRenderer.bind(this);
|
|
}
|
|
|
|
ItemRenderer(idx:number,tNode:Node){
|
|
const ClassPoxy: rewardItem_Proxy = tNode.getComponent(rewardItem_Proxy);
|
|
ClassPoxy.setInfo(this._tokentype, this._tokennum);
|
|
CNodeUtils.addBtnComponent(tNode, this.ItemClick.bind(this), this);
|
|
}
|
|
|
|
private ItemClick() {
|
|
const tData: IData = {
|
|
id: this._tokentype,
|
|
num: 0,
|
|
type: GameTotalType.TOKEN
|
|
}
|
|
UIMgr.Ins.ShowUI(EUIForms.ShopInfoUI, { param: {tdata: tData} });
|
|
}
|
|
|
|
|
|
setInfo(idx:number, token:PropType, num:number){
|
|
if(idx < 3){
|
|
this.spr_bg.spriteFrame = this.mBgs[idx];
|
|
this.spr_rankbg.spriteFrame = this.mRankBgs[idx];
|
|
}else{
|
|
this.spr_bg.spriteFrame = this.mBgs[3];
|
|
this.spr_rankbg.spriteFrame = null;
|
|
}
|
|
CNodeUtils.switchText(this.lab_rank, this.strRank[idx]);
|
|
this._tokentype = token;
|
|
this._tokennum = num;
|
|
this.mRewardItems.m_ItemCount = 5;
|
|
}
|
|
}
|