123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- // 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 { PopName } from "../EventName/EventName";
- import LocalData from "../Template/LocalData";
- import PopComponet from "../Template/PopComponet";
- import PopManger from "./PopManger";
- const { ccclass, property } = cc._decorator;
- @ccclass
- export default class UserProp extends PopComponet {
- @property(cc.SpriteFrame)
- Time: cc.SpriteFrame = null
- @property(cc.SpriteFrame)
- Jump: cc.SpriteFrame = null
- @property(cc.Label)
- PropDetails: cc.Label = null
- NoThanks() {
- this.Surpclose()
- }
- GetProp() {
- switch (this.Options.PropType) {
- case 0://时间
- LocalData.getInstance().AddTimeStopCount()
- break;
- case 1://跳跃
- LocalData.getInstance().AddNowSitDownCount()
- break;
- default:
- console.error('错误了');
- break;
- }
- this.Surpclose()
- }
- protected start(): void {
- let image = this.node.getChildByName("Node").getChildByName("image").getComponent(cc.Sprite)
- switch (this.Options.PropType) {
- case 0://时间
- image.spriteFrame = this.Time
- this.PropDetails.string = '它能延长时间十秒'
- break;
- case 1://跳跃
- image.spriteFrame = this.Jump
- this.PropDetails.string = '它能让一个乘客跳跃'
- break;
- default:
- console.error('错误了');
- break;
- }
- }
- }
|