Example #1
0
        public override void Setup()
        {
            base.Setup();
            Size = new Point(Size.X, Parent.Size.Y);
            _itemsContainer.Position = Position;
            _itemsContainer.Setup();

            UpButton.Setup();
            DownButton.Setup();
            SliderButton.Setup();

            UpButton.Position     = new Point(Left, Top);
            DownButton.Position   = new Point(Left, Parent.Height - DownButton.Height);
            SliderButton.Position = new Point(Left, UpButton.Bottom + CurrentScrollValue);

            _itemsContainer.AddItem(UpButton.Position, UpButton);
            _itemsContainer.AddItem(DownButton.Position, DownButton);
            _itemsContainer.AddItem(SliderButton.Position, SliderButton);

            _scrollEvent.onScroll += ScrollBar_onScrollEvent;

            UpButton.MouseEvent.onMouseClick += (sender, args) =>
            {
                var slider = _itemsContainer[SliderButton].Position;
                _itemsContainer.UpdateSlot(SliderButton, new Point(slider.X, slider.Y - 1));
                _scrollEvent.OnScroll(Parent, ScrollDirection.UP, -1);
            };
            DownButton.MouseEvent.onMouseClick += (sender, args) =>
            {
                var slider = _itemsContainer[SliderButton].Position;
                _itemsContainer.UpdateSlot(SliderButton, new Point(slider.X, slider.Y + 1));
                _scrollEvent.OnScroll(Parent, ScrollDirection.DOWN, 1);
            };
        }
Example #2
0
        public void ReInit()
        {
            if (Product == null)
            {
                Logger.Log("ExoFab Product not found", Category.Machines);
                return;
            }
            foreach (var element in Elements)
            {
                string nameBeforeIndex = element.name.Split('~')[0];
                switch (nameBeforeIndex)
                {
                case "QueueNumber":
                    queueNumberElement = (GUI_ExoFabQueueLabel)element;
                    queueNumberElement.SetValueServer(NumberInQueue.ToString());
                    break;

                case "ProductName":
                    productTextColorElement = (GUI_ExoFabQueueLabel)element;
                    productTextColorElement.SetValueServer(Product.Name);
                    break;

                case "UpButton":
                    UpButton = (NetInteractiveButton)element;
                    UpButton.SetValueServer("true");
                    break;

                case "DownButton":
                    DownButton = (NetInteractiveButton)element;
                    DownButton.SetValueServer("true");
                    break;
                }
            }
        }
        private void BuildFloor()
        {
            ElevatorPanel.Visible = false;
            FloorPanel.Visible    = true;

            FloorName.Text = CurFloor.Name;
            UpButton.Initialize(CurFloor, CurFloor.UpButton, ElevatorButtonTypes.Up);
            DownButton.Initialize(CurFloor, CurFloor.DownButton, ElevatorButtonTypes.Down);
        }
Example #4
0
    public void OnClick(string name)
    {
        if (name == "DropDown")
        {
            DropDownn.SetActive(true);
            UpButton.SetActive(true);
            DropButton.SetActive(false);
            settingsDown.SetActive(true);
            settingsUp.SetActive(false);
            SettingsMenu.SetActive(false);
        }

        else if (name == "Up")
        {
            DropDownn.SetActive(false);
            UpButton.SetActive(false);
            DropButton.SetActive(true);
        }

        else if (name == "SettingsDown")
        {
            settingsDown.SetActive(false);
            settingsUp.SetActive(true);
            SettingsMenu.SetActive(true);
            DropDownn.SetActive(false);
            UpButton.SetActive(false);
            DropButton.SetActive(true);
        }

        else if (name == "SettingsUp")
        {
            settingsDown.SetActive(true);
            settingsUp.SetActive(false);
            SettingsMenu.SetActive(false);
            DropDownn.SetActive(false);
            UpButton.SetActive(false);
            DropButton.SetActive(true);
        }

        else if (name == "AboutUs")
        {
            AboutUs.SetActive(true);
            settingsDown.SetActive(true);
            settingsUp.SetActive(false);
            SettingsMenu.SetActive(false);
            DropDownn.SetActive(false);
            UpButton.SetActive(false);
        }

        else if (name == "AboutEnd")
        {
            AboutUs.SetActive(false);
        }
    }
Example #5
0
        /// <summary>
        /// Resets the settings.
        /// </summary>
        public void ResetSettings()
        {
            if (_isShiftUp)
            {
                UpButton.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));
            }

            if (_isSymbolMode)
            {
                SymbolButton.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));
            }
        }
Example #6
0
 public void Arrived(Elevator elevator)
 {
     if (this.WaitingForDown && elevator.Direction.CurrentState == ElevatorDirectionStates.Down)
     {
         DownButton.ChangeStateTo(ElevatorCallButtonStates.Off);
     }
     if (this.WaitingForUp && elevator.Direction.CurrentState == ElevatorDirectionStates.Up)
     {
         UpButton.ChangeStateTo(ElevatorCallButtonStates.Off);
     }
     ChangeStateTo(FloorStates.ElevatorArrived);
     Output.OutputLine(FloorGreeting);
 }
Example #7
0
 public override void draw(SpriteBatch b)
 {
     Draw(b);
     if (_currentRow < _maxRow)
     {
         DownButton.draw(b);
     }
     if (_currentRow > 0)
     {
         UpButton.draw(b);
     }
     drawMouse(b);
 }
        public MentQNumericUpDown()
        {
            BackColor      = Color.White;
            SelectedColor  = MentQDefaults.MentQBlue;
            DoubleBuffered = true;
            SetStyle(
                ControlStyles.AllPaintingInWmPaint | ControlStyles.CacheText | ControlStyles.OptimizedDoubleBuffer |
                ControlStyles.UserPaint, true);
            Padding = new Padding(3);
            Size    = new Size(90, 24);
            Size        buttonSize = CalculateButtonSize();
            MentQButton upButton   = new MentQButton
            {
                Anchor   = AnchorStyles.Right | AnchorStyles.Top,
                Size     = buttonSize,
                Location = new Point(Width - Padding.Right - buttonSize.Width, Padding.Top),
                Font     = new Font("Segoe UI Symbol", 6),
                Text     = "\uE010"
            };
            MentQButton downButton = new MentQButton
            {
                Anchor   = AnchorStyles.Right | AnchorStyles.Top,
                Size     = buttonSize,
                Location = new Point(Width - Padding.Right - buttonSize.Width,
                                     Height - Padding.Bottom - buttonSize.Height),
                Font = new Font("Segoe UI Symbol", 6),
                Text = "\uE011"
            };

            InternalNumericUpDown             = new NumericUpDown();
            InternalNumericUpDown.BackColor   = BackColor;
            InternalNumericUpDown.BorderStyle = BorderStyle.None;

            // Remove the default numeric up down buttons
            InternalNumericUpDown.Controls.RemoveAt(0);
            UpButton          = upButton;
            DownButton        = downButton;
            UpButton.Click   += (sender, args) => InternalNumericUpDown.UpButton();
            DownButton.Click += (sender, args) => InternalNumericUpDown.DownButton();
            Controls.Add(InternalNumericUpDown);
            InternalNumericUpDown.SendToBack();
            Controls.Add(UpButton);
            UpButton.BringToFront();
            Controls.Add(DownButton);
            DownButton.BringToFront();
        }
Example #9
0
 public override void receiveLeftClick(int x, int y, bool playSound = true)
 {
     base.receiveLeftClick(x, y, true);
     if (UpButton.containsPoint(x, y) && _currentRow > 0)
     {
         Game1.playSound("coin");
         _currentRow--;
         UpButton.scale = UpButton.baseScale;
     }
     if (DownButton.containsPoint(x, y) && _currentRow < _maxRow)
     {
         Game1.playSound("coin");
         _currentRow++;
         DownButton.scale = DownButton.baseScale;
     }
     Refresh();
 }
    /////////////////////////////////////////////////
    //         メイン処理
    ////////////////////////////////////////////////
    void Update()
    {
        UpButton    upButton    = refObjUP.GetComponent <UpButton>();
        RightButton rightButton = refObjR.GetComponent <RightButton>();
        LeftButton  leftButton  = refObjL.GetComponent <LeftButton>();
        FireButton  fireButton  = refObjF.GetComponent <FireButton>();

        if (m_state != State.Damaged)
        {
            //キーでも反映
            float x    = rightButton.fRight + leftButton.fLeft + Input.GetAxis("Horizontal");
            bool  jump = upButton.bJump | Input.GetButtonDown("Jump");


            Move(x, jump);

            // 弾の発射処理
            if ((Input.GetKey(KeyCode.X) || fireButton.bfire) && bbulletflag)
            {
                Shot();
            }

            if (30 == nflame) //取り敢えず30fに一度の発射で
            {
                bbulletflag = true;
            }

            if (false == bbulletflag) //発射不能時のみカウント
            {
                nflame += 1;
            }

            if (false == jump) //ジャンプが二回読み込まれてしまったので一回だけにするように調整 
            {
                nfirstjump = 0;
            }

            if (bigjump)    // upobjectからのフラグでjump
            {
                m_rigidbody2D.AddForce(Vector2.up * jumpPower * 2);
                bigjump = false;
            }
        }
    }
Example #11
0
        public override void OnLayout(IGUIContext ctx, RectangleF bounds)
        {
            if (IsLayoutSuspended)
            {
                return;
            }

            SetBounds(bounds);
            bounds = Bounds;

            float buttonWidth = UpButton.PreferredSize(ctx).Width;
            float halfHeight  = bounds.Height / 2f;
            float buttonLeft  = bounds.Right - buttonWidth;

            UpButton.SetBounds(new RectangleF(buttonLeft, bounds.Top, buttonWidth, halfHeight));
            DownButton.SetBounds(new RectangleF(buttonLeft, bounds.Top + halfHeight - 1, buttonWidth, bounds.Height - halfHeight));

            TB.OnLayout(ctx, new RectangleF(bounds.Left, bounds.Top, bounds.Width - buttonWidth, bounds.Height));
        }
Example #12
0
    // Use this for initialization
    void Start()
    {
        canMoveUp    = true;
        canMoveDown  = true;
        canMoveLeft  = true;
        canMoveRight = true;

        // 重心の回転軌道半径を計算
        radius = sideLength * Mathf.Sqrt(2f) / 2f;

        canGoThruPortals = true;

        up    = MoveButtons.Instance.Up;
        down  = MoveButtons.Instance.Down;
        left  = MoveButtons.Instance.Left;
        right = MoveButtons.Instance.Right;

        MoveButtons.Instance.MovingCubes.Add(this);
    }
Example #13
0
 void UpButton_MouseUp(object sender, MouseEventArgs e)
 {
     upButtonState = 0;
     UpButton.Refresh();
 }
Example #14
0
    void Operate()
    {
        xy LT, RB = new xy();

        LT.x      = startPos.x < endPos.x ? startPos.x : endPos.x;
        LT.y      = startPos.y < endPos.y ? startPos.y : endPos.y;
        RB.x      = startPos.x > endPos.x ? startPos.x : endPos.x;
        RB.y      = startPos.y > endPos.y ? startPos.y : endPos.y;
        OverlayLT = LT;
        OverlayRB = RB;
        if (Oper == 1) // +
        {
            bool isable = true;
            int  cnt    = 0;
            for (int i = LT.x; i <= RB.x; i++)
            {
                for (int j = LT.y; j <= RB.y; j++)
                {
                    cnt++;
                    if (gridNow[i, j] != 0)
                    {
                        isable = false;
                    }
                }
            }
            if (isable && cnt == Num)
            {
                SavePreData();
                for (int i = LT.x; i <= RB.x; i++)
                {
                    for (int j = LT.y; j <= RB.y; j++)
                    {
                        gridcs.ChangeBlockColor(i, j, color);
                    }
                }

                FinishOperate();
            }
            else
            {
                PopDisable();
            }
        }
        else if (Oper == 2) // -
        {
            bool isable = true;
            int  cnt    = 0;
            for (int i = LT.x; i <= RB.x; i++)
            {
                for (int j = LT.y; j <= RB.y; j++)
                {
                    cnt++;
                    if (gridNow[i, j] == 0)
                    {
                        isable = false;
                    }
                }
            }
            if (isable && cnt == Num)
            {
                SavePreData();
                for (int i = LT.x; i <= RB.x; i++)
                {
                    for (int j = LT.y; j <= RB.y; j++)
                    {
                        gridcs.ChangeBlockColor(i, j, 0);
                    }
                }
                FinishOperate();
            }
            else
            {
                PopDisable();
            }
        }
        else if (Oper == 3) // ×
        {
            Overlay.SetActive(true);
            Direction_Button.SetActive(true);
            bool isable = true;
            for (int i = LT.x; i <= RB.x; i++)
            {
                for (int j = LT.y; j <= RB.y; j++)
                {
                    if (gridNow[i, j] == 0)
                    {
                        isable = false;
                    }
                }
            }
            if (!isable)
            {
                Overlay.SetActive(false);
                Direction_Button.SetActive(false);
                goto end;
            }

            bool isableUp, isableDown, isableLeft, isableRight;
            isableUp = isableDown = isableLeft = isableRight = true;

            //위로 가능한지 확인
            if (LT.y - (Num - 1) * (RB.y - LT.y + 1) < 0)
            {
                isableUp = false;;
            }
            else
            {
                for (int i = LT.x; i <= RB.x; i++)
                {
                    for (int j = LT.y - 1; j >= LT.y - (Num - 1) * (RB.y - LT.y + 1); j--)
                    {
                        if (gridNow[i, j] != 0)
                        {
                            isableUp = false;
                        }
                    }
                }
            }

            //아래로 가능한지 확인
            if (RB.y + (Num - 1) * (RB.y - LT.y + 1) >= gridSize)
            {
                isableDown = false;;
            }
            else
            {
                for (int i = LT.x; i <= RB.x; i++)
                {
                    for (int j = RB.y + 1; j <= RB.y + (Num - 1) * (RB.y - LT.y + 1); j++)
                    {
                        if (gridNow[i, j] != 0)
                        {
                            isableDown = false;
                        }
                    }
                }
            }
            //왼쪽로 가능한지 확인
            if (LT.x - (Num - 1) * (RB.x - LT.x + 1) < 0)
            {
                isableLeft = false;
            }
            else
            {
                for (int i = LT.x - 1; i >= LT.x - (Num - 1) * (RB.x - LT.x + 1); i--)
                {
                    for (int j = LT.y; j <= RB.y; j++)
                    {
                        if (gridNow[i, j] != 0)
                        {
                            isableLeft = false;
                        }
                    }
                }
            }

            //오른쪽으로 가능한지 확인

            if (RB.x + (Num - 1) * (RB.x - LT.x + 1) >= gridSize)
            {
                isableRight = false;
            }
            else
            {
                for (int i = RB.x + 1; i <= RB.x + (Num - 1) * (RB.x - LT.x + 1); i++)
                {
                    for (int j = LT.y; j <= RB.y; j++)
                    {
                        if (gridNow[i, j] != 0)
                        {
                            isableRight = false;
                        }
                    }
                }
            }


            UpButton.transform.position    = (gridViewArr[LT.x, LT.y] + gridViewArr[RB.x + 1, LT.y]) / 2f + new Vector2(0f, 50f) * ratio;
            DownButton.transform.position  = (gridViewArr[LT.x, RB.y + 1] + gridViewArr[RB.x + 1, RB.y + 1]) / 2f - new Vector2(0f, 50f) * ratio;
            LeftButton.transform.position  = (gridViewArr[LT.x, LT.y] + gridViewArr[LT.x, RB.y + 1]) / 2f - new Vector2(50f, 0f) * ratio;
            RightButton.transform.position = (gridViewArr[RB.x + 1, LT.y] + gridViewArr[RB.x + 1, RB.y + 1]) / 2f + new Vector2(50f, 0f) * ratio;
            if (isableUp || isableDown || isableLeft || isableRight)
            {
                isOverlay = true;
            }

            UpButton.SetActive(isableUp);
            DownButton.SetActive(isableDown);
            LeftButton.SetActive(isableLeft);
            RightButton.SetActive(isableRight);

            end :;
        }
        else if (Oper == 4) // ÷
        {
            Overlay.SetActive(true);
            Direction_Button_Division.SetActive(true);
            bool isable = true;
            for (int i = LT.x; i <= RB.x; i++)
            {
                for (int j = LT.y; j <= RB.y; j++)
                {
                    if (gridNow[i, j] == 0)
                    {
                        isable = false;
                    }
                }
            }
            if (!isable)
            {
                Overlay.SetActive(false);
                Direction_Button_Division.SetActive(false);
                goto end;
            }

            bool isVertical, isHorizental;
            isVertical = isHorizental = true;

            if ((RB.x - LT.x + 1) % Num != 0)
            {
                isHorizental = false;
            }
            else
            {
                for (int j = LT.y; j <= RB.y; j++)
                {
                    for (int k = 0; k < ((RB.x - LT.x + 1) / Num); k++)
                    {
                        for (int i = LT.x + ((RB.x - LT.x + 1) / Num) + k; i <= RB.x; i += ((RB.x - LT.x + 1) / Num))
                        {
                            if (gridNow[i, j] != gridNow[LT.x + k, j])
                            {
                                isHorizental = false;
                            }
                        }
                    }
                }
            }
            if ((RB.y - LT.y + 1) % Num != 0)
            {
                isVertical = false;
            }
            else
            {
                for (int i = LT.x; i <= RB.x; i++)
                {
                    for (int k = 0; k < ((RB.y - LT.y + 1) / Num); k++)
                    {
                        for (int j = LT.y + ((RB.y - LT.y + 1) / Num) + k; j <= RB.y; j += ((RB.y - LT.y + 1) / Num))
                        {
                            if (gridNow[i, j] != gridNow[i, LT.y + k])
                            {
                                isVertical = false;
                            }
                        }
                    }
                }
            }

            DownButton_Division.transform.position  = (gridViewArr[LT.x, LT.y] + gridViewArr[RB.x + 1, LT.y]) / 2f - new Vector2(0f, 50f) * ratio;
            UpButton_Division.transform.position    = (gridViewArr[LT.x, RB.y + 1] + gridViewArr[RB.x + 1, RB.y + 1]) / 2f + new Vector2(0f, 50f) * ratio;
            RightButton_Division.transform.position = (gridViewArr[LT.x, LT.y] + gridViewArr[LT.x, RB.y + 1]) / 2f + new Vector2(50f, 0f) * ratio;
            LeftButton_Division.transform.position  = (gridViewArr[RB.x + 1, LT.y] + gridViewArr[RB.x + 1, RB.y + 1]) / 2f - new Vector2(50f, 0f) * ratio;
            if (isVertical || isHorizental)
            {
                isOverlay = true;
            }

            UpButton_Division.SetActive(isVertical);
            DownButton_Division.SetActive(isVertical);
            LeftButton_Division.SetActive(isHorizental);
            RightButton_Division.SetActive(isHorizental);

            end :;
        }
        else if (Oper == 5) // change_color
        {
            if (color_from != 0 && color_to != 0)
            {
                SavePreData();
                for (int i = LT.x; i <= RB.x; i++)
                {
                    for (int j = LT.y; j <= RB.y; j++)
                    {
                        if (gridNow[i, j] == color_from)
                        {
                            gridcs.ChangeBlockColor(i, j, color_to);
                        }
                    }
                }

                FinishOperate();
            }
        }
        else if (Oper == 6) // erase_line
        {
            if (is_Vertical == 1)
            {
                SavePreData();
                int i = LT.x;
                for (int j = 0; j < gridSize; j++)
                {
                    gridcs.ChangeBlockColor(i, j, 0);
                }

                FinishOperate();
            }
            else if (is_Vertical == 2)
            {
                SavePreData();
                int j = LT.y;
                for (int i = 0; i < gridSize; i++)
                {
                    gridcs.ChangeBlockColor(i, j, 0);
                }

                FinishOperate();
            }
        }
        else // ?
        {
        }
    }
Example #15
0
 public override void performHoverAction(int x, int y)
 {
     base.performHoverAction(x, y);
     UpButton.scale   = UpButton.containsPoint(x, y) ? Math.Min(UpButton.scale + 0.02f, UpButton.baseScale + 0.1f) : Math.Max(UpButton.scale - 0.02f, UpButton.baseScale);
     DownButton.scale = DownButton.containsPoint(x, y) ? Math.Min(DownButton.scale + 0.02f, DownButton.baseScale + 0.1f) : Math.Max(DownButton.scale - 0.02f, DownButton.baseScale);
 }