Esempio n. 1
0
        private void ShowContextIcons()
        {
            Hotspot hotspot = KickStarter.playerInteraction.GetActiveHotspot();

            if (hotspot == null)
            {
                return;
            }

            if (hotspot.HasContextUse())
            {
                if (!hotspot.HasContextLook())
                {
                    DrawIcon(KickStarter.cursorManager.GetCursorIconFromID(hotspot.GetFirstUseButton().iconID), false);
                    return;
                }
                else
                {
                    Button _button = hotspot.GetFirstUseButton();

                    if (hotspot.HasContextUse() && hotspot.HasContextLook() && CanDisplayIconsSideBySide())
                    {
                        CursorIcon icon = KickStarter.cursorManager.GetCursorIconFromID(_button.iconID);
                        DrawIcon(new Vector2(-icon.size * Screen.width / 2f, 0f), icon, false);
                    }
                    else if (CanCycleContextSensitiveMode() && contextCycleExamine && hotspot.HasContextLook())
                    {
                        CursorIcon lookIcon = KickStarter.cursorManager.GetCursorIconFromID(KickStarter.cursorManager.lookCursor_ID);
                        DrawIcon(Vector2.zero, lookIcon, true);
                    }
                    else
                    {
                        DrawIcon(KickStarter.cursorManager.GetCursorIconFromID(_button.iconID), false);
                    }
                }
            }

            if (hotspot.HasContextLook() &&
                (!hotspot.HasContextUse() ||
                 (hotspot.HasContextUse() && CanDisplayIconsSideBySide())))
            {
                if (KickStarter.cursorManager.cursorIcons.Count > 0)
                {
                    CursorIcon icon = KickStarter.cursorManager.GetCursorIconFromID(KickStarter.cursorManager.lookCursor_ID);

                    if (hotspot.HasContextUse() && hotspot.HasContextLook() && CanDisplayIconsSideBySide())
                    {
                        DrawIcon(new Vector2(icon.size * Screen.width / 2f, 0f), icon, true);
                    }
                    else
                    {
                        DrawIcon(icon, true);
                    }
                }
            }
        }
Esempio n. 2
0
        private void ShowContextIcons()
        {
            Hotspot hotspot = KickStarter.playerInteraction.GetActiveHotspot();

            if (hotspot == null)
            {
                return;
            }

            if (hotspot.HasContextUse())
            {
                if (!hotspot.HasContextLook())
                {
                    DrawIcon(KickStarter.cursorManager.GetCursorIconFromID(hotspot.GetFirstUseButton().iconID), false);
                    return;
                }
                else
                {
                    Button _button = hotspot.GetFirstUseButton();

                    if (hotspot.HasContextUse() && hotspot.HasContextLook() && KickStarter.cursorManager.lookUseCursorAction == LookUseCursorAction.DisplayBothSideBySide)
                    {
                        CursorIcon icon = KickStarter.cursorManager.GetCursorIconFromID(_button.iconID);
                        DrawIcon(new Vector2(-icon.size * Screen.width / 2f, 0f), icon, false);
                    }
                    else
                    {
                        DrawIcon(KickStarter.cursorManager.GetCursorIconFromID(_button.iconID), false);
                    }
                }
            }

            if (hotspot.HasContextLook() &&
                (!hotspot.HasContextUse() ||
                 (hotspot.HasContextUse() && KickStarter.cursorManager.lookUseCursorAction == LookUseCursorAction.DisplayBothSideBySide)))
            {
                if (KickStarter.cursorManager.cursorIcons.Count > 0)
                {
                    CursorIcon icon = KickStarter.cursorManager.GetCursorIconFromID(KickStarter.cursorManager.lookCursor_ID);

                    if (hotspot.HasContextUse() && hotspot.HasContextLook() && KickStarter.cursorManager.lookUseCursorAction == LookUseCursorAction.DisplayBothSideBySide)
                    {
                        DrawIcon(new Vector2(icon.size * Screen.width / 2f, 0f), icon, true);
                    }
                    else
                    {
                        DrawIcon(icon, true);
                    }
                }
            }
        }
Esempio n. 3
0
        /**
         * Updates the cursor. This is called every frame by StateHandler.
         */
        public void UpdateCursor()
        {
            if (KickStarter.cursorManager.cursorRendering == CursorRendering.Software)
            {
                bool shouldShowCursor = false;

                if (!canShowHardwareCursor)
                {
                    shouldShowCursor = false;
                }
                else if (KickStarter.playerInput.GetDragState() == DragState.Moveable)
                {
                    shouldShowCursor = false;
                }
                else if (KickStarter.settingsManager && KickStarter.cursorManager && (!KickStarter.cursorManager.allowMainCursor || KickStarter.cursorManager.pointerIcon.texture == null) && (KickStarter.runtimeInventory.SelectedItem == null || KickStarter.cursorManager.inventoryHandling == InventoryHandling.ChangeHotspotLabel) && KickStarter.settingsManager.inputMethod == InputMethod.MouseAndKeyboard && KickStarter.stateHandler.gameState != GameState.Cutscene)
                {
                    shouldShowCursor = true;
                }
                else if (KickStarter.cursorManager == null)
                {
                    shouldShowCursor = true;
                }
                else
                {
                    shouldShowCursor = false;
                }

                UnityVersionHandler.SetCursorVisibility(shouldShowCursor);
            }

            if (KickStarter.settingsManager && KickStarter.stateHandler)
            {
                if (KickStarter.stateHandler.gameState == GameState.Cutscene)
                {
                    if (KickStarter.cursorManager.waitIcon.texture != null)
                    {
                        showCursor = true;
                    }
                    else
                    {
                        showCursor = false;
                    }
                }
                else if (KickStarter.stateHandler.gameState != GameState.Normal && KickStarter.settingsManager.inputMethod == InputMethod.KeyboardOrController)
                {
                    if (KickStarter.stateHandler.gameState == GameState.Paused && !KickStarter.menuManager.keyboardControlWhenPaused)
                    {
                        showCursor = true;
                    }
                    else if (KickStarter.stateHandler.gameState == GameState.DialogOptions && !KickStarter.menuManager.keyboardControlWhenDialogOptions)
                    {
                        showCursor = true;
                    }
                    else
                    {
                        showCursor = false;
                    }
                }
                else if (KickStarter.cursorManager)
                {
                    if (KickStarter.stateHandler.gameState == GameState.Paused && (KickStarter.cursorManager.cursorDisplay == CursorDisplay.OnlyWhenPaused || KickStarter.cursorManager.cursorDisplay == CursorDisplay.Always))
                    {
                        showCursor = true;
                    }
                    else if (KickStarter.playerInput.GetDragState() == DragState.Moveable)
                    {
                        showCursor = false;
                    }
                    else if (KickStarter.stateHandler.gameState == GameState.Normal || KickStarter.stateHandler.gameState == GameState.DialogOptions)
                    {
                        showCursor = true;
                    }
                    else
                    {
                        showCursor = false;
                    }
                }
                else
                {
                    showCursor = true;
                }

                if (KickStarter.settingsManager.interactionMethod == AC_InteractionMethod.CustomScript)
                {
                }

                else if (KickStarter.stateHandler.gameState == GameState.Normal && KickStarter.settingsManager.interactionMethod == AC_InteractionMethod.ChooseInteractionThenHotspot && KickStarter.cursorManager != null &&
                         ((KickStarter.cursorManager.cycleCursors && KickStarter.playerInput.GetMouseState() == MouseState.RightClick) || KickStarter.playerInput.InputGetButtonDown("CycleCursors")))
                {
                    CycleCursors();
                }

                else if (KickStarter.stateHandler.gameState == GameState.Normal && KickStarter.settingsManager.SelectInteractionMethod() == SelectInteractions.CyclingCursorAndClickingHotspot &&
                         (KickStarter.playerInput.GetMouseState() == MouseState.RightClick || KickStarter.playerInput.InputGetButtonDown("CycleCursors")))
                {
                    KickStarter.playerInteraction.SetNextInteraction();
                }

                else if (KickStarter.stateHandler.gameState == GameState.Normal && KickStarter.settingsManager.SelectInteractionMethod() == SelectInteractions.CyclingCursorAndClickingHotspot &&
                         (KickStarter.playerInput.InputGetButtonDown("CycleCursorsBack")))
                {
                    KickStarter.playerInteraction.SetPreviousInteraction();
                }

                else if (CanCycleContextSensitiveMode() && KickStarter.playerInput.GetMouseState() == MouseState.RightClick)
                {
                    Hotspot hotspot = KickStarter.playerInteraction.GetActiveHotspot();
                    if (hotspot != null)
                    {
                        if (hotspot.HasContextUse() && hotspot.HasContextLook())
                        {
                            KickStarter.playerInput.ResetMouseClick();
                            contextCycleExamine = !contextCycleExamine;
                        }
                    }
                    else if (KickStarter.runtimeInventory.hoverItem != null && KickStarter.runtimeInventory.SelectedItem == null)
                    {
                        if (KickStarter.runtimeInventory.hoverItem.lookActionList != null)
                        {
                            KickStarter.playerInput.ResetMouseClick();
                            contextCycleExamine = !contextCycleExamine;
                        }
                    }
                }
            }

            if (KickStarter.cursorManager.cursorRendering == CursorRendering.Hardware)
            {
                UnityVersionHandler.SetCursorVisibility(showCursor);
                DrawCursor();
            }
        }
Esempio n. 4
0
        /**
         * Updates the cursor. This is called every frame by StateHandler.
         */
        public void UpdateCursor()
        {
            if (KickStarter.cursorManager.cursorRendering == CursorRendering.Software)
            {
                bool shouldShowCursor = false;

                if (!canShowHardwareCursor)
                {
                    shouldShowCursor = false;
                }
                else if (KickStarter.playerInput.GetDragState() == DragState.Moveable)
                {
                    shouldShowCursor = false;
                }
                else if (KickStarter.settingsManager && KickStarter.cursorManager && (!KickStarter.cursorManager.allowMainCursor || KickStarter.cursorManager.pointerIcon.texture == null) && (!InvInstance.IsValid(KickStarter.runtimeInventory.SelectedInstance) || KickStarter.cursorManager.inventoryHandling == InventoryHandling.ChangeHotspotLabel) && KickStarter.settingsManager.inputMethod == InputMethod.MouseAndKeyboard && KickStarter.stateHandler.gameState != GameState.Cutscene)
                {
                    shouldShowCursor = true;
                }
                else if (KickStarter.cursorManager == null)
                {
                    shouldShowCursor = true;
                }
                else
                {
                    shouldShowCursor = false;
                }

                SetCursorVisibility(shouldShowCursor);
            }

            if (KickStarter.settingsManager && KickStarter.stateHandler)
            {
                if (forceOffCursor)
                {
                    showCursor = false;
                }
                else if (KickStarter.stateHandler.gameState == GameState.Cutscene)
                {
                    if (KickStarter.cursorManager.waitIcon.texture)
                    {
                        showCursor = true;
                    }
                    else
                    {
                        showCursor = false;
                    }
                }
                else if (KickStarter.stateHandler.gameState != GameState.Normal && KickStarter.settingsManager.inputMethod != InputMethod.TouchScreen)
                {
                    if (KickStarter.stateHandler.gameState == GameState.Paused && !KickStarter.menuManager.keyboardControlWhenPaused)
                    {
                        showCursor = true;
                    }
                    else if (KickStarter.stateHandler.gameState == GameState.DialogOptions && !KickStarter.menuManager.keyboardControlWhenDialogOptions)
                    {
                        showCursor = true;
                    }
                    else
                    {
                        showCursor = false;
                    }
                }
                else if (KickStarter.cursorManager)
                {
                    if (KickStarter.stateHandler.gameState == GameState.Paused && (KickStarter.cursorManager.cursorDisplay == CursorDisplay.OnlyWhenPaused || KickStarter.cursorManager.cursorDisplay == CursorDisplay.Always))
                    {
                        showCursor = true;
                    }
                    else if (KickStarter.playerInput.GetDragState() == DragState.Moveable && KickStarter.cursorManager.hideCursorWhenDraggingMoveables)
                    {
                        showCursor = false;
                    }
                    else if (KickStarter.stateHandler.IsInGameplay() || KickStarter.stateHandler.gameState == GameState.DialogOptions)
                    {
                        showCursor = true;
                    }
                    else
                    {
                        showCursor = false;
                    }
                }
                else
                {
                    showCursor = true;
                }

                switch (KickStarter.settingsManager.interactionMethod)
                {
                case AC_InteractionMethod.ContextSensitive:
                {
                    if (CanCycleContextSensitiveMode() && KickStarter.playerInput.GetMouseState() == MouseState.RightClick)
                    {
                        if (CanCurrentlyCycleCursor())
                        {
                            Hotspot hotspot = KickStarter.playerInteraction.GetActiveHotspot();
                            if (hotspot)
                            {
                                if (hotspot.HasContextUse() && hotspot.HasContextLook())
                                {
                                    KickStarter.playerInput.ResetMouseClick();
                                    contextCycleExamine = !contextCycleExamine;
                                }
                            }
                            else if (InvInstance.IsValid(KickStarter.runtimeInventory.HoverInstance) && !InvInstance.IsValid(KickStarter.runtimeInventory.SelectedInstance))
                            {
                                if (KickStarter.runtimeInventory.HoverInstance.InvItem.lookActionList)
                                {
                                    KickStarter.playerInput.ResetMouseClick();
                                    contextCycleExamine = !contextCycleExamine;
                                }
                            }
                        }
                    }
                    break;
                }

                case AC_InteractionMethod.ChooseInteractionThenHotspot:
                    if (CanCurrentlyCycleCursor())
                    {
                        if ((KickStarter.cursorManager.cycleCursors && KickStarter.playerInput.GetMouseState() == MouseState.RightClick) || KickStarter.playerInput.InputGetButtonDown("CycleCursors"))
                        {
                            CycleCursors();
                        }
                        else if (KickStarter.playerInput.InputGetButtonDown("CycleCursorsBack"))
                        {
                            CycleCursorsBack();
                        }
                    }
                    break;

                case AC_InteractionMethod.ChooseHotspotThenInteraction:
                {
                    if (KickStarter.settingsManager.SelectInteractionMethod() == SelectInteractions.CyclingCursorAndClickingHotspot)
                    {
                        if (CanCurrentlyCycleCursor())
                        {
                            if (KickStarter.playerInput.GetMouseState() == MouseState.RightClick || KickStarter.playerInput.InputGetButtonDown("CycleCursors"))
                            {
                                KickStarter.playerInteraction.SetNextInteraction();
                            }
                            else if (KickStarter.playerInput.InputGetButtonDown("CycleCursorsBack"))
                            {
                                KickStarter.playerInteraction.SetPreviousInteraction();
                            }
                        }
                    }
                    break;
                }

                default:
                    break;
                }
            }

            if (KickStarter.cursorManager.cursorRendering == CursorRendering.Hardware)
            {
                SetCursorVisibility(showCursor);
                DrawCursor();
            }
        }