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); }
private void DeviceCallback(IAsyncResult result) { try { StorageDevice deviceTemp = StorageDevice.EndShowSelector(result); if (deviceTemp != null && deviceTemp.IsConnected) { //a storage device WAS chosen. FrameworkCore.storagemanager.SetDevice(deviceTemp); OpenMainMenu(); } else { //device was NOT chosen. SysPopup devicePrompt = new SysPopup(Owner, Resource.SysDeviceChoose); devicePrompt.sideIconRect = sprite.windowIcon.exclamation; MenuItem item = new MenuItem(Resource.SysDeviceChooseConfirm); item.Selected += OnChooseStorageDevice; devicePrompt.AddItem(item); item = new MenuItem(Resource.SysDeviceChooseIgnore); item.Selected += OnNoStorageDevice; devicePrompt.AddItem(item); Owner.AddMenu(devicePrompt); } } catch { } }
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); }
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; }
void client_SendCompleted(object sender, System.ComponentModel.AsyncCompletedEventArgs e) { isSending = false; SysPopup signPrompt = new SysPopup(Owner, Resource.MenuBugReportThanks); signPrompt.transitionOnTime = 200; signPrompt.transitionOffTime = 200; signPrompt.darkenScreen = true; signPrompt.hideChildren = false; signPrompt.canBeExited = false; signPrompt.sideIconRect = sprite.windowIcon.info; MenuItem item = new MenuItem(Resource.MenuOK); item.Selected += CloseBugPopup; signPrompt.AddItem(item); Owner.AddMenu(signPrompt); }
private void HandlePatchCheck(string result) { if (result == null) { return; } //convert string to float. float newVersion = (float)Convert.ToDouble(result, CultureInfo.InvariantCulture); string strUserVersion = FrameworkCore.VERSION; float userVersion = (float)Convert.ToDouble(strUserVersion, CultureInfo.InvariantCulture); //compare version numbers. if (newVersion <= userVersion) { return; } //new version is available. string patchString = string.Format(Resource.MenuPatchAvailable, FrameworkCore.VERSION, result); SysPopup signPrompt = new SysPopup(Owner, patchString); signPrompt.canBeExited = false; signPrompt.darkenScreen = true; signPrompt.sideIconRect = sprite.windowIcon.exclamation; MenuItem item = new MenuItem(Resource.MenuPatchGet); item.Selected += OnPatch; signPrompt.AddItem(item); item = new MenuItem(Resource.MenuPatchLater); item.Selected += OnNoPatch; signPrompt.AddItem(item); Owner.AddMenu(signPrompt); }
public static void BuyGame(PlayerIndex index) { #if LiveEnabled if (Guide.IsVisible) { return; } if (!Guide.IsTrialMode) { return; } SignedInGamer gamer = SignedInGamer.SignedInGamers[index]; //found signed in player. do stuff.. if (gamer != null && gamer.Privileges.AllowPurchaseContent) { try { Guide.ShowMarketplace(FrameworkCore.controllingPlayer); } catch { } } else { //player is attempting to buy game, but profile doesn't have purchasing priviledges. SysPopup signPrompt = new SysPopup(FrameworkCore.sysmenumanager, Resource.MenuBuyProfileError); signPrompt.sideIconRect = sprite.windowIcon.exclamation; signPrompt.darkenScreen = true; signPrompt.transitionOnTime = 200; MenuItem item = new MenuItem(Resource.MenuProfileNotSignedinConfirm); item.Selected += ChooseProfile; signPrompt.AddItem(item); item = new MenuItem(Resource.MenuCancel); item.Selected += OnDoNotSignin; signPrompt.AddItem(item); FrameworkCore.sysmenumanager.AddMenu(signPrompt); } return; #endif #if WINDOWS && STEAM steam.ActivateGameOverlayToStore(Helpers.STEAMAPPID); return; #endif #if WINDOWS try { //clear the inputManagers. for (int i = 0; i < 4; i++) { menuInputs[i].ClearAll(); } if (FrameworkCore.game.IsActive) { //open the browser. Process.Start("http://www.blendogames.com/flotilla"); #if SDL2 SDL.SDL_MinimizeWindow(FrameworkCore.game.Window.Handle); #else //minimize the game. Form MyGameForm = (Form)Form.FromHandle(FrameworkCore.game.Window.Handle); MyGameForm.WindowState = FormWindowState.Minimized; #endif } } catch (Exception ex) { SysPopup signPrompt = new SysPopup(FrameworkCore.sysmenumanager, "VISIT http://www.blendogames.com FOR MORE INFORMATION!"); signPrompt.sideIconRect = sprite.windowIcon.exclamation; signPrompt.darkenScreen = true; signPrompt.transitionOnTime = 200; MenuItem item = new MenuItem(Resource.MenuOK); item.Selected += CloseMenu; signPrompt.AddItem(item); FrameworkCore.sysmenumanager.AddMenu(signPrompt); } #endif }
public override void Update(GameTime gameTime, InputManager inputManager) { #if LiveEnabled if (Transition >= 1 && !checkControllingPlayer) { for (int i = 0; i < 4; i++) { PlayerIndex index = PlayerIndex.One; if (i == 0) { index = PlayerIndex.One; } else if (i == 1) { index = PlayerIndex.Two; } else if (i == 2) { index = PlayerIndex.Three; } else { index = PlayerIndex.Four; } if (FrameworkCore.MenuInputs[i].buttonAPressed || FrameworkCore.MenuInputs[i].buttonStartPressed) { checkControllingPlayer = true; FrameworkCore.ControllingPlayer = index; FrameworkCore.players[0].playerindex = index; } } } if (Helpers.GuideVisible) { return; } if (checkControllingPlayer) { SignedInGamer gamer = SignedInGamer.SignedInGamers[FrameworkCore.ControllingPlayer]; if (gamer != null) { FrameworkCore.shouldCheckSignIn = true; ChooseStorageDevice(); } else { //controllingplayer is not signed in. if (Owner != null) { SysPopup signPrompt = new SysPopup(Owner, Resource.MenuProfileNotSignedin); signPrompt.canBeExited = false; signPrompt.darkenScreen = true; signPrompt.sideIconRect = sprite.windowIcon.exclamation; MenuItem item = new MenuItem(Resource.MenuProfileNotSignedinConfirm); item.Selected += ChooseProfile; signPrompt.AddItem(item); item = new MenuItem(Resource.MenuProfileNotSignedinIgnore); item.Selected += OnDoNotSignin; signPrompt.AddItem(item); Owner.AddMenu(signPrompt); } } } #else //PC build. if (Transition >= 1) { if (inputManager.buttonAPressed || inputManager.kbSkipScreen || inputManager.mouseLeftClick) { OpenMainMenu(); } } #endif base.Update(gameTime, inputManager); }
private void AddShip(object sender, InputArgs e) { if (sender.GetType() != typeof(MenuItem)) { return; } int index = ((MenuItem)sender).GenericInt1; ShipData ship = ((MenuItem)sender).shipArray[0]; if (FrameworkCore.isTrialMode() && ship != null) { if (Helpers.getShipByType(ship) > 1) { #if WINDOWS string errorString = string.Format(Resource.MenuSkirmishTrialSelection, ship.name); SysPopup signPrompt = new SysPopup(Owner, errorString); signPrompt.transitionOnTime = 200; signPrompt.transitionOffTime = 200; signPrompt.darkenScreen = true; signPrompt.hideChildren = false; signPrompt.sideIconRect = sprite.windowIcon.error; MenuItem item = new MenuItem(Resource.MenuUnlockFullGame); item.Selected += OnBuyGame; item.GenericInt1 = index; signPrompt.AddItem(item); item = new MenuItem(Resource.MenuDemoPlanetMaybeLater); item.Selected += CloseMenu; signPrompt.AddItem(item); Owner.AddMenu(signPrompt); FrameworkCore.PlayCue(sounds.click.error); return; #else SignedInGamer gamer = SignedInGamer.SignedInGamers[(PlayerIndex)index]; //found signed in player. do stuff.. if (gamer != null && gamer.Privileges.AllowPurchaseContent) { string errorString = string.Format(Resource.MenuSkirmishTrialSelection, ship.name); SysPopup signPrompt = new SysPopup(Owner, errorString); signPrompt.transitionOnTime = 200; signPrompt.transitionOffTime = 200; signPrompt.darkenScreen = true; signPrompt.hideChildren = false; signPrompt.sideIconRect = sprite.windowIcon.error; MenuItem item = new MenuItem(Resource.MenuUnlockFullGame); item.Selected += OnBuyGame; item.GenericInt1 = index; signPrompt.AddItem(item); item = new MenuItem(Resource.MenuDemoPlanetMaybeLater); item.Selected += CloseMenu; signPrompt.AddItem(item); Owner.AddMenu(signPrompt); } else { //player has no purchasing privileges string errorString = string.Format(Resource.MenuSkirmishTrialSelectionNoSignin, ship.name); SysPopup signPrompt = new SysPopup(Owner, errorString); 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); } FrameworkCore.PlayCue(sounds.click.error); return; #endif } } if (((MenuItem)sender).owner != null) { ((MenuItem)sender).owner.Deactivate(); } int slotNumber = selectedItem.shipArraySelection; if (slotNumber < 0) { return; } selectedItem.shipArray[slotNumber] = ship; }
private void OnSelectStart(object sender, EventArgs e) { bool faction1HasCommander = false; bool faction2HasCommander = false; //check if both sides have at least 1 commander. for (int i = 0; i < menuItems.Count; i++) { if (menuItems[i].commander != null && i <= 1) { faction1HasCommander = true; } else if (menuItems[i].commander != null && (i == 2 || i == 3)) { faction2HasCommander = true; } } if (!faction1HasCommander || !faction2HasCommander) { SysPopup signPrompt = new SysPopup(Owner, Resource.MenuSkirmishMissingPlayer); 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); FrameworkCore.PlayCue(sounds.click.error); return; } if (FrameworkCore.isTrialMode()) { bool hasInvalidShip = false; //check if user has any non-trial ships in the ship array. foreach (MenuItem mItem in menuItems) { if (menuItems.IndexOf(mItem) > 3) { continue; } for (int i = 0; i < mItem.shipArray.Length; i++) { if (Helpers.getShipByType(mItem.shipArray[i]) > 1) { hasInvalidShip = true; mItem.shipArray[i] = null; } } } if (hasInvalidShip) { SysPopup signPrompt = new SysPopup(Owner, Resource.MenuSkirmishTrialShipError); 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 += CloseMenuStartSkirmish; signPrompt.AddItem(item); Owner.AddMenu(signPrompt); return; } } //check if all slots have at least one ship. bool showNoShipError = false; string missingShipPlayerName = ""; foreach (MenuItem mItem in menuItems) { //only check player slots. if (menuItems.IndexOf(mItem) > 3) { continue; } if (mItem.commander == null) { continue; } bool PlayerHasNoShip = true; for (int i = 0; i < mItem.shipArray.Length; i++) { if (Helpers.getShipByType(mItem.shipArray[i]) >= 0) { PlayerHasNoShip = false; } } if (PlayerHasNoShip) { showNoShipError = true; if (mItem.commander.commanderName != null) { missingShipPlayerName = mItem.commander.commanderName; } break; } } if (showNoShipError) { String errorString = string.Format(Resource.MenuSkirmishNoShips, missingShipPlayerName); SysPopup signPrompt = new SysPopup(Owner, errorString); 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); FrameworkCore.PlayCue(sounds.click.error); return; } IsLoading = true; //player wants to start the skirmish. }
private void CommitReport() { if (isSending) { return; } if (descriptionText.Length <= 0) { //error message. SysPopup signPrompt = new SysPopup(Owner, Resource.MenuBugReportEmptyDescription); signPrompt.transitionOnTime = 200; signPrompt.transitionOffTime = 200; signPrompt.darkenScreen = true; signPrompt.hideChildren = false; signPrompt.canBeExited = false; signPrompt.sideIconRect = sprite.windowIcon.error; MenuItem item = new MenuItem(Resource.MenuOK); item.Selected += ClosePopup; signPrompt.AddItem(item); Owner.AddMenu(signPrompt); return; } FrameworkCore.PlayCue(sounds.click.activate); isSending = true; try { System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage(); message.From = new System.Net.Mail.MailAddress("*****@*****.**"); message.To.Add(new System.Net.Mail.MailAddress("*****@*****.**")); message.Subject = "[FLOTILLA] " + subjectText; string registered = string.Empty; if (FrameworkCore.isTrialMode()) { registered = "Demo"; } else { registered = "Registered"; } string finalString = registered + " version " + FrameworkCore.VERSION + "\n\n" + descriptionText; message.Body = finalString; System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient(); client.Host = "smtp.gmail.com"; //smtp server client.Port = 587; //Port for TLS/STARTTLS client.EnableSsl = true; client.Credentials = new System.Net.NetworkCredential("*****@*****.**", ""); client.SendCompleted += new System.Net.Mail.SendCompletedEventHandler(client_SendCompleted); client.SendAsync(message, null); } catch (Exception ex) { Console.WriteLine(ex.Message); } }