Example #1
0
    /// <summary>
    /// Check a list of npc names from the database against the npc names in the current scene so
    /// if the names are not there (meaning they have been removed from the scene) then the table
    /// of characters is updated to remove the scene from the character table scene field and in
    /// turn informs the user using the data dialogue UI.
    /// </summary>
    /// <param name="namesList">A list of character names</param>
    private void UpdateCharsInDbNoLongerInScene(List <string[]> namesList)
    {
        NPCs npcs = FindObjectOfType <NPCs>();

        foreach (string[] nameBox in namesList)
        {
            string npcName = nameBox[0];
            string npcParam;
            if (npcName == "")
            {
                npcParam = "''";
            }
            else
            {
                npcParam = DbCommands.GetParameterNameFromValue(npcName);
            }
            if (!npcs.IsNameInCharDict(npcName))
            {
                DbCommands.UpdateTableField(
                    "Characters",
                    "Scenes",
                    "null",
                    "CharacterNames = " + npcParam,
                    npcName
                    );
            }
        }
    }