LoginDog.ts 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. import Plat from "../utils/Palt";
  2. import SubLoad from "../utils/SubLoad";
  3. import PrefabUtil from "../utils/manager/PrefabUtil";
  4. import Log from "../utils/util/Log";
  5. const { ccclass, property } = cc._decorator;
  6. @ccclass
  7. export class LoginDog extends cc.Component {
  8. onLoad() {
  9. // console.log("第一个脚本--加载脚本--这里执行了哈哈哈111");
  10. // this.gameVersion.string="v_"+Log.game_version+(Log.test==true?"_测试":"");
  11. // cc.sys.localStorage.clear();
  12. // cc.debug.setDisplayStats(false);
  13. this.flags[0] = 0;
  14. this.scheduleOnce(this.startLoad, 0.2);
  15. }
  16. private flags: Array<number> = new Array();
  17. public onnext() {
  18. console.log(123123);
  19. }
  20. public startLoad() {
  21. SubLoad.loadSub(() => {
  22. PrefabUtil.load((() => {
  23. // console.warn("预制体全部加载完成");
  24. cc.director.preloadScene("Main", () => {
  25. // Log.info("main场景预加载成功")
  26. this.flags[0] = 1;
  27. });
  28. }));
  29. })
  30. Plat.init();
  31. // Log.info("---加载开始---")
  32. }
  33. private p = 40;
  34. private frame_ok: boolean = false;
  35. update() {
  36. this.p += 0.5;
  37. if (this.p > 98) {
  38. this.p = 98;
  39. }
  40. if (this.p < 10) {
  41. this.p = 10;
  42. }
  43. if (this.p > 90 && this.frame_ok == false) {
  44. for (var key in this.flags) {
  45. if (this.flags[key] != 1) {
  46. return;
  47. }
  48. }
  49. console.log("================")
  50. this.frame_ok = true;
  51. }
  52. }
  53. onClickInGame() {
  54. if (!this.frame_ok) {
  55. return;
  56. }
  57. cc.director.loadScene("Main", () => {
  58. // Log.info("main场景加载成功")
  59. });
  60. }
  61. }