/**
         * <summary>Draws the element using OnGUI.</summary>
         * <param name = "_style">The GUIStyle to draw with</param>
         * <param name = "_slot">Ignored by this subclass</param>
         * <param name = "zoom">The zoom factor</param>
         * <param name = "isActive">If True, then the element will be drawn as though highlighted</param>
         */
        public override void Display(GUIStyle _style, int _slot, float zoom, bool isActive)
        {
            base.Display(_style, _slot, zoom, isActive);

            string fullText = label;

            if (Application.isPlaying && (isSelected || isActive))
            {
                fullText = AdvGame.CombineLanguageString(fullText, "|", Options.GetLanguage(), false);
            }

            _style.wordWrap  = true;
            _style.alignment = anchor;
            if (zoom < 1f)
            {
                _style.fontSize = (int)((float)_style.fontSize * zoom);
            }

            if (textEffects != TextEffects.None)
            {
                AdvGame.DrawTextEffect(ZoomRect(relativeRect, zoom), fullText, _style, Color.black, _style.normal.textColor, outlineSize, textEffects);
            }
            else
            {
                GUI.Label(ZoomRect(relativeRect, zoom), fullText, _style);
            }
        }
Beispiel #2
0
        /**
         * <summary>Gets the items's display name, with prefix.</summary>
         * <param name = "languageNumber">The index of the current language, as set in SpeechManager</param>
         * <returns>The item's display name, with prefix</returns>
         */
        public string GetFullLabel(int languageNumber = 0)
        {
            string label = "";

            if (KickStarter.stateHandler.gameState == GameState.DialogOptions && !KickStarter.settingsManager.allowInventoryInteractionsDuringConversations && !KickStarter.settingsManager.allowGameplayDuringConversations)
            {
                return("");
            }

            if (KickStarter.runtimeInventory.showHoverLabel)
            {
                if (KickStarter.runtimeInventory.SelectedItem == null || this != KickStarter.runtimeInventory.SelectedItem || KickStarter.settingsManager.ShowHoverInteractionInHotspotLabel())
                {
                    label = AdvGame.CombineLanguageString(
                        KickStarter.playerInteraction.GetLabelPrefix(null, this, languageNumber),
                        GetLabel(languageNumber),
                        languageNumber
                        );
                }
                else
                {
                    label = GetLabel(languageNumber);
                }
            }

            return(label);
        }
Beispiel #3
0
        public string GetFullLabel(Hotspot _hotspot, int _language)
        {
            if (_hotspot == null)
            {
                return(string.Empty);
            }

            if (_hotspot.lookButton == this)
            {
                string prefix = KickStarter.cursorManager.GetLabelFromID(KickStarter.cursorManager.lookCursor_ID, _language);
                return(AdvGame.CombineLanguageString(prefix,
                                                     _hotspot.GetName(_language),
                                                     _language));
            }
            else if (_hotspot.useButtons.Contains(this))
            {
                string prefix = KickStarter.cursorManager.GetLabelFromID(iconID, _language);
                return(AdvGame.CombineLanguageString(prefix,
                                                     _hotspot.GetName(_language),
                                                     _language));
            }
            else if (_hotspot.invButtons.Contains(this))
            {
                InvItem item   = KickStarter.runtimeInventory.GetItem(invID);
                string  prefix = KickStarter.runtimeInventory.GetHotspotPrefixLabel(item, item.GetLabel(_language), _language);
                return(AdvGame.CombineLanguageString(prefix,
                                                     _hotspot.GetName(_language),
                                                     _language));
            }

            return(string.Empty);
        }
        public override string GetHotspotLabelOverride(int _slot, int _language)
        {
                        #if UNITY_EDITOR
            if (!Application.isPlaying)
            {
                return(string.Empty);
            }
                        #endif

            if (KickStarter.cursorManager.addHotspotPrefix)
            {
                if (KickStarter.settingsManager.interactionMethod == AC_InteractionMethod.ChooseHotspotThenInteraction)
                {
                    if (KickStarter.settingsManager.SelectInteractionMethod() != SelectInteractions.ClickingMenu)
                    {
                        // Don't override, refer to the clicked InventoryBox or Hotspot
                        return(string.Empty);
                    }

                    if (parentMenu.TargetInvItem != null)
                    {
                        return(AdvGame.CombineLanguageString(
                                   KickStarter.cursorManager.GetLabelFromID(iconID, _language),
                                   parentMenu.TargetInvItem.GetLabel(_language),
                                   _language
                                   ));
                    }

                    if (KickStarter.settingsManager.SelectInteractionMethod() != SelectInteractions.ClickingMenu)
                    {
                        return(string.Empty);
                    }

                    if (parentMenu.TargetHotspot != null)
                    {
                        return(AdvGame.CombineLanguageString(
                                   KickStarter.cursorManager.GetLabelFromID(iconID, _language),
                                   parentMenu.TargetHotspot.GetName(_language),
                                   _language
                                   ));
                    }
                }
                else if (KickStarter.settingsManager.interactionMethod == AC_InteractionMethod.ChooseInteractionThenHotspot)
                {
                    if (KickStarter.settingsManager.ShowHoverInteractionInHotspotLabel())
                    {
                        if (KickStarter.playerCursor.GetSelectedCursor() == -1)
                        {
                            return(KickStarter.cursorManager.GetLabelFromID(iconID, _language));
                        }
                    }
                }
            }

            return(string.Empty);
        }
Beispiel #5
0
 /**
  * <summary>Gets the label to display when the cursor is over this Hotspot, with cursor names and active inventory item included if appropriate.</summary>
  * <returns>The label to display when the cursor is over this Hotspot, with cursor names and active inventory item included if appropriate.</returns>
  */
 public string GetFullLabel(int languageNumber = 0)
 {
     if (KickStarter.stateHandler.gameState == GameState.DialogOptions && !KickStarter.settingsManager.allowInventoryInteractionsDuringConversations)
     {
         return("");
     }
     return(AdvGame.CombineLanguageString(
                KickStarter.playerInteraction.GetLabelPrefix(this, null, languageNumber),
                GetName(languageNumber),
                languageNumber
                ));
 }
Beispiel #6
0
        public string GetFullLabel(Hotspot _hotspot, InvInstance invInstance, int _language)
        {
            if (_hotspot == null)
            {
                return(string.Empty);
            }

            if (_hotspot.lookButton == this)
            {
                string prefix      = KickStarter.cursorManager.GetLabelFromID(KickStarter.cursorManager.lookCursor_ID, _language);
                string hotspotName = _hotspot.GetName(_language);
                if (_hotspot.canBeLowerCase && !string.IsNullOrEmpty(prefix))
                {
                    hotspotName = hotspotName.ToLower();
                }

                return(AdvGame.CombineLanguageString(prefix, hotspotName, _language));
            }
            else if (_hotspot.useButtons.Contains(this))
            {
                string prefix      = KickStarter.cursorManager.GetLabelFromID(iconID, _language);
                string hotspotName = _hotspot.GetName(_language);
                if (_hotspot.canBeLowerCase && !string.IsNullOrEmpty(prefix))
                {
                    hotspotName = hotspotName.ToLower();
                }

                return(AdvGame.CombineLanguageString(prefix, hotspotName, _language));
            }
            else if (_hotspot.invButtons.Contains(this) && InvInstance.IsValid(invInstance))
            {
                string prefix      = invInstance.GetHotspotPrefixLabel(_language);
                string hotspotName = _hotspot.GetName(_language);
                if (_hotspot.canBeLowerCase && !string.IsNullOrEmpty(prefix))
                {
                    hotspotName = hotspotName.ToLower();
                }

                return(AdvGame.CombineLanguageString(prefix, hotspotName, _language));
            }

            return(string.Empty);
        }
Beispiel #7
0
        /**
         * <summary>Gets the items's display name, with prefix.</summary>
         * <param name = "languageNumber">The index of the current language, as set in SpeechManager</param>
         * <returns>The item's display name, with prefix</returns>
         */
        public string GetFullLabel(int languageNumber = 0)
        {
            if (KickStarter.stateHandler.gameState == GameState.DialogOptions && !KickStarter.settingsManager.allowInventoryInteractionsDuringConversations && !KickStarter.settingsManager.allowGameplayDuringConversations)
            {
                return(string.Empty);
            }

            if (KickStarter.runtimeInventory.ShowHoverLabel)
            {
                if (!InvInstance.IsValid(KickStarter.runtimeInventory.SelectedInstance) || KickStarter.runtimeInventory.SelectedInstance.InvItem != this || KickStarter.settingsManager.ShowHoverInteractionInHotspotLabel())
                {
                    return(AdvGame.CombineLanguageString(
                               GetLabelPrefix(languageNumber),
                               GetLabel(languageNumber),
                               languageNumber));
                }
                else
                {
                    return(GetLabel(languageNumber));
                }
            }

            return(string.Empty);
        }
Beispiel #8
0
        /**
         * <summary>Gets the full prefix to a Hotpsot label when an item is selected, e.g. "Use X on " / "Give X to ".</summary>
         * <param name = "invItem">The inventory item that is selected</param>
         * <param name = "languageNumber">The index of the current language, as set in SpeechManager</param>
         * <param name = "canGive">If True, the the item is assumed to be in "give" mode, as opposed to "use".</param>
         * <returns>The full prefix to a Hotspot label when the item is selected</returns>
         */
        public string GetHotspotPrefixLabel(int languageNumber, bool canGive = false)
        {
            if (KickStarter.runtimeInventory == null)
            {
                return(string.Empty);
            }

            string prefix1 = string.Empty;
            string prefix2 = string.Empty;

            string itemName = (invItem != null) ? invItem.GetLabel(languageNumber) : string.Empty;

            if (canGive && selectItemMode == SelectItemMode.Give)
            {
                prefix1 = KickStarter.runtimeLanguages.GetTranslation(KickStarter.cursorManager.hotspotPrefix3.label, KickStarter.cursorManager.hotspotPrefix3.lineID, languageNumber, KickStarter.cursorManager.hotspotPrefix3.GetTranslationType(0));
                prefix2 = KickStarter.runtimeLanguages.GetTranslation(KickStarter.cursorManager.hotspotPrefix4.label, KickStarter.cursorManager.hotspotPrefix4.lineID, languageNumber, KickStarter.cursorManager.hotspotPrefix4.GetTranslationType(0));
            }
            else
            {
                if (invItem != null && invItem.overrideUseSyntax)
                {
                    prefix1 = KickStarter.runtimeLanguages.GetTranslation(invItem.hotspotPrefix1.label, invItem.hotspotPrefix1.lineID, languageNumber, invItem.hotspotPrefix1.GetTranslationType(0));
                    prefix2 = KickStarter.runtimeLanguages.GetTranslation(invItem.hotspotPrefix2.label, invItem.hotspotPrefix2.lineID, languageNumber, invItem.hotspotPrefix2.GetTranslationType(0));
                }
                else
                {
                    prefix1 = KickStarter.runtimeLanguages.GetTranslation(KickStarter.cursorManager.hotspotPrefix1.label, KickStarter.cursorManager.hotspotPrefix1.lineID, languageNumber, KickStarter.cursorManager.hotspotPrefix1.GetTranslationType(0));
                    prefix2 = KickStarter.runtimeLanguages.GetTranslation(KickStarter.cursorManager.hotspotPrefix2.label, KickStarter.cursorManager.hotspotPrefix2.lineID, languageNumber, KickStarter.cursorManager.hotspotPrefix2.GetTranslationType(0));
                }
            }

            if (string.IsNullOrEmpty(prefix1) && !string.IsNullOrEmpty(prefix2))
            {
                return(prefix2);
            }
            if (!string.IsNullOrEmpty(prefix1) && string.IsNullOrEmpty(prefix2))
            {
                if (invItem != null && invItem.canBeLowerCase)
                {
                    itemName = itemName.ToLower();
                }

                return(AdvGame.CombineLanguageString(prefix1, itemName, languageNumber));
            }
            if (prefix1 == " " && !string.IsNullOrEmpty(prefix2))
            {
                return(AdvGame.CombineLanguageString(itemName, prefix2, languageNumber));
            }

            if (invItem != null && invItem.canBeLowerCase)
            {
                itemName = itemName.ToLower();
            }

            if (KickStarter.runtimeLanguages.LanguageReadsRightToLeft(languageNumber))
            {
                return(prefix2 + " " + itemName + " " + prefix1);
            }

            return(prefix1 + " " + itemName + " " + prefix2);
        }
        public override string GetHotspotLabelOverride(int _slot, int _language)
        {
            if (fixedIcon && uiButton && !uiButton.interactable)
            {
                return(string.Empty);
            }

                        #if UNITY_EDITOR
            if (!Application.isPlaying)
            {
                return(string.Empty);
            }
                        #endif

            int slotIconID = GetIconIDAtSlot(_slot);
            if (KickStarter.cursorManager.addHotspotPrefix)
            {
                if (KickStarter.settingsManager.interactionMethod == AC_InteractionMethod.ChooseHotspotThenInteraction)
                {
                    if (KickStarter.settingsManager.SelectInteractionMethod() != SelectInteractions.ClickingMenu)
                    {
                        // Don't override, refer to the clicked InventoryBox or Hotspot
                        return(string.Empty);
                    }

                    if (InvInstance.IsValid(parentMenu.TargetInvInstance))
                    {
                        string prefix   = KickStarter.cursorManager.GetLabelFromID(slotIconID, _language);
                        string itemName = parentMenu.TargetInvInstance.InvItem.GetLabel(_language);
                        if (parentMenu.TargetInvInstance.InvItem.canBeLowerCase && !string.IsNullOrEmpty(prefix))
                        {
                            itemName = itemName.ToLower();
                        }

                        return(AdvGame.CombineLanguageString(prefix, itemName, _language));
                    }

                    if (KickStarter.settingsManager.SelectInteractionMethod() != SelectInteractions.ClickingMenu)
                    {
                        return(string.Empty);
                    }

                    if (parentMenu.TargetHotspot)
                    {
                        string prefix      = KickStarter.cursorManager.GetLabelFromID(slotIconID, _language);
                        string hotspotName = parentMenu.TargetHotspot.GetName(_language);
                        if (parentMenu.TargetHotspot.canBeLowerCase && !string.IsNullOrEmpty(prefix))
                        {
                            hotspotName = hotspotName.ToLower();
                        }

                        return(AdvGame.CombineLanguageString(prefix, hotspotName, _language));
                    }
                }
                else if (KickStarter.settingsManager.interactionMethod == AC_InteractionMethod.ChooseInteractionThenHotspot)
                {
                    if (KickStarter.settingsManager.ShowHoverInteractionInHotspotLabel())
                    {
                        if (KickStarter.playerCursor.GetSelectedCursor() == -1)
                        {
                            return(KickStarter.cursorManager.GetLabelFromID(slotIconID, _language));
                        }
                    }
                }
            }

            return(string.Empty);
        }