Example #1
0
        public void SetName()
        {
            _name1.Text = TargetManager.Target_1_name;
            _name2.Text = TargetManager.Target_2_name;
            _name3.Text = TargetManager.Target_3_name;
            _name4.Text = TargetManager.Target_4_name;
            _name5.Text = TargetManager.Target_5_name;

            //_obj1.Text = TargetManager.Object_1_name;
            //_obj2.Text = TargetManager.Object_2_name;
            //_obj3.Text = TargetManager.Object_3_name;
            //_obj4.Text = TargetManager.Object_4_name;
            //_obj5.Text = TargetManager.Object_5_name;

            //_lastObjectGump.Text = GameActions.LastObject_name;

            _lastTarget.Text           = TargetManager.LastTarget_name;
            _lastHarmfulTarget.Text    = TargetManager.LastHarmfulTarget_name;
            _lastBeneficialTarget.Text = TargetManager.LastBeneficialTarget_name;
            _selectTarget.Text         = TargetManager.SelectedTarget_name;
            if (LastGump != 0)
            {
                _lastGump.Text = LastGump.ToString();
            }
            else
            {
                _lastGump.Text = "";
            }
            _lastButton.Text = LastButton.ToString();
        }
Example #2
0
 public override void Update()
 {
     base.Update();
     CatalogList.Update();
     LastButton.Update();
     NextButton.Update();
     PageScope.Update();
 }
Example #3
0
 public override void Draw(SpriteBatch spriteBatch)
 {
     base.Draw(spriteBatch);
     CatalogList.Draw(spriteBatch);
     LastButton.Draw(spriteBatch);
     PageScope.Draw(spriteBatch);
     NextButton.Draw(spriteBatch);
 }
Example #4
0
        private void btn_0_Click(object sender, EventArgs e)
        {
            if (LB != LastButton.DIGIT) {
                txtbox_result.ResetText();
            }

            if (LB == LastButton.EQUAL) {
                op1 = op2 = 0.0;
                lbl_expr.Text = "";
                chained = false;
            }

            if (txtbox_result.Text.IndexOf('0') != 0) {
                if (txtbox_result.TextLength < 12) {
                    txtbox_result.AppendText("0");
                } else {
                    SystemSounds.Beep.Play();
                }
            }

            LB = LastButton.DIGIT;
        }
        public void UpdateButton()
        {
            if (ChartSlider.Value == 0)
            {
                FirstButton.DisableButton();
                PreviousButton.DisableButton();
            }
            else
            {
                FirstButton.EnableButton();
                PreviousButton.EnableButton();
            }

            if (ChartSlider.Value == ChartSlider.Maximum)
            {
                NextButton.DisableButton();
                LastButton.DisableButton();
            }
            else
            {
                NextButton.EnableButton();
                LastButton.EnableButton();
            }
        }
Example #6
0
        public TargetMenuGump() : base(0, 0)
        {
            X                = _lastX;
            Y                = _lastY;
            CanMove          = true;
            AcceptMouseInput = true;
            Add(_background  = new AlphaBlendControl(0.3f)
            {
                Width = 180, Height = 500
            });
            Add(new Label(LanguageManager.Current.UI_TargetMenu, true, HUE_FONT, 160, FONT, Renderer.FontStyle.BlackBorder, IO.Resources.TEXT_ALIGN_TYPE.TS_CENTER)
            {
                X = 10,
                Y = 10
            });
            Add(new NiceButton(10, 50, 20, 20, ButtonAction.Activate, "1", 1)
            {
                ButtonParameter = (int)TargetButton.Target_1, IsSelected = (TargetManager.Target_1_name != null)
            });
            Add(new NiceButton(10, 90, 20, 20, ButtonAction.Activate, "2", 2)
            {
                ButtonParameter = (int)TargetButton.Target_2, IsSelected = (TargetManager.Target_2_name != null)
            });
            Add(new NiceButton(10, 130, 20, 20, ButtonAction.Activate, "3", 3)
            {
                ButtonParameter = (int)TargetButton.Target_3, IsSelected = (TargetManager.Target_3_name != null)
            });
            Add(new NiceButton(10, 170, 20, 20, ButtonAction.Activate, "4", 4)
            {
                ButtonParameter = (int)TargetButton.Target_4, IsSelected = (TargetManager.Target_4_name != null)
            });
            Add(new NiceButton(10, 210, 20, 20, ButtonAction.Activate, "5", 5)
            {
                ButtonParameter = (int)TargetButton.Target_5, IsSelected = (TargetManager.Target_5_name != null)
            });



            _name1 = new Label(TargetManager.Target_1_name, true, HUE_FONT, 80, FONT)
            {
                X = 90,
                Y = 50,
            };
            _name2 = new Label(TargetManager.Target_2_name, true, HUE_FONT, 80, FONT)
            {
                X = 90,
                Y = 90,
            };

            _name3 = new Label(TargetManager.Target_3_name, true, HUE_FONT, 80, FONT)
            {
                X = 90,
                Y = 130,
            };
            _name4 = new Label(TargetManager.Target_4_name, true, HUE_FONT, 80, FONT)
            {
                X = 90,
                Y = 170,
            };
            _name5 = new Label(TargetManager.Target_5_name, true, HUE_FONT, 80, FONT)
            {
                X = 90,
                Y = 210,
            };

            Add(_name1);
            Add(_name2);
            Add(_name3);
            Add(_name4);
            Add(_name5);
            Add(new Label("LastTarget:", true, 15, 70, FONT, Renderer.FontStyle.BlackBorder, IO.Resources.TEXT_ALIGN_TYPE.TS_LEFT)
            {
                X = 10,
                Y = 250
            });
            _lastTarget = (new Label(TargetManager.LastTarget_name, true, HUE_FONT, 80, FONT, Renderer.FontStyle.BlackBorder, IO.Resources.TEXT_ALIGN_TYPE.TS_LEFT)
            {
                X = 90,
                Y = 250
            });
            Add(new Label("LastHarmfulTarget:", true, HUE_TITLE, 70, FONT, Renderer.FontStyle.BlackBorder, IO.Resources.TEXT_ALIGN_TYPE.TS_LEFT)
            {
                X = 10,
                Y = 290
            });
            _lastHarmfulTarget = (new Label(TargetManager.LastHarmfulTarget_name, true, HUE_FONT, 80, FONT, Renderer.FontStyle.BlackBorder, IO.Resources.TEXT_ALIGN_TYPE.TS_LEFT)
            {
                X = 90,
                Y = 290
            });
            Add(new Label("LastBeneficialTarget:", true, 60, 70, FONT, Renderer.FontStyle.BlackBorder, IO.Resources.TEXT_ALIGN_TYPE.TS_LEFT)
            {
                X = 10,
                Y = 330
            });
            _lastBeneficialTarget = (new Label(TargetManager.LastBeneficialTarget_name, true, HUE_FONT, 80, FONT, Renderer.FontStyle.BlackBorder, IO.Resources.TEXT_ALIGN_TYPE.TS_LEFT)
            {
                X = 90,
                Y = 330
            });
            Add(new Label("SelectTarget:", true, 50, 70, FONT, Renderer.FontStyle.BlackBorder, IO.Resources.TEXT_ALIGN_TYPE.TS_LEFT)
            {
                X = 10,
                Y = 370
            });
            _selectTarget = (new Label(TargetManager.SelectedTarget_name, true, HUE_FONT, 80, FONT, Renderer.FontStyle.BlackBorder, IO.Resources.TEXT_ALIGN_TYPE.TS_LEFT)
            {
                X = 90,
                Y = 370
            });
            Add(_lastTarget);
            Add(_lastHarmfulTarget);
            Add(_lastBeneficialTarget);
            Add(_selectTarget);

            Add(new Label("LastGump:", true, 60, 70, FONT, Renderer.FontStyle.BlackBorder, IO.Resources.TEXT_ALIGN_TYPE.TS_LEFT)
            {
                X = 10,
                Y = 410
            });
            _lastGump = new Label("", true, HUE_FONT, 80, FONT, Renderer.FontStyle.BlackBorder, IO.Resources.TEXT_ALIGN_TYPE.TS_LEFT)
            {
                X = 90,
                Y = 410
            };
            Add(new Label("LastButton:", true, 60, 70, FONT, Renderer.FontStyle.BlackBorder, IO.Resources.TEXT_ALIGN_TYPE.TS_LEFT)
            {
                X = 10,
                Y = 450
            }
                );
            _lastButton = new Label(LastButton.ToString(), true, HUE_FONT, 80, FONT, Renderer.FontStyle.BlackBorder, IO.Resources.TEXT_ALIGN_TYPE.TS_LEFT)
            {
                X = 90,
                Y = 450
            };

            Add(_lastGump);
            Add(_lastButton);

            //Add(new NiceButton(10, 490, 20, 20, ButtonAction.Activate, "1", 6) { ButtonParameter = (int)TargetButton.Object_1, IsSelected = (TargetManager.Object_1 != 0) });
            //Add(new NiceButton(10, 530, 20, 20, ButtonAction.Activate, "2", 7) { ButtonParameter = (int)TargetButton.Object_2, IsSelected = (TargetManager.Object_2 != 0) });
            //Add(new NiceButton(10, 570, 20, 20, ButtonAction.Activate, "3", 8) { ButtonParameter = (int)TargetButton.Object_3, IsSelected = (TargetManager.Object_3 != 0) });
            //Add(new NiceButton(10, 610, 20, 20, ButtonAction.Activate, "4", 9) { ButtonParameter = (int)TargetButton.Object_4, IsSelected = (TargetManager.Object_4 != 0) });
            //Add(new NiceButton(10, 650, 20, 20, ButtonAction.Activate, "5", 10) { ButtonParameter = (int)TargetButton.Object_5, IsSelected = (TargetManager.Object_5 != 0) });

            //_obj1 = new Label("", true, HUE_FONT, 80, FONT)
            //{
            //    X = 90,
            //    Y = 490,
            //};
            //_obj2 = new Label("", true, HUE_FONT, 80, FONT)
            //{
            //    X = 90,
            //    Y = 530,
            //};

            //_obj3 = new Label("", true, HUE_FONT, 80, FONT)
            //{
            //    X = 90,
            //    Y = 570,
            //};
            //_obj4 = new Label("", true, HUE_FONT, 80, FONT)
            //{
            //    X = 90,
            //    Y = 610,
            //};
            //_obj5 = new Label("", true, HUE_FONT, 80, FONT)
            //{
            //    X = 90,
            //    Y = 650,
            //};
            //Add(_obj1);
            //Add(_obj2);
            //Add(_obj3);
            //Add(_obj4);
            //Add(_obj5);
            //Add(new Label("LastObject:", true, 60, 70, FONT, Renderer.FontStyle.BlackBorder, IO.Resources.TEXT_ALIGN_TYPE.TS_LEFT)
            //{
            //    X = 10,
            //    Y = 690
            //});
            //_lastObjectGump = new Label("", true, HUE_FONT, 80, FONT, Renderer.FontStyle.BlackBorder, IO.Resources.TEXT_ALIGN_TYPE.TS_LEFT)
            //{
            //    X = 90,
            //    Y = 690
            //};
            //Add(_lastObjectGump);
        }
Example #7
0
    void Update()
    {
        fireDelay = LevelController.FireRate;
        maxSpeed  = LevelController.MoveSpeed;
        float shootH = Input.GetAxis("ShootHorizontal");
        float shootV = Input.GetAxis("ShootVertical");

        //resolve sw, se, nw, ne shooting directions
        if (shootH < 0)
        {
            LastButtonPressed = LastButton.Left;
        }
        else if (shootH > 0)
        {
            LastButtonPressed = LastButton.Right;
        }
        else if (shootV < 0)
        {
            LastButtonPressed = LastButton.Down;
        }
        else if (shootV > 0)
        {
            LastButtonPressed = LastButton.Up;
        }

        if (Mathf.Abs(shootH) > Mathf.Abs(shootV))
        {
            shootV = 0;
        }

        if (Mathf.Abs(shootV) > Mathf.Abs(shootH))
        {
            shootH = 0;
        }
        if (Mathf.Abs(shootV) == Mathf.Abs(shootH))
        {
            switch (LastButtonPressed)
            {
            case LastButton.Left:
                shootV = 0;
                break;

            case LastButton.Right:
                shootV = 0;
                break;

            case LastButton.Down:
                shootH = 0;
                break;

            case LastButton.Up:
                shootH = 0;
                break;
            }
        }

        if ((shootH != 0 || shootV != 0) && Time.time > lastFire + fireDelay)
        {
            Shoot(shootH, shootV);
            lastFire = Time.time;
            Debug.Log("Tear Fired");
        }
    }
Example #8
0
 private void LastTButton_Click(object sender, EventArgs e)
 {
     LastButton.PerformClick();
 }
Example #9
0
        private void btn_1_Click(object sender, EventArgs e)
        {
            if (LB != LastButton.DIGIT) {
                txtbox_result.ResetText();
            }

            if (LB == LastButton.EQUAL) {
                op1 = op2 = 0.0;
                lbl_expr.Text = "";
                chained = false;
            }

            if (LB == LastButton.DIGIT && txtbox_result.Text != "0") {
                if (txtbox_result.TextLength < 12) {
                    txtbox_result.AppendText("1");
                } else {
                    // max length of input is 12 characters
                    SystemSounds.Beep.Play();
                }
            } else {
                txtbox_result.Text = "1";
            }

            LB = LastButton.DIGIT;
        }
Example #10
0
        private void btn_subtract_Click(object sender, EventArgs e)
        {
            double D = 0.0;
            expression = lbl_expr.Text;

            // attempt parse and store in local D
            if (double.TryParse(txtbox_result.Text, out D)) {
                if (LB == LastButton.DIGIT && !chained) {
                    expression += D.ToString() + " − ";
                    op1 = D;
                    chained = true;
                } else if (LB == LastButton.OPERATION) {
                    // if last button pressed was an operation button then
                    // replace previous operation in expression with newly
                    // pressed operation
                    if (OP == Operation.ADD || OP == Operation.SUBTRACT ||
                        OP == Operation.MULTIPLY || OP == Operation.DIVIDE) {
                        if (expression.LastIndexOf(" + ") == expression.Length - 3 ||
                        expression.LastIndexOf(" × ") == expression.Length - 3 ||
                        expression.LastIndexOf(" ÷ ") == expression.Length - 3) {

                            expression = expression.Substring(0, expression.Length - 3);
                            expression += " − ";
                        }
                    }
                } else if (LB == LastButton.DIGIT && chained) {
                    expression += D.ToString() + " − ";
                    op1 -= D;
                } else if (LB == LastButton.EQUAL || LB == LastButton.MEMORY) {
                    op1 = D;
                    expression = D.ToString() + " − ";
                }
            }

            LB = LastButton.OPERATION;
            OP = Operation.SUBTRACT;
            lbl_expr.Text = expression;
        }
Example #11
0
        private void btn_period_Click(object sender, EventArgs e)
        {
            if (LB == LastButton.DIGIT || LB == LastButton.NONE) {
                if (txtbox_result.Text.Contains(".")) {
                    // issue system beep sound to indicate error
                    SystemSounds.Beep.Play();
                } else {
                    txtbox_result.AppendText(".");
                }
            } else if (LB == LastButton.EQUAL) {
                op1 = op2 = 0.0;
                txtbox_result.Text = ".";
                lbl_expr.Text = "";
                chained = false;
            } else if (LB == LastButton.OPERATION) {
                txtbox_result.Text = ".";
            }

            LB = LastButton.DIGIT;
        }
Example #12
0
        private void btn_memStore_Click(object sender, EventArgs e)
        {
            double D;

            if (double.TryParse(txtbox_result.Text, out D)) {
                memory = D;
            }

            lbl_memory.Text = "M";

            if (LB != LastButton.EQUAL) {
                LB = LastButton.MEMORY;
            }
        }
Example #13
0
        private void btn_memRecall_Click(object sender, EventArgs e)
        {
            txtbox_result.Text = memory.ToString();

            if (LB != LastButton.EQUAL) {
                LB = LastButton.MEMORY;
            }
        }
Example #14
0
        private void btn_memClear_Click(object sender, EventArgs e)
        {
            memory = 0.0;
            lbl_memory.Text = " ";

            if (LB != LastButton.EQUAL) {
                LB = LastButton.MEMORY;
            }
        }
Example #15
0
        private void btn_equal_Click(object sender, EventArgs e)
        {
            double D = 0.0;
            expression = lbl_expr.Text;

            if (double.TryParse(txtbox_result.Text, out D)) {
                if (LB == LastButton.DIGIT || LB == LastButton.OPERATION || LB == LastButton.MEMORY) {
                    op2 = D;
                    expression += D.ToString() + " =";

                    // perform operation depending on latest operation button pressed
                    switch (OP) {
                    case Operation.ADD:
                        {
                            res = op1 + op2;
                        } break;

                    case Operation.SUBTRACT:
                        {
                            res = op1 - op2;
                        } break;

                    case Operation.MULTIPLY:
                        {
                            res = op1 * op2;
                        } break;

                    case Operation.DIVIDE:
                        {
                            res = op1 / op2;
                        } break;

                    case Operation.NONE:
                        {
                            res = op2;
                        } break;
                    }

                    txtbox_result.Text = res.ToString();
                    lbl_expr.Text = expression;
                } else if (LB == LastButton.EQUAL) {
                    op1 = D;

                    switch (OP) {
                    case Operation.ADD:
                        {
                            res = op1 + op2;
                            expression = op1.ToString() + " + " + op2.ToString() + " =";
                        } break;

                    case Operation.SUBTRACT:
                        {
                            res = op1 - op2;
                            expression = op1.ToString() + " - " + op2.ToString() + " =";
                        } break;

                    case Operation.MULTIPLY:
                        {
                            res = op1 * op2;
                            expression = op1.ToString() + " × " + op2.ToString() + " =";
                        } break;

                    case Operation.DIVIDE:
                        {
                            res = op1 / op2;
                            expression = op1.ToString() + " ÷ " + op2.ToString() + " =";
                        } break;

                    case Operation.NONE:
                        {
                            res = op1;
                            expression = op1.ToString() + " =";
                        } break;
                    }

                    lbl_expr.Text = expression;
                    txtbox_result.Text = res.ToString();
                }

                LB = LastButton.EQUAL;
            }
        }
Example #16
0
 private void btn_clear_Click(object sender, EventArgs e)
 {
     // reset input
     txtbox_result.Text = "0";
     lbl_expr.ResetText();
     chained = false;
     LB = LastButton.NONE;
 }