TipPanel.ts 915 B

12345678910111213141516171819202122232425262728293031
  1. import { BaseView } from "../../../lightMVC/core/base/BaseView";
  2. const { ccclass, property } = cc._decorator;
  3. @ccclass
  4. export default class TipPanel extends BaseView {
  5. public drawView(data?: any): void {
  6. this.node.setSiblingIndex(100);
  7. let label = this.ui.getNode("label");
  8. label.getComponent(cc.Label).string = (data) ? data : '';
  9. this.node.stopAllActions();
  10. this.node.position = new cc.Vec3(0, -100, 0);
  11. this.PlayAction();
  12. console.log('tipPanel:**(*******', this.node.getSiblingIndex());
  13. }
  14. /**
  15. * 播放tip动作
  16. */
  17. public PlayAction(): void {
  18. let cb = cc.callFunc(() => {
  19. this.closeView();
  20. })
  21. var actions = cc.sequence(cc.moveTo(1, cc.v2(0, 100)), cc.fadeOut(1), cb);
  22. this.node.runAction(actions);
  23. }
  24. public static path(): string {
  25. return "/prefabs/TipPanel";
  26. }
  27. }