예제 #1
0
        public bool WorldLoad(string fileName)
        {
            EControl worldLoadingWindow = null;

            //world loading window
            {
                worldLoadingWindow = ControlDeclarationManager.Instance.CreateControl(
                    "Gui\\WorldLoadingWindow.gui");
                if (worldLoadingWindow != null)
                {
                    worldLoadingWindow.Text = fileName;
                    controlManager.Controls.Add(worldLoadingWindow);
                }
                RenderScene();
            }

            DeleteAllGameWindows();

            //Subcribe to callbacks during engine loading. We will render scene from callback.
            LongOperationCallbackManager.Subscribe(LongOperationCallbackManager_LoadingCallback,
                                                   worldLoadingWindow);

            if (!MapSystemWorld.WorldLoad(WorldSimulationTypes.Single, fileName))
            {
                if (worldLoadingWindow != null)
                {
                    worldLoadingWindow.SetShouldDetach();
                }

                LongOperationCallbackManager.Unsubscribe();

                return(false);
            }

            //Update shadow settings. This operation can be slow because need update all
            //shaders if shadow technique changed.
            Map.Instance.UpdateSceneManagerShadowSettings();

            fullscreenFadingRemainingFrames = 35;

            LongOperationCallbackManager.Unsubscribe();

            //Error
            foreach (EControl control in controlManager.Controls)
            {
                if (control is MessageBoxWindow && !control.IsShouldDetach())
                {
                    return(false);
                }
            }

            //create game window
            CreateGameWindowForMap();

            //play music
            if (GameMap.Instance != null)
            {
                GameMusic.MusicPlay(GameMap.Instance.GameMusic, true);
            }

            return(true);
        }