1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- import { _decorator, assetManager, Component, ImageAsset, Node, RichText, Sprite, SpriteFrame, Texture2D } from 'cc';
- import { GetAwardVo } from '../../game/pack/GetAwardVo';
- import { gameManager } from '../../game/gameManager';
- const { ccclass, property } = _decorator;
-
- /**
- * 获取礼物界面
- */
- @ccclass('GetGoodPanel')
- export class GetGoodPanel extends Component {
- @property(Sprite)
- wupImg:Sprite = null!;
- @property(RichText)
- wupTitle:RichText = null!;
- @property(Node)
- btnLingqu:Node =null!;
- @property(Node)
- btnQure:Node = null!;
- private _data:GetAwardVo =null!;
- // [1]
- // dummy = '';
- // [2]
- // @property
- // serializableDummy = 0;
- start () {
- // [3]
- }
- // update (deltaTime: number) {
- // // [4] <color=#2D3461>蛋仔盲盒精致版</color><color=#FF5C00>*1</color>
- // }
- public SetData(data:GetAwardVo){
- if(!data)return;
- if(!data.id)return;
- console.log("设置显示的数据",data);
- this._data=data;
- this.wupTitle.string = `<color=#2D3461>${data.name}</color><color=#FF5C00>*${data.num}</color>`;
- const remoteUrl=data.icon?data.icon:"";
- var thiss=this;
- this.wupImg.spriteFrame=null;
- if(remoteUrl.length>10){
- assetManager.loadRemote<ImageAsset>(remoteUrl, function (err, imageAsset) {
- if(err){
- return console.warn("ImageAssert load failed, err:" + err.message,remoteUrl);
- }
- thiss.wupImg.spriteFrame = SpriteFrame.createWithImage(imageAsset);
- // const spriteFrame = new SpriteFrame();
- // const texture = new Texture2D();
- // texture.image = imageAsset;
- // spriteFrame.texture = texture;
- // thiss.wupImg.spriteFrame=spriteFrame;
- });
- }
- const type=data.basicType?data.basicType:0;
- this.btnLingqu.active=type==1;
- this.btnQure.active=type==0;
- }
- public btnClose(){
- this.wupImg.spriteFrame=null;
- this.node.active=false;
- }
- public btnLingQue(){
- let http=gameManager.Instance.golabMemory.isReplse?"http://star.mstardance.com":"http://teststar.mstardance.com";
- let url=`${http}/starmini/address.html?id=${this._data.id}&icon=${this._data.icon}&name=${this._data.name}`;
- window.location.href = url;
- }
- }
|