示例#1
0
        public override string GetHotspotLabelOverride(int _slot, int _language)
        {
            if (uiSlots != null && _slot < uiSlots.Length && !uiSlots[_slot].CanOverrideHotspotLabel)
            {
                return(string.Empty);
            }

            InvItem invItem = GetItem(_slot);

            if (invItem != null)
            {
                if (_language > 0)
                {
                    return(KickStarter.runtimeLanguages.GetTranslation(invItem.label, invItem.lineID, _language, AC_TextType.InventoryItem));
                }

                if (!string.IsNullOrEmpty(invItem.altLabel))
                {
                    return(invItem.altLabel);
                }

                return(invItem.GetLabel(_language));
            }

            return(string.Empty);
        }
示例#2
0
        /**
         * <summary>Generates a label that represents the name of the parameter's value, if appropriate<summary>
         * <returns>A label that represents the name of the parameter's value<summary>
         */
        public string GetLabel()
        {
            switch (parameterType)
            {
            case ParameterType.GameObject:
                if (gameObject != null)
                {
                    Hotspot _hotspot = gameObject.GetComponent <Hotspot>();
                    if (_hotspot)
                    {
                        return(_hotspot.GetName(Options.GetLanguage()));
                    }

                    Char _char = gameObject.GetComponent <Char>();
                    if (_char)
                    {
                        return(_char.GetName(Options.GetLanguage()));
                    }

                    return(gameObject.name);
                }
                return(string.Empty);

            case ParameterType.InventoryItem:
                InvItem invItem = KickStarter.inventoryManager.GetItem(intValue);
                if (invItem != null)
                {
                    return(invItem.GetLabel(Options.GetLanguage()));
                }
                return(GetSaveData());

            case ParameterType.GlobalVariable:
                GVar gVar = KickStarter.variablesManager.GetVariable(intValue);
                if (gVar != null)
                {
                    return(gVar.label);
                }
                return(GetSaveData());

            case ParameterType.LocalVariable:
                GVar lVar = LocalVariables.GetVariable(intValue);
                if (lVar != null)
                {
                    return(lVar.label);
                }
                return(GetSaveData());

            default:
                return(GetSaveData());
            }
        }
示例#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);
        }
示例#4
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);
        }
示例#5
0
        /**
         * <summary>Generates a label that represents the name of the parameter's value, if appropriate<summary>
         * <returns>A label that represents the name of the parameter's value<summary>
         */
        public string GetLabel()
        {
            switch (parameterType)
            {
            case ParameterType.GameObject:
                if (gameObject != null)
                {
                    Hotspot _hotspot = gameObject.GetComponent <Hotspot> ();
                    if (_hotspot)
                    {
                        return(_hotspot.GetName(Options.GetLanguage()));
                    }

                    Char _char = gameObject.GetComponent <Char> ();
                    if (_char)
                    {
                        return(_char.GetName(Options.GetLanguage()));
                    }

                    return(gameObject.name);
                }
                return(string.Empty);

            case ParameterType.InventoryItem:
                InvItem invItem = KickStarter.inventoryManager.GetItem(intValue);
                if (invItem != null)
                {
                    return(invItem.GetLabel(Options.GetLanguage()));
                }
                return(GetSaveData());

            case ParameterType.Document:
                Document document = KickStarter.inventoryManager.GetDocument(intValue);
                if (document != null)
                {
                    return(KickStarter.runtimeLanguages.GetTranslation(document.title,
                                                                       document.titleLineID,
                                                                       Options.GetLanguage()));
                }
                return(GetSaveData());

            case ParameterType.GlobalVariable:
                GVar gVar = GetVariable();
                if (gVar != null)
                {
                    return(gVar.label);
                }
                return(GetSaveData());

            case ParameterType.LocalVariable:
                GVar lVar = GetVariable();
                if (lVar != null)
                {
                    return(lVar.label);
                }
                return(GetSaveData());

            case ParameterType.ComponentVariable:
                GVar cVar = GetVariable();
                if (cVar != null)
                {
                    return(cVar.label);
                }
                return(GetSaveData());

            default:
                return(GetSaveData());
            }
        }
示例#6
0
        public override void PreDisplay(int _slot, int languageNumber, bool isActive)
        {
            string fullText = string.Empty;

            if (displayType == ConversationDisplayType.TextOnly || displayType == ConversationDisplayType.IconAndText)
            {
                InvItem invItem = GetItem(_slot);
                if (invItem != null)
                {
                    fullText = invItem.GetLabel(languageNumber);
                }

                string countText = GetCount(_slot);
                if (!string.IsNullOrEmpty(countText))
                {
                    fullText += " (" + countText + ")";
                }
            }
            else
            {
                string countText = GetCount(_slot);
                if (!string.IsNullOrEmpty(countText))
                {
                    fullText = countText;
                }
            }

            if (labels == null || labels.Length != numSlots)
            {
                labels = new string [numSlots];
            }
            labels [_slot] = fullText;

            if (Application.isPlaying)
            {
                if (uiSlots != null && uiSlots.Length > _slot)
                {
                    LimitUISlotVisibility(uiSlots, numSlots, uiHideStyle);

                    uiSlots[_slot].SetText(labels [_slot]);

                    switch (displayType)
                    {
                    case ConversationDisplayType.IconOnly:
                    case ConversationDisplayType.TextOnly:
                        if ((craftingType == CraftingElementType.Ingredients && GetItem(_slot) != null) || (craftingType == CraftingElementType.Output && invInstances.Count > 0))
                        {
                            uiSlots[_slot].SetImage(GetTexture(_slot));
                        }
                        else
                        {
                            uiSlots[_slot].SetImage(null);
                        }
                        break;

                    default:
                        break;
                    }
                }
            }
        }
        override public float Run()
        {
            InvItem invItem = (setVarAsPropertyMethod == SetVarAsPropertyMethod.SelectedItem) ?
                              KickStarter.runtimeInventory.LastSelectedItem :
                              KickStarter.inventoryManager.GetItem(invID);

            if (invItem != null && runtimeVariable != null)
            {
                InvVar invVar = invItem.GetProperty(propertyID);

                if (invVar == null)
                {
                    LogWarning("Cannot find property with ID " + propertyID + " on Inventory item " + invItem.GetLabel(0));
                    return(0f);
                }

                if (runtimeVariable.type == VariableType.String)
                {
                    runtimeVariable.textVal = invVar.GetDisplayValue(Options.GetLanguage());
                }
                else if (runtimeVariable.type == invVar.type)
                {
                    if (invVar.type == VariableType.Float)
                    {
                        runtimeVariable.FloatValue = invVar.FloatValue;
                    }
                    else if (invVar.type == VariableType.Vector3)
                    {
                        runtimeVariable.Vector3Value = invVar.Vector3Value;
                    }
                    else
                    {
                        runtimeVariable.IntegerValue = invVar.IntegerValue;
                    }
                }
                else
                {
                    LogWarning("Cannot assign " + varLocation.ToString() + " Variable " + runtimeVariable.label + "'s value from '" + invVar.label + "' property because their types do not match.");
                }
            }

            return(0);
        }