private void DrawMenuInfo(SpriteBatch spriteBatch) { spriteBatch.DrawString(game.fontManager.GetFont(12), "Difficulty: " + StatsManager.gameMode.ToString(), new Vector2(game.camera.cameraPos.X - Game1.ScreenSize.X / 2 + 8, game.camera.cameraPos.Y - Game1.ScreenSize.Y / 2 + 15) + game.fontManager.FontOffset, game.fontManager.FontColor, .0f, Vector2.Zero, 1f, SpriteEffects.None, 0.92f); spriteBatch.DrawString(game.fontManager.GetFont(12), "Press '" + ControlManager.GetKeyName(RebindableKeys.Pause) + "' to open menu", new Vector2(game.camera.cameraPos.X - Game1.ScreenSize.X / 2 + 8, game.camera.cameraPos.Y - Game1.ScreenSize.Y / 2 + 40) + game.fontManager.FontOffset, game.fontManager.FontColor, .0f, Vector2.Zero, 1f, SpriteEffects.None, 0.92f); spriteBatch.DrawString(game.fontManager.GetFont(12), "Press '" + ControlManager.GetKeyName(RebindableKeys.Inventory) + "' to open inventory", new Vector2(game.camera.cameraPos.X - Game1.ScreenSize.X / 2 + 8, game.camera.cameraPos.Y - Game1.ScreenSize.Y / 2 + 60) + game.fontManager.FontOffset, game.fontManager.FontColor, .0f, Vector2.Zero, 1f, SpriteEffects.None, 0.92f); spriteBatch.DrawString(game.fontManager.GetFont(12), "Press '" + ControlManager.GetKeyName(RebindableKeys.Map) + "' to show map", new Vector2(game.camera.cameraPos.X - Game1.ScreenSize.X / 2 + 8, game.camera.cameraPos.Y - Game1.ScreenSize.Y / 2 + 80) + game.fontManager.FontOffset, game.fontManager.FontColor, .0f, Vector2.Zero, 1f, SpriteEffects.None, 0.92f); spriteBatch.DrawString(game.fontManager.GetFont(12), "Press '" + ControlManager.GetKeyName(RebindableKeys.Missions) + "' to open mission log", new Vector2(game.camera.cameraPos.X - Game1.ScreenSize.X / 2 + 8, game.camera.cameraPos.Y - Game1.ScreenSize.Y / 2 + 100) + game.fontManager.FontOffset, game.fontManager.FontColor, .0f, Vector2.Zero, 1f, SpriteEffects.None, 0.92f); }
public override void OnDisplay() { holdTimer = game.HoldKeyTreshold; cursorIndex = 0; menuOptions[0, 0] = "Control Type:"; if (ControlManager.GamepadReady) { menuOptions[0, 1] = "Gamepad"; } else { menuOptions[0, 1] = "Keyboard"; } menuOptions[1, 0] = "Action 1 / Fire / Confirm"; menuOptions[1, 1] = ControlManager.GetKeyName(RebindableKeys.Action1); menuOptions[2, 0] = "Action 2 / Switch weapons / Back"; menuOptions[2, 1] = ControlManager.GetKeyName(RebindableKeys.Action2); menuOptions[3, 0] = "Action 3"; menuOptions[3, 1] = ControlManager.GetKeyName(RebindableKeys.Action3); menuOptions[4, 0] = "Up"; menuOptions[4, 1] = ControlManager.GetKeyName(RebindableKeys.Up); menuOptions[5, 0] = "Down"; menuOptions[5, 1] = ControlManager.GetKeyName(RebindableKeys.Down); menuOptions[6, 0] = "Left"; menuOptions[6, 1] = ControlManager.GetKeyName(RebindableKeys.Left); menuOptions[7, 0] = "Right"; menuOptions[7, 1] = ControlManager.GetKeyName(RebindableKeys.Right); menuOptions[8, 0] = "Pause / Access Menu"; menuOptions[8, 1] = ControlManager.GetKeyName(RebindableKeys.Pause); menuOptions[9, 0] = "Access Inventory"; menuOptions[9, 1] = ControlManager.GetKeyName(RebindableKeys.Inventory); menuOptions[10, 0] = "Access Map"; menuOptions[10, 1] = ControlManager.GetKeyName(RebindableKeys.Map); menuOptions[11, 0] = "Access Mission Log"; menuOptions[11, 1] = ControlManager.GetKeyName(RebindableKeys.Missions); menuOptions[12, 0] = "Access Help Screen"; menuOptions[12, 1] = ControlManager.GetKeyName(RebindableKeys.Help); menuOptions[13, 0] = "Reset Default Keys"; menuOptions[13, 1] = ""; menuOptions[14, 0] = "Back"; menuOptions[14, 1] = ""; base.OnDisplay(); }
protected override void SetupObjectives() { objectives.Clear(); Objectives.Add(new TimedMessageObjective(Game, this, ObjectiveDescriptions[0], 3000, 3000, PortraitID.Sair, GetEvent((int)EventID.TravelingToAsteroids).Text)); Objectives.Add(new CloseInOnLocationObjective(Game, this, ObjectiveDescriptions[0], 250, new EventTextCapsule(GetEvent((int)EventID.TalkWithCaptain1), null, EventTextCanvas.MessageBox, new List <PortraitID>() { PortraitID.AllianceCaptain, PortraitID.Sair, PortraitID.AllianceCaptain }, new List <int> { 2, 3 }))); CloseInOnLocationObjective talkToCaptainObjective = new CloseInOnLocationObjective(Game, this, ObjectiveDescriptions[0], 100, new EventTextCapsule(GetEvent((int)EventID.TalkWithCaptain2), null, EventTextCanvas.MessageBox, PortraitID.AllianceCaptain)); Objectives.Add(talkToCaptainObjective); objectives.Add(new CustomObjective(Game, this, ObjectiveDescriptions[0], delegate { ReplaceObjectiveText(TextType.Event, ActionKeyID, "'" + ControlManager.GetKeyName(RebindableKeys.Action1) + "'-key", (int)EventID.InLevel2); }, delegate { }, delegate { return(true); }, delegate { return(false); })); ShootingLevelObjective shootingLevelObjective = new ShootingLevelObjective(Game, this, ObjectiveDescriptions[0], "RebelsInTheMeteors", LevelStartCondition.Immediately, new EventTextCapsule(GetEvent((int)EventID.AfterCombat), null, EventTextCanvas.MessageBox, PortraitID.AllianceCaptain)); shootingLevelObjective.SetFailLogic( delegate { Game.player.position = Game.stateManager.overworldState.GetMiningOutpost.GetGameObject("mining asteroids").position; Game.camera.cameraPos = Game.player.position; PopupHandler.DisplayPortraitMessage(PortraitID.AllianceCaptain, "Too bad. Talk to me to try again."); talkToCaptainObjective.Reset(); shootingLevelObjective.Reset(); ObjectiveIndex = 2; } ); Objectives.Add(shootingLevelObjective); Objectives.Add(new TimedMessageObjective(Game, this, ObjectiveDescriptions[1], 3000, 3000, PortraitID.Sair, GetEvent((int)EventID.TravelingBack).Text)); objectives.Add(new ArriveAtLocationObjective(Game, this, ObjectiveDescriptions[1])); }
private void CheckForInput() { menuOptions[cursorIndex, 1] = "Press key"; if (ControlManager.RebindKey(ControlManager.UseGamepad, keyToRebind)) { menuOptions[cursorIndex, 1] = ControlManager.GetKeyName(keyToRebind); checkInput = false; } }
public void SaveSettings() { Game.settingsFile.EmptySaveFile(Game1.SaveFilePath, "settings.ini"); SortedDictionary<String, String> keySaveData = new SortedDictionary<string, string>(); keySaveData.Add("action1", ControlManager.GetKeyName(RebindableKeys.Action1)); keySaveData.Add("action2", ControlManager.GetKeyName(RebindableKeys.Action2)); keySaveData.Add("action3", ControlManager.GetKeyName(RebindableKeys.Action3)); keySaveData.Add("up", ControlManager.GetKeyName(RebindableKeys.Up)); keySaveData.Add("down", ControlManager.GetKeyName(RebindableKeys.Down)); keySaveData.Add("left", ControlManager.GetKeyName(RebindableKeys.Left)); keySaveData.Add("right", ControlManager.GetKeyName(RebindableKeys.Right)); keySaveData.Add("pause", ControlManager.GetKeyName(RebindableKeys.Pause)); keySaveData.Add("inv", ControlManager.GetKeyName(RebindableKeys.Inventory)); keySaveData.Add("map", ControlManager.GetKeyName(RebindableKeys.Map)); keySaveData.Add("log", ControlManager.GetKeyName(RebindableKeys.Missions)); keySaveData.Add("help", ControlManager.GetKeyName(RebindableKeys.Help)); Game.settingsFile.Save(Game1.SaveFilePath, "settings.ini", "keys", keySaveData); SortedDictionary<String, String> visualSaveData = new SortedDictionary<string, string>(); visualSaveData.Add("fullscreen", Game.graphics.IsFullScreen.ToString()); visualSaveData.Add("showfps", Game.ShowFPS.ToString()); visualSaveData.Add("resolutionx", ((int)Game.Resolution.X).ToString()); visualSaveData.Add("resolutiony", ((int)Game.Resolution.Y).ToString()); Game.settingsFile.Save(Game1.SaveFilePath, "settings.ini", "visual", visualSaveData); SortedDictionary<String, String> soundSaveData = new SortedDictionary<string, string>(); soundSaveData.Add("mutemusic", Game.musicManager.IsMusicMuted().ToString()); soundSaveData.Add("musicvolume", Convert.ToString(Game.musicManager.GetMusicVolume(), CultureInfo.InvariantCulture)); soundSaveData.Add("muteSound", Game.soundEffectsManager.isSoundMuted().ToString()); soundSaveData.Add("soundvolume", Convert.ToString(Game.soundEffectsManager.GetSoundVolume(), CultureInfo.InvariantCulture)); soundSaveData.Add("loadsound", SoundEffectsManager.LoadSoundEffects.ToString()); Game.settingsFile.Save(Game1.SaveFilePath, "settings.ini", "sound", soundSaveData); SortedDictionary<String, String> gameOptionsSaveData = new SortedDictionary<string, string>(); gameOptionsSaveData.Add("tutorials", Game.tutorialManager.TutorialsUsed.ToString()); gameOptionsSaveData.Add("showmouse", ControlManager.IsMouseShown().ToString()); Game.settingsFile.Save(Game1.SaveFilePath, "settings.ini", "game options", gameOptionsSaveData); }
/// <summary> /// Draws names of all objects in gameObjects relative to their position /// </summary> /// <param name="spriteBatch"></param> /// <param name="gameObjects">objects which names to be displayed</param> public static void DrawOverlay(SpriteBatch spriteBatch, List <GameObjectOverworld> gameObjects) { if (mapState == MapState.On) { foreach (GameObjectOverworld obj in gameObjects) { spriteBatch.DrawString(FontManager.GetFontStatic(14), obj.name, new Vector2(obj.position.X, obj.position.Y - ((obj.Bounds.Height * obj.scale) / 2) - 300), Color.White, 0f, FontManager.GetFontStatic(14).MeasureString(obj.name) / 2, 55, SpriteEffects.None, 1f); } spriteBatch.DrawString(FontManager.GetFontStatic(14), "Press '" + ControlManager.GetKeyName(RebindableKeys.Map) + "' to hide map..", new Vector2(camera.cameraPos.X, camera.cameraPos.Y + HelpTextOffset), Color.White, 0f, FontManager.GetFontStatic(14).MeasureString("Press '" + ControlManager.GetKeyName(RebindableKeys.Map) + "' to hide map..") / 2, 80, SpriteEffects.None, 1f); } }
public override void StartMission() { ReplaceObjectiveText(TextType.Event, ActionKeyID, "'" + ControlManager.GetKeyName(RebindableKeys.Action2) + "'"); missionHelper.ShowEvent(GetEvent((int)EventID.Introduction)); }
public void DrawEndMessage(SpriteBatch spriteBatch) { if (IsObjectiveCompleted) { spriteBatch.DrawString(font1, "Level Completed!\n\n" + EndText, new Vector2(Game1.ScreenSize.X / 2, Game1.ScreenSize.Y / 2) + Game.fontManager.FontOffset, Game.fontManager.FontColor, 0f, font1.MeasureString("Level Completed!\n\n" + EndText) / 2, 1f, SpriteEffects.None, 0.9f); } else if (IsObjectiveFailed || isLevelGivenUp) { String failText; if (!isPirateLevel) { failText = String.Format("You are dead!\n\nPress 'R' to try again '{0}' to go back.", ControlManager.GetKeyName(RebindableKeys.Action2)); } else { failText = String.Format("You are dead! You lost {0} crebits.\n\nPress '{1}' to go back.", pirateLossPenaly, ControlManager.GetKeyName(RebindableKeys.Action2)); } spriteBatch.DrawString(font1, failText, new Vector2(Game1.ScreenSize.X / 2, Game1.ScreenSize.Y / 2) + Game.fontManager.FontOffset, Game.fontManager.FontColor, 0f, font1.MeasureString(failText) / 2, 1f, SpriteEffects.None, 1f); } }
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."); } } }