예제 #1
0
        protected override void Initialize()
        {
            Game1.GameRestarted = false;

            CreateDirectories();
            SetAvailableResolutions();
            GameStarted = false;

            settingsFile = new SaveFile(this);
            settingsFile.Load(SaveFilePath, "settings.ini");

            Vector2 defaultResolution = GetDefaultResolution();

            resolution = new Vector2(settingsFile.GetPropertyAsFloat("visual", "resolutionx", defaultResolution.X),
                                     settingsFile.GetPropertyAsFloat("visual", "resolutiony", defaultResolution.Y));

            random = new Random(DateTime.Now.Millisecond);

            showFPS = settingsFile.GetPropertyAsBool("visual", "showfps", false);

            // MAC CHANGE - Fullscreen before resolution
            graphics.IsFullScreen = settingsFile.GetPropertyAsBool("visual", "fullscreen", !IsDualMonitor());
            //
            graphics.PreferredBackBufferWidth       = (int)resolution.X;
            graphics.PreferredBackBufferHeight      = (int)resolution.Y;
            graphics.SynchronizeWithVerticalRetrace = true;

            // Uncomment to unlock FPS
            //IsFixedTimeStep = false;
            //graphics.SynchronizeWithVerticalRetrace = false;

            graphics.ApplyChanges();

            // MAC CHANGE - Set ScreenSize to clientbounds after applyChanges
            ScreenSize = new Point((int)Window.ClientBounds.Width, (int)Window.ClientBounds.Height);

            CenterScreenWindow();

            IsMouseVisible = settingsFile.GetPropertyAsBool("game options", "showmouse", true);

            menuBGController = new MenuBackdropController(this);
            menuBGController.Initialize();

            musicManager = new MusicManager(this);
            musicManager.Initialize();

            soundEffectsManager = new SoundEffectsManager(this);
            soundEffectsManager.Initialize();

            fontManager = new FontManager(this);
            fontManager.Initialize();

            ControlManager.LoadControls(settingsFile);

            spriteSheetOverworld       = new Sprite(Content.Load <Texture2D>("Overworld-Sprites/smallObjectSpriteSheet"));
            spriteSheetVerticalShooter = new Sprite(Content.Load <Texture2D>("Vertical-Sprites/shooterSheet"));
            messageBoxSpriteSheet      = new Sprite(Content.Load <Texture2D>("Overworld-Sprites/messageBoxSpriteSheet"));
            spriteSheetItemDisplay     = new Sprite(Content.Load <Texture2D>("itemVisualSheet"));
            beaconMenuSprite           = new Sprite(Content.Load <Texture2D>("Overworld-Sprites/BeaconMenu"));
            CollisionHandlingOverWorld.LoadLineTexture(this);

            shipInventoryManager = new ShipInventoryManager(this);
            shipInventoryManager.Initialize();

            statsManager = new StatsManager(this);
            statsManager.Initialize();

            player = new PlayerOverworld(this, spriteSheetOverworld);
            player.Initialize();

            beaconMenu = new BeaconMenu(this, beaconMenuSprite);
            beaconMenu.Initialize();

            stateManager = new GameStateManager(this);
            stateManager.Initialize();

            missionManager = new MissionManager(this);
            missionManager.Initialize();

            tutorialManager = new TutorialManager(this);
            tutorialManager.Initialize();
            tutorialManager.TutorialsUsed = settingsFile.GetPropertyAsBool("game options", "tutorials", true);

            shopManager = new ShopManager();

            saveFile = new SaveFile(this);

            Portrait.InitializePortraitSpriteSheet(this);
            popupHandler = new PopupHandler(this, messageBoxSpriteSheet);
            popupHandler.Initialize();

            helper = new HelperBox(this);

            ShopManager.SetShopUpdateTime(ShopManager.PRESET_SHOPTIME);

            base.Initialize();
        }
 public override void StartMission()
 {
     MissionManager.RemoveAvailableMission(MissionID.Main9_B_AllianceArc);
     MissionManager.RemoveAvailableMission(MissionID.Main9_C_OnYourOwnArc);
 }
예제 #3
0
        public override void Initialize()
        {
            base.Initialize();

            untriggeredEvents.Add(new SimpleMessageVertical(Game, player, spriteSheet, this, Message1Time, MissionManager.GetMission(MissionID.Main7_Information).GetEvent(Message1Index).Text, PortraitID.RebelTroopLeader));
        }
        private void UpdateTutorialMessages(GameTime gameTime)
        {
            if (!hasEnteredStation && GameStateManager.currentState.Equals("StationState") &&
                game.stateManager.stationState.SubStateManager.ButtonControl == ButtonControl.Menu)
            {
                hasEnteredStation = true;
                DisplayTutorialMessage("You can disable tutorial messages in the options menu.", TutorialImage.MenuControls);
            }

            if (!hasEnteredOverworld && GameStateManager.currentState.Equals("OverworldState"))
            {
                tempTimer -= gameTime.ElapsedGameTime.Milliseconds;

                if (tempTimer < 0)
                {
                    tempTimer           = 50;
                    hasEnteredOverworld = true;

                    DisplayTutorialImage(TutorialImage.OverworldControls);
                }
            }

            else if (!coordinatesDisplayed &&
                     hasEnteredOverworld &&
                     PopupHandler.TextBufferEmpty)
            {
                coordinatesDisplayed = true;

                DisplayTutorialMessage("Your current objective is to go to coordinates (2450, 700). To find that location, follow the blinking dot on your radar. Main missions are represented by gold-colored dots and secondary missions by silver-colored dots.",
                                       TutorialImage.Radar);
            }

            Vector2 highfenceBeaconPosition = game.stateManager.overworldState.GetBeacon("Highfence Beacon").position;

            if (!hasEnteredHighfenceBeaconArea &&
                Vector2.Distance(game.player.position, highfenceBeaconPosition) < BeaconTutorialActivationRadius)
            {
                hasEnteredHighfenceBeaconArea = true;
                DisplayTutorialMessage("This is a 'beacon'. Beacons are used for traveling quickly between planets, but they need to be activated before use. Activate a beacon by flying close to it!");
            }

            if (!hasEnteredVerticalShooter && GameStateManager.currentState.Equals("ShooterState"))
            {
                tempTimer2 -= gameTime.ElapsedGameTime.Milliseconds;

                if (tempTimer2 < 0)
                {
                    tempTimer2 = 500;

                    hasEnteredVerticalShooter = true;
                    DisplayTutorialMessage(new List <String> {
                        "You can rebind the keys in the options menu.",
                        "Down at the bottom-left you can find information about the current level objective, your active weapons and on your ship's health, energy and shields."
                    },
                                           new List <TutorialImage> {
                        TutorialImage.CombatControls, TutorialImage.CombatBars
                    },
                                           new List <int> {
                        1
                    });
                }
            }

            if (!hasEnteredShooterWithShield && !(ShipInventoryManager.equippedShield is EmptyShield) &&
                GameStateManager.currentState.Equals("ShooterState"))
            {
                tempTimer2 -= gameTime.ElapsedGameTime.Milliseconds;

                if (tempTimer2 < 0)
                {
                    tempTimer2 = 500;

                    hasEnteredShooterWithShield = true;
                    DisplayTutorialMessage("You now have a shield to protect your ship's hull! If you take a hit, the shield will absorb the damage if it has enough power.");
                }
            }

            if (equipShieldTutorial &&
                !equipShieldTutorialFinished)
            {
                game.stateManager.stationState.SubStateManager.ShopMenuState.DisplayBuyAndEquip = false;
                switch (equipShieldProgress)
                {
                case 0:
                    if (GameStateManager.currentState.Equals("StationState") &&
                        game.stateManager.stationState.Station.name.Equals("Highfence Shop"))
                    {
                        string message = "[Alliance Pilot] \"Start by selecting 'Buy/Sell' and pressing 'Enter'.";

                        if (!hasRecievedTutorialMoney)
                        {
                            message += " Here is two hundred Crebits, it should cover the cost for the shield.\"";
                        }

                        PopupHandler.DisplayPortraitMessage(PortraitID.AlliancePilot, message);

                        if (!hasRecievedTutorialMoney)
                        {
                            StatsManager.Crebits += 200;
                            PopupHandler.DisplayMessage("You recieved 200 Crebits.");
                            hasRecievedTutorialMoney = true;
                        }

                        equipShieldProgress = 1;
                    }
                    break;

                case 1:
                    if (GameStateManager.currentState.Equals("StationState") &&
                        game.stateManager.stationState.Station.name.Equals("Highfence Shop") &&
                        game.stateManager.stationState.SubStateManager.ActiveMenuState.Equals(game.stateManager.stationState.SubStateManager.ShopMenuState))
                    {
                        PopupHandler.DisplayPortraitMessage(PortraitID.AlliancePilot, "[Alliance Pilot] \"Select the 'Basic shield' in the column to the right and select 'Buy'.\"");
                        equipShieldProgress = 2;
                    }
                    break;

                case 2:
                    if (GameStateManager.currentState.Equals("StationState") &&
                        game.stateManager.stationState.Station.name.Equals("Highfence Shop") &&
                        game.stateManager.stationState.SubStateManager.ActiveMenuState.Equals(game.stateManager.stationState.SubStateManager.ShopMenuState) &&
                        ShipInventoryManager.ownedShields.Count > 0)
                    {
                        PopupHandler.DisplayPortraitMessage(PortraitID.AlliancePilot, "[Alliance Pilot] \"Good! Now exit the shop by selecting and pressing 'Go Back' and return to the overworld!\"");
                        equipShieldProgress = 3;
                    }
                    break;

                case 3:
                    if (GameStateManager.currentState.Equals("OverworldState"))
                    {
                        PopupHandler.DisplayPortraitMessage(PortraitID.AlliancePilot, "[Alliance Pilot] \"Now, press 'I' to access your inventory.\"");
                        equipShieldProgress = 4;
                    }
                    break;

                case 4:
                    if (GameStateManager.currentState.Equals("ShipManagerState"))
                    {
                        PopupHandler.DisplayPortraitMessage(PortraitID.AlliancePilot, "[Alliance Pilot] \"To equip your shield, select the shield slot and press 'Enter' to select from your list of available shields.\"");
                        equipShieldProgress = 5;
                    }
                    break;

                case 5:
                    if (GameStateManager.currentState.Equals("ShipManagerState") &&
                        game.stateManager.shipManagerState.IsShieldSlotSelected)
                    {
                        PopupHandler.DisplayPortraitMessage(PortraitID.AlliancePilot, "[Alliance Pilot] \"Now, press 'Enter' again to equip the selected shield.\"");
                        equipShieldProgress = 6;
                    }
                    break;

                case 6:
                    if (!(ShipInventoryManager.equippedShield is EmptyShield))
                    {
                        PopupHandler.DisplayPortraitMessage(PortraitID.AlliancePilot, "[Alliance Pilot] \"Good! Now your shield is equipped! What parts you have equipped is crucial for your success. Come back here often and try different combinations of ship parts.\"#\"Now, exit the inventory by pressing 'Escape' and return to me!\"");
                        equipShieldTutorialFinished = true;
                    }
                    break;
                }

                if (equipShieldProgress < 2 &&
                    ShipInventoryManager.OwnedShields.Count > 0)
                {
                    PopupHandler.DisplayPortraitMessage(PortraitID.AlliancePilot, "You already bought a shield? Okay, let me tell you how to equip it! Start by pressing 'I' to access your inventory.");
                    equipShieldProgress = 4;
                }
            }

            if (equipShieldTutorialFinished &&
                game.stateManager.stationState.SubStateManager.ShopMenuState.DisplayBuyAndEquip == false)
            {
                game.stateManager.stationState.SubStateManager.ShopMenuState.DisplayBuyAndEquip = true;
            }

            if (ShipInventoryManager.HasItemOfKind("LongShot") &&
                MissionManager.GetMission(MissionID.Main3_DefendColony).MissionState.Equals(StateOfMission.Unavailable) &&
                GameStateManager.currentState.Equals("OverworldState") && !longShotTutorialActivated)
            {
                tempTimer3 -= gameTime.ElapsedGameTime.Milliseconds;

                if (tempTimer3 <= 0)
                {
                    tempTimer3 = 1000;
                    longShotTutorialActivated = true;
                    DisplayTutorialMessage(new List <string>()
                    {
                        String.Format("You have recieved your first long-range weapon: 'LongShot'. You can have two weapons equipped at a time, and you can toggle between them in combat using '{0}'.", ControlManager.GetKeyName(RebindableKeys.Action2)),
                        "Try accessing your inventory with 'I' and equip LongShot on one slot and SpreadBullet on the other. Then you can vary your strategy in combat depending on which enemies you encounter."
                    });
                }
            }

            if (ShipInventoryManager.OwnedSecondary.Count > 0 && GameStateManager.currentState.Equals("OverworldState") &&
                !secondaryWeaponTutorialDisplayed)
            {
                tempTimer3 -= gameTime.ElapsedGameTime.Milliseconds;

                if (tempTimer3 <= 0)
                {
                    tempTimer3 = 1000;
                    secondaryWeaponTutorialDisplayed = true;
                    DisplayTutorialMessage("You have acquired your first secondary weapon! Don't forget to equip it if you havn't done so already. Secondary weapons are fired automatically and don't use energy, so they are very handy!");
                }
            }

            if (isAMissionFailed && GameStateManager.currentState.Equals("OverworldState") &&
                !hasDisplayedSkipMessage)
            {
                tempTimer2 -= gameTime.ElapsedGameTime.Milliseconds;

                if (tempTimer2 < 0)
                {
                    tempTimer2 = 500;

                    hasDisplayedSkipMessage = true;
                    DisplayTutorialMessage("When you fail a mission, you can replay most of them by going back to where they started. Press 'Escape' to skip dialogs and mission events you have already seen.");
                }
            }
        }
예제 #5
0
        private void DrawVisibleGameObjects(SpriteBatch spriteBatch)
        {
            float drawDistance = 0.91f;

            foreach (GameObjectOverworld obj in objectsVisibleOnRadar)
            {
                Color color = ImmovableObjectColor;
                float scale = 1f;
                activeSprite = objectSprite;
                drawDistance = 0.91f;
                bool isHidden = false;

                if (MissionManager.IsCurrentObjectiveDestination(obj) ||
                    MissionManager.IsFailedMissionDestination(obj))
                {
                    drawDistance = 0.92f;
                    if (colorSwapCounter <= 25)
                    {
                        if (MissionManager.IsMainMissionDestination(obj))
                        {
                            color = MainMissionColor;
                        }
                        else
                        {
                            color = SecondaryMissionColor;
                        }
                        activeSprite = blinkingSprite;
                        scale        = 1.25f;
                    }

                    else
                    {
                        color = Color.White;
                        scale = 1f;
                    }

                    if (colorSwapCounter >= 50)
                    {
                        colorSwapCounter = 0;
                    }
                }
                else if (IsObjectAvailableMainMissionLocation(obj) &&
                         MissionManager.IsNoMainMissionActive())
                {
                    drawDistance = 0.92f;
                    if (colorSwapCounter <= 25)
                    {
                        color        = MainMissionColor;
                        activeSprite = blinkingSprite;
                        scale        = 1.25f;
                    }

                    else
                    {
                        color = Color.White;
                        scale = 1f;
                    }

                    if (colorSwapCounter >= 50)
                    {
                        colorSwapCounter = 0;
                    }
                }
                else if (obj.isHidden)
                {
                    isHidden = true;
                }
                else if (obj is FreighterShip)
                {
                    color = FriendlyShipColor;
                }
                else if (obj is RebelShip)
                {
                    if (StatsManager.reputation >= 0)
                    {
                        color = HostileShipColor;
                    }
                    else
                    {
                        color = FriendlyShipColor;
                    }
                }
                else if (obj is AllianceShip ||
                         obj is HangarShip)
                {
                    if (StatsManager.reputation < 0)
                    {
                        color = HostileShipColor;
                    }
                    else
                    {
                        color = FriendlyShipColor;
                    }
                }
                else if (obj is SystemStar)
                {
                    color = Color.White;
                    scale = 1.25f;
                }
                else if (obj is Asteroid)
                {
                    activeSprite = asteroidSprite;
                    color        = AsteroidColor;
                    scale        = 1.5f;
                }
                else if (obj is ShopStation)
                {
                    activeSprite = shopSprite;
                    color        = Color.White;
                    drawDistance = 0.915f;
                }

                if (!isHidden)
                {
                    spriteBatch.Draw(activeSprite.Texture,
                                     new Vector2(Origin.X + ((obj.position.X - View.X) / scaleX), Origin.Y + ((obj.position.Y - View.Y) / scaleY)),
                                     activeSprite.SourceRectangle,
                                     color,
                                     0.0f,
                                     new Vector2(activeSprite.SourceRectangle.Value.Width / 2, activeSprite.SourceRectangle.Value.Height / 2),
                                     scale,
                                     SpriteEffects.None,
                                     drawDistance
                                     );
                }
            }
        }
        public override void Initialize()
        {
            base.Initialize();

            untriggeredEvents.Add(new SimpleMessageVertical(Game, player, spriteSheet, this, Message1Time, MissionManager.GetMission(MissionID.Main4_Infiltration).GetEvent(Message1Index).Text, PortraitID.AllianceCaptain));
        }
예제 #7
0
        private void CheckKeysCursorLevel2()
        {
            if (cursorLevel1Position == 0)
            {
                if (ControlManager.CheckPress(RebindableKeys.Down) && elapsedSinceKey > 100)
                {
                    cursorLevel2Position += 1;

                    if (cursorLevel2Position > MissionManager.ReturnActiveMissions().Count)
                    {
                        cursorLevel2Position = 0;
                    }

                    elapsedSinceKey = 0;
                }

                if (ControlManager.CheckPress(RebindableKeys.Up) && elapsedSinceKey > 100)
                {
                    cursorLevel2Position -= 1;
                    if (cursorLevel2Position < 0)
                    {
                        cursorLevel2Position = MissionManager.ReturnActiveMissions().Count;
                    }

                    elapsedSinceKey = 0;
                }

                if ((ControlManager.CheckPress(RebindableKeys.Action1) || ControlManager.CheckKeyPress(Keys.Enter)) &&
                    elapsedSinceKey > 100)
                {
                    int missionCount = MissionManager.ReturnActiveMissions().Count;

                    if (missionCount > 0 &&
                        cursorLevel2Position == missionCount)
                    {
                        cursorLevel = 1;
                    }

                    elapsedSinceKey = 0;
                }

                if (ControlManager.CheckPress(RebindableKeys.Action2) && elapsedSinceKey > 100)
                {
                    cursorLevel     = 1;
                    elapsedSinceKey = 0;
                }
            }

            else if (cursorLevel1Position == 1)
            {
                if (ControlManager.CheckPress(RebindableKeys.Down) && elapsedSinceKey > 100)
                {
                    cursorLevel2Position += 1;
                    if (cursorLevel2Position > MissionManager.ReturnCompletedDeadMissions().Count)
                    {
                        cursorLevel2Position = 0;
                    }

                    elapsedSinceKey = 0;
                }

                if (ControlManager.CheckPress(RebindableKeys.Up) && elapsedSinceKey > 100)
                {
                    cursorLevel2Position -= 1;
                    if (cursorLevel2Position < 0)
                    {
                        cursorLevel2Position = MissionManager.ReturnCompletedDeadMissions().Count;
                    }

                    elapsedSinceKey = 0;
                }

                if ((ControlManager.CheckPress(RebindableKeys.Action1) || ControlManager.CheckKeyPress(Keys.Enter)) &&
                    elapsedSinceKey > 100)
                {
                    int missionCount = MissionManager.ReturnCompletedDeadMissions().Count;

                    if (missionCount > 0 &&
                        cursorLevel2Position == missionCount)
                    {
                        cursorLevel = 1;
                    }

                    elapsedSinceKey = 0;
                }

                if (ControlManager.CheckPress(RebindableKeys.Action2) && elapsedSinceKey > 100)
                {
                    cursorLevel     = 1;
                    elapsedSinceKey = 0;
                }
            }

            else if (cursorLevel1Position == 2)
            {
                if (ControlManager.CheckPress(RebindableKeys.Down) && elapsedSinceKey > 100)
                {
                    cursorLevel2Position += 1;
                    if (cursorLevel2Position > MissionManager.ReturnFailedDeadMissions().Count)
                    {
                        cursorLevel2Position = 0;
                    }

                    elapsedSinceKey = 0;
                }

                if (ControlManager.CheckPress(RebindableKeys.Up) && elapsedSinceKey > 100)
                {
                    cursorLevel2Position -= 1;
                    if (cursorLevel2Position < 0)
                    {
                        cursorLevel2Position = MissionManager.ReturnFailedDeadMissions().Count;
                    }

                    elapsedSinceKey = 0;
                }

                if ((ControlManager.CheckPress(RebindableKeys.Action1) || ControlManager.CheckKeyPress(Keys.Enter)) &&
                    elapsedSinceKey > 100)
                {
                    int missionCount = MissionManager.ReturnFailedDeadMissions().Count;

                    if (missionCount > 0 &&
                        cursorLevel2Position == missionCount)
                    {
                        cursorLevel = 1;
                    }

                    elapsedSinceKey = 0;
                }

                if (ControlManager.CheckPress(RebindableKeys.Action2) && elapsedSinceKey > 100)
                {
                    cursorLevel     = 1;
                    elapsedSinceKey = 0;
                }
            }
        }