public override Boolean Activate() { Boolean successfullyActivated = false; var eventTextList = new List <String>(); if (!IsCleared()) { eventTextList.Add(eventText); if (ShipInventoryManager.HasAvailableSlot()) { ShipInventoryManager.AddItem(item); ClearEvent(); successfullyActivated = true; } else { eventTextList.Add(inventoryFullText); } } else { eventTextList.Add(clearText); } PopupHandler.DisplayMessage(eventTextList.ToArray()); return(successfullyActivated); }
public static void MarkCompletedMissionAsDead(MissionID missionID) { Mission tempMission = GetMission(missionID); tempMission.CurrentObjectiveDescription = tempMission.ObjectiveCompleted; if (tempMission.MissionState.Equals(StateOfMission.CompletedDead)) { return; } else if (tempMission.MissionState.Equals(StateOfMission.Completed)) { foreach (Item reward in tempMission.RewardItems) { ShipInventoryManager.AddItem(reward); } StatsManager.progress += tempMission.ProgressReward; StatsManager.reputation += tempMission.ReputationReward; StatsManager.Crebits += tempMission.MoneyReward; tempMission.OnCompleted(); tempMission.MissionState = StateOfMission.CompletedDead; } RefreshLists(); }
private void OnAcceptBribe() { ShipInventoryManager.AddItem(rebelBribe); moneyReward = SmallReward; CompletedText = GetEvent((int)EventID.AcceptBribeCompletedText).Text; progress = 1; }
public override void Update(Game1 game, GameTime gameTime) { if (!levelCleared && level != null && level != "") { if (game.stateManager.shooterState.CurrentLevel != null && game.stateManager.shooterState.CurrentLevel.Identifier.ToLower().Equals(level.ToLower()) && game.stateManager.shooterState.CurrentLevel.IsObjectiveFailed && GameStateManager.currentState.ToLower().Equals("overworldstate")) { PopupHandler.DisplayMessage(levelFailedText); game.stateManager.shooterState.GetLevel(level).Initialize(); } else if (game.stateManager.shooterState.CurrentLevel != null && game.stateManager.shooterState.CurrentLevel.Identifier.ToLower().Equals(level.ToLower()) && game.stateManager.shooterState.CurrentLevel.IsObjectiveCompleted && GameStateManager.currentState.ToLower().Equals("overworldstate")) { levelCleared = true; PopupHandler.DisplayMessage(levelCompletedTextStrings.ToArray()); foreach (Item item in itemRewards) { ShipInventoryManager.AddItem(item); } StatsManager.Crebits += moneyReward; ClearEvent(); } } if (startLevelWhenTextCleared && PopupHandler.TextBufferEmpty) { game.stateManager.shooterState.BeginLevel(level); startLevelWhenTextCleared = false; } }
public void DisplayMissionCompletedText() { if (MissionManager.MissionEventBuffer.Count <= 0) { List <String> temp = new List <String>(); Game.SaveOnEnterOverworld = true; BaseStateManager.TextBoxes.Clear(); List <Mission> completedMissions = MissionManager.ReturnCompletedMissions(BaseState.GetBase().name); foreach (String str in completedMissions[0].CompletedText.Split('#')) { temp.Add(str); } SetPortraitFromText(temp[0]); SetTextRectangle(); if (HasReward(completedMissions[0])) { if (HasRewardItem(completedMissions[0])) { if (ShipInventoryManager.HasAvailableSlot()) { temp.Add(GetRewardText(completedMissions[0])); } else { temp.Add(GetNoEmptySlotText(completedMissions[0])); } } else { temp.Add(GetRewardText(completedMissions[0])); } } BaseStateManager.TextBoxes.Add(TextUtils.CreateTextBox(BaseState.Game.fontManager.GetFont(14), tempRect, false, true, temp[0])); MissionManager.MarkCompletedMissionAsDead(completedMissions[0].MissionID); BaseStateManager.ButtonControl = ButtonControl.Confirm; for (int i = 1; i < temp.Count; i++) { MissionManager.MissionEventBuffer.Add(temp[i]); } } }
public static void EquipItemFromSublist(ShipParts kind, int equipPos, int invPos) { List <ShipPart> availablePrimaryWeapons; switch (kind) { case ShipParts.Primary1: { availablePrimaryWeapons = ShipInventoryManager.GetAvailablePrimaryWeapons(1); ShipInventoryManager.equippedPrimaryWeapons.RemoveAt(0); ShipInventoryManager.equippedPrimaryWeapons.Insert(0, (PlayerWeapon)availablePrimaryWeapons[invPos]); break; } case ShipParts.Primary2: { availablePrimaryWeapons = ShipInventoryManager.GetAvailablePrimaryWeapons(2); ShipInventoryManager.equippedPrimaryWeapons.RemoveAt(1); ShipInventoryManager.equippedPrimaryWeapons.Insert(1, (PlayerWeapon)availablePrimaryWeapons[invPos]); break; } case ShipParts.Secondary: { ShipInventoryManager.equippedSecondary = (PlayerWeapon)ShipInventoryManager.ownedSecondary[invPos]; break; } case ShipParts.Plating: { equippedPlating = (PlayerPlating)ShipInventoryManager.ownedPlatings[invPos]; ChangePrimarySlots(equippedPlating.PrimarySlots); break; } case ShipParts.EnergyCell: { ShipInventoryManager.equippedEnergyCell = (PlayerEnergyCell)ShipInventoryManager.ownedEnergyCells[invPos]; break; } case ShipParts.Shield: { ShipInventoryManager.equippedShield = (PlayerShield)ShipInventoryManager.ownedShields[invPos]; break; } default: { throw new ArgumentException("You entered an unimplemented shippart!"); } } UpdateLists(emptyItem); }
private void RemoveItemFromInventory() { foreach (Item i in ShipInventoryManager.ShipItems) { if (i.GetType().Equals(item.GetType())) { ShipInventoryManager.RemoveItem(i); break; } } }
private void ApplyEquipments() { String equipInfo = ""; if (ControlManager.CheckKeyPress(Keys.D1)) { equipInfo = ShipInventoryManager.MapCreatorEquip(1); } if (ControlManager.CheckKeyPress(Keys.D2)) { equipInfo = ShipInventoryManager.MapCreatorEquip(2); } if (ControlManager.CheckKeyPress(Keys.D3)) { equipInfo = ShipInventoryManager.MapCreatorEquip(3); } if (ControlManager.CheckKeyPress(Keys.D4)) { equipInfo = ShipInventoryManager.MapCreatorEquip(4); } if (ControlManager.CheckKeyPress(Keys.D5)) { equipInfo = ShipInventoryManager.MapCreatorEquip(5); } if (ControlManager.CheckKeyPress(Keys.D6)) { equipInfo = ShipInventoryManager.MapCreatorEquip(6); } if (ControlManager.CheckKeyPress(Keys.D7)) { equipInfo = ShipInventoryManager.MapCreatorEquip(7); } if (ControlManager.CheckKeyPress(Keys.D8)) { equipInfo = ShipInventoryManager.MapCreatorEquip(8); } if (ControlManager.CheckKeyPress(Keys.D9)) { equipInfo = ShipInventoryManager.MapCreatorEquip(9); } if (equipInfo != "") { gui.SetEquipInfo(equipInfo); } }
private void CheckStandardEquip(LevelTesterEntry entry) { // Evaluate if chosen entry has standard equipment // If so, assign it to standard equip int standardEq = entry.GetStandardEquip(); if (standardEq != -1) { equipInfo = ShipInventoryManager.MapCreatorEquip(standardEq); } }
public static void DisplayPrimaryWeaponInfo(SpriteBatch spriteBatch) { if (layer == 2) { if (ShipInventoryManager.OwnedPrimaryWeapons.Count > 0) { int slot = layer1YPos + 1; ShipInventoryManager.GetAvailablePrimaryWeapons(slot)[layer2pos].DisplayInventoryInfo( spriteBatch, infoFont, FontManager.FontColorStatic); } } }
private void EquipComponent() { switch (cursorCoordLv1.ToInt()) { case 1: { ShipInventoryManager.EquipItemFromSublist(ShipParts.EnergyCell, 0, cursorLevel2Position); break; } case 2: { ShipInventoryManager.EquipItemFromSublist(ShipParts.Plating, 0, cursorLevel2Position); break; } case 3: { ShipInventoryManager.EquipItemFromSublist(ShipParts.Shield, 0, cursorLevel2Position); break; } case 4: { ShipInventoryManager.EquipItemFromSublist(ShipParts.Secondary, 0, cursorLevel2Position); break; } case 5: { switch (cursorCoordLv1.Y) { case 0: ShipInventoryManager.EquipItemFromSublist(ShipParts.Primary1, cursorCoordLv1.Y, cursorLevel2Position); break; case 1: ShipInventoryManager.EquipItemFromSublist(ShipParts.Primary2, cursorCoordLv1.Y, cursorLevel2Position); break; } break; } default: { throw new ArgumentException("Illegal or non-implemented value tried!"); } } }
public static void CompressInventory() { List <int> removeList = new List <int>(); for (int n = 0; n < ShipInventoryManager.ShipItems.Count; n++) { if (ShipInventoryManager.ShipItems[n].Kind == "Empty") { removeList.Add(n); } } for (int n = removeList.Count; n > 0; n--) { ShipInventoryManager.RemoveItemAt(removeList[n - 1]);; } }
public override Boolean Activate() { itemBought = false; var responseChoices = new List <String>() { "Yes", "No" }; PopupHandler.DisplaySelectionMenu(welcomeText, responseChoices, new List <System.Action>() { delegate { if (!ShipInventoryManager.HasAvailableSlot()) { PopupHandler.DisplayMessage(inventoryFullText); } else if (StatsManager.Crebits >= price) { PopupHandler.DisplayMessage(itemBoughtText); StatsManager.Crebits -= price; ShipInventoryManager.AddItem(item); if (oneTimeOnly) { IsCleared(); } itemBought = true; } else { PopupHandler.DisplayMessage(notEnoughMoneyText); } }, delegate { PopupHandler.DisplayMessage(declinePurchaseText); } }); return(true); }
private static void DisplayList(SpriteBatch spriteBatch, String tag, List <ShipPart> partList, Vector2 startPosition, float deltaY, int slot = 0) { spriteBatch.DrawString(FontManager.GetFontStatic(fontSize), tag, startPosition, FontManager.FontColorStatic); int pos = 1; foreach (ShipPart part in partList) { string name = part.Name; Color color = Color.White; if (!part.Kind.ToLower().Equals("primary") && ShipInventoryManager.IsEquipped(part)) { name += " [equipped]"; } else if (part.Kind.ToLower().Equals("primary") && ShipInventoryManager.IsEquippedAt(part, slot)) { name += " [equipped]"; } if (layer == 2 && layer2pos == partList.IndexOf(part)) { color = FontManager.FontSelectColor1; } spriteBatch.DrawString(FontManager.GetFontStatic(fontSize), name, new Vector2(startPosition.X + 20, startPosition.Y + pos * deltaY), color); pos++; } if (layer == 2) { Color color = Color.White; if (layer2pos == partList.Count) { color = FontManager.FontSelectColor1; } spriteBatch.DrawString(FontManager.GetFontStatic(fontSize), "Back", new Vector2(startPosition.X + 20, startPosition.Y + pos * deltaY), color); } }
// Evaluates if a number key is pressed. If so, tells the ShipInventoryManager // to equip corresponding equipment set. private void ApplyEquipments() { if (ControlManager.CheckKeyPress(Keys.D1)) { equipInfo = ShipInventoryManager.MapCreatorEquip(1); } else if (ControlManager.CheckKeyPress(Keys.D2)) { equipInfo = ShipInventoryManager.MapCreatorEquip(2); } else if (ControlManager.CheckKeyPress(Keys.D3)) { equipInfo = ShipInventoryManager.MapCreatorEquip(3); } else if (ControlManager.CheckKeyPress(Keys.D4)) { equipInfo = ShipInventoryManager.MapCreatorEquip(4); } else if (ControlManager.CheckKeyPress(Keys.D5)) { equipInfo = ShipInventoryManager.MapCreatorEquip(5); } else if (ControlManager.CheckKeyPress(Keys.D6)) { equipInfo = ShipInventoryManager.MapCreatorEquip(6); } else if (ControlManager.CheckKeyPress(Keys.D7)) { equipInfo = ShipInventoryManager.MapCreatorEquip(7); } else if (ControlManager.CheckKeyPress(Keys.D8)) { equipInfo = ShipInventoryManager.MapCreatorEquip(8); } else if (ControlManager.CheckKeyPress(Keys.D9)) { equipInfo = ShipInventoryManager.MapCreatorEquip(9); } else if (ControlManager.CheckKeyPress(Keys.D0)) { equipInfo = ShipInventoryManager.MapCreatorEquip(0); } }
private void OnPressLevel1() { if (cursorCoordLv1.Position != backPos && cursorCoordLv1.Position < 5 && ShipInventoryManager.ownCounts[cursorCoordLv1.Position - 1] > 0) { cursorLevel = 2; cursorLevel2Position = 0; elapsedSinceKey = 0; } else if (cursorCoordLv1.Position == 5) { switch (cursorCoordLv1.Y) { case 0: if (ShipInventoryManager.GetAvailablePrimaryWeapons(1).Count > 0) { cursorLevel = 2; cursorLevel2Position = 0; elapsedSinceKey = 0; } break; case 1: if (ShipInventoryManager.GetAvailablePrimaryWeapons(2).Count > 0) { cursorLevel = 2; cursorLevel2Position = 0; elapsedSinceKey = 0; } break; } } else if (cursorCoordLv1.Position == backPos) { BackToOverworldLogic(); } }
public static void DisplayPrimaryWeaponInfo2(SpriteBatch spriteBatch) { spriteBatch.DrawString(FontManager.GetFontStatic(fontSize), "Primary weapon slot 2", topDisplayPos + FontManager.FontOffsetStatic, FontManager.FontColorStatic, 0, FontManager.GetFontStatic(16).MeasureString("Primary weapon slot 2") / 2, 1.0f, SpriteEffects.None, 0.5f); DisplayList(spriteBatch, "Owned weapons", ShipInventoryManager.GetAvailablePrimaryWeapons(2), equippedDisplayPos + FontManager.FontOffsetStatic, ySpacing, 2); }
public override void StartMission() { ShipInventoryManager.AddItem(medicalSupplies); ObjectiveIndex = 0; progress = 0; }
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."); } } }
public void DisplayMissionAcceptText() { if (SelectedMission.AcceptText[0].ToLower().Equals("empty")) { MissionManager.MarkMissionAsActive(selectedMission.MissionID); BaseStateManager.ChangeMenuSubState("Overview"); BaseStateManager.ActiveButton = BaseStateManager.AllButtons[BaseStateManager.ActiveButtonIndexY]; selectedMission.IntroductionText += "/ok"; return; } if (selectedMission.RequiresAvailableSlot) { if (ShipInventoryManager.HasAvailableSlot()) { String[] temp = SelectedMission.AcceptText[selectedMission.AcceptIndex].Split('#'); SetPortraitFromText(temp[0]); BaseStateManager.TextBoxes.Clear(); MissionManager.MarkMissionAsActive(selectedMission.MissionID); SetTextRectangle(); BaseStateManager.TextBoxes.Add(TextUtils.CreateTextBox(BaseState.Game.fontManager.GetFont(14), tempRect, false, true, temp[0])); if (temp.Length > 1) { for (int i = temp.Length - 1; i > 0; i--) { MissionManager.MissionEventBuffer.Insert(0, temp[i]); } } missionCursorIndex = 0; BaseStateManager.ButtonControl = ButtonControl.Confirm; selectedMission.IntroductionText += "/ok"; } else { DisplayMissionAcceptFailedText(); } } else { String[] temp = SelectedMission.AcceptText[selectedMission.AcceptIndex].Split('#'); SetPortraitFromText(temp[0]); BaseStateManager.TextBoxes.Clear(); MissionManager.MarkMissionAsActive(selectedMission.MissionID); SetTextRectangle(); BaseStateManager.TextBoxes.Add(TextUtils.CreateTextBox(BaseState.Game.fontManager.GetFont(14), tempRect, false, true, temp[0])); if (temp.Length > 1) { for (int i = temp.Length - 1; i > 0; i--) { MissionManager.MissionEventBuffer.Insert(0, temp[i]); } } missionCursorIndex = 0; BaseStateManager.ButtonControl = ButtonControl.Confirm; selectedMission.IntroductionText += "/ok"; } }
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(); }
private void CheckMouseLevel2() { int listLength; string text = ""; if (cursorCoordLv1.Position != 5) { listLength = ShipInventoryManager.ownCounts[cursorCoordLv1.Position - 1]; } else { if (cursorCoordLv1.Y == 0) { listLength = ShipInventoryManager.GetAvailablePrimaryWeapons(1).Count; } else { listLength = ShipInventoryManager.GetAvailablePrimaryWeapons(2).Count; } } for (int i = 0; i < listLength + 1; i++) { if (i < listLength) { if (cursorCoordLv1.Position != 5) { if (cursorCoordLv1.Position == 1) { text = ShipInventoryManager.ownedEnergyCells[i].Name; } else if (cursorCoordLv1.Position == 2) { text = ShipInventoryManager.ownedPlatings[i].Name; } else if (cursorCoordLv1.Position == 3) { text = ShipInventoryManager.ownedShields[i].Name; } else if (cursorCoordLv1.Position == 4) { text = ShipInventoryManager.OwnedSecondary[i].Name; } } else { if (cursorCoordLv1.Y == 0) { text = ShipInventoryManager.GetAvailablePrimaryWeapons(1)[i].Name; } else { text = ShipInventoryManager.GetAvailablePrimaryWeapons(2)[i].Name; } } } else { text = "Back"; } if (ControlManager.IsMouseOverText(FontManager.GetFontStatic(16), text, new Vector2(Game1.ScreenSize.X / 2 + 50, 93 + i * 23), Vector2.Zero, false)) { cursorLevel2Position = i; if (ControlManager.IsLeftMouseButtonClicked()) { if (cursorLevel2Position < listLength) { OnPressLevel2(); } else { cursorLevel = 1; elapsedSinceKey = 0; } } } } }
private void CheckKeysLevel2(GameTime gameTime) { if (cursorLevel == 2 && cursorCoordLv1.Position != inventoryPos) { int listLength; if (cursorCoordLv1.Position != 5) { listLength = ShipInventoryManager.ownCounts[cursorCoordLv1.Position - 1]; } else { if (cursorCoordLv1.Y == 0) { listLength = ShipInventoryManager.GetAvailablePrimaryWeapons(1).Count; } else { listLength = ShipInventoryManager.GetAvailablePrimaryWeapons(2).Count; } } if (ControlManager.CheckPress(RebindableKeys.Down) && cursorLevel == 2 && elapsedSinceKey > elapseDelay) { cursorLevel2Position += 1; if (cursorLevel2Position > listLength) { cursorLevel2Position = 0; } elapsedSinceKey = 0; holdTimer = Game.HoldKeyTreshold; } else if (ControlManager.CheckHold(RebindableKeys.Down)) { holdTimer -= gameTime.ElapsedGameTime.Milliseconds; if (holdTimer <= 0) { cursorLevel2Position += 1; if (cursorLevel2Position > listLength) { cursorLevel2Position = listLength; } elapsedSinceKey = 0; holdTimer = Game.ScrollSpeedFast; } } if (ControlManager.CheckPress(RebindableKeys.Up) && cursorLevel == 2 && elapsedSinceKey > elapseDelay) { cursorLevel2Position -= 1; if (cursorLevel2Position < 0) { cursorLevel2Position = listLength; } elapsedSinceKey = 0; holdTimer = Game.HoldKeyTreshold; } else if (ControlManager.CheckHold(RebindableKeys.Up)) { holdTimer -= gameTime.ElapsedGameTime.Milliseconds; if (holdTimer <= 0) { cursorLevel2Position -= 1; if (cursorLevel2Position < 0) { cursorLevel2Position = 0; } elapsedSinceKey = 0; holdTimer = Game.ScrollSpeedFast; } } //This is where the magic happens. if (((ControlManager.CheckPress(RebindableKeys.Action1) || ControlManager.CheckKeyPress(Keys.Enter)) && cursorLevel == 2 && elapsedSinceKey > elapseDelay)) { if (cursorLevel2Position < listLength) { OnPressLevel2(); } else { cursorLevel = 1; elapsedSinceKey = 0; } } if (ControlManager.CheckPress(RebindableKeys.Action2) && cursorLevel == 2 && elapsedSinceKey > elapseDelay) { cursorLevel = 1; elapsedSinceKey = 0; } } }
private void DeveloperOptions() { if (ControlManager.CheckKeyPress(Keys.D1)) { Game.stateManager.shooterState.BeginLevel("flightTraining_1"); } if (ControlManager.CheckKeyPress(Keys.D2)) { Game.stateManager.shooterState.BeginLevel("flightTraining_2"); } if (ControlManager.CheckKeyPress(Keys.D3)) { Game.stateManager.shooterState.BeginLevel("flightTraining_3"); } if (ControlManager.CheckKeyPress(Keys.D0)) { Game.stateManager.shooterState.BeginLevel("JakobDevelop"); } if (ControlManager.CheckKeyPress(Keys.D9)) { Game.stateManager.shooterState.BeginLevel("mapCreator2"); } if (ControlManager.CheckKeyPress(Keys.NumPad0)) { ShipInventoryManager.ActivateCheatPrimary(); } if (ControlManager.CheckKeyPress(Keys.NumPad1)) { ShipInventoryManager.ActivateCheatSecondary(); } if (ControlManager.CheckKeyPress(Keys.NumPad2)) { ShipInventoryManager.ActivateCheatEnergy(); } if (ControlManager.CheckKeyPress(Keys.NumPad3)) { ShipInventoryManager.ActivateCheatShield(); } if (ControlManager.CheckKeyPress(Keys.NumPad4)) { ShipInventoryManager.ActivateCheatPlating(); } if (ControlManager.CheckKeyPress(Keys.NumPad5)) { ShipInventoryManager.ActivateCheatEquip1(); } if (ControlManager.CheckKeyPress(Keys.NumPad6)) { ShipInventoryManager.ActivateCheatEquip2(); } }
private void ItemComparision() { switch (cursorLevel) { case 1: { itemComp.OkayToClearStats = true; itemComp.OkayToClearSymbols = true; break; } case 2: { switch (cursorCoordLv1.ToInt()) { case 1: if (cursorLevel2Position < ShipInventoryManager.ownedEnergyCells.Count) { itemComp.SetItem2(ShipInventoryManager.ownedEnergyCells[cursorLevel2Position]); itemComp.SetItem1(ShipInventoryManager.equippedEnergyCell); itemComp.ShowSymbols = true; } else { itemComp.OkayToClearStats = true; itemComp.OkayToClearSymbols = true; } break; case 2: if (cursorLevel2Position < ShipInventoryManager.ownedPlatings.Count) { itemComp.SetItem2(ShipInventoryManager.OwnedPlatings[cursorLevel2Position]); itemComp.SetItem1(ShipInventoryManager.equippedPlating); itemComp.ShowSymbols = true; } else { itemComp.OkayToClearStats = true; itemComp.OkayToClearSymbols = true; } break; case 3: if (cursorLevel2Position < ShipInventoryManager.ownedShields.Count) { itemComp.SetItem2(ShipInventoryManager.ownedShields[cursorLevel2Position]); itemComp.SetItem1(ShipInventoryManager.equippedShield); itemComp.ShowSymbols = true; } else { itemComp.OkayToClearStats = true; itemComp.OkayToClearSymbols = true; } break; case 4: if (cursorLevel2Position < ShipInventoryManager.OwnedSecondary.Count) { itemComp.SetItem2(ShipInventoryManager.OwnedSecondary[cursorLevel2Position]); itemComp.SetItem1(ShipInventoryManager.equippedSecondary); itemComp.ShowSymbols = true; } else { itemComp.OkayToClearStats = true; itemComp.OkayToClearSymbols = true; } break; case 5: if (cursorCoordLv1.Y == 0) { if (cursorLevel2Position < ShipInventoryManager.GetAvailablePrimaryWeapons(1).Count) { itemComp.SetItem2(ShipInventoryManager.GetAvailablePrimaryWeapons(1)[cursorLevel2Position]); itemComp.SetItem1(ShipInventoryManager.equippedPrimaryWeapons[0]); itemComp.ShowSymbols = true; } else { itemComp.OkayToClearStats = true; itemComp.OkayToClearSymbols = true; } } else if (cursorCoordLv1.Y == 1) { if (cursorLevel2Position < ShipInventoryManager.GetAvailablePrimaryWeapons(2).Count) { itemComp.SetItem2(ShipInventoryManager.GetAvailablePrimaryWeapons(2)[cursorLevel2Position]); itemComp.SetItem1(ShipInventoryManager.equippedPrimaryWeapons[1]); itemComp.ShowSymbols = true; } else { itemComp.OkayToClearStats = true; itemComp.OkayToClearSymbols = true; } } break; } break; } } }
public void Draw(SpriteBatch spriteBatch) { foreach (ShipInventoryDisplayObject dispObj in displayList) { dispObj.Draw(spriteBatch); } if (back.isActive) { ShipManagerText.DisplayBackInfo(spriteBatch); } else if (primaryDisplay.isActive) { ShipManagerText.DisplayPrimaryWeaponInfo1(spriteBatch); if (layer >= 2 && cursorLv2Pos < ShipInventoryManager.GetAvailablePrimaryWeapons(1).Count) { InventoryInformation.DisplayPrimaryWeaponInfo(spriteBatch); } } else if (primaryDisplay2.isActive) { ShipManagerText.DisplayPrimaryWeaponInfo2(spriteBatch); if (layer >= 2 && cursorLv2Pos < ShipInventoryManager.GetAvailablePrimaryWeapons(2).Count) { InventoryInformation.DisplayPrimaryWeaponInfo(spriteBatch); } } else if (secondaryDisplay.isActive) { ShipManagerText.DisplaySecondaryInfo(spriteBatch); if (layer >= 2 && cursorLv2Pos < ShipInventoryManager.OwnedSecondary.Count) { InventoryInformation.DisplaySecondaryWeaponInfo(spriteBatch); } } else if (platingDisplay.isActive) { ShipManagerText.DisplayPlatingInfo(spriteBatch); if (layer >= 2 && cursorLv2Pos < ShipInventoryManager.ownedPlatings.Count) { InventoryInformation.DisplayPlatingInfo(spriteBatch); } } else if (cellDisplay.isActive) { ShipManagerText.DisplayEnergyCellInfo(spriteBatch); if (layer >= 2 && cursorLv2Pos < ShipInventoryManager.ownedEnergyCells.Count) { InventoryInformation.DisplayEnergyCellInfo(spriteBatch); } } else if (shieldDisplay.isActive) { ShipManagerText.DisplayShieldInfo(spriteBatch); if (layer >= 2 && cursorLv2Pos < ShipInventoryManager.ownedShields.Count) { InventoryInformation.DisplayShieldInfo(spriteBatch); } } //if (inventoryDisplay.isActive && cursorLv3Pos != -1) // Why was this here to begin with? /Jakob 140615 //if (inventoryDisplay.isActive) //{ // ShipManagerText.DisplayInventory(spriteBatch, Game.Resolution); // // if (layer >= 2) // InventoryInformation.DisplayInventoryInfo(spriteBatch); //} }