Lobby.ts 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. import { _decorator, Component, Node, settings, Animation, Vec3 } from "cc";
  2. import BaseUI from "../base/BaseUI";
  3. import { AbsM, AbsWrapper } from "../web3/AbsM";
  4. import { SceneUtil } from "../../core_tgx/base/SceneUtils";
  5. import { SceneDef } from "../../scripts/SceneDef";
  6. import { BallUISoloMatch } from "./BallUISoloMatch";
  7. import { UIWaiting } from "../../core_tgx/easy_ui_framework/waiting/UIWaiting";
  8. import { Layout } from "cc";
  9. import { ChooseMode } from "./ChooseMode";
  10. import { BallUIRanking } from "./BallUIRanking";
  11. import { BallUITask } from "./BallUITask";
  12. import { BallUIShop } from "./BallUIShop";
  13. import UIUtils from "../base/UIUtils";
  14. import { TopBar } from "../ui_base/TopBar";
  15. import { UserAvatar } from "../ui_base/UserAvatar";
  16. const { ccclass, property } = _decorator;
  17. @ccclass("Lobby")
  18. export class Lobby extends BaseUI {
  19. public static ins: Lobby;
  20. private topBar: TopBar;
  21. private userAvatar: UserAvatar;
  22. public onLoad(): void {
  23. super.onLoad();
  24. this.topBar = this.getComponentInChildren(TopBar);
  25. this.userAvatar = this.getComponentInChildren(UserAvatar);
  26. Lobby.ins = this;
  27. let t = new Date().getTime();
  28. console.log("onLoad", t);
  29. console.log("onLoad end", new Date().getTime() - t);
  30. this.setActive("connect_node", true);
  31. this.setActive("gem_node", false);
  32. console.log("onLoad end", new Date().getTime() - t);
  33. }
  34. protected start(): void {
  35. this.enter();
  36. }
  37. public enter() {
  38. this.FindAs("balls_layout", Animation).play();
  39. this.FindAs("bottom_layout", Animation).play();
  40. // UIUtils.MoveXY(this.topBar.node, 0, 200, 0.5, 0);
  41. // UIUtils.MoveXY(this.userAvatar.node, 0, 200, 0.5, 0);
  42. let gamePassNode = this.FindNode("game_pass_node");
  43. UIUtils.MoveXY(gamePassNode, -500, -100, 0.5, 0);
  44. let ball_node = this.FindNode("ball");
  45. ball_node.setScale(0, 0, 0);
  46. UIUtils.DelayBezierMoveAndScale(
  47. ball_node,
  48. ball_node.getPosition(),
  49. 1,
  50. 0.5,
  51. 300
  52. );
  53. let children = this.FindNode("right_layout").children;
  54. for (let i = 0; i < children.length; i++) {
  55. let child = children[i];
  56. UIUtils.MoveXY(child, 200, 0, 0.5, 100 * i);
  57. }
  58. }
  59. // public setActive(name: string, active: boolean) {}
  60. protected simpleOnBtnClick(name: string): void {
  61. switch (name) {
  62. case "btn_play":
  63. ChooseMode.show();
  64. break;
  65. case "btn_tab_1":
  66. BallUIShop.show();
  67. break;
  68. case "btn_tab_2":
  69. BallUITask.show();
  70. break;
  71. case "btn_tab_3":
  72. //
  73. BallUIRanking.show();
  74. break;
  75. default:
  76. break;
  77. }
  78. }
  79. }