예제 #1
0
 void CancelButtonClicked(Control sender)
 {
     Show = false;
 }
예제 #2
0
파일: Game1.cs 프로젝트: secgoat/GameServer
 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();
     }
 }
예제 #3
0
파일: Kroz.cs 프로젝트: 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();
     }
 }
예제 #4
0
 protected virtual void HandlerToggle(Control sender)
 {
     bChecked = !bChecked;
     if (onToggle != null) onToggle(this);
 }
예제 #5
0
파일: Game1.cs 프로젝트: secgoat/GameServer
 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();
     }
 }
예제 #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;
 }
예제 #7
0
 void ButtonClick(Control sender)
 {
     if (ButtonClicked != null)
     {
         this.MaxConnections = Int32.Parse(textBoxMaxConnections.Text);
         this.Port = Int32.Parse(textBoxPort.Text);
         this.ButtonClicked(sender);
     }
 }
예제 #8
0
파일: Form.cs 프로젝트: secgoat/GameServer
        /// <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;
                    }
                }
            }
        }
예제 #9
0
파일: Form.cs 프로젝트: secgoat/GameServer
 /// <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;
 }
예제 #10
0
파일: Form.cs 프로젝트: secgoat/GameServer
 /// <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);
 }
예제 #11
0
파일: Form.cs 프로젝트: secgoat/GameServer
 /// <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;
     }
 }
예제 #12
0
파일: Form.cs 프로젝트: secgoat/GameServer
 /// <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;
     }
 }
예제 #13
0
파일: Form.cs 프로젝트: secgoat/GameServer
 /// <summary>
 /// Closes this form, must have a parent to work
 /// </summary>
 public virtual void Close(Control sender)
 {
     if (onClose != null) onClose(this);
 }
예제 #14
0
파일: Form.cs 프로젝트: secgoat/GameServer
        /// <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);
        }
예제 #15
0
 void Changed(Control sender)
 {
     Applied = true;
 }
예제 #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();
        }
예제 #17
0
 void MouseDown(Control sender)
 {
     Clicked = true;
 }
예제 #18
0
 protected virtual void ChildClicked(Control sender)
 {
     if (onClick != null) onClick(this);
 }
예제 #19
0
 void SpringClicked(Control sender)
 {
     springClicked = sender.Name;
     Show = false;
 }
예제 #20
0
 protected virtual void ChildMouseDown(Control sender)
 {
     if (onMouseDown != null) onMouseDown(this);
 }
예제 #21
0
 void LoadButtonClicked(Control sender)
 {
     levelToLoad = Convert.ToInt32(txtLevelSelect.Text);
 }
예제 #22
0
 protected virtual void ChildMouseMove(Control sender)
 {
     if (onMouseMove != null) onMouseMove(this);
 }
예제 #23
0
 void ButtonClick(Control sender)
 {
     if (ButtonClicked != null)
         this.ButtonClicked(sender);
 }
예제 #24
0
 void ButtonClick(Control sender)
 {
     if (ButtonClicked != null)
         this.ButtonClicked(sender);
     //what do here?
 }
예제 #25
0
파일: Game1.cs 프로젝트: secgoat/GameServer
 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();
     }
 }
예제 #26
0
        void ButtonClick(Control sender)
        {
            if (ButtonClicked != null)
            {
                this.Address = textBoxIP.Text;
                this.Port = textBoxPort.Text;
                this.ButtonClicked(sender);

            }
        }
예제 #27
0
파일: Game1.cs 프로젝트: secgoat/GameServer
        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();
                }
            }*/
        }
예제 #28
0
 protected override void HandlerToggle(Control sender)
 {
     bChecked = true;
     if (onToggle != null) onToggle(this);
 }