Inheritance: MonoBehaviour
Ejemplo n.º 1
0
        public virtual IEnumerator<ITask> ReplaceHandler(ButtonPress replace)
        {
            WinFormsServicePort.FormInvoke(
                delegate
                {
                    _form.AddMsg(replace.Body.msg);

                }
            );

            yield break;
        }
Ejemplo n.º 2
0
    public void LoadButtonPress(string guiName, GUICanvasBase guiBase)
    {
        mGUIName = guiName;
        mGUIBase = guiBase;

        mButtonPress = mGUIBase.FindButton(mGUIName);

        if (mButtonPress == null)
        {
            throw new NullReferenceException("NO ButtonPress FOUND. mGUIBase: " + mGUIBase + ", mGUIName: " + mGUIName);
        }

        enabled = ((mObj != null) && (mButtonPress != null));
    }
Ejemplo n.º 3
0
    public void SetShipDesign(ShipDesign design, ButtonPress callBack, DeleteButtonPress deleteMethod)
    {
        shipDesign     = design;
        buttonCallBack = callBack;
        deleteCallBack = deleteMethod;

        ShipDesignData designData = shipDesign.GetShipDesignData();

        DesignName.text   = shipDesign.Name;
        CommandValue.text = designData.CommandPoints.ToString();
        CostValue.text    = designData.GetTotalValue().ToString("0.#");

        CommandIcon.overrideSprite = ResourceManager.instance.GetIconTexture("Icon_CommandPoint");
        CommandIcon.preserveAspect = true;

        CostIcon.overrideSprite = ResourceManager.instance.GetIconTexture("Icon_Money");
        CostIcon.preserveAspect = true;
    }
Ejemplo n.º 4
0
 public void Initialize()
 {
     buttons.Add(new MouseButtonHandler(
                     () => mouseCore.LeftButton,
                     () => ButtonPress?.Invoke(this, new MouseButtonInteraction(X, Y, MouseButton.Left)),
                     () => ButtonHold?.Invoke(this, new MouseButtonInteraction(X, Y, MouseButton.Left)),
                     () => ButtonLift?.Invoke(this, new MouseButtonInteraction(X, Y, MouseButton.Left))));
     buttons.Add(new MouseButtonHandler(
                     () => mouseCore.MiddleButton,
                     () => ButtonPress?.Invoke(this, new MouseButtonInteraction(X, Y, MouseButton.Middle)),
                     () => ButtonHold?.Invoke(this, new MouseButtonInteraction(X, Y, MouseButton.Middle)),
                     () => ButtonLift?.Invoke(this, new MouseButtonInteraction(X, Y, MouseButton.Middle))));
     buttons.Add(new MouseButtonHandler(
                     () => mouseCore.RightButton,
                     () => ButtonPress?.Invoke(this, new MouseButtonInteraction(X, Y, MouseButton.Right)),
                     () => ButtonHold?.Invoke(this, new MouseButtonInteraction(X, Y, MouseButton.Right)),
                     () => ButtonLift?.Invoke(this, new MouseButtonInteraction(X, Y, MouseButton.Right))));
 }
Ejemplo n.º 5
0
        private void OnGrabPress(ButtonPress btn)
        {
            if (!IsSameHand(trackedHand.hand, btn.hand))
            {
                return;
            }

            foreach (IGrabable grabable in intersectingGrababales)
            {
                var canGrab = !grabbing.Contains(grabable) &&
                              grabable.GetGrabMode().HasFlag(GrabMode.Grabable);
                if (canGrab && grabable.Grabbed(this))
                {
                    grabbing.Add(grabable);
                }
            }

            lastGrabPressTime = Time.time;
        }
Ejemplo n.º 6
0
    private void Awake()
    {
        myGameObject = gameObject;
        photonView   = GetComponent <PhotonView>();
        animator     = GetComponent <Animator>();

        holdKeyMinigame = GetComponentInChildren <HoldKeyMinigame>();

        buildCostText   = transform.Find("Canvas").GetChild(1).GetChild(1).GetComponentInChildren <TMPro.TextMeshProUGUI>();
        buildCostObject = buildCostText.transform.parent.gameObject;

        buttonPress       = transform.Find("Canvas").GetChild(1).GetChild(0).GetComponent <ButtonPress>();
        buttonPressObject = buttonPress.gameObject;

        holdKeyMinigame = GetComponentInChildren <HoldKeyMinigame>();
        holdKeyBold     = holdKeyMinigame.gameObject;

        NetworkManager.OnGameStart += OnGameStart;
    }
Ejemplo n.º 7
0
    public void AddToLog(ButtonPress buttonPress)
    {
        string title     = "%Log_" + System.DateTime.Now.ToString("yyyy-MM-dd") + ".csv";
        string CSVString = "";

        if (!File.Exists(defaultPalettePath + SLASH + title))
        {
            CSVString += "Timestamp,Response Time,Client ID,Palette Title,Speech,Goal,Subgoal,Proficiency" + "\r\n";
        }
        CSVString += System.DateTime.Now.ToString("yyyy-MM-dd h:mm:sstt ") + timezone + ","; //Time Stamp
        CSVString += buttonDuration.ToString("n2") + "s" + ",";                              //Response time
        CSVString += palettes[paletteIndex].title + ",";                                     //Title
        CSVString += buttonPress.speech + ",";                                               //Speech
        //Write to file
        StreamWriter writer = new StreamWriter(defaultPalettePath + SLASH + title, true);    //true to append, false to overwrite

        writer.WriteLine(CSVString);
        writer.Close();
    }
Ejemplo n.º 8
0
 protected virtual void OnButtonPress(ButtonPress buttonPress, UFE3D.CharacterInfo player)
 {
     // Fires when a player successfully executes a move
     // player.playerNum = 1 or 2
     if (player.playerNum == 1 &&
         !complete &&
         !UFE.config.lockInputs &&
         UFE.gameMode == GameMode.ChallengeMode &&
         challengeActions[currentAction].actionType == ActionType.ButtonPress &&
         challengeActions[currentAction].button == buttonPress)
     {
         currentAction++;
         testChallenge();
     }
     else
     {
         currentAction = 0;
     }
 }
Ejemplo n.º 9
0
        public bool getButtonPressForPlayer(ActivePlayer player, string buttonName, ButtonPress buttonPress)
        {
            if (GameType == GameType.MultiPlayerSplitScreen && player == PlayerTwo)
            {
                buttonName += " P2";
            }

            if (buttonPress == ButtonPress.Down)
            {
                return(Input.GetButtonDown(buttonName));
            }
            else if (buttonPress == ButtonPress.Up)
            {
                return(Input.GetButtonUp(buttonName));
            }
            else
            {
                return(Input.GetButton(buttonName));
            }
        }
Ejemplo n.º 10
0
    //returns the pressed buttons
    public List <ButtonPress> getPressed()
    {
        //checks if the screen is touched
        if (!(isBeingTouched()))
        {
            return(null);
        }

        //array holding all the touches on screen
        Touch[] touches = Input.touches;

        //creates list of touches
        List <ButtonPress> list = new List <ButtonPress> ();

        //if we are not paused
        foreach (GameObject test in UserUiObjects)
        {
            //verifies that the touch is valid
            if (test == null)
            {
                continue;
            }

            //gets the script of the button
            ButtonPress button = test.GetComponent <ButtonPress> ();

            //checks each instance
            foreach (Touch instance in touches)
            {
                //checks if instance is pressedd
                if (button.isPressed(instance.position))
                {
                    //adds to pressed buttons
                    list.Add(button);
                    break;
                }
            }
        }

        return(list);
    }
Ejemplo n.º 11
0
    public static NetworkButtonPress ToNetworkButtonPress(this ButtonPress button)
    {
        switch (button)
        {
        case ButtonPress.Up:            return(NetworkButtonPress.Up);

        case ButtonPress.Down:          return(NetworkButtonPress.Down);

        case ButtonPress.Back:          return(NetworkButtonPress.Back);

        case ButtonPress.Forward:       return(NetworkButtonPress.Forward);

        case ButtonPress.Button1:       return(NetworkButtonPress.Button1);

        case ButtonPress.Button2:       return(NetworkButtonPress.Button2);

        case ButtonPress.Button3:       return(NetworkButtonPress.Button3);

        case ButtonPress.Button4:       return(NetworkButtonPress.Button4);

        case ButtonPress.Button5:       return(NetworkButtonPress.Button5);

        case ButtonPress.Button6:       return(NetworkButtonPress.Button6);

        case ButtonPress.Button7:       return(NetworkButtonPress.Button7);

        case ButtonPress.Button8:       return(NetworkButtonPress.Button8);

        case ButtonPress.Button9:       return(NetworkButtonPress.Button9);

        case ButtonPress.Button10:      return(NetworkButtonPress.Button10);

        case ButtonPress.Button11:      return(NetworkButtonPress.Button11);

        case ButtonPress.Button12:      return(NetworkButtonPress.Button12);

        case ButtonPress.Start:         return(NetworkButtonPress.Start);

        default:                                        return(NetworkButtonPress.None);
        }
    }
Ejemplo n.º 12
0
    public ScenarioListEntry(Rect rect, Scenario scene, ButtonPress callBack, GameManager controller)
    {
        mainRect = rect;

        TitleRect       = new Rect(rect.x + rect.width * 0.05f, rect.y + rect.height * 0.03f, rect.width * 0.9f, rect.height * 0.15f);
        DifficultlyRect = new Rect(TitleRect.x, TitleRect.yMax, TitleRect.width, rect.height * 0.1f);
        TimeRect        = new Rect(TitleRect.x, DifficultlyRect.yMax, TitleRect.width, rect.height * 0.1f);
        CommandRect     = new Rect(TitleRect.x, TimeRect.yMax, TitleRect.width, rect.height * 0.1f);
        MoneyRect       = new Rect(TitleRect.x, CommandRect.yMax, TitleRect.width, rect.height * 0.1f);
        DescriptionRect = new Rect(TitleRect.x, MoneyRect.yMax, TitleRect.width, rect.height * 0.35f);

        scenario       = scene;
        buttonCallBack = callBack;

        gameController = controller;

        Difficulty = "Difficulty: " + GetDifficultyString(scenario.Difficulty);
        Time       = "Time: " + ((int)scenario.TimeLimit / 60).ToString("0") + ":" + (scenario.TimeLimit % 60).ToString("00");
        Command    = "Command: " + scenario.CommandLimit.ToString();
        Money      = "Money: " + scenario.MoneyLimit.ToString();
    }
Ejemplo n.º 13
0
        public static void Update()
        {
            if (FirstPlayer == -1)
            {
                return;
            }
            var oldStates = States;

            States = new InputStates
            {
                GamePadState = OpenTK.Input.GamePad.GetState(FirstPlayer),
                //KeyboardState = Keyboard.GetState()
            };
            foreach (string button in ButtonNames)
            {
                if (States.IsButtonDown(button, true))
                {
                    if (!oldStates.IsButtonDown(button, true))
                    {
                        foreach (var dele in ButtonPress?.GetInvocationList() ?? new Delegate[] { })
                        {
                            if ((bool)dele.DynamicInvoke(button))
                            {
                                break;
                            }
                        }
                    }
                }
                else if (oldStates.IsButtonDown(button, true))
                {
                    foreach (var dele in ButtonRelease?.GetInvocationList() ?? new Delegate[] { })
                    {
                        if ((bool)dele.DynamicInvoke(button))
                        {
                            break;
                        }
                    }
                }
            }
        }
Ejemplo n.º 14
0
        void Start()
        {
            // seed the random number generator
            Random.InitState(randomSeed);

            // save all primitives
            primitives = new Dictionary <string, GameObject>();
            foreach (Transform t in GameObject.Find("GeometricPrimitives").transform)
            {
                primitives.Add(t.name, t.gameObject);
            }

            //Add all the available holders to the manager
            vholders = new List <GameObject>();
            hholders = new List <GameObject>();

            foreach (Transform child in transform)
            {
                if (child.name.Contains("VerticalHolder"))
                {
                    vholders.Add(child.gameObject);
                }
                else if (child.name.Contains("HorizontalHolder"))
                {
                    hholders.Add(child.gameObject);
                }
            }

            // find button
            button = GetComponentInChildren <ButtonPress>();

            // find data logger
            logger = FindObjectOfType <DataLogger>();
            logger.SetLogging(DataLogger.LoggingStatus.Clear);
            edc = FindObjectOfType <EyeDataCollect>();
            edc.SetLogging(EyeDataCollect.LoggingStatus.Clear);

            // clear PHAM
            ClearPHAM();
        }
Ejemplo n.º 15
0
        void OnButtonUnpress(VREvent_t ev)
        {
            ButtonPress btn;
            var         hand   = GetHandForDevice(ev.trackedDeviceIndex);
            var         button = (EVRButtonId)ev.data.controller.button;

            if (button == triggerButton)
            {
                btn = new ButtonPress(hand, Button.Trigger, false);
                TriggerUnpress.Send(btn);
            }
            if (button == grabButton)
            {
                btn = new ButtonPress(hand, Button.Grab, false);
                GrabUnpress.Send(btn);
            }
            if (button == menuButton)
            {
                btn = new ButtonPress(hand, Button.Menu, false);
                MenuUnpress.Send(btn);
            }

            if (basicBtnActions.ContainsKey(button))
            {
                var btnAction = basicBtnActions[button];
                var press     = new ButtonActionsPress(hand, btnAction, false);
                ButtonActionUnpress.Send(press);
            }

            if (button == EVRButtonId.k_EButton_SteamVR_Touchpad)
            {
                if (UnpressTouchpadHandler != null)
                {
                    UnpressTouchpadHandler();
                    UnpressTouchpadHandler = null;
                }
            }
        }
Ejemplo n.º 16
0
        private void OnGrabUnpress(ButtonPress btn)
        {
            if (!IsSameHand(trackedHand.hand, btn.hand))
            {
                return;
            }

            var delta = Time.time - lastGrabPressTime;
            var isUnderGrabToggleTiming = delta < toggleGrabPressTiming;

            foreach (IGrabable grabable in grabbing)
            {
                // If we are toggle grabbing the object we should also remove it from the list
                if (toggleGrabbing.Contains(grabable))
                {
                    toggleGrabbing.Remove(grabable);
                    grabable.Ungrabbed(this);
                }
                // if this might be a grab toggle and the surface allows it,
                // add it to the toggle-grabbing list. otherwise, whether it's
                // not a grab toggle or the surface won't be toggle-grabbed,
                // ungrab the surface
                else if (isUnderGrabToggleTiming && grabable.GetGrabMode().HasFlag(GrabMode.ToggleGrabable))
                {
                    toggleGrabbing.Add(grabable);
                }
                else
                {
                    grabable.Ungrabbed(this);
                }
            }

            grabbing.Clear();
            foreach (var grabable in toggleGrabbing)
            {
                grabbing.Add(grabable);
            }
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Evaluates the action against a given InputState.
        /// </summary>
        /// <param name="state">The InputState to test for the action.</param>
        /// <param name="controllingPlayer">The player to test, or null to allow any player.</param>
        /// <param name="player">If controllingPlayer is null, this is the player that performed the action.</param>
        /// <returns>True if the action occurred, false otherwise.</returns>
        public bool Evaluate(InputState state, System.Nullable <PlayerIndex> controllingPlayer, ref PlayerIndex player)
        {
            // Figure out which delegate methods to map from the state which takes care of our "newPressOnly" logic
            ButtonPress buttonTest = null;
            KeyPress    keyTest    = null;

            if (newPressOnly)
            {
                buttonTest = state.IsNewButtonPress;
                keyTest    = state.IsNewKeyPress;
            }
            else
            {
                buttonTest = state.IsButtonPressed;
                keyTest    = state.IsKeyPressed;
            }

            // Now we simply need to invoke the appropriate methods for each button and key in our collections
            foreach (Buttons button in buttons)
            {
                if (buttonTest(button, controllingPlayer, ref player))
                {
                    return(true);
                }
            }
            foreach (Keys key in keys)
            {
                if (keyTest(key, controllingPlayer, ref player))
                {
                    return(true);
                }
            }

            // If we got here, the action is not matched
            player = PlayerIndex.One;
            return(false);
        }
Ejemplo n.º 18
0
    public ModuleSetEntry(Rect rect, ModuleSet mod, Texture2D tex, ButtonPress callBack)
    {
        Entry          = rect;
        moduleSet      = mod;
        Texture        = tex;
        buttonCallBack = callBack;

        Icon        = new Rect(Entry.x + Entry.height * 0.06f, Entry.y + Entry.height * 0.06f, Entry.height * 0.88f, Entry.height * 0.88f);
        Name        = new Rect(Icon.xMax + Entry.height * 0.06f, Entry.y + Entry.height * 0.03f, Entry.width - Icon.width - Entry.height * 0.2f, Entry.height * 0.25f);
        Description = new Rect(Name.x, Name.yMax, Name.width, Entry.height * 0.5f);
        Mod         = new Rect(Name.x, Description.yMax, Name.width, Entry.height * 0.25f);

        DisplayName        = ResourceManager.GetLocalization(moduleSet.Name);
        DisplayDiscription = ResourceManager.GetLocalization(moduleSet.Description);

        if (moduleSet.GetParentMod() != null)
        {
            DisplayMod = "Mod: " + moduleSet.GetParentMod().Name;
        }
        else
        {
            DisplayMod = "Mod: N/A";
        }
    }
Ejemplo n.º 19
0
 public void AddToFrame(int frame, ButtonPress bp)
 {
     ControllerState currentState = HasFrame(frame) ? _moveDict[frame] : new ControllerState(frame);
     currentState.Add(bp);
     _moveDict[frame] = currentState;
 }
 void Awake()
 {
     instance = this;
 }
 public bool GetButtonUp(ButtonPress engineRelatedButton)
 {
     bool buttonUp = false;
     foreach (InputReferences button in this.buttons) {
         if (
             button != null &&
             button.engineRelatedButton == engineRelatedButton &&
             this.GetButtonUp (button)
         ){
             return true;
         }
     }
     return buttonUp;
 }
Ejemplo n.º 22
0
 private void BottomRight_CheckedChanged(object sender, EventArgs e)
 {
     stateCheck           = ButtonPress.ButtomRight;
     pictureBox1.Location = new Point(430, 300);
 }
Ejemplo n.º 23
0
 private void TopLeft_CheckedChanged(object sender, EventArgs e)
 {
     stateCheck           = ButtonPress.TopLeft;
     pictureBox1.Location = new Point(217, 84);
 }
Ejemplo n.º 24
0
        public MovementInfo(string name, ButtonPress[][] simulatedInput = null, float weight = 0f)
        {
            this.name = name;
            this.weight = weight;

            if (simulatedInput != null){
                this.simulatedInput = simulatedInput;
            }else{
                this.simulatedInput = new ButtonPress[0][];
            }

            for (int i = 0; i < this.simulatedInput.Length; ++i){
                if (this.simulatedInput[i] == null){
                    this.simulatedInput[i] = new ButtonPress[0];
                }
            }
        }
Ejemplo n.º 25
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 ///
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 /// ------------------------------------------------------------------------------------
 private void m_btnExit_Click(object sender, System.EventArgs e)
 {
     m_dlgResult = ButtonPress.Exit;
     Hide();
 }
Ejemplo n.º 26
0
 public void Add(ButtonPress b)
 {
     if (b is C_StickPress)
     {
         CX = ((C_StickPress)b).x;
         CY = ((C_StickPress)b).y;
     }
     else if (b is StickPress)
     {
         StickX = ((StickPress)b).x;
         StickY = ((StickPress)b).y;
     }
     else if (b is ShoulderPress)
     {
         LAnalog = ((ShoulderPress)b).L;
         RAnalog = ((ShoulderPress)b).R;
     }
     else if (b is DigitalPress)
     {
         DigitalButton db = ((DigitalPress)b).db;
         switch (db)
         {
             case DigitalButton.A:
                 A = true;
                 break;
             case DigitalButton.B:
                 B = true;
                 break;
             case DigitalButton.Y:
                 Y = true;
                 break;
             case DigitalButton.X:
                 X = true;
                 break;
             case DigitalButton.Z:
                 Z = true;
                 break;
             case DigitalButton.DDown:
                 DDown = true;
                 break;
             case DigitalButton.DLeft:
                 DLeft = true;
                 break;
             case DigitalButton.DUp:
                 DUp = true;
                 break;
             case DigitalButton.DRight:
                 DRight = true;
                 break;
             case DigitalButton.R:
                 RDigital = true;
                 break;
             case DigitalButton.L:
                 LDigital = true;
                 break;
             case DigitalButton.Start:
                 Start = true;
                 break;
         }
     }
 }
 public InputReferences GetInputReference(ButtonPress button)
 {
     foreach (InputReferences inputReference in this.inputReferences){
         if (inputReference != null && inputReference.engineRelatedButton == button){
             return inputReference;
         }
     }
     return null;
 }
Ejemplo n.º 28
0
        public void Add(ButtonPress b)
        {
            if (b is C_StickPress)
            {
                CX = ((C_StickPress)b).x;
                CY = ((C_StickPress)b).y;
            }
            else if (b is StickPress)
            {
                StickX = ((StickPress)b).x;
                StickY = ((StickPress)b).y;
            }
            else if (b is ShoulderPress)
            {
                LAnalog = ((ShoulderPress)b).L;
                RAnalog = ((ShoulderPress)b).R;
            }
            else if (b is DigitalPress)
            {
                DigitalButton db = ((DigitalPress)b).db;
                switch (db)
                {
                case DigitalButton.A:
                    A = true;
                    break;

                case DigitalButton.B:
                    B = true;
                    break;

                case DigitalButton.Y:
                    Y = true;
                    break;

                case DigitalButton.X:
                    X = true;
                    break;

                case DigitalButton.Z:
                    Z = true;
                    break;

                case DigitalButton.DDown:
                    DDown = true;
                    break;

                case DigitalButton.DLeft:
                    DLeft = true;
                    break;

                case DigitalButton.DUp:
                    DUp = true;
                    break;

                case DigitalButton.DRight:
                    DRight = true;
                    break;

                case DigitalButton.R:
                    RDigital = true;
                    break;

                case DigitalButton.L:
                    LDigital = true;
                    break;

                case DigitalButton.Start:
                    Start = true;
                    break;
                }
            }
        }
Ejemplo n.º 29
0
        /// <summary>
        /// Evaluates the action against a given InputState.
        /// </summary>
        /// <param name="state">The InputState to test for the action.</param>
        /// <param name="controllingPlayer">The player to test, or null to allow any player.</param>
        /// <param name="player">If controllingPlayer is null, this is the player that performed the action.</param>
        /// <returns>True if the action occurred, false otherwise.</returns>
        public bool Evaluate(InputState state, PlayerIndex? controllingPlayer, out PlayerIndex player)
        {
            // Figure out which delegate methods to map from the state which takes care of our "newPressOnly" logic
            if (newPressOnly)
            {
                buttonTest = state.IsNewButtonPress;
                keyTest = state.IsNewKeyPress;
            }
            else
            {
                buttonTest = state.IsButtonPressed;
                keyTest = state.IsKeyPressed;
            }

            // Now we simply need to invoke the appropriate methods for each button and key in our collections
            for (int i = 0; i < buttons.Length; i++)
            {
                if (buttonTest(buttons[i], controllingPlayer, out player))
                {
                    playMenuSound();
                    return true;
                }
            }
            for (int i = 0; i < keys.Length; i++)
            {
                if (keyTest(keys[i], controllingPlayer, out player))
                {
                    playMenuSound();
                    return true;
                }
            }

            // If we got here, the action is not matched
            player = PlayerIndex.One;
            return false;
        }
Ejemplo n.º 30
0
        void OnButtonPress(VREvent_t ev)
        {
            ButtonPress btn;
            var         hand   = GetHandForDevice(ev.trackedDeviceIndex);
            var         button = (EVRButtonId)ev.data.controller.button;

            if (button == triggerButton)
            {
                btn = new ButtonPress(hand, Button.Trigger, true);
                TriggerPress.Send(btn);
            }
            if (button == grabButton)
            {
                btn = new ButtonPress(hand, Button.Grab, true);
                GrabPress.Send(btn);
            }
            if (button == menuButton)
            {
                btn = new ButtonPress(hand, Button.Menu, true);
                MenuPress.Send(btn);
            }

            if (basicBtnActions.ContainsKey(button))
            {
                var btnAction = basicBtnActions[button];
                var press     = new ButtonActionsPress(hand, btnAction, true);
                ButtonActionPress.Send(press);
            }

            if (button == EVRButtonId.k_EButton_SteamVR_Touchpad)
            {
                var vr = OpenVR.System;
                // For now this only handles the SteamVR Touchpad
                // In the future Joysticks and small WMR touchpads should be supported
                // Though it's probably easiest to switch to get the SteamVR Input API working to replace this first
                var err         = ETrackedPropertyError.TrackedProp_Success;
                var axisTypeInt = vr.GetInt32TrackedDeviceProperty(ev.trackedDeviceIndex, ETrackedDeviceProperty.Prop_Axis0Type_Int32, ref err);
                if (err == ETrackedPropertyError.TrackedProp_Success)
                {
                    var axisType = (EVRControllerAxisType)axisTypeInt;
                    if (axisType == EVRControllerAxisType.k_eControllerAxis_TrackPad)
                    {
                        var state = new VRControllerState_t();
                        var size  = (uint)System.Runtime.InteropServices.Marshal.SizeOf(typeof(VRControllerState_t));
                        if (vr.GetControllerState(ev.trackedDeviceIndex, ref state, size))
                        {
                            var       axis      = ControllerAxisToVector2(state.rAxis0);
                            float     magnitude = 0;
                            Direction dir       = GetLargestVectorDirection(axis, ref magnitude);

                            if (magnitude > trackpadCenterButtonRadius)
                            {
                                // Directional button press
                                var dirBtn = new DirectionActionsPress(hand, DirectionAction.D1, dir, true);
                                DirectionActionPress.Send(dirBtn);

                                UnpressTouchpadHandler = () =>
                                {
                                    var dirBtnUnpress = new DirectionActionsPress(hand, DirectionAction.D1, dir, false);
                                    DirectionActionUnpress.Send(dirBtnUnpress);
                                };
                            }
                            else
                            {
                                // Center button press
                                var press = new ButtonActionsPress(hand, BtnAction.D1, true);
                                ButtonActionPress.Send(press);

                                UnpressTouchpadHandler = () =>
                                {
                                    var unpress = new ButtonActionsPress(hand, BtnAction.D1, false);
                                    ButtonActionUnpress.Send(unpress);
                                };
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 31
0
 protected void InvokeButtonPress(GamePadButton b)
 {
     AppConsole.WriteLine("Button Press: " + b, EventLevel.Debugging);
     ButtonPress?.Invoke(b);
 }
Ejemplo n.º 32
0
 public void SetCallBackFunction(ButtonPress callBackFunction)
 {
     buttonCallBack = callBackFunction;
 }
Ejemplo n.º 33
0
 void Awake()
 {
     mPlayLevelButton = transform.Find("PlayLevelButton").GetComponent<ButtonPress>();
 }
Ejemplo n.º 34
0
 public AxisSequenceRecord(ButtonPress axisPress_, float chargeTime_)
 {
     axisPress  = axisPress_;
     chargeTime = chargeTime_;
 }
Ejemplo n.º 35
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		///
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		/// ------------------------------------------------------------------------------------
		private void m_btnRestore_Click(object sender, System.EventArgs e)
		{
			m_dlgResult = ButtonPress.Restore;
			Hide();
		}
Ejemplo n.º 36
0
 internal static void InvokePress(MouseButton button)
 {
     System.Diagnostics.Debug.Assert(heldButtons.Add(button), "added a button which was pressed");
     ButtonPress?.Invoke(button);
 }
Ejemplo n.º 37
0
 // Use this for initialization
 void Start()
 {
     CorrectButtonScript = CorrectButton.GetComponent <ButtonPress> ();
     DoorScript          = Door.GetComponent <DoorLogic> ();
 }
Ejemplo n.º 38
0
    protected virtual ButtonPress[][] Repeat(ButtonPress[] originalInput, int frames)
    {
        ButtonPress[][] input = new ButtonPress[frames][];

        for (int i = 0; i < frames; ++i){
            input[i] = originalInput;
        }

        return input;
    }
Ejemplo n.º 39
0
 private bool testMoveExecution(ButtonPress buttonPress, bool inputUp)
 {
     return testMoveExecution(new ButtonPress[]{buttonPress}, inputUp);
 }
Ejemplo n.º 40
0
 public static string GetInputReference(ButtonPress button, InputReferences[] inputReferences)
 {
     foreach(InputReferences inputReference in inputReferences){
         if (inputReference.engineRelatedButton == button) return inputReference.inputButtonName;
     }
     return null;
 }
Ejemplo n.º 41
0
 private bool testMoveExecution(ButtonPress[] buttonPresses, bool inputUp)
 {
     storedMove = myMoveSetScript.GetMove(buttonPresses, 0, currentMove, false);
     if (storedMove != null) {
         storedMoveTime = ((float)UFE.config.executionBufferTime / UFE.config.fps);
         return true;
     }
     return false;
 }
Ejemplo n.º 42
0
 private void Center_CheckedChanged(object sender, EventArgs e)
 {
     stateCheck           = ButtonPress.Center;
     pictureBox1.Location = new Point(327, 187);
 }
 private void OnTriggerUnpress(ButtonPress btn)
 {
 }
Ejemplo n.º 44
0
 public static bool ButtonPressComparator(ButtonPress pEv, ButtonPress uEv)
 {
     return(uEv.hand == pEv.hand && uEv.button == pEv.button);
 }
Ejemplo n.º 45
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		///
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		/// ------------------------------------------------------------------------------------
		private void m_btnExit_Click(object sender, System.EventArgs e)
		{
			m_dlgResult = ButtonPress.Exit;
			Hide();
		}