Beispiel #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;
                    ScreenControlManager.Instance.Controls.Add( worldLoadingWindow );
                }
                RenderScene();
            }

            //Delete all GameWindow's
            {
                ttt:
                foreach( EControl control in ScreenControlManager.Instance.Controls )
                {
                    if( control is GameWindow )
                    {
                        ScreenControlManager.Instance.Controls.Remove( control );
                        goto ttt;
                    }
                }
            }

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

            //Error
            foreach( EControl control in ScreenControlManager.Instance.Controls )
            {
                if( control is MessageBoxWindow )
                    return false;
            }

            //create game window
            {
                ScreenControlManager.Instance.Controls.Clear();

                GameWindow gameWindow = null;

                //Create specific game window
                if( GameMap.Instance != null )
                    gameWindow = CreateGameWindowByGameType( GameMap.Instance.GameType );

                if( gameWindow == null )
                    gameWindow = new VHFOSGameWindows();

                ScreenControlManager.Instance.Controls.Add( gameWindow );
            }

            if( string.Compare( fileName, "Maps\\Vietheroes\\Map.map", true ) != 0 )
                GameMusic.MusicPlay("Sounds\\Vietheroes\\NewLegend.mp3", true);

            return true;
        }
Beispiel #2
0
        void CreateGameWindowForMap()
        {
            ScreenControlManager.Instance.Controls.Clear();

            GameWindow gameWindow = null;

            //Create specific game window
            if( GameMap.Instance != null )
                gameWindow = CreateGameWindowByGameType( GameMap.Instance.GameType );

            if( gameWindow == null )
                gameWindow = new VHFOSGameWindows();

            ScreenControlManager.Instance.Controls.Add( gameWindow );
        }