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.
86 lines
2.2 KiB
86 lines
2.2 KiB
1 week ago
|
// Learn TypeScript:
|
||
|
// - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
|
||
|
// Learn Attribute:
|
||
|
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
|
||
|
// Learn life-cycle callbacks:
|
||
|
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
|
||
|
|
||
|
import { ryw_Event } from "../../FrameWork/Event/EventEnum";
|
||
|
import EventMgr from "../../FrameWork/Event/EventMgr";
|
||
|
import Common5 from "../../Platform/th/Common5";
|
||
|
import BagManager from "../Manager/BagManager";
|
||
|
|
||
|
const {ccclass, property} = cc._decorator;
|
||
|
|
||
|
@ccclass
|
||
|
export default class CangKuItem extends cc.Component {
|
||
|
|
||
|
@property(cc.Sprite)
|
||
|
iconSpr: cc.Sprite = null;
|
||
|
|
||
|
@property(cc.Label)
|
||
|
iconNum: cc.Label = null;
|
||
|
// LIFE-CYCLE CALLBACKS:
|
||
|
|
||
|
@property(cc.Label)
|
||
|
iconName: cc.Label = null;
|
||
|
// onLoad () {}
|
||
|
@property(cc.Node)
|
||
|
chooseNode: cc.Node = null;
|
||
|
|
||
|
@property(cc.Label)
|
||
|
LabMoney: cc.Label = null;
|
||
|
|
||
|
_data = null
|
||
|
|
||
|
|
||
|
|
||
|
start () {
|
||
|
|
||
|
EventMgr.onEvent_custom(ryw_Event.ViewpPoperty,(goodId)=>{
|
||
|
if(this._data.goodId == goodId){
|
||
|
this.chooseNode.active = true
|
||
|
}else{
|
||
|
this.chooseNode.active = false
|
||
|
}
|
||
|
},this)
|
||
|
this.chooseNode.active = false
|
||
|
|
||
|
}
|
||
|
|
||
|
initView(data){
|
||
|
this._data = data
|
||
|
//console.log(this._data, 'initView+++++++++++++++====')
|
||
|
let goodId = this._data.goodId
|
||
|
let goodNum = this._data.goodNum
|
||
|
|
||
|
// Common5.getSpriteFrameFromBundle("GoodIcon","icon/"+ goodId, this.iconSpr);
|
||
|
Common5.setRemoteSpriteFrame(this.iconSpr,'GoodIcon/'+ goodId)
|
||
|
this.iconNum.string = goodNum
|
||
|
|
||
|
let _pro = BagManager.getGoodsProperty(goodId)
|
||
|
this.iconName.string = _pro.goodName
|
||
|
|
||
|
if(this.LabMoney){
|
||
|
this.LabMoney.string = Common5.getNumberChangeHanzi(_pro.priceNum,'1',1)+''
|
||
|
}
|
||
|
}
|
||
|
|
||
|
iconBtnClick(){
|
||
|
let goodId = this._data.goodId
|
||
|
let goodNum = this._data.goodNum
|
||
|
EventMgr.emitEvent_custom(ryw_Event.ViewpPoperty, goodId, goodNum);
|
||
|
}
|
||
|
|
||
|
|
||
|
setCanTouch(isTouch){
|
||
|
this.node.getChildByName('sprdi').getComponent(cc.Button).interactable = isTouch
|
||
|
}
|
||
|
|
||
|
myselfClickEvent(){
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|