123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- import { Component, game, UIRenderer, _decorator, Game, SpriteFrame, ProgressBar, assetManager } from 'cc';
- import { ViewID } from '../framework/config/LayerConf';
- import { Framework } from '../framework/Framework';
- import { GameEvent } from './data/GameEvent';
- import { MaterialUtil, ProcessData } from '../framework/util/MaterialUtil';
- import { NetManager } from './common/NetManager';
- import { FrameworkConf } from '../framework/config/FrameworkConf';
- import { resLoader } from '../framework/res/ResLoader';
- import { UnionManager } from './manager/UnionManager';
- const { ccclass, property } = _decorator;
- game.frameRate = 59;
- function getParameterByName(name) {
- let url = window.location.href;
- name = name.replace(/[\[\]]/g, "\\$&");
- const regex = new RegExp(`[?&]${name}(=([^&#]*)|&|#|$)`);
- const results = regex.exec(url);
- if (!results) return null;
- if (!results[2]) return '';
- return decodeURIComponent(results[2].replace(/\+/g, ' '));
-
- }
- @ccclass('Main')
- export class Main extends Component {
-
- @property(ProgressBar)
- mainProgress: ProgressBar = null;
-
- @property(ProgressBar)
- subProgress: ProgressBar = null;
- private _uid = "";
-
- hideTime = 0;
-
- reconnectTime = 2000;
- onLoad() {
- Framework.event.addEvent(FrameworkConf.Event.GAME_SHOW, this.gameEvent_onShow, this);
- Framework.event.addEvent(FrameworkConf.Event.GAME_HIDE, this.gameEvent_onHide, this);
-
- let loginbg = this.node.getChildByPath('loginbg');
- Framework.unionManager = UnionManager;
-
-
- MaterialUtil.init(this.finishBack.bind(this));
-
- }
- finishBack(process:ProcessData){
- if(this.mainProgress.progress == 1) return
-
- let mainProgressPercent = process.curMain/process.maxMain
- if(mainProgressPercent>=1){
- this.mainProgress.progress = 1
- Framework.layer.open(ViewID.LoginUI, null, () => {
-
- });
- return
- }
- else if(mainProgressPercent < 0){
- this.mainProgress.progress = 0
- }
-
- this.mainProgress.progress = mainProgressPercent
- }
- gameEvent_onShow() {
-
-
-
-
- }
- gameEvent_onHide() {
-
- }
- }
|