1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- // 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 AudioManager from "../AudioManager";
- import EventName from "../EventName/EventName";
- import LocalData from "../LocalData";
- import MyComponent from "../Template/MyComponent";
- import RewardMnr from "../Template/RewardMnr";
- const { ccclass, property } = cc._decorator;
- @ccclass
- export default class Award extends MyComponent {
- @property(cc.SpriteFrame)
- XuXian: cc.SpriteFrame = null
- @property(cc.SpriteFrame)
- ChaojiTiao: cc.SpriteFrame = null
- @property(cc.SpriteFrame)
- Fly: cc.SpriteFrame = null
- onEnable(): void {
- let guang = this.node.getChildByName("guang")
- cc.tween(guang)
- .to(0, { angle: 0 })
- .to(3 * 1000, { angle: 360 * 1000 })
- .start()
- }
- protected onDisable(): void {
- this.unscheduleAllCallbacks()
- }
- setSp(num: AwardType) {
- console.log(num);
- let a = this.node.getChildByName("wushizhongli").getComponent(cc.Sprite)
- switch (num) {
- case 1:
- a.spriteFrame = this.XuXian
- RewardMnr.getInstance().PropUseParabola(1)
- break;
- case 2:
- a.spriteFrame = this.ChaojiTiao
- break;
- case 3:
- a.spriteFrame = this.Fly
- break;
- default:
- break;
- }
- }
- }
- export enum AwardType {
- XuXian = 1,
- ChaojiTiao = 2,
- Fly = 3
- }
|