示例#1
0
        // called before screen shows
        public override void SetFocus(ContentManager content, bool focus)
        {
            // if getting focus
            if (focus == true)
            {
                // load all resources
                confirmed[0] = false;
                confirmed[1] = (gameManager.GameMode == GameMode.SinglePlayer);

                rotation[0] = Matrix.Identity;
                rotation[1] = Matrix.Identity;

                lights = LightList.Load("content/screens/player_lights.xml");

                for (int i = 0; i < NumberShips; i++)
                {
                    shipModels[i] = content.Load <Model>(
                        "ships/" + ships[i]);
                    FixupShip(shipModels[i], "ships/" + ships[i]);
                }

                padModel       = content.Load <Model>("ships/pad");
                padHaloModel   = content.Load <Model>("ships/pad_halo");
                padSelectModel = content.Load <Model>("ships/pad_select");

                textureChangeShip = content.Load <Texture2D>(
                    "screens/change_ship");
                textureRotateShip = content.Load <Texture2D>(
                    "screens/rotate_ship");
                textureSelectBack = content.Load <Texture2D>(
                    "screens/select_back");
                textureSelectCancel = content.Load <Texture2D>(
                    "screens/select_cancel");
                textureInvertYCheck = content.Load <Texture2D>(
                    "screens/inverty_check");
                textureInvertYUncheck = content.Load <Texture2D>(
                    "screens/inverty_uncheck");
            }
            else // loosing focus
            {
                // free all resources
                lights = null;

                for (int i = 0; i < NumberShips; i++)
                {
                    shipModels[i] = null;
                }

                padModel       = null;
                padHaloModel   = null;
                padSelectModel = null;

                textureChangeShip     = null;
                textureRotateShip     = null;
                textureSelectBack     = null;
                textureSelectCancel   = null;
                textureInvertYCheck   = null;
                textureInvertYUncheck = null;
            }
        }
示例#2
0
        // called before screen shows
        public override void SetFocus(ContentManager content, bool focus)
        {
            // if getting focus
            if (focus)
            {
                // load all resources
                int winner = gameManager.PlayerWinner;

                shipModel = content.Load <Model>("ships/" +
                                                 gameManager.GetPlayerShip(winner));

                padModel     = content.Load <Model>("ships/pad");
                padHaloModel = content.Load <Model>("ships/pad_halo");

                lights = LightList.Load("content/screens/end_lights.xml");

                textureContinue = content.Load <Texture2D>("screens/continue");
                if (winner == 0)
                {
                    texturePlayerWin = content.Load <Texture2D>(
                        "screens/player1_wins");
                }
                else
                {
                    texturePlayerWin = content.Load <Texture2D>(
                        "screens/player2_wins");
                }
            }
            else // loosing focus
            {
                // free all resources
                shipModel    = null;
                padModel     = null;
                padHaloModel = null;

                lights = null;

                textureContinue  = null;
                texturePlayerWin = null;
            }
        }