Beispiel #1
0
        private bool checkButtonState(bool pressedNow, string buttonName)
        {
            bool       significant   = false;
            ButtonFlag buttonFlag    = getButtonFlag(buttonName);
            bool       pressedBefore = isButtonPressed(buttonFlag);

            if (pressedNow && !pressedBefore) //On down
            {
                setPressedButton(buttonFlag, true);
                significant = true;
                if (buttonName == "Home")
                {
                    Console.WriteLine("home down");
                    if (OverlayWindow.Current.OverlayIsOn())
                    {
                        this.hideOverlayOnUp = true;
                        Console.WriteLine("hide overlay on up");
                    }
                    else
                    {
                        this.homeButtonTimer.Start();
                    }
                }
                else
                {
                    this.KeyMap.executeButtonDown(buttonName);
                }
            }
            else if (!pressedNow && pressedBefore) //On up
            {
                setPressedButton(buttonFlag, false);
                significant = true;
                if (buttonName == "Home")
                {
                    Console.WriteLine("home up");
                    this.homeButtonTimer.Stop();

                    if (this.hideOverlayOnUp)
                    {
                        this.hideOverlayOnUp = false;
                        OverlayWindow.Current.HideOverlay();
                    }
                    else if (OverlayWindow.Current.OverlayIsOn()) //We opened the overlay on this down
                    {
                    }
                    else
                    {
                        this.KeyMap.executeButtonDown("Home");
                        this.releaseHomeOnNextUpdate = true;
                    }
                }
                else
                {
                    this.KeyMap.executeButtonUp(buttonName);
                }
            }

            return(significant);
        }
Beispiel #2
0
 public void clickExtrudeButton()
 {
     buttonFlag = ButtonFlag.EXTRUDE;
     foreach (Transform iter in transform)
     {
         iter.GetComponent <MeshExtrude>().setState("ACTIVE");
     }
 }
Beispiel #3
0
 public void clickDoneButton()
 {
     buttonFlag = ButtonFlag.DESELECT;
     foreach (Transform iter in transform)
     {
         iter.GetComponent <MeshExtrude>().setState("INACTIVE");
     }
 }
Beispiel #4
0
 public void ClickDoneButton()
 {
     buttonFlag = ButtonFlag.DESELECT;
     //CancelInvoke();
     foreach (Transform iter in transform)
     {
         iter.GetComponent <CylinderLine>().setState("INACTIVE");
     }
 }
Beispiel #5
0
 private void setPressedButton(ButtonFlag button, bool value)
 {
     if (value)
     {
         PressedButtons |= button;
     }
     else
     {
         PressedButtons &= ~button;
     }
 }
Beispiel #6
0
        public Keymap loadKeyMap(string filename)
        {
            Keymap keymap = KeymapDatabase.Current.getKeymap(filename);

            this.setKeymap(keymap);

            //this.processWiimoteState(new WiimoteState()); //Sets all buttons to "not pressed"
            PressedButtons = PressedButtons & ButtonFlag.Home;

            Console.WriteLine("Loaded new keymap " + filename);
            return(keymap);
        }
Beispiel #7
0
 public void clickDoneButton()
 {
     buttonFlag = ButtonFlag.DESELECT;
     foreach (Transform iter in transform)
     {
         if (iter.gameObject.name == "QuadPolygon")
         {
             iter.GetComponent <QuadPolygon>().setState("INACTIVE");
         }
         if (iter.gameObject.name == "QuadCircle")
         {
             iter.GetComponent <QuadCircle>().setState("INACTIVE");
         }
     }
     drawone = false;
 }
    /// <summary>
    /// 버튼 UI에서 방향값 획득
    /// ButtonFlag 컴포넌트 연동
    /// </summary>
    /// <returns></returns>
    void CheckFlag()
    {
        ButtonFlag L = btnL.GetComponent <ButtonFlag>();
        ButtonFlag R = btnR.GetComponent <ButtonFlag>();
        ButtonFlag U = btnU.GetComponent <ButtonFlag>();
        ButtonFlag D = btnD.GetComponent <ButtonFlag>();


        if (L.getFlag())
        {
            moveDirection = MoveDirection.Left;
        }
        else if (R.getFlag())
        {
            moveDirection = MoveDirection.Right;
        }
        else if (U.getFlag())
        {
            moveDirection = MoveDirection.Up;
        }
        else if (D.getFlag())
        {
            moveDirection = MoveDirection.Down;
        }
        else
        {
            moveDirection = MoveDirection.None;
        }

        L.setOff();
        R.setOff();
        U.setOff();
        D.setOff();

        L.MirrorSync(true);
        R.MirrorSync(true);
        U.MirrorSync(true);
        D.MirrorSync(true);
    }
Beispiel #9
0
 public void ClickEraserButton()
 {
     buttonFlag = ButtonFlag.ERASER;
 }
Beispiel #10
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="ButtonActionAttribute" /> class.
 /// </summary>
 /// <param name="buttonFlag">The button flag.</param>
 public ButtonActionAttribute(ButtonFlag buttonFlag)
 {
     ButtonFlag = buttonFlag;
 }
Beispiel #11
0
    /* --------------------------------------------------
     * Public Function
     * -------------------------------------------------- */

    public void ClickPencilButton()
    {
        buttonFlag = ButtonFlag.PENCIL;
    }
 /// <summary>
 ///     Clicks the button without WaitAjax.
 /// </summary>
 /// <typeparam name="TPageObject">The type of the T page object.</typeparam>
 /// <param name="pageObject">The page object.</param>
 /// <param name="buttonFlag">The button flag.</param>
 public void ClickButtonWithoutAjax <TPageObject>(TPageObject pageObject, ButtonFlag buttonFlag)
     where TPageObject : class
 {
     GetButton(pageObject, buttonFlag).Click();
 }
 /// <summary>
 ///     Gets the property of type <see cref="Button" /> with attribute <see cref="ButtonActionAttribute" />
 /// </summary>
 /// <param name="value">The page object.</param>
 /// <param name="buttonFlag">The ButtonFlag.</param>
 /// <returns>The found button element.</returns>
 public Button GetButton(object value, ButtonFlag buttonFlag)
 {
     return
         (value.GetPropertyValuesWithFilteredAttribute <Button, ButtonActionAttribute>(x => x.ButtonFlag.Equals(buttonFlag))
          .First());
 }
 /// <summary>
 ///     Clicks the button.
 /// </summary>
 /// <typeparam name="TPageObject">The type of the T page object.</typeparam>
 /// <param name="pageObject">The page object.</param>
 /// <param name="buttonFlag">The button flag.</param>
 public void ClickButton <TPageObject>(TPageObject pageObject, ButtonFlag buttonFlag) where TPageObject : class
 {
     GetButton(pageObject, buttonFlag).ClickAndWaitAjax();
 }
 /// <summary>
 ///     Clicks the button.
 /// </summary>
 /// <typeparam name="TPageObject">The type of the T page object.</typeparam>
 /// <param name="buttonFlag">The button flag.</param>
 public void ClickButtonWithoutAjax <TPageObject>(ButtonFlag buttonFlag) where TPageObject : class, new()
 {
     GetButton(new TPageObject(), buttonFlag).Click();
 }
 /// <summary>
 ///     Verifies the button enabled/disabled.
 /// </summary>
 /// <typeparam name="TPageObject">The type of the T page object.</typeparam>
 /// <param name="pageObject">The page object.</param>
 /// <param name="buttonFlag">The button flag.</param>
 /// <param name="enabled">if set to <c>true</c> verify button enabled, <c>false</c> - disabled.</param>
 public void VerifyButtonEnabled <TPageObject>(TPageObject pageObject, ButtonFlag buttonFlag, bool enabled)
     where TPageObject : class
 {
     Verify.AreEqual(GetButton(pageObject, buttonFlag).Enabled, enabled);
 }
 /// <summary>
 ///     Clicks the button.
 /// </summary>
 /// <typeparam name="TPageObject">The type of the T page object.</typeparam>
 /// <param name="buttonFlag">The button flag.</param>
 public void ClickButton <TPageObject>(ButtonFlag buttonFlag) where TPageObject : class, new()
 {
     GetButton(new TPageObject(), buttonFlag).ClickAndWaitAjax();
 }
Beispiel #18
0
 public void clickCircleButton()
 {
     buttonFlag = ButtonFlag.CIRCLE;
 }
Beispiel #19
0
 private bool isButtonPressed(ButtonFlag button)
 {
     return((PressedButtons & button) != 0);
 }
Beispiel #20
0
        /// <summary>
        /// Returns true while the virtual button identified by buttonName is held down.
        /// </summary>
        /// <returns><c>true</c>, if button was gotten, <c>false</c> otherwise.</returns>
        /// <param name="buttonName">The button whose down state we are checking.</param>
        public bool GetButton(string buttonName)
        {
            bool key = false;             //default

            ButtonFlag buttonMask = (ButtonFlag)cData.Buttons;

            switch (buttonName.ToLower())
            {
            case "joystickup":
                if (cData.yJoyStick > joystickButtonThreshold)
                {
                    key = true;
                }
                break;

            case "joystickdown":
                if (cData.yJoyStick < -joystickButtonThreshold)
                {
                    key = true;
                }
                break;

            case "joystickright":
                if (cData.xJoyStick > joystickButtonThreshold)
                {
                    key = true;
                }
                break;

            case "joystickleft":
                if (cData.xJoyStick < -joystickButtonThreshold)
                {
                    key = true;
                }
                break;

            case "app":
                if ((buttonMask & ButtonFlag.App) == ButtonFlag.App)
                {
                    key = true;
                }
                break;

            case "home":
                if ((buttonMask & ButtonFlag.Home) == ButtonFlag.Home)
                {
                    key = true;
                }
                break;

            case "square":
                if ((buttonMask & ButtonFlag.Square) == ButtonFlag.Square)
                {
                    key = true;
                }
                break;

            case "down":
                if ((buttonMask & ButtonFlag.Down) == ButtonFlag.Down)
                {
                    key = true;
                }
                break;

            case "trigger1":
                if ((buttonMask & ButtonFlag.Trigger1) == ButtonFlag.Trigger1)
                {
                    key = true;
                }
                break;

            case "trigger2":
                if ((buttonMask & ButtonFlag.Trigger2) == ButtonFlag.Trigger2)
                {
                    key = true;
                }
                break;

            case "z":
                if ((buttonMask & ButtonFlag.Z) == ButtonFlag.Z)
                {
                    key = true;
                }
                break;

            case "power":
                if ((buttonMask & ButtonFlag.Power) == ButtonFlag.Power)
                {
                    key = true;
                }
                break;

            default:
                break;
            }
            return(key);            //default
        }
Beispiel #21
0
 public static bool All(ButtonFlag selection, ButtonFlag search)
 {
     return((selection & search) == search);
 }
Beispiel #22
0
 public static bool Any(ButtonFlag selection, ButtonFlag search)
 {
     return((selection & search) != MouseTracker.ButtonFlag.None);
 }
 /// <summary>
 ///     Verifies the button enabled.
 /// </summary>
 /// <typeparam name="TPageObject">The type of the T page object.</typeparam>
 /// <param name="pageObject">The page object.</param>
 /// <param name="buttonFlag">The button flag.</param>
 public void VerifyButtonEnabled <TPageObject>(TPageObject pageObject, ButtonFlag buttonFlag) where TPageObject : class
 {
     VerifyButtonEnabled(pageObject, buttonFlag, true);
 }
Beispiel #24
0
 public void clickPolygonButton()
 {
     buttonFlag = ButtonFlag.POLYGON;
 }