大侠
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.
 
 
 

34 lines
1.2 KiB

import { _decorator, CCBoolean, CCInteger, Component, Enum, Node } from 'cc';
import { GameTotalType } from '../const/GameEnum';
import { EResUrls } from '../ResUrl/EResUrls';
import GDUtils from '../ExCUtils/GDUtils';
const { ccclass, property ,menu} = _decorator;
@ccclass('ResUrlLoad')
@menu("UI界面资源加载/道具加载")
export class ResUrlLoad extends Component {
@property({type:Enum(GameTotalType)})
Type:GameTotalType = GameTotalType.TOKEN;
@property(CCInteger)
id:number = 0;
@property(CCInteger)
width:number=0;
@property(CCBoolean)
autoshow:boolean=true;
protected onEnable(): void {
this.autoshow && CNodeUtils.SwitchTexture(GDUtils.getUrl2(this.Type,this.id),this.node,GDUtils.getUBundle(this.Type),this.width);
//CNodeUtils.SwitchTextureByAutoAtlas(,EResUrls.Atlas("IconAtlas"),this.node,GDUtils.getUBundle(this.Type),this.width)
}
showResInfo(type:GameTotalType,id:number){
this.Type = type;
this.id = id;
CNodeUtils.SwitchTexture(GDUtils.getUrl2(this.Type,this.id),this.node,GDUtils.getUBundle(this.Type),this.width);
}
protected onDisable(): void {
}
}