protected override void im_ButtonCombinationReleased(object sender, ButtonReleasedEventArgs e)
 {
     base.im_ButtonCombinationReleased(sender, e);
     if (Active)
     {
         e.Cancel = handleButtonCombination(sender, e);
     }
 }
        protected override void im_ButtonCombinationReleased(object sender, ButtonReleasedEventArgs e)
        {
            if (Active)
            {
                #region global button commands

                if ((e.ReleasedGenericKeys.Count == 1 && e.ReleasedGenericKeys[0] == "clc") || // center the focused element
                    // handling if the cursor-key-pad is wrongly pressed with another key of this pad
                    (e.ReleasedGenericKeys.Count == 2 && e.ReleasedGenericKeys.Contains("clc") &&
                        (e.ReleasedGenericKeys.Contains("clu") || e.ReleasedGenericKeys.Contains("cll") || e.ReleasedGenericKeys.Contains("clr") || e.ReleasedGenericKeys.Contains("cld"))))
                {
                    if (jumpToDomFocus()) AudioRenderer.Instance.PlaySoundImmediately(LL.GetTrans("tangram.lector.oo_observer.focus.center_element"));
                    else AudioRenderer.Instance.PlayWaveImmediately(StandardSounds.End);
                    Logger.Instance.Log(LogPriority.MIDDLE, this, "[DRAW INTERACTION] center focused shape");
                    e.Cancel = true;
                }

                else if (e.ReleasedGenericKeys.Count == 2 && e.ReleasedGenericKeys.Contains("l") && e.ReleasedGenericKeys.Contains("lr"))
                {
                    if (shapeManipulatorFunctionProxy.LastSelectedShape == null)
                    {
                        AudioRenderer.Instance.PlaySoundImmediately(LL.GetTrans("tangram.lector.oo_observer.focus.no_element"));
                        Logger.Instance.Log(LogPriority.MIDDLE, this, "[DRAW INTERACTION] mark Braille focus in GUI - no element focused");
                    }
                    else
                    {
                        InitBrailleDomFocusHighlightMode();   // retriggers focus highlighting
                        AudioRenderer.Instance.PlaySoundImmediately(LL.GetTrans("tangram.lector.oo_observer.focus.mark_in_gui"));
                        Logger.Instance.Log(LogPriority.MIDDLE, this, "[DRAW INTERACTION] mark Braille focus in GUI");
                    }
                    e.Cancel = true;
                }
                #endregion

                #region InteractionMode.Normal

                if (InteractionManager.Instance.Mode == InteractionMode.Normal)
                {
                    switch (e.ReleasedGenericKeys.Count)
                    {

                        #region 1 Key

                        //TODO: stop blinking only if a manipulation mode is active
                        //TODO: stop blinking for diagonal interaction
                        case 1:

                            switch (e.ReleasedGenericKeys[0])
                            {
                                // DE/ACTIVATE BRAILLE TEXT ADDITION
                                case "k6":
                                    string text = LL.GetTrans("tangram.lector.oo_observer.text.braille_replacement") + " ";
                                    if (this.TextRendererHook.CanBeActivated())
                                    {
                                        this.TextRendererHook.Active = !this.TextRendererHook.Active;
                                        if (this.TextRendererHook.Active) text += LL.GetTrans("tangram.lector.oo_observer.activated");
                                        else text += LL.GetTrans("tangram.lector.oo_observer.deactivated");
                                        AudioRenderer.Instance.PlaySoundImmediately(text);
                                        Logger.Instance.Log(LogPriority.MIDDLE, this, "[DRAW INTERACTION] show Braille font in drawing: " + this.TextRendererHook.Active.ToString());
                                    }
                                    else
                                    {
                                        AudioRenderer.Instance.PlaySoundImmediately(text + LL.GetTrans("tangram.lector.oo_observer.text.braille_replacement.exception"));
                                        Logger.Instance.Log(LogPriority.MIDDLE, this, "[DRAW INTERACTION] can't show Braille font in drawing");
                                    }
                                    break;
                                // TOGGLE FOCUS BLINKING
                                case "k8":
                                    if (blinkFocusActive)
                                    {
                                        stopFocusHighlightModes();
                                        AudioRenderer.Instance.PlaySoundImmediately(LL.GetTrans("tangram.lector.oo_observer.focus.blinking") + " " + LL.GetTrans("tangram.lector.oo_observer.deactivated"));
                                        Logger.Instance.Log(LogPriority.MIDDLE, this, "[DRAW INTERACTION] blinking Braille focus frame off");
                                    }
                                    else
                                    {
                                        startFocusHighlightModes();
                                        AudioRenderer.Instance.PlaySoundImmediately(LL.GetTrans("tangram.lector.oo_observer.focus.blinking") + " " + LL.GetTrans("tangram.lector.oo_observer.activated"));
                                        Logger.Instance.Log(LogPriority.MIDDLE, this, "[DRAW INTERACTION] blinking Braille focus frame on");
                                    }
                                    e.Cancel = true;
                                    break;
                                case "cru":
                                    if(shapeManipulatorFunctionProxy.Mode != ModificationMode.Unknown) stopFocusHighlightModes();
                                    break;
                                case "crr":
                                    if (shapeManipulatorFunctionProxy.Mode != ModificationMode.Unknown) stopFocusHighlightModes();
                                    break;
                                case "crd":
                                    if (shapeManipulatorFunctionProxy.Mode != ModificationMode.Unknown) stopFocusHighlightModes();
                                    break;
                                case "crl":
                                    if (shapeManipulatorFunctionProxy.Mode != ModificationMode.Unknown) stopFocusHighlightModes();
                                    break;
                                case "crc":
                                    stopFocusHighlightModes();
                                    break;
                                default:
                                    break;
                            }
                            break;

                        #endregion

                        #region 2 Keys

                        case 2:

                            #region crc with direction button

                            if (e.ReleasedGenericKeys.Contains("crc"))
                            {
                                stopFocusHighlightModes();
                            }

                            #endregion

                            #region Diagonal Interactions

                            else if (e.ReleasedGenericKeys.Intersect(new List<String>(2) { "cru", "crr" }).ToList().Count == 2)
                            {
                                stopFocusHighlightModes();
                            }
                            else if (e.ReleasedGenericKeys.Intersect(new List<String>(2) { "cru", "crl" }).ToList().Count == 2)
                            {
                                stopFocusHighlightModes();
                            }
                            else if (e.ReleasedGenericKeys.Intersect(new List<String>(2) { "crd", "crr" }).ToList().Count == 2)
                            {
                                stopFocusHighlightModes();
                            }
                            else if (e.ReleasedGenericKeys.Intersect(new List<String>(2) { "crd", "crl" }).ToList().Count == 2)
                            {
                                stopFocusHighlightModes();
                            }

                            #endregion

                            break;

                        #endregion

                        #region 3 Keys

                        case 3:
                            // follow DOM focus mode //
                            if (e.ReleasedGenericKeys.Intersect(new List<String> { "k1", "k2", "k4" }).ToList().Count == 3)
                            {
                                Logger.Instance.Log(LogPriority.MIDDLE,this,"[DRAW INTERACTION] jump to DOM focus");
                                WindowManager.Instance.FocusMode = WindowManager.Instance.FocusMode != FollowFocusModes.FOLLOW_BRAILLE_FOCUS ? FollowFocusModes.FOLLOW_BRAILLE_FOCUS : FollowFocusModes.NONE;
                                if (WindowManager.Instance.FocusMode == FollowFocusModes.FOLLOW_BRAILLE_FOCUS)
                                {
                                    bool success = jumpToDomFocus();
                                    if (!success)
                                    {
                                        audioRenderer.PlaySoundImmediately(
                                            LL.GetTrans("tangram.lector.oo_observer.focus.folowing_braille")
                                            + " " + LL.GetTrans("tangram.lector.oo_observer.activated")
                                            + ". " + LL.GetTrans("tangram.lector.oo_observer.selected_no"));
                                    }
                                }
                                e.Cancel = true;
                            }
                            break;

                        #endregion

                        #region 4 Keys

                        case 4:

                            // open title/description dialog
                            if (e.ReleasedGenericKeys.Intersect(new List<String> { "k2", "k3", "k4", "k5" }).ToList().Count == 4)
                            {
                                stopFocusHighlightModes();
                                openTitleDescDialog();
                                Logger.Instance.Log(LogPriority.MIDDLE, this, "[DRAW INTERACTION] open title and description dialog");
                                e.Cancel = true;
                            }
                            break;

                        #endregion

                        default:
                            break;
                    }
                }
                #endregion
            }
        }
        private bool handleButtonCombination(Object sender, ButtonReleasedEventArgs e)
        {

            #region InteractionMode.Normal

            if (InteractionManager.Instance.Mode == InteractionMode.Normal)
            {
                switch (e.ReleasedGenericKeys.Count)
                {
                    #region 1 Key
                    case 1:
                        switch (e.ReleasedGenericKeys[0])
                        {
                            case "k4":
                                Logger.Instance.Log(LogPriority.MIDDLE, this, "[DRAW INTERACTION] set Braille focus to mouse focus");
                                chooseElementWithGuiFocus();
                                e.Cancel = true;
                                break;
                            case "k5":
                                // TODO: Taste ist noch frei
                                break;
                            case "cru":
                                Logger.Instance.Log(LogPriority.MIDDLE, this, "[DRAW INTERACTION] handle up button");
                                e.Cancel = handleUP();
                                break;
                            case "crr":
                                Logger.Instance.Log(LogPriority.MIDDLE, this, "[DRAW INTERACTION] handle right button");
                                e.Cancel = handleRIGHT();
                                break;
                            case "crd":
                                Logger.Instance.Log(LogPriority.MIDDLE, this, "[DRAW INTERACTION] handle down button");
                                e.Cancel = handleDOWN();
                                break;
                            case "crl":
                                Logger.Instance.Log(LogPriority.MIDDLE, this, "[DRAW INTERACTION] handle left button");
                                e.Cancel = handleLEFT();
                                break;
                            case "crc":
                                Logger.Instance.Log(LogPriority.MIDDLE, this, "[DRAW INTERACTION] rotate element manipulation dialog");
                                rotateThroughModes();
                                e.Cancel = true;
                                //TODO: open element manipulation dialog
                                break;
                            case "hbr":

                                // start gesture recognition for tabs
                                break;
                            default:
                                break;
                        }
                        break;

                    #endregion

                    #region 2 Keys

                    case 2:

                        if (e.ReleasedGenericKeys.Intersect(new List<String> { "k4", "k5" }).ToList().Count == 2)
                        {
                            Logger.Instance.Log(LogPriority.MIDDLE, this, "[DRAW INTERACTION] choose next element");
                            chooseNextElement();
                            e.Cancel = true;
                        }
                        else if (e.ReleasedGenericKeys.Intersect(new List<String> { "k1", "k2" }).ToList().Count == 2)
                        {
                            Logger.Instance.Log(LogPriority.MIDDLE, this, "[DRAW INTERACTION] choose previous element");
                            choosePreviousElement();
                            e.Cancel = true;
                        }
                        else if (e.ReleasedGenericKeys.Intersect(new List<String> { "k5", "k6" }).ToList().Count == 2)
                        {
                            Logger.Instance.Log(LogPriority.MIDDLE, this, "[DRAW INTERACTION] speak description");
                            string desc = OoElementSpeaker.GetElementDescriptionText(LastSelectedShape);
                            if (!String.IsNullOrEmpty(desc))
                            {
                                sentTextNotification(desc);
                                sentAudioFeedback(desc);
                            }
                            e.Cancel = true;
                        }

                        #region crc with direction button

                        else if (e.ReleasedGenericKeys.Contains("crc"))
                        {
                            if (e.ReleasedGenericKeys.Contains("cru")
                                || e.ReleasedGenericKeys.Contains("crr")
                                || e.ReleasedGenericKeys.Contains("crd")
                                || e.ReleasedGenericKeys.Contains("crl")
                                )
                            {
                                Logger.Instance.Log(LogPriority.MIDDLE, this, "[DRAW INTERACTION] rotate element manipulation dialog (weak handling)");
                                rotateThroughModes();
                                e.Cancel = true;
                            }
                        }

                        #endregion

                        #region Diagonal Interactions

                        else if (e.ReleasedGenericKeys.Intersect(new List<String>(2) { "cru", "crr" }).ToList().Count == 2)
                        {
                            Logger.Instance.Log(LogPriority.MIDDLE, this, "[DRAW INTERACTION] handle top right");
                            e.Cancel = handleUP_RIGHT();
                        }
                        else if (e.ReleasedGenericKeys.Intersect(new List<String>(2) { "cru", "crl" }).ToList().Count == 2)
                        {
                            Logger.Instance.Log(LogPriority.MIDDLE, this, "[DRAW INTERACTION] handle top left");
                            e.Cancel = handleUP_LEFT();
                        }
                        else if (e.ReleasedGenericKeys.Intersect(new List<String>(2) { "crd", "crr" }).ToList().Count == 2)
                        {
                            Logger.Instance.Log(LogPriority.MIDDLE, this, "[DRAW INTERACTION] handle down right");
                            e.Cancel = handleDOWN_RIGHT();
                        }
                        else if (e.ReleasedGenericKeys.Intersect(new List<String>(2) { "crd", "crl" }).ToList().Count == 2)
                        {
                            Logger.Instance.Log(LogPriority.MIDDLE, this, "[DRAW INTERACTION] handle down left");
                            e.Cancel = handleDOWN_LEFT();
                        }

                        #endregion

                        break;

                    #endregion

                    #region 3 Keys

                    case 3:
                        if (e.ReleasedGenericKeys.Intersect(new List<String> { "k1", "k2", "k3" }).ToList().Count == 3)
                        {
                            Logger.Instance.Log(LogPriority.MIDDLE, this, "[DRAW INTERACTION] choose parent group");
                            chooseParentOfElement();
                            e.Cancel = true;
                        }
                        else if (e.ReleasedGenericKeys.Intersect(new List<String> { "k4", "k5", "k6" }).ToList().Count == 3)
                        {
                            Logger.Instance.Log(LogPriority.MIDDLE, this, "[DRAW INTERACTION] choose first child in group");
                            chooseFirstChildOfElement();
                            e.Cancel = true;
                        }
                        else if (e.ReleasedGenericKeys.Intersect(new List<String> { "k1", "k4", "k5" }).ToList().Count == 3)
                        {
                            Logger.Instance.Log(LogPriority.MIDDLE, this, "[DRAW INTERACTION] delete selected shape");
                            deleteSelectedShape();
                            e.Cancel = true;
                        }
                        break;

                    #endregion

                    #region 4 Keys

                    case 4:
                        // unfocus DOM element (no element is selected on the pin device) //
                        if (e.ReleasedGenericKeys.Intersect(new List<String> { "k1", "k2", "k4", "k5" }).ToList().Count == 4)
                        {
                            Logger.Instance.Log(LogPriority.MIDDLE, this, "[DRAW INTERACTION] unfocus DOM element");
                            LastSelectedShape = null;
                            playEdit();
                            AudioRenderer.Instance.PlaySoundImmediately(LL.GetTrans("tangram.oomanipulation.clear_braille_focus"));
                            sentTextFeedback(LL.GetTrans("tangram.oomanipulation.no_element_selected"));
                            e.Cancel = true;
                        }
                        break;

                    #endregion

                    default:
                        break;
                }
            }

            #endregion

            return e != null ? e.Cancel : false;
        }
 /// <summary>Raised after the player releases a button on the keyboard, controller, or mouse.</summary>
 /// <param name="sender">The event sender.</param>
 /// <param name="e">The event arguments.</param>
 protected virtual void OnButtonReleased(object sender, ButtonReleasedEventArgs e)
 {
 }
Example #5
0
 private void OnButtonReleased(object sender, ButtonReleasedEventArgs e)
 {
     this.ReleaseLeftClick(Game1.getMouseX(), Game1.getMouseY());
 }
Example #6
0
        private void InputEvents_ButtonReleased(object sender, ButtonReleasedEventArgs e)
        {
            bool flag = Context.IsWorldReady;

            string button = e.Button.ToString();

            if (isExtendedModeOn)
            {
                if (button == "RightControl")
                {
                    isHoldingRightCtrl = false;
                }

                if (button == "LeftControl")
                {
                    isHoldingLeftCtrl = false;
                }

                if (button == "RightAlt")
                {
                    isHoldingRightAlt = false;
                }
            }

            if (isRightClickMoveModeOn)
            {
                if (e.Button == Game1.options.runButton[0].ToSButton())
                {
                    isHoldingRunButton = false;
                }

                if (flag)
                {
                    if (button == "MouseRight")
                    {
                        isHoldingRightMouse = false;
                        if (isHoldingMove)
                        {
                            isDone        = 0;
                            holdCount     = 0;
                            isHoldingMove = false;
                            if (!isStopAfterHold)
                            {
                                position_Destination.X = (float)e.Cursor.ScreenPixels.X + Game1.viewport.X;
                                position_Destination.Y = (float)e.Cursor.ScreenPixels.Y + Game1.viewport.Y;

                                vector_PlayerToDestination.X = position_Destination.X - Game1.player.GetBoundingBox().Center.X;
                                vector_PlayerToDestination.Y = position_Destination.Y - Game1.player.GetBoundingBox().Center.Y;
                            }
                            else
                            {
                                isMovingAutomaticaly = false;
                            }
                            //if (isPerformUseAtMouseReleasePlace && !isStopAfterHold && (holdCount > HoldTick))
                            //{
                            //    grabTile = new Vector2((float)(position_MouseOnScreen.X + Game1.viewport.X), (float)(position_MouseOnScreen.Y + Game1.viewport.Y)) / 64f;
                            //    getActionType(ref grabTile);
                            //}
                        }
                    }
                }
            }
        }
 internal static bool Prefix(Mod __instance, ButtonReleasedEventArgs e)
 {
     ArcadePongMod.pong = __instance;
     return(ArcadePongMod.runPong);
 }
Example #8
0
 private void Input_ButtonReleased(object sender, ButtonReleasedEventArgs e)
 {
     if (Context.IsWorldReady && Context.CanPlayerMove)
     {
     }
 }
Example #9
0
 /// <summary>Handle the player releasing a button if <see cref="ICheat.OnSaveLoaded"/> indicated input was needed.</summary>
 /// <param name="context">The cheat context.</param>
 /// <param name="e">The input event arguments.</param>
 public virtual void OnButtonReleased(CheatContext context, ButtonReleasedEventArgs e)
 {
 }
 /// <summary>
 /// Handles the ButtonCombinationReleased event of the <see cref="IInteractionEventProxy"/> control.
 /// Base implementation forwards this event.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="ButtonReleasedEventArgs"/> instance containing the event data.</param>
 protected virtual void im_ButtonCombinationReleased(object sender, ButtonReleasedEventArgs e)
 {
     if (Active) { base.fireButtonCombinationReleasedEvent(e); }
 }
Example #11
0
 /// <summary>Raised after the player releases a button on the keyboard, controller, or mouse.</summary>
 /// <param name="sender">The event sender.</param>
 /// <param name="e">The event arguments.</param>
 private void OnButtonReleased(object sender, ButtonReleasedEventArgs e)
 {
     this.Cheats.OnButtonReleased(e);
 }
Example #12
0
 public void OnMouseButtonReleased(ButtonReleasedEventArgs e)
 {
 }