46 lines
1.2 KiB
TypeScript
46 lines
1.2 KiB
TypeScript
import { _decorator, Component, Node } from 'cc';
|
|
const { ccclass, property } = _decorator;
|
|
|
|
@ccclass('FeatureBuyPopup')
|
|
export class FeatureBuyPopup extends Component {
|
|
@property(Node)
|
|
buyFreeSpinNode: Node = null;
|
|
|
|
@property(Node)
|
|
buySuperSpinNode: Node = null;
|
|
|
|
@property(Node)
|
|
buyFreeSpinBgSprite: Node = null;
|
|
|
|
@property(Node)
|
|
buySuperFreeSpinBgSprite: Node = null;
|
|
|
|
BuyType: number = 1;
|
|
|
|
protected onLoad(): void {
|
|
this.BuyType = 1;
|
|
// 两个Node加入点击事件
|
|
this.buyFreeSpinNode.on(Node.EventType.TOUCH_START, this.onClickBuyFreeSpin, this);
|
|
this.buySuperSpinNode.on(Node.EventType.TOUCH_START, this.onClickBuySuperSpin, this);
|
|
}
|
|
|
|
show() {
|
|
this.buyFreeSpinBgSprite.active = this.BuyType == 1;
|
|
}
|
|
|
|
onClickBuyFreeSpin() {
|
|
if (this.BuyType == 1) return;
|
|
this.BuyType = 1;
|
|
this.buyFreeSpinBgSprite.active = true;
|
|
this.buySuperFreeSpinBgSprite.active = false;
|
|
}
|
|
|
|
onClickBuySuperSpin() {
|
|
if (this.BuyType == 2) return;
|
|
this.BuyType = 2;
|
|
this.buyFreeSpinBgSprite.active = false;
|
|
this.buySuperFreeSpinBgSprite.active = true;
|
|
}
|
|
}
|
|
|