/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { /* * logoTexture = Content.Load<Texture2D>("images/cannonBalls/ball_inner.png"); * spriteBatch = new SpriteBatch(graphics.GraphicsDevice); */ client = new XnaClient(); renderer = new XnaRenderer(GraphicsDevice, Content, graphics, client); client.LoadImages(renderer); bool opened = false; client.Init(renderer, new XnaClientSettings() { GetKeyboardInput = (callback) => { if (opened) { return; } opened = true; Guide.BeginShowKeyboardInput(PlayerIndex.One, "", "", "", (asyncer) => { var endShowKeyboardInput = Guide.EndShowKeyboardInput(asyncer); opened = false; callback(endShowKeyboardInput); }, null); }, OneLayoutAtATime = true }); graphics.SupportedOrientations = DisplayOrientation.LandscapeLeft; }
private void GetText(IAsyncResult result) { try { string resultString = Guide.EndShowKeyboardInput(result);; if (resultString != null) { if (resultString.Length > 10) { resultString = resultString.Remove(10); } if (resultString.Length < 3) { return; } username = resultString; } else { username = "******"; } } catch (Exception ex) { username = "******"; return; } entries.Add(new highscoreEntry(username, newLevel, newTS)); sortHighscore(); saveHighscore(); }
void keyboardCallback(IAsyncResult result) { string retval = Guide.EndShowKeyboardInput(result); List <HighScoreEntry> l = new List <HighScoreEntry>(); if (retval == null) { l.Add(new HighScoreEntry("Anon.", time)); } else { l.Add(new HighScoreEntry(retval, time)); //RESET XBOX SCORES //l.Add(new HighScoreEntry("Anonymous", 9999999999)); //l.Add(new HighScoreEntry("Anonymous", 9999999999)); //l.Add(new HighScoreEntry("Anonymous", 9999999999)); //l.Add(new HighScoreEntry("Anonymous", 9999999999)); //l.Add(new HighScoreEntry("Anonymous", 9999999999)); //l.Add(new HighScoreEntry("Anonymous", 9999999999)); //l.Add(new HighScoreEntry("Anonymous", 9999999999)); //l.Add(new HighScoreEntry("Anonymous", 9999999999)); //l.Add(new HighScoreEntry("Anonymous", 9999999999)); //l.Add(new HighScoreEntry("Anonymous", 9999999999)); // Do whatever you want with the string you got from the user, which is now stored in retval } HighScore.getHighScores(MapManager.currentMap.currentMapName, raceType, l); }
private void InputHandler(IAsyncResult result) { #if !WINDOWS_PHONE && !XBOX && !PSM var newText = Guide.EndShowKeyboardInput(result); m_pGuideShowHandle = null; if (newText != null && Text != newText) { bool canceled = false; ScheduleOnce( time => { DoEndEditing(ref newText, ref canceled); if (!canceled) { Text = newText; } }, 0 ); } #endif }
public void OnFocusChanged(FocusEvent newFocus) { IsFocused = newFocus == FocusEvent.FocusIn; if (IsFocused) { m_cursorBlink = true; m_cursorBlinkLastTime = GameFacade.LastUpdateState.Time.TotalGameTime.Ticks; if (FSOEnvironment.SoftwareKeyboard && FSOEnvironment.SoftwareDepth) { try { Guide.BeginShowKeyboardInput(PlayerIndex.One, "", "", CurrentText, (ar) => { var str = Guide.EndShowKeyboardInput(ar); lock (this) { QueuedChange = str; } }, null); } catch (Exception e) { } } } else { m_cursorBlink = false; SelectionEnd = -1; SelectionStart = -1; m_DrawDirty = true; Invalidate(); } }
void TouchTextEntered(IAsyncResult result) { string typedText = Guide.EndShowKeyboardInput(result); InputBox.Text = typedText != null ? typedText : ""; Close(); }
/// <summary> /// A handler invoked after the user has enter his name. /// </summary> /// <param name="result"></param> private void AfterPlayerEnterName(IAsyncResult result) { // Gets the name entered string playerName = Guide.EndShowKeyboardInput(result); if (!string.IsNullOrEmpty(playerName)) { // Ensure that it is valid if (playerName != null && playerName.Length > 15) { playerName = playerName.Substring(0, 15); } // Puts it in high score HighScoreScreen.PutHighScore(playerName, GameplayScreen.FinalScore); HighScoreScreen.HighScoreChanged(); } // Moves to the next screen foreach (GameScreen screen in ScreenManager.GetScreens()) { screen.ExitScreen(); } ScreenManager.AddScreen(new BackgroundScreen("highScoreScreen"), null); ScreenManager.AddScreen(new HighScoreScreen(), null); }
/// <summary> /// Finish the current game /// </summary> private void FinishCurrentGame() { IsActive = false; foreach (GameScreen screen in ScreenManager.GetScreens()) { screen.ExitScreen(); } if (HighScoreScreen.IsInHighscores(gameTime)) { // Show the device's keyboard Guide.BeginShowKeyboardInput(PlayerIndex.One, "Player Name", "Enter your name (max 15 characters)", "Player", (r) => { string playerName = Guide.EndShowKeyboardInput(r); if (playerName != null && playerName.Length > 15) { playerName = playerName.Substring(0, 15); } HighScoreScreen.PutHighScore(playerName, gameTime); ScreenManager.AddScreen(new BackgroundScreen(), null); ScreenManager.AddScreen(new HighScoreScreen(), null); }, null); return; } ScreenManager.AddScreen(new BackgroundScreen(), null); ScreenManager.AddScreen(new HighScoreScreen(), null); }
/// <summary> /// Store the text that was typed in by the user. /// </summary> /// <param name="r">Result of the keyboard input.</param> protected void GetTypedChars(IAsyncResult r) { typedText = Guide.EndShowKeyboardInput(r); HighScoreTable.SendScore(typedText, PlayerManager.Score); //call to send the score to the database gameState = GameStates.TitleScreen; //leave the game, go to the title screen bannerAd.Visible = true; //set the ad to visible since we are leaving the playing state }
/// <summary> /// Asynchronous handler for the highscore player name popup messagebox. /// </summary> /// <param name="result">The popup messagebox result. The result's /// AsyncState property should be true if the user successfully finished /// the game, or false otherwise.</param> private void ShowHighscorePromptEnded(IAsyncResult result) { string playerName = Guide.EndShowKeyboardInput(result); bool finishedGame = (bool)result.AsyncState; if (playerName != null) { if (playerName.Length > 15) { playerName = playerName.Substring(0, 15); } HighScoreScreen.PutHighScore(playerName, currentLevelNumber); } if (finishedGame) { moveToHighScore = true; } else { AudioManager.PlaySound("fail"); isActive = true; currentLevelNumber = 1; isLevelChange = true; } }
/// <summary> /// Load your graphics content. /// </summary> protected override void LoadContent() { client = new XnaClient(); renderer = new XnaRenderer(GraphicsDevice, Content, graphics, client); client.LoadImages(renderer); bool opened = false; client.Init(renderer, new XnaClientSettings() { OneLayoutAtATime = true, GetKeyboardInput = (callback) => { if (opened) { return; } opened = true; Guide.BeginShowKeyboardInput(PlayerIndex.One, "", "", "", (asyncer) => { var endShowKeyboardInput = Guide.EndShowKeyboardInput(asyncer); opened = false; callback(endShowKeyboardInput); }, null); } }); }
private void GetText(IAsyncResult result) { string res = Guide.EndShowKeyboardInput(result); Text = res != null ? res : ""; Pos = text.Length; }
public virtual void keyboard_done(IAsyncResult r) { #if WINDOWS string msg = Guide.EndShowKeyboardInput(r); sayMessage(msg); SendMessage("T" + msg); #endif }
/* * Updates the wating room */ void UpdateWR() { KeyboardState keyState = Keyboard.GetState(); if (networkSession.SessionState == NetworkSessionState.Playing) { beginGame(); } //startgame if host if (keyState.IsKeyDown(Keys.S) && isHost && !isChatting) { beginGame(); } //chat if (keyState.IsKeyDown(Keys.T) && !isChatting) { chat(); } if (keyState.IsKeyDown(Keys.R) && !isChatting) { networkSession.LocalGamers[0].IsReady = true; } if (isHost) { bool start = true; GamerCollection <NetworkGamer> players = networkSession.AllGamers; for (int i = 0; i < players.Count; i++) { if (!players[i].IsReady) { start = false; } } if (start) { beginGame(); } } recievePacket(); String inputString; if (KeyboardResult != null && KeyboardResult.IsCompleted) { inputString = Guide.EndShowKeyboardInput(KeyboardResult); if (inputString == null) { inputString = ""; } KeyboardResult = null; sendChatPacket(inputString); } }
private void GuideCallback(IAsyncResult result) { string input = Guide.EndShowKeyboardInput(result); Text = input; selectionStartIndex = selectionEndIndex = 0; typing = false; }
/// <summary> /// Shows the specified text, caption and default input text, and awaits for the user to reply. /// </summary> /// <param name="text">The message to display.</param> /// <param name="caption">The title of the input box.</param> /// <param name="defaultText">The default text displayed in the input area when the interface dialog box is first shown.</param> /// <param name="usePasswordMode">true if password mode is enabled; otherwise, false.</param> /// <param name="textInputed">The <see cref="T:Action{string}" /> to be called once the operation is finished.</param> public void Show(string text, string caption, string defaultText, bool usePasswordMode, Action <string> textInputed) { Guide.BeginShowKeyboardInput(PlayerIndex.One, caption, text, defaultText, ar => { text = Guide.EndShowKeyboardInput(ar); Deployment.Current.Dispatcher.BeginInvoke(() => textInputed(text)); }, null, usePasswordMode); }
/// <summary> /// Gets the result text of the Guide keyboard. /// </summary> private void GuideCallback(IAsyncResult result) { string resultText = Guide.EndShowKeyboardInput(result); if (resultText != null) { Text = resultText; } }
public void EndEdit() { if (guideShowHandle != null) { #if !WINDOWS_PHONE && !ANDROID Guide.EndShowKeyboardInput(guideShowHandle); #endif guideShowHandle = null; } }
public void EndEdit() { if (m_pGuideShowHandle != null) { #if !WINDOWS_PHONE && !XBOX && !PSM Guide.EndShowKeyboardInput(m_pGuideShowHandle); #endif m_pGuideShowHandle = null; } }
private void HandleKeyboardInputComplete(IAsyncResult asyncResult) { var text = Guide.EndShowKeyboardInput(asyncResult); Text = text; _clickSubscription = Gestures.Subscribe(HandleClick); InvokeTextChanged(EventArgs.Empty); }
// Invoked after the user inputs text from the on screen keyboard private void InputDebugCommandCallback(IAsyncResult result) { // get the string they entered string cmd = Guide.EndShowKeyboardInput(result); // if they entered something, execute the command if (!string.IsNullOrEmpty(cmd)) { debugSystem.DebugCommandUI.ExecuteCommand(cmd); } }
private void GetVirtualKeyboardResult(IAsyncResult result) { Text = Guide.EndShowKeyboardInput(result); if (OnVirtualKeyboardClose != null) { OnVirtualKeyboardClose.Invoke(this, EventArgs.Empty); } VirtualKeyboard = null; }
private void gotText(IAsyncResult result) { if (result.IsCompleted) { string caca = Guide.EndShowKeyboardInput(result); if (caca != null && caca.Count() < 11) { IsolatedStorageSettings.ApplicationSettings["player1"] = Guide.EndShowKeyboardInput(result); } } }
void ComposeCompleted(IAsyncResult textResult) { HandleError(() => { RefreshFeed(); string text = Guide.EndShowKeyboardInput(textResult); if (!string.IsNullOrWhiteSpace(text)) { Yammer.Api.BeginComposeMessage(accessToken, text, res => { HandleError(() => { var addedMessage = res.messages.FirstOrDefault(); if (addedMessage != null) { var users = new Dictionary <string, Yammer.Reference>(); foreach (var item in res.references) { if (item.type == "user") { users.Add(item.id, item); } } var messageView = new MessageViewModel(addedMessage); if (users.ContainsKey(addedMessage.sender_id)) { messageView.LineOne = users[addedMessage.sender_id].full_name; if (!string.IsNullOrEmpty(users[addedMessage.sender_id].mugshot_url)) { messageView.Image = users[addedMessage.sender_id].mugshot_url; } } Dispatcher.BeginInvoke(() => { HandleError(() => { data.MyFeedItems.Insert(0, messageView); data.CompanyFeedItems.Insert(0, new MessageViewModel { LineOne = messageView.LineOne, LineTwo = messageView.LineTwo, Date = messageView.Date, Image = messageView.Image }); data.SentFeedItems.Insert(0, new MessageViewModel { LineOne = messageView.LineOne, LineTwo = messageView.LineTwo, Date = messageView.Date, Image = messageView.Image }); }); }); } }); }); } }); }
/// <summary> /// Handler launched once the user selects a location to zoom on. /// </summary> /// <param name="result">Asynchronous call result containing the text typed by the user.</param> private void LocationSelected(IAsyncResult result) { locationToFocusOn = Guide.EndShowKeyboardInput(result); if (String.IsNullOrEmpty(locationToFocusOn)) { return; } // Cancel any ongoing request, or do nothing if there was none locationWebClient.CancelAsync(); }
private void TestShowKeyboardInput(string title, string description, string defaultText) { var result = Guide.BeginShowKeyboardInput( PlayerIndex.One, title, description, defaultText, Guide_ShowKeyboardInputCallback, null); _labelEndShowKeyboardInput.Text = "EndShow: " + (Guide.EndShowKeyboardInput(result) ?? "<null>"); }
/// <summary> /// get input string from album name input dialog /// </summary> /// <param name="res"></param> void GetInputString(IAsyncResult res) { NewAlbumName = Guide.EndShowKeyboardInput(res); // check null or empty string. if (string.IsNullOrEmpty(NewAlbumName) || string.IsNullOrWhiteSpace(NewAlbumName)) { return; } Create_new_album(); }
/// <summary> /// Checks if the text input is touched and if it is, then opens the virtual keyboard /// </summary> /// <param name="touchLocation">The touch location</param> public void Update(TouchLocation touchLocation) { if (destination.Contains(new Point((int)touchLocation.Position.X, (int)touchLocation.Position.Y))) { if (touchLocation.State == TouchLocationState.Pressed) { if (!Guide.IsVisible) { if (Text == HintText) { Guide.BeginShowKeyboardInput(PlayerIndex.One, "Moto Trial Racer", HintText, "", delegate(IAsyncResult result) { String tempText = Guide.EndShowKeyboardInput(result); if (tempText != null) { if (tempText == "") { Text = HintText; } else { Text = tempText; } } }, null); } else { Guide.BeginShowKeyboardInput(PlayerIndex.One, "Moto Trial Racer", HintText, Text, delegate(IAsyncResult result) { String tempText = Guide.EndShowKeyboardInput(result); if (tempText != null) { if (tempText == "") { Text = HintText; } else { Text = tempText; } } }, null); } } } } }
private void gotText(IAsyncResult result) { if (result.IsCompleted) { string caca = Guide.EndShowKeyboardInput(result); if (caca != null && caca.Count() < 13) { IsolatedStorageSettings.ApplicationSettings["player1"] = Guide.EndShowKeyboardInput(result); } } this.ExitScreen(); ScreenManager.AddScreen(new OptionScreen()); }
private void loadSearch(IAsyncResult res) { string data = Guide.EndShowKeyboardInput(res); if (data == null) { return; } if (data.Length <= 1) { return; } App.LatestShows.queryListing(data); }