Ejemplo n.º 1
0
        /**
         * <summary>Returns the value of a global String variable.</summary>
         * <param name = "_id">The ID number of the variable</param>
         * <param name = "synchronise">If True, then the variable's value will be synchronised with any external link it may have.</param>
         * <param name = "languageNumber">The index number of the game's current language</param>
         * <returns>The string value of the variable</returns>
         */
        public static string GetStringValue(int _id, bool synchronise = true, int languageNumber = 0)
        {
            GVar var = GetVariable(_id, synchronise);

            if (var != null)
            {
                return(var.GetValue(languageNumber));
            }

            ACDebug.LogWarning("Variable with ID=" + _id + " not found!");
            return(string.Empty);
        }
Ejemplo n.º 2
0
        private void CopyVariable(GVar newVar, GVar oldVar)
        {
            if (newVar == null || oldVar == null)
            {
                ACDebug.LogWarning("Cannot copy variable since it cannot be found!");
                return;
            }

            if (oldLocation == VariableLocation.Global)
            {
                oldVar.Download();
            }

            if (newVar.type == VariableType.Integer || newVar.type == VariableType.Boolean || newVar.type == VariableType.PopUp)
            {
                int oldValue = oldVar.val;

                if (oldVar.type == VariableType.Float)
                {
                    oldValue = (int)oldVar.floatVal;
                }
                else if (oldVar.type == VariableType.String)
                {
                    float oldValueAsFloat = 0f;
                    float.TryParse(oldVar.textVal, out oldValueAsFloat);
                    oldValue = (int)oldValueAsFloat;
                }

                newVar.SetValue(oldValue, SetVarMethod.SetValue);
            }
            else if (newVar.type == VariableType.Float)
            {
                float oldValue = oldVar.floatVal;

                if (oldVar.type == VariableType.Integer || oldVar.type == VariableType.Boolean || oldVar.type == VariableType.PopUp)
                {
                    oldValue = (float)oldVar.val;
                }
                else if (oldVar.type == VariableType.String)
                {
                    float.TryParse(oldVar.textVal, out oldValue);
                }

                newVar.SetFloatValue(oldValue, AC.SetVarMethod.SetValue);
            }
            else if (newVar.type == VariableType.String)
            {
                string oldValue = oldVar.GetValue();
                newVar.SetStringValue(oldValue);
            }
        }
Ejemplo n.º 3
0
        /**
         * <summary>Returns the value of a global Popup variable.</summary>
         * <param name = "_id">The ID number of the variable</param>
         * <param name = "synchronise">If True, then the variable's value will be synchronised with any external link it may have.</param>
         * <param name = "languageNumber">The index number of the game's current language</param>
         * <returns>The string value of the variable</returns>
         */
        public static string GetPopupValue(int _id, bool synchronise = true, int languageNumber = 0)
        {
            GVar var = GetVariable(_id);

            if (var != null)
            {
                if (synchronise)
                {
                    var.Download();
                }
                return(var.GetValue(languageNumber));
            }

            ACDebug.LogWarning("Variable with ID=" + _id + " not found!");
            return("");
        }
Ejemplo n.º 4
0
            public string GetCellText(GVar variable, VariableLocation location, bool replaceForwardSlashes, string sceneName = "")
            {
                string cellText = " ";

                switch (columnType)
                {
                case ColumnType.Location:
                    cellText = location.ToString();
                    break;

                case ColumnType.SceneName:
                    if (location == VariableLocation.Local || location == VariableLocation.Component)
                    {
                        cellText = sceneName;
                    }
                    break;

                case ColumnType.Label:
                    cellText = variable.label;
                    if (replaceForwardSlashes)
                    {
                        cellText = cellText.Replace("/", ".");
                    }
                    break;

                case ColumnType.Type:
                    cellText = variable.type.ToString();
                    break;

                case ColumnType.Description:
                    cellText = variable.description;
                    break;

                case ColumnType.InitialValue:
                    cellText = variable.GetValue();
                    break;
                }

                if (string.IsNullOrEmpty(cellText))
                {
                    cellText = " ";
                }
                return(RemoveLineBreaks(cellText));
            }
Ejemplo n.º 5
0
            public string GetCellText(GVar variable, VariableLocation location, string sceneName = "")
            {
                string cellText = " ";

                switch (columnType)
                {
                case ColumnType.Location:
                    cellText = location.ToString();
                    break;

                case ColumnType.SceneName:
                    if (location == VariableLocation.Local)
                    {
                        cellText = sceneName;
                    }
                    break;

                case ColumnType.Label:
                    cellText = variable.label;
                    break;

                case ColumnType.Type:
                    cellText = variable.type.ToString();
                    break;

                case ColumnType.Description:
                    cellText = variable.description;
                    break;

                case ColumnType.InitialValue:
                    cellText = variable.GetValue();
                    break;
                }

                if (cellText == "")
                {
                    cellText = " ";
                }
                return(RemoveLineBreaks(cellText));
            }
Ejemplo n.º 6
0
        private void PerformSaveOrLoad()
        {
            ClearAllEvents();

            if (saveHandling == SaveHandling.ContinueFromLastSave || saveHandling == SaveHandling.LoadGame)
            {
                EventManager.OnFinishLoading += OnComplete;
                EventManager.OnFailLoading   += OnComplete;
            }
            else if (saveHandling == SaveHandling.OverwriteExistingSave || saveHandling == SaveHandling.SaveNewGame)
            {
                EventManager.OnFinishSaving += OnComplete;
                EventManager.OnFailSaving   += OnComplete;
            }

            if ((saveHandling == SaveHandling.LoadGame || saveHandling == SaveHandling.ContinueFromLastSave) && doSelectiveLoad)
            {
                KickStarter.saveSystem.SetSelectiveLoadOptions(selectiveLoad);
            }

            string newSaveLabel = "";

            if (customLabel && ((updateLabel && saveHandling == SaveHandling.OverwriteExistingSave) || saveHandling == AC.SaveHandling.SaveNewGame))
            {
                if (selectSaveType != SelectSaveType.Autosave)
                {
                    GVar gVar = GlobalVariables.GetVariable(varID);
                    if (gVar != null)
                    {
                        newSaveLabel = gVar.GetValue(Options.GetLanguage());
                    }
                    else
                    {
                        ACDebug.LogWarning("Could not " + saveHandling.ToString() + " - no variable found.");
                        return;
                    }
                }
            }

            int i = Mathf.Max(0, saveIndex);

            if (saveHandling == SaveHandling.ContinueFromLastSave)
            {
                SaveSystem.ContinueGame();
                return;
            }

            if (saveHandling == SaveHandling.LoadGame || saveHandling == SaveHandling.OverwriteExistingSave)
            {
                if (selectSaveType == SelectSaveType.Autosave)
                {
                    if (saveHandling == SaveHandling.LoadGame)
                    {
                        SaveSystem.LoadAutoSave();
                        return;
                    }
                    else
                    {
                        if (PlayerMenus.IsSavingLocked(this))
                        {
                            ACDebug.LogWarning("Cannot save at this time - either blocking ActionLists, a Conversation is active, or saving has been manually locked.");
                            OnComplete();
                        }
                        else
                        {
                            SaveSystem.SaveAutoSave();
                        }
                        return;
                    }
                }
                else if (selectSaveType == SelectSaveType.SlotIndexFromVariable)
                {
                    GVar gVar = GlobalVariables.GetVariable(slotVarID);
                    if (gVar != null)
                    {
                        i = gVar.val;
                    }
                    else
                    {
                        ACDebug.LogWarning("Could not get save slot index - no variable found.");
                        return;
                    }
                }
            }

            if (menuName != "" && elementName != "")
            {
                MenuElement menuElement = PlayerMenus.GetElementWithName(menuName, elementName);
                if (menuElement != null && menuElement is MenuSavesList)
                {
                    MenuSavesList menuSavesList = (MenuSavesList)menuElement;
                    i += menuSavesList.GetOffset();
                }
                else
                {
                    ACDebug.LogWarning("Cannot find ProfilesList element '" + elementName + "' in Menu '" + menuName + "'.");
                }
            }
            else
            {
                ACDebug.LogWarning("No SavesList element referenced when trying to find slot slot " + i.ToString());
            }

            if (saveHandling == SaveHandling.LoadGame)
            {
                SaveSystem.LoadGame(i, -1, false);
            }
            else if (saveHandling == SaveHandling.OverwriteExistingSave || saveHandling == SaveHandling.SaveNewGame)
            {
                if (PlayerMenus.IsSavingLocked(this))
                {
                    ACDebug.LogWarning("Cannot save at this time - either blocking ActionLists, a Conversation is active, or saving has been manually locked.");
                    OnComplete();
                }
                else
                {
                    if (saveHandling == SaveHandling.OverwriteExistingSave)
                    {
                        SaveSystem.SaveGame(i, -1, false, updateLabel, newSaveLabel);
                    }
                    else if (saveHandling == SaveHandling.SaveNewGame)
                    {
                        SaveSystem.SaveNewGame(updateLabel, newSaveLabel);
                    }
                }
            }
        }
Ejemplo n.º 7
0
        /**
         * <summary>Performs all calculations necessary to display the element.</summary>
         * <param name = "_slot">Ignored by this subclass</param>
         * <param name = "languageNumber">The index number of the language to display text in</param>
         * <param name = "isActive">If True, then the element will be drawn as though highlighted</param>
         */
        public override void PreDisplay(int _slot, int languageNumber, bool isActive)
        {
            if (Application.isPlaying)
            {
                if (labelType == AC_LabelType.Hotspot)
                {
                    string _newLabel = "";
                    if (invItem != null)
                    {
                        _newLabel = invItem.GetFullLabel(languageNumber);
                    }
                    else if (hotspot != null)
                    {
                        _newLabel = hotspot.GetFullLabel(languageNumber);
                    }
                    else if (!showPendingWhileMovingToHotspot && KickStarter.settingsManager.interactionMethod == AC_InteractionMethod.ChooseInteractionThenHotspot && KickStarter.playerInteraction.GetHotspotMovingTo() != null && KickStarter.playerCursor.GetSelectedCursorID() == -1)
                    {
                        _newLabel = KickStarter.playerInteraction.MovingToHotspotLabel;
                    }
                    else
                    {
                        _newLabel = KickStarter.playerMenus.GetHotspotLabel();
                    }

                    if (_newLabel != "" || updateIfEmpty)
                    {
                        newLabel = _newLabel;
                    }
                }
                else if (labelType == AC_LabelType.Normal)
                {
                    newLabel = TranslateLabel(label, languageNumber);
                }
                else if (labelType == AC_LabelType.GlobalVariable)
                {
                    GVar variable = GlobalVariables.GetVariable(variableID);
                    if (variable != null)
                    {
                        newLabel = variable.GetValue(languageNumber);
                    }
                    else
                    {
                        ACDebug.LogWarning("Label element '" + title + "' cannot display Global Variable " + variableID + " as it does not exist!");
                    }
                }
                else if (labelType == AC_LabelType.ActiveSaveProfile)
                {
                    newLabel = KickStarter.options.GetProfileName();
                }
                else if (labelType == AC_LabelType.InventoryProperty)
                {
                    newLabel = "";

                    if (inventoryPropertyType == InventoryPropertyType.SelectedItem)
                    {
                        newLabel = GetPropertyDisplayValue(languageNumber, KickStarter.runtimeInventory.SelectedItem);
                    }
                    else if (inventoryPropertyType == InventoryPropertyType.LastClickedItem)
                    {
                        newLabel = GetPropertyDisplayValue(languageNumber, KickStarter.runtimeInventory.lastClickedItem);
                    }
                    else if (inventoryPropertyType == InventoryPropertyType.MouseOverItem)
                    {
                        newLabel = GetPropertyDisplayValue(languageNumber, KickStarter.runtimeInventory.hoverItem);
                    }
                }
                else if (labelType == AC_LabelType.DialogueLine || labelType == AC_LabelType.DialogueSpeaker)
                {
                    if (linkedMenu != null && linkedMenu.IsFadingOut())
                    {
                        return;
                    }

                    UpdateSpeechLink();

                    if (labelType == AC_LabelType.DialogueLine)
                    {
                        if (speech != null)
                        {
                            string line = speech.displayText;
                            if (line != "" || updateIfEmpty)
                            {
                                newLabel = line;
                            }

                            if (useCharacterColour)
                            {
                                speechColour = speech.GetColour();
                                if (uiText)
                                {
                                    uiText.color = speechColour;
                                }
                            }
                        }
                        else if (!KickStarter.speechManager.keepTextInBuffer)
                        {
                            newLabel = "";
                        }
                    }
                    else if (labelType == AC_LabelType.DialogueSpeaker)
                    {
                        if (speech != null)
                        {
                            string line = speech.GetSpeaker(languageNumber);

                            if (line != "" || updateIfEmpty || speech.GetSpeakingCharacter() == null)
                            {
                                newLabel = line;
                            }
                        }
                        else if (!KickStarter.speechManager.keepTextInBuffer)
                        {
                            newLabel = "";
                        }
                    }
                }
            }
            else
            {
                newLabel = label;
            }

            newLabel = AdvGame.ConvertTokens(newLabel, languageNumber);

            if (uiText != null && Application.isPlaying)
            {
                uiText.text = newLabel;
                UpdateUIElement(uiText);
            }
        }
Ejemplo n.º 8
0
        protected void PerformSaveOrLoad()
        {
            ClearAllEvents();

            if (saveHandling == SaveHandling.ContinueFromLastSave || saveHandling == SaveHandling.LoadGame)
            {
                EventManager.OnFinishLoading += OnFinishLoading;
                EventManager.OnFailLoading   += OnFail;
            }
            else if (saveHandling == SaveHandling.OverwriteExistingSave || saveHandling == SaveHandling.SaveNewGame)
            {
                EventManager.OnFinishSaving += OnFinishSaving;
                EventManager.OnFailSaving   += OnFail;
            }

            if ((saveHandling == SaveHandling.LoadGame || saveHandling == SaveHandling.ContinueFromLastSave) && doSelectiveLoad)
            {
                KickStarter.saveSystem.SetSelectiveLoadOptions(selectiveLoad);
            }

            string newSaveLabel = string.Empty;

            if (customLabel && ((updateLabel && saveHandling == SaveHandling.OverwriteExistingSave) || saveHandling == AC.SaveHandling.SaveNewGame))
            {
                if (selectSaveType != SelectSaveType.Autosave)
                {
                    GVar gVar = GlobalVariables.GetVariable(varID);
                    if (gVar != null)
                    {
                        newSaveLabel = gVar.GetValue(Options.GetLanguage());
                    }
                    else
                    {
                        LogWarning("Could not " + saveHandling.ToString() + " - no variable found.");
                        return;
                    }
                }
            }

            int i = saveIndex;

            if (saveHandling == SaveHandling.ContinueFromLastSave)
            {
                SaveSystem.ContinueGame();
                return;
            }

            if (saveHandling == SaveHandling.LoadGame || saveHandling == SaveHandling.OverwriteExistingSave)
            {
                if (selectSaveType == SelectSaveType.Autosave)
                {
                    if (saveHandling == SaveHandling.LoadGame)
                    {
                        SaveSystem.LoadAutoSave();
                        return;
                    }
                    else
                    {
                        if (PlayerMenus.IsSavingLocked(this, true))
                        {
                            OnComplete();
                        }
                        else
                        {
                            SaveSystem.SaveAutoSave();
                        }
                        return;
                    }
                }
                else if (selectSaveType == SelectSaveType.SlotIndexFromVariable)
                {
                    GVar gVar = GlobalVariables.GetVariable(slotVarID);
                    if (gVar != null)
                    {
                        i = gVar.IntegerValue;
                    }
                    else
                    {
                        LogWarning("Could not get save slot index - no variable found.");
                        return;
                    }
                }
            }

            if (selectSaveType != SelectSaveType.Autosave && selectSaveType != SelectSaveType.SetSaveID)
            {
                if (!string.IsNullOrEmpty(menuName) && !string.IsNullOrEmpty(elementName))
                {
                    MenuElement menuElement = PlayerMenus.GetElementWithName(menuName, elementName);
                    if (menuElement != null && menuElement is MenuSavesList)
                    {
                        MenuSavesList menuSavesList = (MenuSavesList)menuElement;
                        i += menuSavesList.GetOffset();
                    }
                    else
                    {
                        LogWarning("Cannot find ProfilesList element '" + elementName + "' in Menu '" + menuName + "'.");
                    }
                }
                else
                {
                    LogWarning("No SavesList element referenced when trying to find slot slot " + i.ToString());
                }
            }

            if (saveHandling == SaveHandling.LoadGame)
            {
                if (selectSaveType == SelectSaveType.SetSaveID)
                {
                    SaveSystem.LoadGame(i);
                }
                else
                {
                    SaveSystem.LoadGame(i, -1, false);
                }
            }
            else if (saveHandling == SaveHandling.OverwriteExistingSave || saveHandling == SaveHandling.SaveNewGame)
            {
                if (PlayerMenus.IsSavingLocked(this, true))
                {
                    OnComplete();
                }
                else
                {
                    if (saveHandling == SaveHandling.OverwriteExistingSave)
                    {
                        if (selectSaveType == SelectSaveType.SetSaveID)
                        {
                            SaveSystem.SaveGame(0, i, true, updateLabel, newSaveLabel);
                        }
                        else
                        {
                            SaveSystem.SaveGame(i, -1, false, updateLabel, newSaveLabel);
                        }
                    }
                    else if (saveHandling == SaveHandling.SaveNewGame)
                    {
                        SaveSystem.SaveNewGame(updateLabel, newSaveLabel);
                    }
                }
            }
        }
Ejemplo n.º 9
0
        /**
         * <summary>Copies the value of another variable onto itself.</summary>
         * <param name = "oldVar">The variable to copy from</param>
         * <param name = "oldLocation">The location of the variable to copy (Global, Local)</param>
         */
        public void CopyFromVariable(GVar oldVar, VariableLocation oldLocation)
        {
            if (oldLocation == VariableLocation.Global)
            {
                oldVar.Download();
            }

            if (type == VariableType.Integer || type == VariableType.Boolean || type == VariableType.PopUp)
            {
                int oldValue = oldVar.val;

                if (oldVar.type == VariableType.Float)
                {
                    oldValue = (int)oldVar.floatVal;
                }
                else if (oldVar.type == VariableType.String)
                {
                    float oldValueAsFloat = 0f;
                    float.TryParse(oldVar.textVal, out oldValueAsFloat);
                    oldValue = (int)oldValueAsFloat;
                }

                if (type == VariableType.PopUp && oldVar.HasTranslations())
                {
                    runtimeTranslations = oldVar.GetTranslations();
                }
                else
                {
                    runtimeTranslations = null;
                }

                SetValue(oldValue, SetVarMethod.SetValue);
            }
            else if (type == VariableType.Float)
            {
                float oldValue = oldVar.floatVal;

                if (oldVar.type == VariableType.Integer || oldVar.type == VariableType.Boolean || oldVar.type == VariableType.PopUp)
                {
                    oldValue = (float)oldVar.val;
                }
                else if (oldVar.type == VariableType.String)
                {
                    float.TryParse(oldVar.textVal, out oldValue);
                }

                SetFloatValue(oldValue, AC.SetVarMethod.SetValue);
            }
            else if (type == VariableType.String)
            {
                string oldValue = oldVar.GetValue();
                textVal = oldValue;

                if (oldVar.HasTranslations())
                {
                    runtimeTranslations = oldVar.GetTranslations();
                }
                else
                {
                    runtimeTranslations = null;
                }
            }
            else if (type == VariableType.Vector3)
            {
                Vector3 oldValue = oldVar.vector3Val;
                vector3Val = oldValue;
            }
        }
        /**
         * Updates the label's text buffer.  This is normally done internally at runtime, but can be called manually to update it in Edit mode.
         */
        public void UpdateLabelText(int languageNumber = 0)
        {
            string _oldLabel = newLabel;

            switch (labelType)
            {
            case AC_LabelType.Normal:
                newLabel = TranslateLabel(label, languageNumber);
                break;

            case AC_LabelType.Hotspot:
                string _newLabel = string.Empty;

                if (showPendingWhileMovingToHotspot &&
                    KickStarter.playerInteraction.GetHotspotMovingTo() != null &&
                    KickStarter.playerCursor.GetSelectedCursorID() == -1 &&
                    KickStarter.runtimeInventory.SelectedItem == null)
                {
                    _newLabel = KickStarter.playerInteraction.MovingToHotspotLabel;
                }

                if (string.IsNullOrEmpty(_newLabel))
                {
                    _newLabel = KickStarter.playerMenus.GetHotspotLabel();
                }

                if (!string.IsNullOrEmpty(_newLabel) || updateIfEmpty)
                {
                    newLabel = _newLabel;
                }
                break;

            case AC_LabelType.GlobalVariable:
                GVar variable = GlobalVariables.GetVariable(variableID);
                if (variable != null)
                {
                    newLabel = variable.GetValue(languageNumber);
                }
                else
                {
                    ACDebug.LogWarning("Label element '" + title + "' cannot display Global Variable " + variableID + " as it does not exist!");
                }
                break;

            case AC_LabelType.ActiveSaveProfile:
                newLabel = KickStarter.options.GetProfileName();
                break;

            case AC_LabelType.InventoryProperty:
                newLabel = string.Empty;
                if (inventoryPropertyType == InventoryPropertyType.SelectedItem)
                {
                    newLabel = GetPropertyDisplayValue(languageNumber, KickStarter.runtimeInventory.SelectedItem);
                }
                else if (inventoryPropertyType == InventoryPropertyType.LastClickedItem)
                {
                    newLabel = GetPropertyDisplayValue(languageNumber, KickStarter.runtimeInventory.lastClickedItem);
                }
                else if (inventoryPropertyType == InventoryPropertyType.MouseOverItem)
                {
                    newLabel = GetPropertyDisplayValue(languageNumber, KickStarter.runtimeInventory.hoverItem);
                }
                break;

            case AC_LabelType.DialogueLine:
            case AC_LabelType.DialogueSpeaker:
                if (parentMenu != null && parentMenu.IsFadingOut())
                {
                    return;
                }

                UpdateSpeechLink();

                if (labelType == AC_LabelType.DialogueLine)
                {
                    if (speech != null)
                    {
                        string line = speech.displayText;
                        if (line != string.Empty || updateIfEmpty)
                        {
                            newLabel = line;
                        }

                        if (useCharacterColour)
                        {
                            speechColour = speech.GetColour();
                            if (uiText)
                            {
                                uiText.color = speechColour;
                            }
                        }
                    }
                    else if (!KickStarter.speechManager.keepTextInBuffer)
                    {
                        newLabel = string.Empty;
                    }
                }
                else if (labelType == AC_LabelType.DialogueSpeaker)
                {
                    if (speech != null)
                    {
                        string line = speech.GetSpeaker(languageNumber);

                        if (line != string.Empty || updateIfEmpty || speech.GetSpeakingCharacter() == null)
                        {
                            newLabel = line;
                        }
                    }
                    else if (!KickStarter.speechManager.keepTextInBuffer)
                    {
                        newLabel = string.Empty;
                    }
                }
                break;

            case AC_LabelType.DocumentTitle:
                if (Document != null)
                {
                    newLabel = KickStarter.runtimeLanguages.GetTranslation(Document.title,
                                                                           Document.titleLineID,
                                                                           languageNumber);
                }
                break;
            }

            if (newLabel != _oldLabel && sizeType == AC_SizeType.Automatic && parentMenu != null && parentMenu.menuSource == MenuSource.AdventureCreator)
            {
                parentMenu.Recalculate();
            }
        }
Ejemplo n.º 11
0
        /**
         * <summary>Copies the value of another variable onto itself.</summary>
         * <param name = "oldVar">The variable to copy from</param>
         * <param name = "oldLocation">The location of the variable to copy (Global, Local)</param>
         */
        public void CopyFromVariable(GVar oldVar, VariableLocation oldLocation)
        {
            if (oldLocation == VariableLocation.Global)
            {
                oldVar.Download(oldLocation);
            }

            switch (type)
            {
            case VariableType.Float:
            {
                float oldValue = oldVar.FloatValue;

                if (oldVar.type == VariableType.Integer || oldVar.type == VariableType.Boolean || oldVar.type == VariableType.PopUp)
                {
                    oldValue = (float)oldVar.IntegerValue;
                }
                else if (oldVar.type == VariableType.String)
                {
                    float.TryParse(oldVar.textVal, out oldValue);
                }

                FloatValue = oldValue;
                break;
            }

            case VariableType.String:
            {
                string oldValue = oldVar.GetValue();
                textVal = oldValue;

                if (oldVar.HasTranslations())
                {
                    runtimeTranslations = oldVar.GetTranslations();
                }
                else
                {
                    runtimeTranslations = null;
                }
                break;
            }

            case VariableType.Vector3:
            {
                Vector3 oldValue = oldVar.vector3Val;
                Vector3Value = oldValue;
                break;
            }

            default:
            {
                int oldValue = oldVar.val;

                if (oldVar.type == VariableType.Float)
                {
                    oldValue = (int)oldVar.floatVal;
                }
                else if (oldVar.type == VariableType.String)
                {
                    float oldValueAsFloat = 0f;
                    float.TryParse(oldVar.textVal, out oldValueAsFloat);
                    oldValue = (int)oldValueAsFloat;
                }

                if (type == VariableType.PopUp && oldVar.HasTranslations())
                {
                    runtimeTranslations = oldVar.GetTranslations();
                }
                else
                {
                    runtimeTranslations = null;
                }

                IntegerValue = oldValue;
                break;
            }
            }
        }