Example #1
0
 void CancelButtonClicked(Control sender)
 {
     Show = false;
 }
Example #2
0
 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();
     }
 }
Example #3
0
File: Kroz.cs Project: secgoat/Kroz
 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();
     }
 }
Example #4
0
 protected virtual void HandlerToggle(Control sender)
 {
     bChecked = !bChecked;
     if (onToggle != null) onToggle(this);
 }
Example #5
0
 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();
     }
 }
Example #6
0
 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);
     }
 }
Example #8
0
        /// <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;
                    }
                }
            }
        }
Example #9
0
 /// <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;
 }
Example #10
0
 /// <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);
 }
Example #11
0
 /// <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;
     }
 }
Example #12
0
 /// <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;
     }
 }
Example #13
0
 /// <summary>
 /// Closes this form, must have a parent to work
 /// </summary>
 public virtual void Close(Control sender)
 {
     if (onClose != null) onClose(this);
 }
Example #14
0
        /// <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);
        }
Example #15
0
 void Changed(Control sender)
 {
     Applied = true;
 }
Example #16
0
        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();
        }
Example #17
0
 void MouseDown(Control sender)
 {
     Clicked = true;
 }
Example #18
0
 protected virtual void ChildClicked(Control sender)
 {
     if (onClick != null) onClick(this);
 }
Example #19
0
 void SpringClicked(Control sender)
 {
     springClicked = sender.Name;
     Show = false;
 }
Example #20
0
 protected virtual void ChildMouseDown(Control sender)
 {
     if (onMouseDown != null) onMouseDown(this);
 }
Example #21
0
 void LoadButtonClicked(Control sender)
 {
     levelToLoad = Convert.ToInt32(txtLevelSelect.Text);
 }
Example #22
0
 protected virtual void ChildMouseMove(Control sender)
 {
     if (onMouseMove != null) onMouseMove(this);
 }
 void ButtonClick(Control sender)
 {
     if (ButtonClicked != null)
         this.ButtonClicked(sender);
 }
Example #24
0
 void ButtonClick(Control sender)
 {
     if (ButtonClicked != null)
         this.ButtonClicked(sender);
     //what do here?
 }
Example #25
0
 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);

            }
        }
Example #27
0
        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();
                }
            }*/
        }
Example #28
0
 protected override void HandlerToggle(Control sender)
 {
     bChecked = true;
     if (onToggle != null) onToggle(this);
 }