SamsaraGame/assets/Script/panel/Chat/ChatEmotionItem.ts
2025-04-24 17:03:28 +08:00

41 lines
1019 B
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//已TS化測試無誤可刪除原JS代碼
import GameModel from "../../ts/core/GameModel";
import GameUtil from "../../ts/core/GameUtil";
import JSUtil = require("../../ts/core/JSUtil");
const { ccclass, property } = cc._decorator;
@ccclass
export default class ChatTasktem extends cc.Component {
@property(cc.Sprite)
item_icon: cc.Sprite = null;
@property(cc.SpriteAtlas)
emojiAtlas: cc.SpriteAtlas = null;
itemInfo: any = null;
isEmpty: boolean = false
onLoad() {
}
loadInfo(info: any) {
this.itemInfo = info;
this.itemInfo.type = 0;
this.item_icon.spriteFrame = this.emojiAtlas.getSpriteFrame(('000' + info.index).substr(-3) + '0000');
this.isEmpty = this.item_icon.spriteFrame == null || this.item_icon.spriteFrame == undefined;
}
mCallback: any;
setCallback(callback) {
this.mCallback = callback;
}
onPetClick() {
if (this.mCallback) {
this.mCallback(this.itemInfo);
}
}
}