private void CenterPlayer(GameTime gameTime) { int playerIndex = -1; for (int k = 0; k < menuHighscoreName.Length; k++) { string playerName = Helpers.StripOutAmpersands(FrameworkCore.players[0].commanderName); if (System.String.Compare(menuHighscoreName[k], playerName, true, CultureInfo.InvariantCulture) == 0) { //found player name. playerIndex = k; break; } } if (playerIndex < 0) { //couldn't find player. FrameworkCore.PlayCue(sounds.click.error); return; } FrameworkCore.PlayCue(sounds.click.activate); offset = ((LINESIZE * playerIndex) * -1f) + HEADERSIZE; }
private void ClickButton() { if (selectedInventoryIndex < 0) { return; } FrameworkCore.PlayCue(sounds.click.activate); if (selectedInventoryIndex <= 1) { //click on a inventorySlot. bool slotOccupied = (FrameworkCore.players[0].campaignShips[selectedIndex].upgradeArray[selectedInventoryIndex] != null); InventoryPopup popup = new InventoryPopup(Owner, slotOccupied); Owner.AddMenu(popup); ResetMenuPositions(); } else { //click on an additionalButton. if (FrameworkCore.players.Count > 1 && selectedInventoryIndex == 2) { //coop FrameworkCore.players[0].campaignShips[selectedIndex].childShip = !FrameworkCore.players[0].campaignShips[selectedIndex].childShip; } else { Deactivate(); } } }
private void OnSelectItem(object sender, EventArgs e) { Deactivate(); if (sender.GetType() != typeof(InventoryMenuItem)) { return; } if (((InventoryMenuItem)sender).inventoryItem == null) { return; } FrameworkCore.PlayCue(sounds.Fanfare.drill); for (int i = 0; i < Owner.menus.Count; i++) { if (Owner.menus[i].GetType() == typeof(FleetMenu)) { ((FleetMenu)Owner.menus[i]).ApplyItem(((InventoryMenuItem)sender).inventoryItem); break; } } }
public void OnlineError() { if (FrameworkCore.isTrialMode()) { return; } SysPopup signPrompt = new SysPopup(FrameworkCore.sysMenuManager, Resource.MenuHighScoreSendError); signPrompt.transitionOnTime = 200; signPrompt.transitionOffTime = 200; signPrompt.darkenScreen = true; signPrompt.hideChildren = false; signPrompt.sideIconRect = sprite.windowIcon.error; MenuItem item = new MenuItem(Resource.MenuOK); item.Selected += CloseMenu; signPrompt.AddItem(item); FrameworkCore.sysMenuManager.AddMenu(signPrompt); FrameworkCore.PlayCue(sounds.click.error); }
public override void Update(GameTime gameTime, InputManager inputManager) { if (!hasLoadedStorage && !Helpers.GuideVisible) { try { hasLoadedStorage = true; StorageDevice.BeginShowSelector(new AsyncCallback(LoadHighScoresCallback), null); } catch { hasLoadedStorage = false; } return; } sizeTimer += (float)gameTime.ElapsedGameTime.TotalSeconds; if (sizeTimer < 0.3f) { return; } if (!hasPlayedMusic) { hasPlayedMusic = true; FrameworkCore.PlayCue(sounds.Music.raindrops01); } if (Transition >= 1) { for (int i = 0; i < 4; i++) { if (FrameworkCore.MenuInputs[i].buttonAPressed || FrameworkCore.MenuInputs[i].buttonStartPressed) { DoneTitle(); } } if (inputManager.buttonAPressed || inputManager.buttonStartPressed || inputManager.kbSkipScreen || inputManager.mouseLeftClick || inputManager.kbEscPressed) { DoneTitle(); } } if (sizeTimer >= 7) { DoneTitle(); } base.Update(gameTime, inputManager); }
private void CancelPlayerItemSelect() { FrameworkCore.PlayCue(sounds.click.back); ClearStates(); tradeState = TradeState.selectTraderItem; }
private void OnButtonChange(GameButton gameBtn, JoyAxis axis) { //change the option. if (gameBtn == GameButton.moveforward) { FrameworkCore.options.joyMoveForwardAxis = (int)axis; } else if (gameBtn == GameButton.movestrafe) { FrameworkCore.options.joyMoveStrafeAxis = (int)axis; } else if (gameBtn == GameButton.lookhoriz) { FrameworkCore.options.joyLookStrafeAxis = (int)axis; } else if (gameBtn == GameButton.lookvert) { FrameworkCore.options.joyLookForwardAxis = (int)axis; } //change the menu item's text. if (selectedItem != null) { selectedItem.optionText = GetAxisName(axis); } //close the popup. waitingForInput = false; FrameworkCore.PlayCue(sounds.click.activate); }
private void OnYes(object sender, EventArgs e) { FrameworkCore.PlayCue(sounds.click.activate); Deactivate(); FrameworkCore.ExitToMainMenu(null); }
public override void Activate() { //kill music. FrameworkCore.PlayCue(sounds.Music.none); base.Activate(); }
public virtual void Activate() { if (musicCue != null) { FrameworkCore.PlayCue(musicCue); } }
public override void Update(GameTime gameTime, InputManager inputManager) { UpdateTargetPositions(); UpdateItemTransitions(gameTime); if (inputManager.camResetClick) { owner.WarpCameraToShip(gameTime, owner.selectedShip); } #if WINDOWS if (Transition >= 1 && (inputManager.kbSpace || inputManager.kbBackspaceJustPressed)) { Deactivate(); } if (Helpers.UpdateTiltedMouseMenu(menuItems, owner.CursorPos, 0.85f, false, new Point(14, 70), FrameworkCore.Serif, true, inputManager, selectedItem, out mouseIsHovering, out selectedItem)) { if (selectedItem != lastSelectedItem) { lastSelectedItem = selectedItem; if (selectedItem != null) { FrameworkCore.PlayCue(sounds.click.select); } } } if (inputManager.kb1Pressed) { SelectAndActivate(0, inputManager); } else if (inputManager.kb2Pressed) { SelectAndActivate(1, inputManager); } else if (inputManager.kb3Pressed) { SelectAndActivate(2, inputManager); } else if (inputManager.kb4Pressed) { SelectAndActivate(3, inputManager); } #endif base.Update(gameTime, inputManager); }
private void OnButtonChange(GameButton gameBtn, int buttonNumber) { if (gameBtn == GameButton.confirm) { FrameworkCore.options.joyConfirm = buttonNumber; } else if (gameBtn == GameButton.cancel) { FrameworkCore.options.joyCancel = buttonNumber; } else if (gameBtn == GameButton.altA) { FrameworkCore.options.joyAltA = buttonNumber; } else if (gameBtn == GameButton.giveToAlly) { FrameworkCore.options.joyGiveToAlly = buttonNumber; } else if (gameBtn == GameButton.prev) { FrameworkCore.options.joyPrev = buttonNumber; } else if (gameBtn == GameButton.next) { FrameworkCore.options.joyNext = buttonNumber; } else if (gameBtn == GameButton.camReset) { FrameworkCore.options.joyCamReset = buttonNumber; } else if (gameBtn == GameButton.openMenu) { FrameworkCore.options.joyOpenMenu = buttonNumber; } else if (gameBtn == GameButton.turbo) { FrameworkCore.options.joyTurbo = buttonNumber; } else if (gameBtn == GameButton.climb) { FrameworkCore.options.joyClimb = buttonNumber; } else if (gameBtn == GameButton.lower) { FrameworkCore.options.joyLower = buttonNumber; } if (selectedItem != null) { selectedItem.optionText = GetButtonName(buttonNumber); } waitingForInput = false; FrameworkCore.PlayCue(sounds.click.activate); }
public override void Activate() { UpdateItemPositions(); FrameworkCore.PlayCue(sounds.click.whoosh); base.Activate(); }
public override void Activate() { if (noItemsFound) { FrameworkCore.PlayCue(sounds.click.error); } base.Activate(); }
public override void Deactivate() { FrameworkCore.PlayCue(sounds.click.activate); subjectText = ""; descriptionText = ""; base.Deactivate(); }
/// <summary> /// Activate this menu. /// </summary> public override void Activate() { #if WINDOWS FrameworkCore.players[0].inputmanager.ForceMouseCenter(); #endif FrameworkCore.PlayCue(sounds.click.whoosh); base.Activate(); }
/// <summary> /// Activate this menu. /// </summary> public override void Activate() { //kill music. FrameworkCore.PlayCue(sounds.Music.jazz); FrameworkCore.PlayCue(sounds.click.whoosh); base.Activate(); }
public void StartLoad() { if (FrameworkCore.isTrialMode() && FrameworkCore.isHardcoreMode) { FrameworkCore.isHardcoreMode = false; } isLoading = true; FrameworkCore.PlayCue(sounds.Music.none); }
public static void ExitToMainMenu(SysMenu menuToAdd) { if (FrameworkCore.worldMap != null) { FrameworkCore.worldMap = null; } FrameworkCore.level.ClearActionMusic(); foreach (PlayerCommander player in FrameworkCore.players) { player.ClearAll(); } //clear out some spaceships. for (int i = 0; i < FrameworkCore.level.Ships.Count; i++) { //check every other. if (i % 2 == 0) { continue; } //only check spaceships. if (!Helpers.IsSpaceship(FrameworkCore.level.Ships[i])) { continue; } if (FrameworkCore.level.Ships[i].IsDestroyed) { continue; } ((SpaceShip)FrameworkCore.level.Ships[i]).ForceKill(); } FrameworkCore.MainMenuManager.ClearAll(); FrameworkCore.sysMenuManager.ClearAll(); FrameworkCore.gameState = GameState.Logos; FrameworkCore.PlayCue(sounds.Music.raindrops01); FrameworkCore.MainMenuManager.AddMenu(new MainMenu()); Helpers.UpdateCameraProjections(1); if (menuToAdd == null) { return; } FrameworkCore.MainMenuManager.AddMenu(menuToAdd); }
public void AddCargo(InventoryItem item) { FrameworkCore.PlayCue(sounds.Fanfare.item); ItemPopup popup = new ItemPopup(menuManager); popup.inventoryItem = item; menuManager.AddMenu(popup); FrameworkCore.players[0].AddCargo(item); }
public void ActivateItem(InputManager inputManager) { if (selectedItem == null) { return; } selectedItem.activateTransition = 0; selectedItem.OnSelectEntry(inputManager.playerIndex); FrameworkCore.PlayCue(sounds.click.activate); }
private void KickToTitleScreen() { if (!FrameworkCore.shouldCheckSignIn) { return; } //close down everything. Kick player to the title screen. FrameworkCore.shouldCheckSignIn = false; if (FrameworkCore.worldMap != null) { FrameworkCore.worldMap = null; } FrameworkCore.level.ClearActionMusic(); foreach (PlayerCommander player in FrameworkCore.players) { player.ClearAll(); } //remove all players except player zero if (FrameworkCore.players.Count > 1) { for (int x = FrameworkCore.players.Count - 1; x >= 1; x--) { FrameworkCore.players.RemoveAt(x); } } Helpers.UpdateCameraProjections(1); FrameworkCore.PlayCue(sounds.Music.raindrops01); FrameworkCore.gameState = GameState.Logos; FrameworkCore.sysMenuManager.CloseAll(); FrameworkCore.MainMenuManager.CloseAll(); FrameworkCore.MainMenuManager.AddMenu(new TitleMenu()); SysPopup signPrompt = new SysPopup(FrameworkCore.MainMenuManager, Resource.MenuProfileSigninChange); signPrompt.sideIconRect = sprite.windowIcon.exclamation; MenuItem item = new MenuItem(Resource.MenuOK); item.Selected += SignInChangeDismiss; signPrompt.AddItem(item); FrameworkCore.MainMenuManager.AddMenu(signPrompt); }
public override void Activate() { FrameworkCore.PlayCue(sounds.click.whoosh); if (isGameOver) { TimeSpan timeSpan = TimeSpan.FromMilliseconds(FrameworkCore.campaignTimer); DateTime dt = new DateTime(timeSpan.Ticks); timeString = dt.ToString("mm:ss"); } base.Activate(); }
public override void Activate() { FrameworkCore.PlayCue(sounds.click.whoosh); if (FrameworkCore.playbackSystem.RoundNumber > 1) { playbackTime = MathHelper.Clamp(FrameworkCore.playbackSystem.WorldTimer - FrameworkCore.playbackSystem.MaxRoundTime, 0, FrameworkCore.playbackSystem.WorldTimer); } else { playbackTime = 0; } playSpeed = 0; base.Activate(); }
/// <summary> /// add a new ship to this player's flotilla. /// </summary> public void AddShip(ShipData shipType) { FrameworkCore.PlayCue(sounds.Fanfare.ship); FleetShip ship = Helpers.AddFleetShip(FrameworkCore.players[0].campaignShips, shipType); //create popup. if (ship == null) { return; } ShipPopup popup = new ShipPopup(menuManager); popup.fleetShip = ship; menuManager.AddMenu(popup); }
private void StartWaitingInput(GameButton btn) { if ((int)btn <= 3) { waitingLine1 = Resource.JoyWaitingForStick; } else { waitingLine1 = Resource.JoyWaitingForKey; } waitingLine2 = GetGameButtonName(btn); waitingForInput = true; FrameworkCore.PlayCue(sounds.click.select); }
private void OnYes(object sender, EventArgs e) { FrameworkCore.PlayCue(sounds.click.activate); //Deactivate(); //clear out all menus. if (Owner != null) { Owner.ClearAll(); } //blow up the player. //go to aciton phase. if (FrameworkCore.level.gamemode != GameMode.Action) { for (int k = 0; k < FrameworkCore.players.Count; k++) { FrameworkCore.players[k].ForceReady(); } } for (int k = 0; k < FrameworkCore.level.Ships.Count; k++) { //only check ships. if (!Helpers.IsSpaceship(FrameworkCore.level.Ships[k])) { continue; } //sanity check. if (((SpaceShip)FrameworkCore.level.Ships[k]).owner == null) { continue; } //only check human controlled ships. if (((SpaceShip)FrameworkCore.level.Ships[k]).owner.GetType() != typeof(PlayerCommander)) { continue; } ((SpaceShip)FrameworkCore.level.Ships[k]).ForceKill(); } FrameworkCore.worldMap.evManager.AddLog(sprite.eventSprites.bouquet, eResource.logDestruct); }
private void UpdateMouseInput(GameTime gameTime, InputManager inputManager) { if (Transition < 1) { return; } bool confirmHover = false; for (int i = 0; i < confirmButtons.Length; i++) { Rectangle confirmRect = new Rectangle( (int)(confirmButtons[i].X - 110), (int)(confirmButtons[i].Y - 30), 220, 60); if (confirmRect.Contains((int)inputManager.mousePos.X, (int)inputManager.mousePos.Y)) { hoverConfirmButton = i; confirmHover = true; if (inputManager.mouseLeftClick) { if (i == 0) { FrameworkCore.PlayCue(sounds.click.activate); Deactivate(); } else if (i == 1) { FrameworkCore.PlayCue(sounds.click.activate); Owner.AddMenu(new HelpControlsPC()); Deactivate(); } } } } if (!confirmHover) { hoverConfirmButton = -1; } }
private void ToggleHardcore() { if (FrameworkCore.isTrialMode()) { if (FrameworkCore.isHardcoreMode) { FrameworkCore.isHardcoreMode = false; } FrameworkCore.PlayCue(sounds.click.error); hardcoreHover = false; SysPopup signPrompt = new SysPopup(Owner, Resource.HardcoreTrial); signPrompt.transitionOnTime = 200; signPrompt.transitionOffTime = 200; signPrompt.darkenScreen = true; signPrompt.hideChildren = false; signPrompt.sideIconRect = sprite.windowIcon.error; MenuItem item = new MenuItem(Resource.MenuOK); item.Selected += CloseMenu; signPrompt.AddItem(item); Owner.AddMenu(signPrompt); return; } if (!FrameworkCore.isHardcoreMode) { FrameworkCore.PlayCue(sounds.Fanfare.ready); } else { FrameworkCore.PlayCue(sounds.click.activate); } FrameworkCore.isHardcoreMode = !FrameworkCore.isHardcoreMode; }
private void FlipAxis(int index) { FrameworkCore.PlayCue(sounds.click.activate); if (index == 0) { FrameworkCore.options.joyMoveForwardFlip = !FrameworkCore.options.joyMoveForwardFlip; } else if (index == 1) { FrameworkCore.options.joyMoveStrafeFlip = !FrameworkCore.options.joyMoveStrafeFlip; } else if (index == 2) { FrameworkCore.options.joyLookVertFlip = !FrameworkCore.options.joyLookVertFlip; } else if (index == 3) { FrameworkCore.options.joyLookHorizFlip = !FrameworkCore.options.joyLookHorizFlip; } }