Ejemplo n.º 1
0
        /// <summary>
        /// menu processor
        /// </summary>
        void menu_OnExit(GameScreen_MenuScreen menu)
        {
            switch (menu.iResult)
            {
                case MenuReturnCodes.Error:
                case MenuReturnCodes.Exit:
                    Exit();
                    break;
                case MenuReturnCodes.GameStartRequested:
                    /*switch (loading_stage)
                    {
                        case -1: //show loading UI and find items to load
                            menu_DestroyBackground();
                            this.menu = menu.oResult as GameScreen_MenuScreen;
                            this.menu.OnExit += menu_OnExit;
                            this.menu.LoadAndInitialize();

                            loading_stages.Clear();
                            //obligatory loadings
                            loading_stages.Add(GameLoadingStages.Load_Motors);
                            loading_stages.Add(GameLoadingStages.Load_Map_Parameters);
                            loading_stages.Add(GameLoadingStages.Load_Map_Points);
                            loading_stages.Add(GameLoadingStages.Load_Map_Edges);
                            loading_stages.Add(GameLoadingStages.Load_Map_SpawnPoints);
                            loading_stages.Add(GameLoadingStages.Load_Map_Sectors);
                            loading_stages.Add(GameLoadingStages.Load_Map_Rectangles);
                            loading_stages.Add(GameLoadingStages.Load_Map_CleanUp);
                            loading_stages.Add(GameLoadingStages.Load_Map_Draw_10);
                            loading_stages.Add(GameLoadingStages.Load_Map_Draw_20);
                            loading_stages.Add(GameLoadingStages.Load_Map_Draw_30);
                            loading_stages.Add(GameLoadingStages.Load_Map_Draw_40);
                            loading_stages.Add(GameLoadingStages.Load_Map_Draw_50);
                            loading_stages.Add(GameLoadingStages.Load_Map_Draw_60);
                            loading_stages.Add(GameLoadingStages.Load_Map_Draw_70);
                            loading_stages.Add(GameLoadingStages.Load_Map_Draw_80);
                            loading_stages.Add(GameLoadingStages.Load_Map_Draw_90);
                            loading_stages.Add(GameLoadingStages.Load_Map_Draw_100);
                            loading_stages.Add(GameLoadingStages.Load_Map_Slice);
                            loading_stages.Add(GameLoadingStages.Load_Map_MiscSettings);
                            //non-obligatory but map dependent loadings (need to use though not need to execute)
                            loading_stages.Add(GameLoadingStages.Load_Map_Bonuses_25);
                            loading_stages.Add(GameLoadingStages.Load_Map_Bonuses_50);
                            loading_stages.Add(GameLoadingStages.Load_Map_Bonuses_75);
                            loading_stages.Add(GameLoadingStages.Load_Map_Bonuses_100);
                            //obligatory
                            loading_stages.Add(GameLoadingStages.Load_GFX_StartCounter);
                            loading_stages.Add(GameLoadingStages.Load_GFX_FinishImages);
                            loading_stages.Add(GameLoadingStages.Load_GFX_BumpExplosion);
                            loading_stages.Add(GameLoadingStages.Load_GFX_MotorExplosion);
                            if (GameSettings.audioEnabled)
                            {
                                loading_stages.Add(GameLoadingStages.Load_SFX_Background);
                                loading_stages.Add(GameLoadingStages.Load_SFX_Explosions);
                            }

                            loading_stage++;
                            break;
                        default:
                            switch (loading_stages[loading_stage])
                            {
                                case GameLoadingStages.Load_Motors:
                                    break;
                            }
                            loading_stage++;
                            break;
                    }*/
                    menu_DestroyBackground();
                    UIParent.UI.Clear();
                    int cameraStickBikeID = -1;
                    int playerBikeID = -1;
                    for (int i = 0; i < GameSettings.gameSlots.Length; i++)
                        if (GameSettings.gameSlots[i] != null)
                        {
                            if ((GameSettings.gameSlots[i].type == typeof(PlayerMotor)) && (GameSettings.gameSlots[i].playerID != -1))
                            {
                                playerBikeID = i;
                                break;
                            }
                            if ((cameraStickBikeID == -1) && (GameSettings.gameSlots[i].type == typeof(BotMotor)))
                                cameraStickBikeID = i;
                        }
                    GameSettings.gamePlayScreen = new GamePlay();
                    GameSettings.gamePlayScreen.LoadAndInitialize(currentTime, (playerBikeID != -1 ? playerBikeID : cameraStickBikeID));
                    this.menu = new GameScreen_GameUI(game, (playerBikeID != -1 ? playerBikeID : cameraStickBikeID), 800, 600);
                    this.menu.OnExit += menu_OnExit;
                    this.menu.LoadAndInitialize();
                    break;
                case MenuReturnCodes.GameJoinRequested:
                    //menu_DestroyBackground();
                    break;
                case MenuReturnCodes.MenuStartRequested:
                    this.menu = new GameScreen_Main(this);
                    this.menu.OnExit += menu_OnExit;
                    this.menu.LoadAndInitialize();
                    menu_InitBackground();
                    break;
                case MenuReturnCodes.MenuSwitching:
                    this.menu = menu.oResult as GameScreen_MenuScreen;
                    this.menu.OnExit += menu_OnExit;
                    this.menu.LoadAndInitialize();
                    break;
            }
        }
Ejemplo n.º 2
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

            LayerBlendState = new BlendState();
            LayerBlendState.ColorSourceBlend = LayerBlendState.AlphaSourceBlend = Blend.SourceAlpha;
            LayerBlendState.ColorBlendFunction = LayerBlendState.AlphaBlendFunction = BlendFunction.Add;
            LayerBlendState.ColorDestinationBlend = LayerBlendState.AlphaDestinationBlend = Blend.InverseSourceAlpha;

            SetGraphMode(GameSettings.videoGraphMode, GameSettings.videoFullscreen);
            for (int i = 0; i < layerTargets.Length; i++)
            {
                if (layerTargets[i] != null)
                    layerTargets[i].Dispose();
                layerTargets[i] = new RenderTarget2D(GraphicsDevice, 800, 600, false, SurfaceFormat.Color, DepthFormat.Depth24, 1, RenderTargetUsage.PreserveContents);
                GraphicsDevice.SetRenderTarget(layerTargets[i]);
                GraphicsDevice.Clear(Color.Transparent);
            }
            GraphicsDevice.SetRenderTarget(null);

            mCursor.LoadAndInitialize();
            mCursor.Visible = true;

            //create UI
            UI = new UIParent(this);
            //CreateTestUI();
            //CreateSteeringTestUI();
            //UI.LoadAndInitialize();

            menu = new GameScreen_Main(this);
            menu.OnExit += menu_OnExit;
            menu.LoadAndInitialize();
            menu_InitBackground();
        }