Exemple #1
0
    IEnumerator AfterInit(Action <int> process)
    {
        process(40);
        yield return(null);

        //加载游戏配置数据
        Action onGameDataReady = () =>
        {
            lock (MogoWorld.GameDataLocker)
            {
                MogoWorld.IsGameDataReady = true;
                if (MogoWorld.OnGameDataReady != null)
                {
                    Driver.Invoke(MogoWorld.OnGameDataReady);
                }
            }
        };

        GameDataControler.Init(null, onGameDataReady);
        process(45);
        yield return(null);

        //初始化网络模块
        ServerProxy.Instance.Init();
        ServerProxy.Instance.BackToChooseServer = MogoWorld.BackToChooseCharacter;
        process(50);
        yield return(null);

        //启动游戏逻辑
        MogoWorld.Init();
        SoundManager.Init();
        MogoWorld.Start();
        NPCManager.Init();
    }
Exemple #2
0
    void Start()
    {
        goDiver = gameObject;
        Application.targetFrameRate = 30;
        Screen.sleepTimeout         = (int)SleepTimeout.NeverSleep;
        gameObject.AddComponent <LoadResources>();
        var gameData = GameDataControler.Instance;

        if (Application.platform == RuntimePlatform.Android)
        {
            gameObject.AddComponent <PlatformMessageReceiver>();
        }

        SystemConfig.Init((flag) =>
        {
            serverIp = SystemConfig.GetCfgInfoUrl("serverlist");
            gameData.Init(null, () =>
            {
                MogoWorld.Init(MogoWorld.StartGame);
                hasInitFinish = true;
            }, null);
        });
    }