Esempio n. 1
0
 void CancelButtonClicked(Control sender)
 {
     Show = false;
 }
Esempio n. 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();
     }
 }
Esempio n. 3
0
File: Kroz.cs Progetto: 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();
     }
 }
Esempio n. 4
0
 protected virtual void HandlerToggle(Control sender)
 {
     bChecked = !bChecked;
     if (onToggle != null) onToggle(this);
 }
Esempio n. 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();
     }
 }
Esempio n. 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);
     }
 }
Esempio n. 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;
                    }
                }
            }
        }
Esempio n. 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;
 }
Esempio n. 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);
 }
Esempio n. 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;
     }
 }
Esempio n. 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;
     }
 }
Esempio n. 13
0
 /// <summary>
 /// Closes this form, must have a parent to work
 /// </summary>
 public virtual void Close(Control sender)
 {
     if (onClose != null) onClose(this);
 }
Esempio n. 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);
        }
Esempio n. 15
0
 void Changed(Control sender)
 {
     Applied = true;
 }
Esempio n. 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();
        }
Esempio n. 17
0
 void MouseDown(Control sender)
 {
     Clicked = true;
 }
Esempio n. 18
0
 protected virtual void ChildClicked(Control sender)
 {
     if (onClick != null) onClick(this);
 }
Esempio n. 19
0
 void SpringClicked(Control sender)
 {
     springClicked = sender.Name;
     Show = false;
 }
Esempio n. 20
0
 protected virtual void ChildMouseDown(Control sender)
 {
     if (onMouseDown != null) onMouseDown(this);
 }
Esempio n. 21
0
 void LoadButtonClicked(Control sender)
 {
     levelToLoad = Convert.ToInt32(txtLevelSelect.Text);
 }
Esempio n. 22
0
 protected virtual void ChildMouseMove(Control sender)
 {
     if (onMouseMove != null) onMouseMove(this);
 }
 void ButtonClick(Control sender)
 {
     if (ButtonClicked != null)
         this.ButtonClicked(sender);
 }
Esempio n. 24
0
 void ButtonClick(Control sender)
 {
     if (ButtonClicked != null)
         this.ButtonClicked(sender);
     //what do here?
 }
Esempio n. 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();
     }
 }
Esempio n. 26
0
        void ButtonClick(Control sender)
        {
            if (ButtonClicked != null)
            {
                this.Address = textBoxIP.Text;
                this.Port = textBoxPort.Text;
                this.ButtonClicked(sender);

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