squidGame/tgx-games-client/assets/module_arean/ui_dan_change/UIDanChange.ts

58 lines
2.0 KiB
TypeScript

/************************************************************************************
* FileName : UIDanChange.ts
* Description :
* Version : v1.0.0
* CreateTime : 2024-12-09 14:57:21
* Author :
* Copyright (c) 2024
* ==============================================================
* Method Description:
*
* ==============================================================
************************************************************************************/
import {GameUILayers} from "db://assets/scripts/GameUILayers";
import {tgx_class} from "db://assets/core_tgx/base/ModuleContext";
import {ModuleDef} from "db://assets/scripts/ModuleDef";
import {tgxUIController} from "db://assets/core_tgx/tgx";
import {Layout_UIDanChange} from "db://assets/module_arean/ui_dan_change/Layout_UIDanChange";
import {resLoader} from "db://assets/core_tgx/base/utils/ResLoader";
import { SpriteFrame } from "cc";
import {AreanNetMgr} from "db://assets/module_arean/scripts/AreanNetMgr";
import { _decorator, Component, Node, Button, Label, Sprite } from 'cc';
const { ccclass, property } = _decorator;
@ccclass('UIDanChange')
export class UIDanChange extends Component{
@property(Button)
closeBtn : Button = null;
@property(Label)
curDanLabel : Label = null;
@property(Label)
curStarChangeLabel : Label = null;
@property(Sprite)
icon : Sprite = null;
// constructor() {
// super("ui_dan_change/DanChange", GameUILayers.POPUP,Layout_UIDanChange)
// }
public close() : void{
this.node.destroy();
AreanNetMgr.inst.sendMsg_exit();
}
public initData(params: any) {
this.curDanLabel.string = params.name;
let str = params.changeStar > 0 ? `+${params.changeStar}` : `-${params.changeStar}`;
if(params.changeStar == 0) str = `${params.changeStar}`;
this.curStarChangeLabel.string = str;
let sp : SpriteFrame = resLoader.getSpriteFrame(`res/danIcon/${params.icon}`,ModuleDef.Arean);
if(sp) this.icon.spriteFrame = sp;
}
}