void CancelButtonClicked(Control sender) { Show = false; }
private void HandleNetworkSelectScreenButtons(Control sender) { if (sender.Name == "HostGame") { gameType = Client.Client.GameType.hosted; activeScreen.Hide(); activeScreen = hostGameScreen; activeScreen.Show(); } if (sender.Name == "JoinGame") { //load join screen activeScreen.Hide(); activeScreen = joinGameScreen; activeScreen.Show(); } if (sender.Name == "BackButton") { //go back to startScreen activeScreen.Hide(); activeScreen = startScreen; activeScreen.Show(); } }
private void HandleSelectLevelScreen(Control sender) { if (sender == null) return; if (sender.Name == "Exit") { activeScreen.Hide(); activeScreen = startScreen; activeScreen.Show(); } if (sender.Name == "Load") { activeScreen.Hide(); levelManager.Level = levelSelectScreen.Level; activeScreen = levelManager; activeScreen.Show(); } }
protected virtual void HandlerToggle(Control sender) { bChecked = !bChecked; if (onToggle != null) onToggle(this); }
private void HandleHostGameScreenButtons(Control sender) { if (sender.Name == "Start") { gameType = Client.Client.GameType.hosted; StartServer(gameType); } if (sender.Name == "BackButton") { activeScreen.Hide(); activeScreen = networkScreen; activeScreen.Show(); } }
void OkButtonClicked(Control sender) { foreach (TextBox tb in TextBoxes) { float val; float.TryParse(tb.Text, out val); Fields[tb.Name] = val; } Show = false; }
void ButtonClick(Control sender) { if (ButtonClicked != null) { this.MaxConnections = Int32.Parse(textBoxMaxConnections.Text); this.Port = Int32.Parse(textBoxPort.Text); this.ButtonClicked(sender); } }
/// <summary> /// Removes check from radio buttons except for the one which sent the request /// </summary> /// <param name="sender"></param> protected virtual void HandlerRadioButtonClicked(Control sender) { foreach (Control c in controls) { if (c is RadioButton) { RadioButton radio = (RadioButton)c; if (radio.CheckedThisFrame) // Incase of "CheckBox.Checked = true;" was used { radio.CheckedThisFrame = false; foreach (Control r in controls) { if (r is RadioButton && c != r) ((RadioButton)r).Checked = false; } break; } } } }
/// <summary> /// Removes the focus from all children except for the one which sent the request /// </summary> /// <param name="sender">The control that sent the request</param> protected virtual void HandlerRemoveFocusFromChildren(Control sender) { hasFocus = true; foreach (Control c in controls) if (c != sender) c.Focus = false; }
/// <summary> /// Occurrs when a child form Close is called, which tells the parent form to mark it for deletion /// </summary> /// <param name="sender">Form triggered the event</param> protected virtual void HandlerChidlFormClosed(Control sender) { // cannot delete here since we got here from sender.Update which was called by the loop in this.Update // modifying controls here might twho an exception controlsToDelete.Add(sender); }
/// <summary> /// Removes focus from children only if the form was focused and the user clicked it again /// </summary> /// <param name="sender">Form that triggered the event</param> protected virtual void HandlerMeClicked(Control sender) { if (!this.gotFocus) { foreach (Control c in controls) if (!c.Clicked) c.Focus = false; } }
/// <summary> /// Enables\Disables the brothers of a control..this control is not affected /// </summary> /// <param name="child">Control to maintain state</param> /// <param name="enabled">The state to set for the brothers</param> public virtual void ToggleBrothersOfChildEnabled(Control child,bool enabled) { foreach (Control c in controls) { if (c != child) c.Enabled = enabled; } }
/// <summary> /// Closes this form, must have a parent to work /// </summary> public virtual void Close(Control sender) { if (onClose != null) onClose(this); }
/// <summary> /// Adds a control to the form /// Control position will become relative to the form /// Control viewport will be changed to match the viewport of the form /// </summary> /// <param name="control">Control to add</param> public virtual void AddControl(Control control) { if (control == null) return; control.Viewport = viewport; // If control is a from then register onClose event if (control is Form) ((Form)control).onClose += new EHandler(HandlerChidlFormClosed); // If RadioButton.Checked = true was called we have to uncheck the other RadioButtons if (control is RadioButton) ((RadioButton)control).onToggle += new EHandler(HandlerRadioButtonClicked); //control.PositionWidthHeight = new Rectangle(control.PositionWidthHeight.X + this.positionWidthHeight.X, control.PositionWidthHeight.Y + this.positionWidthHeight.Y, control.PositionWidthHeight.Width, control.PositionWidthHeight.Height); control.Position += this.Position; control.parent = this; controls.Add(control); }
void Changed(Control sender) { Applied = true; }
protected virtual void BtnRight_Click(Control sender) { index = (int)MathHelper.Clamp(index+1, 0, items.Count - 1); if (items.Count > 0) txtText.Text = items[index].ToString(); CheckChanges(); }
void MouseDown(Control sender) { Clicked = true; }
protected virtual void ChildClicked(Control sender) { if (onClick != null) onClick(this); }
void SpringClicked(Control sender) { springClicked = sender.Name; Show = false; }
protected virtual void ChildMouseDown(Control sender) { if (onMouseDown != null) onMouseDown(this); }
void LoadButtonClicked(Control sender) { levelToLoad = Convert.ToInt32(txtLevelSelect.Text); }
protected virtual void ChildMouseMove(Control sender) { if (onMouseMove != null) onMouseMove(this); }
void ButtonClick(Control sender) { if (ButtonClicked != null) this.ButtonClicked(sender); }
void ButtonClick(Control sender) { if (ButtonClicked != null) this.ButtonClicked(sender); //what do here? }
private void HandleJoinGameScreenButtons(Control sender) { if (sender.Name == "ScanLan") { //TODO: Only start client if local game is found gameType = Client.Client.GameType.scanLan; StartClient(); Console.WriteLine("SCAN LAN!"); } if (sender.Name == "Connect") //Join a network game by address { gameType = Client.Client.GameType.hosted; Console.WriteLine("Connect to {0}:{1}", joinGameScreen.Address, joinGameScreen.Port); } if (sender.Name == "BackButton") { activeScreen.Hide(); activeScreen = networkScreen; activeScreen.Show(); } }
void ButtonClick(Control sender) { if (ButtonClicked != null) { this.Address = textBoxIP.Text; this.Port = textBoxPort.Text; this.ButtonClicked(sender); } }
private void HandleStartScreenButtons(Control sender) { if (sender.Name == "StartGame") { gameType = Client.Client.GameType.local; StartServer(gameType); } if (sender.Name == "NetworkGame") { activeScreen.Hide(); activeScreen = networkScreen; activeScreen.Show(); } if (sender.Name == "QuitGame") { this.Exit(); } /* if (CheckKey(Keys.Enter)) { if (startScreen.SelectedIndex == 0) //start { gameType = Client.Client.GameType.local; StartServer(gameType); //activeScreen.Hide(); //activeScreen = actionScreen; //activeScreen.Show(); } if (startScreen.SelectedIndex == 1) //Multiplayer game { activeScreen.Hide(); activeScreen = networkScreen; activeScreen.Show(); } if (startScreen.SelectedIndex == 2) //quit { this.Exit(); } }*/ }
protected override void HandlerToggle(Control sender) { bChecked = true; if (onToggle != null) onToggle(this); }