GameDetailLayer.ts 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import { _decorator, Component, Node, Event } from "cc";
  2. import { game } from "cc";
  3. import { instantiate } from "cc";
  4. import { Vec3 } from "cc";
  5. import { Sprite } from "cc";
  6. import BaseUI from "../../scripts/base/BaseUI";
  7. import UIUtils from "../../scripts/base/UIUtils";
  8. import { Hall } from "../hall/Hall";
  9. const { ccclass, property } = _decorator;
  10. @ccclass("GameDetailLayer")
  11. export class GameDetailLayer extends BaseUI {
  12. static async show(gameId: number, sourceIcon: Node) {
  13. let layer = await Hall.ins.showLayer("prefab/layer/GameDetailLayer");
  14. layer.getComponent(GameDetailLayer).init(gameId, sourceIcon);
  15. }
  16. private gameId: number = 0;
  17. // private sourceNode: Node = null;
  18. init(gameId: number, sourceNode: Node) {
  19. this.gameId = gameId;
  20. // this.sourceNode = sourceNode;
  21. // let newIcon = instantiate(sourceNode);
  22. // newIcon.parent = this.sourceNode;
  23. // UIUtils.moveToNewParent(this.FindNode("icon_slot"), newIcon);
  24. // UIUtils.AnimBezierMoveAndScale(
  25. // newIcon,
  26. // new Vec3(0, 0, 0),
  27. // 0.3,
  28. // 0.3,
  29. // () => {}
  30. // );
  31. }
  32. private close() {
  33. this.closePage();
  34. // let icon = this.FindNode("icon_slot").children[0];
  35. // UIUtils.moveToNewParent(this.sourceNode, icon);
  36. // this.node.active = false;
  37. // let self = this;
  38. // this.sourceNode.getComponent(Sprite).enabled = false;
  39. // UIUtils.AnimBezierMoveAndScale(icon, new Vec3(0, 0, 0), 0.8, 0.3, () => {
  40. // icon.destroy();
  41. // self.sourceNode.getComponent(Sprite).enabled = true;
  42. // UIUtils.closeUI(self.node);
  43. // });
  44. }
  45. protected onBtnClick(name: string, event: Event, customEventData: any): void {
  46. if (name === "btn_close") {
  47. this.close();
  48. }
  49. // super.onBtnClick(name, event, customEventData);
  50. }
  51. }