示例#1
0
    public string GetLabel()
    {
        string label = "";

        if (settingsManager.inventoryHandling != InventoryHandling.ChangeCursor && runtimeInventory.selectedID > -1)
        {
            label = "Use " + runtimeInventory.GetLabel(runtimeInventory.selectedID) + " on ";
        }

        if (hotspot)
        {
            if (hotspot.hotspotName != "")
            {
                label += hotspot.hotspotName;
            }
            else
            {
                label += hotspot.name;
            }
        }

        return(label);
    }
示例#2
0
    private void OnGUI()
    {
        if (playerInput && playerInteraction && stateHandler && settingsManager && runtimeInventory && showCursor)
        {
            GUI.depth = -1;

            if (runtimeInventory.selectedID > -1 && settingsManager.inventoryHandling != InventoryHandling.ChangeHotspotLabel && stateHandler.gameState != GameState.Paused)
            {
                // Cursor becomes selected inventory
                if (runtimeInventory.GetTexture(runtimeInventory.selectedID))
                {
                    GUI.DrawTexture(AdvGame.GUIBox(playerInput.mousePosition, settingsManager.inventoryCursorSize), runtimeInventory.GetTexture(runtimeInventory.selectedID), ScaleMode.ScaleToFit, true, 0f);
                }
                else
                {
                    Debug.LogWarning("No texture defined for " + runtimeInventory.GetLabel(runtimeInventory.selectedID) + " - please set in InventoryManager");
                }
            }
            else
            {
                if (playerInteraction.hotspot && stateHandler.gameState == GameState.Normal && playerInteraction.hotspot.provideUseInteraction && settingsManager.allowInteractionCursor)
                {
                    if (playerInteraction.hotspot.useIcon == InteractionIcon.Talk)
                    {
                        if (settingsManager.talkTexture)
                        {
                            GUI.DrawTexture(AdvGame.GUIBox(playerInput.mousePosition, settingsManager.iconCursorSize), settingsManager.talkTexture, ScaleMode.ScaleToFit, true, 0f);
                        }
                        else
                        {
                            Debug.LogWarning("No 'talk' texture defined - please set in SettingsManager.");
                        }
                    }

                    else if (playerInteraction.hotspot.useIcon == InteractionIcon.Examine)
                    {
                        if (settingsManager.lookTexture)
                        {
                            GUI.DrawTexture(AdvGame.GUIBox(playerInput.mousePosition, settingsManager.iconCursorSize), settingsManager.lookTexture, ScaleMode.ScaleToFit, true, 0f);
                        }
                        else
                        {
                            Debug.LogWarning("No 'look' texture defined - please set in SettingsManager.");
                        }
                    }

                    else
                    {
                        if (settingsManager.useTexture)
                        {
                            GUI.DrawTexture(AdvGame.GUIBox(playerInput.mousePosition, settingsManager.iconCursorSize), settingsManager.useTexture, ScaleMode.ScaleToFit, true, 0f);
                        }
                        else
                        {
                            Debug.LogWarning("No 'use' texture defined - please set in SettingsManager.");
                        }
                    }
                }
                else if (playerInteraction.hotspot && playerInteraction.hotspot.provideLookInteraction && settingsManager.allowInteractionCursor)
                {
                    if (settingsManager.lookTexture)
                    {
                        GUI.DrawTexture(AdvGame.GUIBox(playerInput.mousePosition, settingsManager.iconCursorSize), settingsManager.lookTexture, ScaleMode.ScaleToFit, true, 0f);
                    }
                    else
                    {
                        Debug.LogWarning("No 'examine' texture defined - please set in SettingsManager.");
                    }
                }
                else if (settingsManager.allowMainCursor || settingsManager.inputType == InputType.Controller)
                {
                    if (settingsManager.pointerTexture)
                    {
                        GUI.DrawTexture(AdvGame.GUIBox(playerInput.mousePosition, settingsManager.normalCursorSize), settingsManager.pointerTexture, ScaleMode.ScaleToFit, true, 0f);
                    }
                    else
                    {
                        Debug.LogWarning("No 'main' texture defined - please set in SettingsManager.");
                    }
                }
            }

            // Drag line
            if (stateHandler.gameState == GameState.Normal && playerInput.activeArrows == null && settingsManager.inputType == InputType.TouchScreen && settingsManager.controlStyle != ControlStyle.PointAndClick && playerInput.dragStartPosition != Vector2.zero)
            {
                Vector2 pointA = playerInput.dragStartPosition;
                Vector2 pointB = playerInput.invertedMouse;
                DrawStraightLine.Draw(pointA, pointB, settingsManager.dragLineColor, settingsManager.dragLineWidth);
            }
        }
    }