public override void receiveLeftClick(int x, int y, bool playSound = true) { base.receiveLeftClick(x, y, playSound); textBox.Update(); if (doneNamingButton.containsPoint(x, y)) { textBoxEnter(textBox); Game1.playSound("smallSelect"); } else if (randomButton.containsPoint(x, y)) { textBox.Text = Dialogue.randomName(); randomButton.scale = randomButton.baseScale; Game1.playSound("drumkit6"); } else if (maleButton.containsPoint(x, y)) { gender = "Male"; Game1.playSound("smallSelect"); maleButton.scale -= 0.5f; maleButton.scale = Math.Max(3.5f, maleButton.scale); } else if (femaleButton.containsPoint(x, y)) { gender = "Female"; Game1.playSound("smallSelect"); femaleButton.scale -= 0.5f; femaleButton.scale = Math.Max(3.5f, femaleButton.scale); } textBox.Update(); }
//METHOD ONLY APPLIES TO FUNCTION BUTTONS -- WILL BE REFACTORED/REMOVED TO IMPLEMENT COMMAND public void buttonInput(System.Windows.Forms.Button b) { if (b.Text == "Clear") { pinEntryBox.Text = ""; pinEntryBox.Update(); } else if (b.Text == "Cancel") { pinEntryBox.Text = ""; pinEntryBox.Update(); } else if (b.Text == "Enter") { if (pinEntryBox.Text.Length < 4) { netCashLabel.Text = "Pin not correctly entered"; netCashLabel.Update(); } else { pinEntryBox.Text = "PIN ENTERED"; } pinEntryBox.Update(); } }
private void updateTextBoxFunction(TextBox txtbx, string txt, Boolean append) { if (append) { txtbx.AppendText(txt); txtbx.Update(); } else { txtbx.Text = txt; txtbx.Update(); } }
public MenuStates Update(GameTime gameTime) { foreach (IButton button in buttons) { button.Update(gameTime); } SetTextBoxLocation(); if (buttons[0].IsClicked()) { return(MenuStates.UseSteamAPI); } if (setColor.Update(gameTime) == MenuStates.Color) { information = setColor.GetInformation(); return(MenuStates.Color); } if (buttons[1].IsClicked()) { buttons[1].OffSet = 0; return(MenuStates.MainMenu); } textBox.Update(gameTime); if (textBox.IsTextBoxUpdated()) { information = (object)textBox.Text; return(MenuStates.ProfileNameUpdated); } return(MenuStates.IDLE); }
public void Update(TojamGame game, GameTime gameTime) { chatLog.Update(game, gameTime); textBox.Update(game, gameTime); if (game.gameInstance.GameStarted()) { if (game.gameInstance.GetMyPlayer().carLocation != Player.CarLocation.NotInCar) { carPicture.SetMidground(CarPicture.Midground.Car); } else { carPicture.SetMidground(CarPicture.Midground.None); } Location currentLocation = game.gameInstance.world.GetLocation(game.gameInstance.GetMyPlayer().worldLocation); carPicture.SetBackground(currentLocation.Background); } // TODO process messages from the server // broadcast ready messages to the server if (Keyboard.GetState().IsKeyDown(Keys.Enter)) { String textString = textBox.GetAndClear(); if (textString != "") { game.gameInstance.SendPlayerCommand(textString); } } carPicture.Update(game, gameTime); playerStatusIndicator.UpdateToPlayer(game, game.gameInstance.GetMyPlayer()); }
// 封装同事对象之间的交互 public override void ComponenetChanged(Component c) { // 单击按钮 if (c == addButton) { Console.WriteLine("-- 单击增加按钮 --"); list.Update(); cb.Update(); userNameTextBox.Update(); } // 从列表框选择客户 else if (c == list) { Console.WriteLine("-- 从列表框选择客户 --"); cb.Select(); userNameTextBox.SetText(); } // 从组合框选择客户 else if (c == cb) { Console.WriteLine("-- 从组合框选择客户 --"); cb.Select(); userNameTextBox.SetText(); } }
public int ProcessTaskMsg(int msgType, String message) { String msgTypeStr; if ((Msg_type)msgType == Msg_type.MT_error) { ErrMsgExists = true; pageTasks.ErrMsgExists = true; if (!continueOnErrMsg) { failedAsync = true; } msgTypeStr = "ERROR: "; } else if ((Msg_type)msgType == Msg_type.MT_warning) { WarnMsgExists = true; pageTasks.WarnMsgExists = true; msgTypeStr = "WARNING: "; } else { msgTypeStr = ""; } message = msgTypeStr + message; if (null != logTextBox) { logTextBox.Text += message + System.Console.Out.NewLine; logTextBox.Update(); } return(0); }
// São usadas três peças que requerem instâncias de delegates para // indicar comportamentos específicos. // // A utilização de expressões lambda permite que toda a implementação // fique concentrada em Button_OnClick, apesar de ser constituída por // quatro métodos distintos. // private void Button_OnClick(object source, EventArgs args) { Control control = (Control)source; String pattern = text.Text; Thread searchThread = new Thread(() => // Delegate com código a executar em thread auxiliar. { //FindFiles("C:\\", pattern, name => // Delegate com reacção a cada ficheiro encontrado //{ // control.BeginInvoke((Action)(() => // Delegate com código a executar na thread de controlo da GUI // { // res.Text = res.Text + name + Environment.NewLine; // })); //}); FindFiles("c:\\", pattern, name => { control.Invoke((Action)(() => { if (name.Length < 15) { res.AppendText(name + Environment.NewLine); } res.Update(); })); }); }); searchThread.IsBackground = true; //stop thread when process is ended searchThread.Start(); }
public override void Update(Input input) { textBox.SetInViewPort(inViewport); textBox.Update(input); label.Update(input); base.Update(input); }
public void AppendLog(string sText) { string sTmpBuf = string.Empty; if (textBoxLog.Text.Length + sText.Length >= 10000) { sTmpBuf = textBoxLog.Text; if (sTmpBuf.Length > sText.Length) { sTmpBuf = sTmpBuf.Remove(0, 5000); } else { sTmpBuf = string.Empty; } textBoxLog.Text = "\r\n" + sTmpBuf; } textBoxLog.AppendText(sText + "\r\n"); string sRobotID = "Robot #" + m_nCurrRobotNum; if (sText.StartsWith(sRobotID, StringComparison.Ordinal)) { const string sep = "|"; char [] delim = sep.ToCharArray(); string [] sShortInfo = sText.Split(delim); textBoxCurrCmd.Text = sShortInfo[0]; } textBoxLog.Update(); textBoxCurrCmd.Update(); }
public MenuStates Update(GameTime gameTime) { foreach (IButton button in buttons) { button.Update(gameTime); } SetTextBoxLocation(); if (buttons[0].IsClicked()) { buttons[0].OffSet = 0; return(MenuStates.ExpansionLobby); } if (buttons[1].IsClicked()) { buttons[1].OffSet = 0; return(MenuStates.JoinLobby); } if (buttons[2].IsClicked()) { buttons[2].OffSet = 0; return(MenuStates.MainMenu); } textBox.Update(gameTime); return(MenuStates.IDLE); }
/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) { Exit(); } KeyboardInput.Update(); // This code is in here to play with in debug mode. // You may as well initialize it in LoadContent() or change it in here to achieve lerp effects and so on... float margin = 3; textBox.Area = new Rectangle((int)(viewport.X + margin), viewport.Y, (int)(viewport.Width - margin), viewport.Height); textBox.Renderer.Color = Color.White; textBox.Cursor.Selection = new Color(Color.Purple, .4f); float lerpAmount = (float)(gameTime.TotalGameTime.TotalMilliseconds % 500f / 500f); textBox.Cursor.Color = Color.Lerp(Color.DarkGray, Color.LightGray, lerpAmount); textBox.Active = true; textBox.Update(); base.Update(gameTime); }
public override void Update(InputHelper Input, GameTime GTime) { m_HeadSkinBrowser.Update(Input, GTime); m_BodySkinBrowser.Update(Input, GTime); m_ExitDialog.Update(Input, GTime); m_NameTextEdit.Update(Input, GTime); if (m_DescriptionTextEdit.CanScrollUp()) { m_DescriptionScrollUpBtn.Enabled = true; } else { m_DescriptionScrollUpBtn.Enabled = false; } if (m_DescriptionTextEdit.CanScrollDown()) { m_DescriptionScrollDownBtn.Enabled = true; } else { m_DescriptionScrollDownBtn.Enabled = false; } m_Avatar.Update(GTime); base.Update(Input, GTime); }
private void scroll_to_end(TextBox tb, string txt) { tb.Text = txt; tb.SelectionStart = tb.Text.Length; tb.Focus(); tb.ScrollToCaret(); tb.Update(); }
public override void Update(float deltaTime) { base.Update(deltaTime); textBox.Update(deltaTime); Game.playerName = textBox.text; this.deltaTime = deltaTime; parallax.Update(deltaTime); }
public void Update(GameTime gameTime) { foreach (AGUIComponent component in components) { component.Update(gameTime); } textBox.Update(gameTime); }
void syncControlAppendText(TextBox control, string text) { synchronizedInvoke(control, delegate() { control.AppendText(text); control.Update(); }); }
private void ShakeIT(TextBox control) { for (int i = 0; i < 8; i++) { Point one = new Point(control.Location.X + 3, control.Location.Y); control.Location = one; control.Update(); System.Threading.Thread.Sleep(25); Point two = new Point(control.Location.X - 6, control.Location.Y); control.Location = two; control.Update(); System.Threading.Thread.Sleep(25); Point three = new Point(control.Location.X + 3, control.Location.Y); control.Location = three; control.Update(); System.Threading.Thread.Sleep(25); } }
protected void FlushMessages(List <string> messages, TextBox textBox) { for (int n = 0; n < messages.Count; ++n) { textBox.Text += messages[n] + System.Console.Out.NewLine; } messages.Clear(); textBox.Update(); }
public void Update(GameTime gameTime) { TxtName.Update(gameTime); if (InputMgr.Instance.IsPressed(null, InputMgr.Instance.DefaultConfirmKey, InputMgr.Instance.DefaultConfirmButton)) { HighScoreMenu.HighScoreMgr.AttemptScore(TxtName.Text, Score, new HighScoreColumn("dateTime", DateTime.Now.ToString("MM/dd/yyyy HH:mm")), new HighScoreColumn("kills", Kills.ToString()), new HighScoreColumn("scoreMod", ScoreMod.ToString() + "%"), new HighScoreColumn("shipType", ShipType)); Engine.Instance.ActiveState = new HighScoreMenu(true); } }
public override void receiveLeftClick(int x, int y, bool playSound = true) { ReminderMessageTextBox.Update(); ReminderIntervalTextBox.Update(); if (OkButton.containsPoint(x, y) && IsOkButtonReady()) { HandleButtonClick(OkButton.name); OkButton.scale -= 0.25f; OkButton.scale = Math.Max(0.75f, OkButton.scale); } if (DisplayRemindersButton.containsPoint(x, y)) { Game1.activeClickableMenu = new DisplayReminders(OnChanged); } ReminderMessageTextBox.Update(); ReminderIntervalTextBox.Update(); }
public override void receiveLeftClick(int x, int y, bool playSound = true) { base.receiveLeftClick(x, y, playSound); _textBox.Update(); if (_isNewNameValid && _doneNamingButton.containsPoint(x, y)) { TextBoxEnter(_textBox); Game1.playSound("smallSelect"); } }
private void ClearIfFolderNotExists(TextBox field) { if (field.Text.Length > 0) { if (!Directory.Exists(field.Text)) { field.Text = string.Empty; field.Update(); } } }
/// <summary>Raised after the game state is updated (≈60 times per second).</summary> /// <param name="sender">The event sender.</param> /// <param name="e">The event arguments.</param> private void onUpdateTicked(object sender, UpdateTickedEventArgs e) { if (shop != null) { if (firstTick) { initShop2(); } search.Update(); } }
private void ClearIfFileNotExists(TextBox field) { if (field.Text.Length > 0) { if (!File.Exists(field.Text)) { field.Text = string.Empty; field.Update(); } } }
/// <summary>The method invoked when the player left-clicks on the menu.</summary> /// <param name="x">The X-position of the cursor.</param> /// <param name="y">The Y-position of the cursor.</param> /// <param name="playSound">Whether to enable sound.</param> public override void receiveLeftClick(int x, int y, bool playSound = true) { ReminderTextBox.Update(); if (ReminderSeason == "Spring" || ReminderSeason == "Summer" || ReminderSeason == "Fall" || ReminderSeason == "Winter") { foreach (ClickableTextureComponent button in DayButtons) { if (button.containsPoint(x, y)) { HandleButtonClick(button.name); button.scale -= 0.5f; button.scale = Math.Max(3.5f, button.scale); } } } foreach (ClickableTextureComponent button in SeasonButtons) { if (button.containsPoint(x, y)) { HandleButtonClick(button.name); button.scale -= 0.5f; button.scale = Math.Max(3.5f, button.scale); } } if (OkButton.containsPoint(x, y) && IsOkButtonReady()) { HandleButtonClick(OkButton.name); OkButton.scale -= 0.25f; OkButton.scale = Math.Max(0.75f, OkButton.scale); } if (DisplayRemindersButton.containsPoint(x, y)) { Game1.activeClickableMenu = new DisplayReminders(OnChanged); } ReminderTextBox.Update(); }
private void UpdateFile(TextBox field) { ClearIfFileNotExists(field); InitializeFileDialog(field); var result = openFileDialog1.ShowDialog(); if (result == DialogResult.OK) { field.Text = openFileDialog1.FileName; field.Update(); } }
private void UpdateFolder(TextBox field) { ClearIfFolderNotExists(field); InitializeFolderDialog(field); var result = folderBrowserDialog1.ShowDialog(); if (result == DialogResult.OK) { field.Text = folderBrowserDialog1.SelectedPath; field.Update(); } }
/// <summary> /// Lose focus on the SearchBox - prompt is back /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SrchBox_Leave(object sender, EventArgs e) { TextBox box = sender as TextBox; if (string.IsNullOrEmpty(box.Text)) { box.Text = "Contains .."; box.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(0))); box.ForeColor = System.Drawing.SystemColors.InactiveCaption; box.Update(); } }
public void threadSafeTextBoxUpdate(TextBox txtbx, string txt, Boolean append) { if (txtbx.InvokeRequired) { // d = new updateTextBoxDelegate(updateTextBoxFuncupdateTextBoxDelegatetion); //this.Invoke(d, new object[] { txtbx, txt, append }); } else { if (append) { txtbx.AppendText(txt); txtbx.Update(); } else { txtbx.Text = txt; txtbx.Update(); } } }