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.
56 lines
1.4 KiB
56 lines
1.4 KiB
// Learn TypeScript:
|
|
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html
|
|
// Learn Attribute:
|
|
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html
|
|
// Learn life-cycle callbacks:
|
|
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html
|
|
|
|
import UserManager from "../Manager/UserManager";
|
|
|
|
const { ccclass, property } = cc._decorator;
|
|
|
|
@ccclass
|
|
export default class JianZao extends cc.Component {
|
|
|
|
@property({ type: cc.Label, displayName: '产业名字' })
|
|
name_Label: cc.Label = null;
|
|
|
|
@property({ type: cc.Label, displayName: '店铺收入' })
|
|
shouru_Label: cc.Label = null;
|
|
|
|
@property({ type: cc.Label, displayName: '开设提示' })
|
|
kaishe_Label: cc.Label = null;
|
|
|
|
@property({ type: cc.Label, displayName: '需要资金' })
|
|
price_Label: cc.Label = null;
|
|
price: number;
|
|
|
|
|
|
// LIFE-CYCLE CALLBACKS:
|
|
|
|
// onLoad () {}
|
|
|
|
start() {
|
|
|
|
}
|
|
|
|
init(name, shouru, price) {
|
|
this.name_Label.string = `${name}`
|
|
this.shouru_Label.string = `${shouru}`
|
|
this.kaishe_Label.string = `开设${name}需要资金:`
|
|
this.price_Label.string = `${price}`
|
|
this.price = price
|
|
}
|
|
|
|
onTouchJianZao() {
|
|
UserManager.subMoney(this.price)
|
|
this.onTouchClose()
|
|
}
|
|
|
|
onTouchClose() {
|
|
this.node.removeFromParent()
|
|
this.node.destroy()
|
|
}
|
|
|
|
// update (dt) {}
|
|
}
|
|
|