LoginDog.ts 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. @property(cc.Node)
  9. startGame: cc.Node = null;
  10. @property(cc.ProgressBar)
  11. ProgressBar: cc.ProgressBar = null;
  12. onLoad() {
  13. this.scheduleOnce(this.startLoad, 0);
  14. }
  15. // private flags: Array<number> = new Array();
  16. public onnext() {
  17. }
  18. public startLoad() {
  19. SubLoad.loadSub(() => {
  20. PrefabUtil.load((() => {
  21. cc.director.preloadScene("Main", (a, b) => {
  22. let temp = a / b * 0.1
  23. this.ProgressBar.progress = this.ProgressBar.progress < temp ? temp : this.ProgressBar.progress + 0.9
  24. this.ProgressBar.node.active = false
  25. // this.startGame.active = true
  26. this.onClickInGame()
  27. });
  28. }), (a, b) => {
  29. let temp = a / b * 0.9
  30. this.ProgressBar.progress = this.ProgressBar.progress < temp ? temp : this.ProgressBar.progress
  31. });
  32. })
  33. Plat.init();
  34. }
  35. onClickInGame() {
  36. cc.director.loadScene("Main", () => {
  37. // Log.info("main场景加载成功")
  38. });
  39. }
  40. }