FGold.ts 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. import { AudioMgr, GameViewType } from "../../../main/ViewManage";
  2. import ViewObject from "../../../main/ViewObject";
  3. import FObject from "../object/FObject";
  4. import BaseEvent from "./base/BaseEvent";
  5. /**
  6. * 金币
  7. */
  8. const { ccclass, property } = cc._decorator;
  9. @ccclass
  10. export default class FGold extends BaseEvent {
  11. @property({
  12. type:cc.Node,
  13. displayName: '引导箭头标识'
  14. })
  15. mGuideMark: cc.Node = null;
  16. onLoad() {
  17. super.onLoad()
  18. this.node.zIndex = -9999;
  19. }
  20. /**
  21. * 主角进入碰撞区域
  22. */
  23. public onBegin(tag:number) {
  24. if(this.mGuideMark){
  25. this.mGuideMark.active = false;
  26. }
  27. if(this.node.getChildByName("ani_zuanshi")){
  28. this.ff.main.playerEffectByPath(AudioMgr.amethyst);
  29. }
  30. this.node.removeComponent(cc.PhysicsBoxCollider);
  31. let moveBy = cc.moveBy(1, cc.v2(0, 200)).easing(cc.easeSineOut());
  32. let fadeout = cc.fadeOut(1);
  33. let spawn = null
  34. if (true) {
  35. let seq = cc.sequence(cc.scaleTo(0.1, 1.8), cc.scaleTo(0.2, 2));
  36. spawn = cc.spawn(moveBy, fadeout, seq);
  37. } else {
  38. spawn = cc.spawn(moveBy, fadeout);
  39. }
  40. let seq = cc.sequence(cc.delayTime(0.1), spawn, cc.callFunc(() => {
  41. this.node.removeFromParent(true);
  42. this.node.destroy();
  43. if(this.node.name == '109'){
  44. let main = this.ff.main
  45. main.viewManage.loadFunc(GameViewType.fight_zsj_tips,(viewObject:ViewObject)=>{
  46. viewObject.show();
  47. });
  48. }
  49. }));
  50. this.node.runAction(seq);
  51. this.ff.getMapObject(this.node.name);
  52. }
  53. /**
  54. * 主角离开碰撞区域
  55. */
  56. public onEnd(tag:number) {
  57. }
  58. }