jhsD3BQUzrckXHMC.ts 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. import { Vl2h6kBYov1uNSwzL7 } from "./koffTaS";
  2. import game_config_dyn from "./game_config_dyn";
  3. import game_core from "./game_core";
  4. const { ccclass, property } = cc._decorator;
  5. @ccclass
  6. export default class NewClass extends cc.Component {
  7. @property(cc.Prefab)
  8. public tileBlock: cc.Prefab = null;
  9. @property(cc.Label)
  10. wxOdV3NSqeDk2e2Prog: cc.Label = null;
  11. OBX6txtv: cc.Tween = null;
  12. OBX6txtv2: cc.Tween = null;
  13. onLoad() {
  14. // 加载游戏配置
  15. this.loadGameConfig();
  16. // 初始化游戏核心,并传入相关节点和预制体
  17. this.initGameCore();
  18. // 启动延迟后执行特定函数的动画序列
  19. this.startDelayedAnimation();
  20. }
  21. // 加载游戏配置的函数
  22. private loadGameConfig(): void {
  23. game_config_dyn.load(null);
  24. }
  25. // 初始化游戏核心的函数,传入当前节点和瓦片预制体
  26. private initGameCore(): void {
  27. game_core.init(this.node, this.tileBlock);
  28. }
  29. // 启动延迟后执行特定函数的动画序列的函数
  30. private startDelayedAnimation(): void {
  31. this.OBX6txtv2 = cc.tween(this.node)
  32. .delay(1)
  33. .call(() => {
  34. this.W1cIA6G();
  35. })
  36. .start();
  37. }
  38. W1cIA6G() {
  39. // 创建并启动一个进度更新的动画序列,并根据进度执行相关操作
  40. this.createAndStartProgressAnimation();
  41. }
  42. // 创建并启动一个进度更新的动画序列,并根据进度执行相关操作的函数
  43. private createAndStartProgressAnimation(): void {
  44. this.OBX6txtv = cc.tween({ progress: 0 })
  45. .to(2.85, { progress: 100 }, {
  46. progress: (start: number, end: number, current: number, ratio: number) => {
  47. // 如果当前节点有效,更新进度标签的文本显示
  48. if (cc.isValid(this.node)) {
  49. this.wxOdV3NSqeDk2e2Prog.string = (ratio * 100 | 0) + " %";
  50. }
  51. // 当进度接近完成时,加载指定场景
  52. if (ratio >= 0.9999999) {
  53. cc.director.loadScene(Vl2h6kBYov1uNSwzL7.u_53B7V);
  54. }
  55. },
  56. easing: "circInOut"
  57. })
  58. .start();
  59. }
  60. }