void OnApplyPersistentData()
    {
        GetVariableName();
        TargetTree = GetComponent <TreeBase>();


        if (TargetTree.YieldsProduce && DialogueLua.DoesVariableExist(VariableName + "CurrentProduceGrowth"))
        {
            int seasonAmount = DialogueLua.GetVariable(VariableName + "SeasonAmount").asInt;
            TargetTree.ProduceSeasons = new List <TimeManager.MonthNames>();

            for (int i = 0; i < seasonAmount; i++)
            {
                TargetTree.ProduceSeasons.Add((TimeManager.MonthNames)System.Enum.Parse(typeof(TimeManager.MonthNames), DialogueLua.GetVariable(VariableName + "Season" + i).asString));
            }
            //            print(DialogueLua.GetVariable(VariableName + "CurrentProduceGrowth").asInt);
            TargetTree.CurrentProduceGrowth = DialogueLua.GetVariable(VariableName + "CurrentProduceGrowth").asInt;


            TargetTree.ProduceReady = DialogueLua.GetVariable(VariableName + "ProduceReady").asBool;
            TargetTree.SetProduceSprite();
            if (TargetTree.ProduceSeasons.Contains(TimeManager.Instance.CurrentMonth.Name))
            {
                if (TargetTree.FloweringSprite != null)
                {
                    TargetTree.GetComponent <SpriteRenderer>().sprite = TargetTree.FloweringSprite;
                }
            }
        }
        TargetTree.DroppedItems  = DialogueLua.GetVariable(VariableName + "DroppedItems").asInt;
        TargetTree.CurrentGrowth = DialogueLua.GetVariable(VariableName + "CurrentGrowth").asInt;
        TargetTree.NativeTree    = DialogueLua.GetVariable(VariableName + "Native").asBool;
    }
    void OnApplyPersistentData()
    {
        VariableName              = GameManager.Instance.name;
        TargetManager             = GetComponent <GameManager>();
        TargetManager.GameStarted = DialogueLua.GetVariable(VariableName + "GameStarted").asBool;

        if (DialogueLua.DoesVariableExist(VariableName + "NativeTreeID"))
        {
            TargetManager.NativeTree  = TargetManager.PossibleNativeTrees[DialogueLua.GetVariable(VariableName + "NativeTreeID").asInt];
            TargetManager.NativeFruit = TargetManager.NativeTree.ProduceOutputs.Items[0].Item;
        }
        int shippedItemsAmt = DialogueLua.GetVariable(VariableName + "ShippedItemsAmount").AsInt;

        TargetManager.ShippedItems.Clear();
        for (int i = 0; i < shippedItemsAmt; i++)
        {
            string itemID             = DialogueLua.GetVariable(VariableName + "ShippedItemName" + i).AsString;
            string itemType           = DialogueLua.GetVariable(VariableName + "ShippedItemType" + i).AsString;
            ItemSystem.ItemTypes type = (ItemSystem.ItemTypes)System.Enum.Parse(typeof(ItemSystem.ItemTypes), itemType);
            ItemBase             item = ItemSystem.Instance.GetItemClone(itemID);
            print("got item: " + item.Name);
            ShippedItem newShippedItem = new ShippedItem();
            newShippedItem.ContainedItem = item;
            int amount = DialogueLua.GetVariable(VariableName + "ShippedItemAmount" + i).AsInt;
            TargetManager.AddShippedItem(item, amount);
        }
    }
Beispiel #3
0
        public virtual void LoadGameNow(int slotNum)
        {
            var saveData = (LoadSlotHandler == null) ? PlayerPrefs.GetString(GetSlotDataKey(slotNum)) : LoadSlotHandler(slotNum);

            if (useLoadingScene)
            {
                PersistentDataManager.LevelWillBeUnloaded();
                LoadingScene.SetLoadGameData(saveData);
                SceneManager.LoadScene(loadingSceneIndex);
            }
            else
            {
                FindLevelManager();
                if (levelManager != null)
                {
                    levelManager.LoadGame(saveData);
                }
                else
                {
                    Lua.Run(saveData, true);
                    PersistentDataManager.LevelWillBeUnloaded();
                    if (DialogueLua.DoesVariableExist("SavedLevelName"))
                    {
                        Tools.LoadLevel(DialogueLua.GetVariable("SavedLevelName").AsString);
                    }
                    else
                    {
                        RestartGame();
                    }
                    PersistentDataManager.ApplySaveData(saveData, DatabaseResetOptions.KeepAllLoaded);
                }
            }
        }
        public void OnApplyPersistentData()
        {
            TargetManager = GetComponent <BlossomManager>();
            VariableName  = "BlossomManager";

            if (DialogueLua.DoesVariableExist(VariableName + "OwnedBlossomAmount") == false)
            {
                return;
            }
            TargetManager.CurrentBlossomID      = DialogueLua.GetVariable(VariableName + "CurrentBlossomID").asInt;
            TargetManager.OwnedBlossomAmount    = DialogueLua.GetVariable(VariableName + "OwnedBlossomAmount").asInt;
            TargetManager.ExistingBlossomAmount = DialogueLua.GetVariable(VariableName + "ExistingBlossomAmount").asInt;

            TargetManager.OwnedBlossoms.Clear();
            for (int i = 0; i < TargetManager.OwnedBlossomAmount; i++)
            {
                TargetManager.OwnedBlossoms.Add(DialogueLua.GetVariable(VariableName + "OwnedBlossom" + i).asString);
            }
            TargetManager.ExistingBlossoms.Clear();
            for (int i = 0; i < TargetManager.ExistingBlossomAmount; i++)
            {
                TargetManager.ExistingBlossoms.Add(DialogueLua.GetVariable(VariableName + "ExistingBlossom" + i).asString);
            }

            // TargetManager.BlossomHuts.Clear();
            // for (int i = 0; i < TargetManager.HutAmount; i++)
            // {
            //     TargetManager.BlossomHuts.Add(DialogueLua.GetVariable(VariableName + "Hut" + i).asString);
            // }

            GetComponent <BlossomCompetitionManager>().CompetitionDone = DialogueLua.GetVariable(VariableName + "CompetitionDone").asBool;
        }
Beispiel #5
0
    public void OnApplyPersistentData()
    {
        Target       = GetComponent <GrassPatch>();
        VariableName = "Grass" + transform.position.x + transform.position.y;

        if (DialogueLua.DoesVariableExist(VariableName + "Pregrow") == false)
        {
            return;
        }
        Target.Pregrow       = DialogueLua.GetVariable(VariableName + "Pregrow").asBool;
        Target.AwakeChildren = DialogueLua.GetVariable(VariableName + "AwakeChildren").AsInt;
        GrassTuft[] children = GetComponentsInChildren <GrassTuft>(true);
        int         i        = 0;

        foreach (GrassTuft child in children)
        {
            if (DialogueLua.GetVariable(VariableName + "Tuft" + i).asBool == true)
            {
                child.gameObject.SetActive(true);
            }
            else
            {
                child.gameObject.SetActive(false);
            }
            i++;
        }
    }
 void OnRecordPersistentData()
 {
     GetVariableName();
     //        print(VariableName);
     if (DialogueLua.DoesVariableExist(VariableName + "Init"))
     {
         //            print("variable set");
         return;
     }
     DialogueLua.SetVariable(VariableName + "Init", true);
 }
 void OnApplyPersistentData()
 {
     TargetSpawner = GetComponent <NativeTreeSpawner>();
     GetVariableName();
     if (DialogueLua.DoesVariableExist(VariableName + "Init"))
     {
         Destroy(TargetSpawner.gameObject);
         return;
     }
     TargetSpawner.SpawnTree();
     Destroy(gameObject);
 }
Beispiel #8
0
        void Start()
        {
            Data = GetComponent <BlossomData>();
            if (DialogueLua.DoesVariableExist(Data.ID + "HutX"))
            {
                Data.HutPosition = new Vector2(DialogueLua.GetVariable(Data.ID + "HutX").asFloat, DialogueLua.GetVariable(Data.ID + "HutY").asFloat);
                Data.HutName     = DialogueLua.GetVariable(Data.ID + "HutName").asString;
                Data.Hut         = BlossomManager.Instance.GetHutObject(Data.HutName);
            }


            GetComponent <BlossomAppearance>().SetAppearance(Data.Growth, Data.Color);
        }
        public virtual string GetCurrentDetails(int slotNum)
        {
            var details = GetCurrentSummary(slotNum);

            if (DialogueLua.DoesVariableExist("CurrentStage"))
            {
                details += "\n" + DialogueLua.GetVariable("CurrentStage").AsString;
            }
            if (RecordExtraSlotDetailsHandler != null)
            {
                RecordExtraSlotDetailsHandler(slotNum, ref details);
            }
            return(details);
        }
Beispiel #10
0
 public void OnApplyPersistentData()
 {
     Target       = GetComponent <LightProp>();
     VariableName = "Light" + transform.position.x + transform.position.y;
     if (DialogueLua.DoesVariableExist(VariableName + "On"))
     {
         Target.On = DialogueLua.GetVariable(VariableName + "On").asBool;
         Target.TargetIntensity = DialogueLua.GetVariable(VariableName + "Intensity").asFloat;
         if (Target.On)
         {
             Target.SetOn();
         }
         else
         {
             Target.SetOff();
         }
     }
 }
Beispiel #11
0
        public void OnApplyPersistentData()
        {
            TargetData = GetComponent <NPCData>();

            VariableName                   = "NPC" + TargetData.NPCID;
            TargetData.Met                 = DialogueLua.GetVariable(VariableName + "Met").asBool;
            TargetData.GreetedToday        = DialogueLua.GetVariable(VariableName + "GreetedToday").asBool;
            TargetData.CurrentAffection    = DialogueLua.GetVariable(VariableName + "CurrentAffection").asFloat;
            TargetData.CurrentAcquaintance = DialogueLua.GetVariable(VariableName + "CurrentAcquaintance").asFloat;
            if (DialogueLua.DoesVariableExist(VariableName + "CurrentLevel"))
            {
                TargetData.CurrentLevel = DialogueLua.GetVariable(VariableName + "CurrentLevel").asString;
            }
            if (DialogueLua.DoesVariableExist(VariableName + "CurrentX"))
            {
                TargetData.transform.position = new Vector2(DialogueLua.GetVariable(VariableName + "CurrentX").asFloat, DialogueLua.GetVariable(VariableName + "CurrentY").asFloat);
            }
        }
Beispiel #12
0
 void Start()
 {
     if (DialogueLua.DoesVariableExist(gameObject.name + transform.position.x + transform.position.y + SceneManager.GetActiveScene().name + "Init"))
     {
         IsInit = DialogueLua.GetVariable(gameObject.name + transform.position.x + transform.position.y + SceneManager.GetActiveScene().name + "Init").asBool;
     }
     if (IsInit == false)
     {
         Init();
     }
     if (DialogueLua.DoesVariableExist(gameObject.name + transform.position.x + transform.position.y + SceneManager.GetActiveScene().name + "Flipped"))
     {
         Flipped = DialogueLua.GetVariable(gameObject.name + transform.position.x + transform.position.y + SceneManager.GetActiveScene().name + "Flipped").asBool;
     }
     if (Flipped == true)
     {
         // Vector3 scale = transform.localScale;
         // scale.x = -scale.x;
         // transform.localScale = scale;
     }
 }
Beispiel #13
0
    public void Apply()
    {
        Parent = GetComponent <LevelInfo>();
        uint minutes = 0;
        uint hours   = 0;
        uint days    = 0;
        uint months  = 0;

        if (DialogueLua.DoesVariableExist(Parent.Name + "LastMinutes"))
        {
            uint lastMinutes = (uint)DialogueLua.GetVariable(Parent.Name + "LastMinutes").asInt;
            uint lastHours   = (uint)DialogueLua.GetVariable(Parent.Name + "LastHours").asInt;
            uint lastDays    = (uint)DialogueLua.GetVariable(Parent.Name + "LastDays").asInt;
            uint lastMonths  = (uint)DialogueLua.GetVariable(Parent.Name + "LastMonths").asInt;

            int lastSunny  = DialogueLua.GetVariable(Parent.Name + "SunnyDays").asInt;
            int lastCloudy = DialogueLua.GetVariable(Parent.Name + "CloudyDays").asInt;
            int lastRainy  = DialogueLua.GetVariable(Parent.Name + "RainyDays").asInt;
            int lastSnowy  = DialogueLua.GetVariable(Parent.Name + "SnowyDays").asInt;

            minutes = (uint)TimeManager.Instance.PassedMinutes - lastMinutes;
            hours   = (uint)TimeManager.Instance.PassedHours - lastHours;
            days    = (uint)TimeManager.Instance.PassedDays - lastDays;
            months  = (uint)TimeManager.Instance.PassedMonths - lastMonths;
        }
        else
        {
            minutes = (uint)TimeManager.Instance.PassedMinutes;
            hours   = (uint)TimeManager.Instance.PassedHours;
            days    = (uint)TimeManager.Instance.PassedDays;
            months  = (uint)TimeManager.Instance.PassedMonths;
        }

        //        print("Passed minutes: " + minutes + " Passed hours: " + hours + " Passed days: " + days + " Passed months: " + months);
        TimeManager.Instance.CallEvents(minutes, hours, days, months);
    }
Beispiel #14
0
 private IEnumerator StartConversationAfterSaveSystem(string title)
 {
     for (int i = 0; i < (SaveSystem.framesToWaitBeforeApplyData + 1); i++)
     {
         yield return(null);
     }
     if (!DialogueManager.isConversationActive)
     {
         DialogueLua.SetVariable("Conversation", title);
         var textlineDialogueUI = FindObjectOfType <TextlineDialogueUI>();
         if (DialogueLua.DoesVariableExist(textlineDialogueUI.currentDialogueEntryRecords))
         {
             var originalDontLoadScenes = textlineDialogueUI.dontLoadConversationInScenes;
             textlineDialogueUI.dontLoadConversationInScenes = new int[0] {
             };                                                                // Make sure we load regardless of scene.
             textlineDialogueUI.OnApplyPersistentData();
             textlineDialogueUI.dontLoadConversationInScenes = originalDontLoadScenes;
         }
         else
         {
             DialogueManager.StartConversation(title);
         }
     }
 }
        public void ApplyPersistentData(string pID = null)
        {
            if (pID == null)
            {
                return;
            }
            TargetData    = GetComponent <BlossomData>();
            VariableName  = pID;
            TargetData.ID = pID;
            //STATS
            TargetData.Agility.Value         = DialogueLua.GetVariable(VariableName + "AgilityValue").asFloat;
            TargetData.Agility.Potential     = DialogueLua.GetVariable(VariableName + "AgilityPotential").asFloat;
            TargetData.Agility.LearningSpeed = DialogueLua.GetVariable(VariableName + "AgilityLearningSpeed").asFloat;

            TargetData.Strength.Value         = DialogueLua.GetVariable(VariableName + "StrengthValue").asFloat;
            TargetData.Strength.Potential     = DialogueLua.GetVariable(VariableName + "StrengthPotential").asFloat;
            TargetData.Strength.LearningSpeed = DialogueLua.GetVariable(VariableName + "StrengthLearningSpeed").asFloat;

            TargetData.Intellect.Value         = DialogueLua.GetVariable(VariableName + "IntellectValue").asFloat;
            TargetData.Intellect.Potential     = DialogueLua.GetVariable(VariableName + "IntellectPotential").asFloat;
            TargetData.Intellect.LearningSpeed = DialogueLua.GetVariable(VariableName + "IntellectLearningSpeed").asFloat;

            TargetData.Charm.Value         = DialogueLua.GetVariable(VariableName + "CharmValue").asFloat;
            TargetData.Charm.Potential     = DialogueLua.GetVariable(VariableName + "CharmPotential").asFloat;
            TargetData.Charm.LearningSpeed = DialogueLua.GetVariable(VariableName + "CharmLearningSpeed").asFloat;


            //FAMILY
            if (DialogueLua.DoesVariableExist(VariableName + "Parent1"))
            {
                TargetData.Parent1 = DialogueLua.GetVariable(VariableName + "Parent1").asString;
            }
            if (DialogueLua.DoesVariableExist(VariableName + "Parent2"))
            {
                TargetData.Parent2 = DialogueLua.GetVariable(VariableName + "Parent2").asString;
            }

            TargetData.ChildAmount = DialogueLua.GetVariable(VariableName + "ChildAmount").asInt;
            TargetData.Children.Clear();
            for (int i = 0; i < TargetData.ChildAmount; i++)
            {
                TargetData.Children.Add(DialogueLua.GetVariable(VariableName + "Child" + i).asString);
            }

            TargetData.Name = DialogueLua.GetVariable(VariableName + "Name").asString;
            TargetData.Age  = DialogueLua.GetVariable(VariableName + "Age").asInt;

            BlossomData.BlossomGrowth growth = (BlossomData.BlossomGrowth)System.Enum.Parse(typeof(BlossomData.BlossomGrowth), DialogueLua.GetVariable(VariableName + "Growth").asString);
            TargetData.Growth = growth;

            TargetData.Affection    = DialogueLua.GetVariable(VariableName + "Affection").asInt;
            TargetData.Energy       = DialogueLua.GetVariable(VariableName + "Energy").asInt;
            TargetData.Pregnant     = DialogueLua.GetVariable(VariableName + "Pregnant").asBool;
            TargetData.DaysPregnant = DialogueLua.GetVariable(VariableName + "DaysPregnant").asInt;
            TargetData.BabyID       = DialogueLua.GetVariable(VariableName + "BabyID").asString;
            TargetData.PetToday     = DialogueLua.GetVariable(VariableName + "PetToday").asBool;
            TargetData.TalkedToday  = DialogueLua.GetVariable(VariableName + "TalkedToday").asBool;
            TargetData.FedToday     = DialogueLua.GetVariable(VariableName + "FedToday").asBool;
            TargetData.Hungry       = DialogueLua.GetVariable(VariableName + "Hungry").asBool;
            TargetData.Happiness    = DialogueLua.GetVariable(VariableName + "Happiness").asInt;



            TargetData.TraitAmount = DialogueLua.GetVariable(VariableName + "TraitAmount").asInt;
            TargetData.Traits.Clear();


            for (int i = 0; i < TargetData.TraitAmount; i++)
            {
                string traitName = DialogueLua.GetVariable(VariableName + "Trait" + i).asString;
                TargetData.Traits.Add(Resources.Load <Trait>("BlossomTraits/" + traitName));
            }

            TargetData.CurrentLevel = DialogueLua.GetVariable(VariableName + "CurrentLevel").asString;
            Vector2 newPos = new Vector2();

            newPos.x = DialogueLua.GetVariable(VariableName + "CurrentX").asFloat;
            newPos.y = DialogueLua.GetVariable(VariableName + "CurrentY").asFloat;
            TargetData.transform.position = newPos;

            if (GetComponent <Usable>() != null)
            {
                GetComponent <Usable>().overrideName = TargetData.Name;
            }
            gameObject.name = "Blossom " + TargetData.name;

            TargetData.Color = DialogueLua.GetVariable(VariableName + "Color").asString;

            TargetData.ForSale = DialogueLua.GetVariable(VariableName + "ForSale").asBool;

            if (DialogueLua.DoesVariableExist(VariableName + "Color"))
            {
                GetComponent <BlossomAppearance>().SetAppearance(TargetData.Growth, TargetData.Color);
            }


            if (DialogueLua.DoesVariableExist(VariableName + "HutName"))
            {
                TargetData.HutName     = DialogueLua.GetVariable(VariableName + "HutName").AsString;
                TargetData.HutPosition = new Vector2(DialogueLua.GetVariable(VariableName + "HutX").asFloat, DialogueLua.GetVariable(VariableName + "HutY").asFloat);
                TargetData.Hut         = BlossomManager.Instance.GetHutObject(TargetData.HutName);
            }
        }
    public void OnApplyPersistentData()
    {
        TargetStation = GetComponent <CraftingStation>();
        VariableName  = TargetStation.Name + transform.position.x + transform.position.y;
        if (DialogueLua.DoesVariableExist(VariableName + "CurrentProgress") == false)
        {
            return;
        }

        TargetStation.CurrentProgress = DialogueLua.GetVariable(VariableName + "CurrentProgress").asFloat;
        TargetStation.TargetProgress  = DialogueLua.GetVariable(VariableName + "TargetProgress").asFloat;

        TargetStation.RecipeIndex = DialogueLua.GetVariable(VariableName + "RecipeIndex").AsInt;

        int queueAmt = DialogueLua.GetVariable(VariableName + "QueueAmount").AsInt;

        for (int i = 0; i < queueAmt; i++)
        {
            string recipeName = DialogueLua.GetVariable(VariableName + "Queue" + i).AsString;
            TargetStation.Queue.Add(CraftingManager.Instance.GetRecipeByName(recipeName));
        }

        int chosenAmt = DialogueLua.GetVariable(VariableName + "ChosenItems").AsInt;

        for (int i = 0; i < chosenAmt; i++)
        {
            int    chosenID           = DialogueLua.GetVariable(VariableName + "ChosenID" + i).asInt;
            string typeName           = DialogueLua.GetVariable(VariableName + "ChosenType" + i).AsString;
            ItemSystem.ItemTypes type = (ItemSystem.ItemTypes)System.Enum.Parse(typeof(ItemSystem.ItemTypes), typeName);
            int chosenmAmount         = DialogueLua.GetVariable(VariableName + "ChosenAmount" + i).AsInt;

            StationItem newItem = new StationItem();
            newItem.ContainedItem = ItemSystem.Instance.GetItemClone(chosenID);
            newItem.Amount        = chosenmAmount;

            TargetStation.ChosenItems.Add(newItem);
        }

        string currentRecipe = DialogueLua.GetVariable(VariableName + "CurrentRecipe").AsString;

        if (currentRecipe != "Null")
        {
            TargetStation.CurrentRecipe = CraftingManager.Instance.GetRecipeByName(currentRecipe);
        }
        else
        {
            TargetStation.CurrentRecipe = null;
        }

        TargetStation.CanProgress = DialogueLua.GetVariable(VariableName + "CanProgress").asBool;

        int inputAmount = DialogueLua.GetVariable(VariableName + "RecipesInInput").AsInt;

        for (int i = 0; i < inputAmount; i++)
        {
            string recipeName = DialogueLua.GetVariable(VariableName + "InputName" + i).AsString;
            TargetStation.RecipesInInput.Add(CraftingManager.Instance.GetRecipeByName(recipeName));
        }

        string chosenRecipeName = DialogueLua.GetVariable(VariableName + "ChosenRecipe").AsString;

        if (chosenRecipeName != "Null")
        {
            TargetStation.ChosenRecipe = CraftingManager.Instance.GetRecipeByName(chosenRecipeName);
        }
        else
        {
            TargetStation.ChosenRecipe = null;
        }
        TargetStation.Load();
    }
Beispiel #17
0
        /// <summary>
        /// When loading a game, load the dialogue entry records and resume the conversation.
        /// </summary>
        public virtual void OnApplyPersistentData()
        {
            if (DontLoadInThisScene())
            {
                Debug.Log("OnApplyPersistentData Dont Load in this scene: " + SceneManager.GetActiveScene().buildIndex);
            }
            if (DontLoadInThisScene())
            {
                return;
            }
            records.Clear();
            if (!DialogueLua.DoesVariableExist(currentDialogueEntryRecords))
            {
                return;
            }
            StopAllCoroutines();

            // Load dialogue entry records:
            var s = DialogueLua.GetVariable(currentDialogueEntryRecords).AsString;

            if (Debug.isDebugBuild)
            {
                Debug.Log("TextlineDialogueUI.OnApplyPersistentData: Restoring current conversation from " + currentDialogueEntryRecords + ": " + s);
            }
            var ints       = s.Split(';');
            var numRecords = Tools.StringToInt(ints[0]);

            for (int i = 0; i < numRecords; i++)
            {
                var conversationID = Tools.StringToInt(ints[1 + i * 2]);
                var entryID        = Tools.StringToInt(ints[2 + i * 2]);
                records.Add(new DialogueEntryRecord(conversationID, entryID));
            }

            // If we have records, resume the conversation:
            if (records.Count == 0)
            {
                return;
            }
            var lastRecord = records[records.Count - 1];

            if (lastRecord.conversationID >= 0 && lastRecord.entryID > 0)
            {
                UnityEngine.UI.Button lastContinueButton = null;
                try
                {
                    // Resume conversation:
                    //if (dontRepeatLastSequence) isLoadingGame = true;
                    isLoadingGame = true;
                    var conversation        = DialogueManager.MasterDatabase.GetConversation(lastRecord.conversationID);
                    var actorName           = DialogueLua.GetVariable(currentConversationActor).AsString;
                    var conversantName      = DialogueLua.GetVariable(currentConversationConversant).AsString;
                    var actor               = GameObject.Find(actorName);
                    var conversant          = GameObject.Find(conversantName);
                    var actorTransform      = (actor != null) ? actor.transform : null;
                    var conversantTransform = (conversant != null) ? conversant.transform : null;
                    if (Debug.isDebugBuild)
                    {
                        Debug.Log("Resuming '" + conversation.Title + "' at entry " + lastRecord.entryID);
                    }
                    DialogueManager.StopConversation();
                    var lastEntry        = DialogueManager.MasterDatabase.GetDialogueEntry(lastRecord.conversationID, lastRecord.entryID);
                    var originalSequence = lastEntry.Sequence; // Handle last entry's sequence differently if end entry.
                    npcPreDelaySettings.CopyTo(npcPreDelaySettingsCopy);
                    pcPreDelaySettings.CopyTo(pcPreDelaySettingsCopy);
                    npcPreDelaySettings.basedOnTextLength = false;
                    npcPreDelaySettings.additionalSeconds = 0;
                    pcPreDelaySettings.basedOnTextLength  = false;
                    pcPreDelaySettings.additionalSeconds  = 0;
                    var isEndEntry = lastEntry.Sequence.Contains("WaitForMessage(Forever)") || lastEntry.outgoingLinks.Count == 0;
                    if (isEndEntry)
                    {
                        if (!lastEntry.Sequence.Contains("WaitForMessage(Forever)"))
                        {
                            lastEntry.Sequence = "WaitForMessage(Forever); " + lastEntry.Sequence;
                        }
                    }
                    else if (dontRepeatLastSequence)
                    {
                        lastEntry.Sequence = "None()";
                    }
                    else
                    {
                        lastEntry.Sequence = "Delay(0.1)";
                    }
                    skipNextRecord = true;
                    isInPreDelay   = false;
                    DialogueManager.StartConversation(conversation.Title, actorTransform, conversantTransform, lastRecord.entryID);
                    lastContinueButton = continueButton;
                    lastEntry.Sequence = originalSequence;
                    npcPreDelaySettingsCopy.CopyTo(npcPreDelaySettings);
                    pcPreDelaySettingsCopy.CopyTo(pcPreDelaySettings);

                    // Populate UI with previous records:
                    var lastInstance = (instantiatedMessages.Count > 0) ? instantiatedMessages[instantiatedMessages.Count - 1] : null;
                    instantiatedMessages.Remove(lastInstance);
                    DestroyInstantiatedMessages();
                    for (int i = 0; i < records.Count - 1; i++)
                    {
                        var entry         = DialogueManager.MasterDatabase.GetDialogueEntry(records[i].conversationID, records[i].entryID);
                        var speakerInfo   = DialogueManager.ConversationModel.GetCharacterInfo(entry.ActorID);
                        var listenerInfo  = DialogueManager.ConversationModel.GetCharacterInfo(entry.ConversantID);
                        var formattedText = FormattedText.Parse(entry.currentDialogueText, DialogueManager.MasterDatabase.emphasisSettings);
                        var subtitle      = new Subtitle(speakerInfo, listenerInfo, formattedText, "None()", entry.ResponseMenuSequence, entry);
                        AddMessage(subtitle);
                    }
                    if (lastInstance != null)
                    {
                        instantiatedMessages.Add(lastInstance);
                        lastInstance.transform.SetAsLastSibling();
                    }
                }
                finally
                {
                    isLoadingGame = false;
                    scrollRect.verticalNormalizedPosition = 0;
                    continueButton = lastContinueButton;
                    if (shouldShowContinueButton && lastContinueButton != null)
                    {
                        lastContinueButton.gameObject.SetActive(true);
                    }
                }
            }
            ScrollToBottom();
        }