예제 #1
0
 /**
  * Called when the cancel button is pressed.
  * Pass in the Content which holds the HistoryFieldManagerScript for the quizes
  */
 public void Cancel(HistoryFieldManagerScript Content)
 {
     if (!ds.GetQuizes().ContainsKey(Content.RefreshUniquePath()))
     {
         if (Content.GetPin().transform.Find("Item Background Off"))
         {
             Content.GetPin().transform.Find("Item Background Off").gameObject.SetActive(true);
             Content.GetPin().transform.Find("Item Background On").gameObject.SetActive(false);
         }
         else
         {
             Destroy(Content.GetPin());
         }
     }
     CloseQuizEditor();
 }
    /**
     * Called by the edit section panel to remove a section
     */
    public void removeSection()
    {
        string    removedSection = tObject.text;
        Transform par            = tm.SectionContentPar.transform;

        if (!tObject.text.Contains("/"))
        {
            Destroy(tm.SectionContentPar.transform.Find(tObject.text + "Button").gameObject);
        }
        else
        {
            for (int i = 0; i < tm.SectionContentPar.transform.childCount; i++)
            {
                if (tm.SectionContentPar.transform.GetChild(i).name.Equals(tObject.text + "Button"))
                {
                    Destroy(tm.SectionContentPar.transform.GetChild(i).gameObject);
                    break;
                }
            }
        }
        string sectionData = ds.GetData(removedSection).GetAllData();

        ds.RemoveSection(removedSection);
        //editSectionPanel.gameObject.SetActive (false);
        tm.RemoveCurrentSection();

        List <string> keyList = ds.GetImageKeys();        // ds.GetImages ().Keys.ToList ();

        foreach (string key in keyList)
        {
            if (key.StartsWith(tObject.text) || sectionData.Contains("<Image>" + key + "</Image>"))
            {
                Debug.Log("Removing Image: " + key);
                ds.RemoveImage(key);
                //ds.GetImages ().Remove (key);
            }
        }

        keyList = ds.GetDialogues().Keys.ToList();
        foreach (string key in keyList)
        {
            if (key.StartsWith(tObject.text))
            {
                ds.GetDialogues().Remove(key);
            }
        }

        keyList = ds.GetQuizes().Keys.ToList();
        foreach (string key in keyList)
        {
            if (key.StartsWith(tObject.text))
            {
                ds.GetQuizes().Remove(key);
            }
        }
        string switchTo = "";

        for (int i = 0; i < tm.SectionContentPar.transform.childCount; i++)
        {
            Transform child = tm.SectionContentPar.transform.GetChild(i);
            if (!child.name.Equals("Filler"))
            {
                switchTo = child.Find("SectionDisplayTMP").GetComponent <TextMeshProUGUI> ().text.Replace(" ", "_") + "Section";
                if (!switchTo.Equals(removedSection))
                {
                    break;
                }
            }
            else
            {
                switchTo = "";
            }
        }
        //Debug.Log (tm.SectionContentPar.transform.GetComponentsInChildren<Transform>()[1].name);
        //switchTo = tm.SectionContentPar.GetComponentsInChildren<Transform>()[1].Find("SectionDisplayText").GetComponent<TextMeshProUGUI>().text;
        if (switchTo.Equals(""))
        {
            BG.transform.Find("SectionCreatorBG").gameObject.SetActive(true);
            for (int i = 0; i < tm.TabContentPar.transform.childCount; i++)
            {
                Destroy(tm.TabContentPar.transform.GetChild(i).gameObject);
            }
        }
        else
        {
            tm.SwitchSection(switchTo);
        }

        //Destroy (editTabPanel);
    }
예제 #3
0
    /**
     * Returns the data of this entry in an XML formated string
     */
    public string getData()
    {
        if (gObject.GetComponent <DialogueEntryScript>())
        {
            return(gObject.GetComponent <DialogueEntryScript>().GetData());
        }

        string    xml       = "";
        Transform nextChild = null; //Used to skip sections of XML

        Transform[] allChildren = gObject.GetComponentsInChildren <Transform>();

        /*EntryValue.EntryValue[] values = gObject.GetComponentsInChildren<EntryValue.EntryValue>(true);
         * foreach(EntryValue.EntryValue value in values) {
         *      Debug.Log(value + ", " + value.GetValueWithXML());
         *      xml += value.GetValueWithXML();
         *      //Nested hfms
         *      //Pins
         * }
         * Debug.Log("ENTRY VALUE XML: " + xml);
         */
        xml = "";
        foreach (Transform child in allChildren)
        {
            if (child != null)
            {
                string startingUID = "";
                string newUID      = "";
                if (child.GetComponent <HistoryFieldManagerScript>() != null)  //There's a nested entry. We don't worry about that entry's data
                {
                    xml += child.GetComponent <HistoryFieldManagerScript>().getData();
                    Transform tempChild = child;
                    while (nextChild == null)
                    {
                        if (tempChild.GetSiblingIndex() + 1 == tempChild.parent.childCount)
                        {
                            tempChild = tempChild.parent;
                        }
                        else
                        {
                            nextChild = tempChild.parent.GetChild(tempChild.GetSiblingIndex() + 1);
                        }
                    }
                }
                else if (child.gameObject.GetComponent <EntryValue.EntryValue>() != null)
                {
                    //Value is escaped if appropriate by the EnvryValue class
                    xml += child.gameObject.GetComponent <EntryValue.EntryValue>().GetValueWithXML();
                }
                else if ((child.name.ToLower().EndsWith("value") || child.tag.Equals("Value") || child.name.ToLower().EndsWith("toggle")) && nextChild == null)                     //Input object
                {
                    if (child.gameObject.GetComponent <Toggle>() != null && child.gameObject.GetComponent <Toggle>().isOn)
                    {
                        xml += "<" + child.name + ">";
                        xml += child.gameObject.GetComponent <Toggle>().isOn;
                        xml += "</" + child.name + ">";
                    }
                    else if (child.name.ToLower().EndsWith("toggle"))
                    {
                        continue;
                    }
                    else
                    {
                        xml += "<" + child.name + ">";

                        //Handle reading the child
                        if (child.gameObject.GetComponent <InputField>() != null)
                        {
                            xml += UnityWebRequest.EscapeURL(child.gameObject.GetComponent <InputField>().text);
                        }
                        else if (child.gameObject.GetComponent <Dropdown>() != null)
                        {
                            xml += UnityWebRequest.EscapeURL(child.gameObject.GetComponent <Dropdown>().captionText.text);
                        }
                        else if (child.gameObject.GetComponent <Text>() != null)
                        {
                            xml += UnityWebRequest.EscapeURL(child.gameObject.GetComponent <Text>().text);
                        }
                        else if (child.gameObject.GetComponent <TMPro.TMP_InputField>() != null)
                        {
                            xml += UnityWebRequest.EscapeURL(child.gameObject.GetComponent <TMPro.TMP_InputField>().text);
                        }
                        else if (child.gameObject.GetComponent <TMPro.TextMeshProUGUI>() != null)
                        {
                            xml += UnityWebRequest.EscapeURL(child.gameObject.GetComponent <TMPro.TextMeshProUGUI>().text);
                        }
                        else if (child.gameObject.GetComponent <TMPro.TMP_Dropdown>() != null)
                        {
                            xml += UnityWebRequest.EscapeURL(child.gameObject.GetComponent <TMPro.TMP_Dropdown>().captionText.text);
                        }
                        else if (child.name.Equals("DialoguePin") || child.name.Equals("QuizPin") || child.name.Equals("FlagPin") || child.name.Equals("EventPin"))
                        {
                            newUID      = "";
                            startingUID = "";
                            Transform tempChild = child;
                            while (tempChild != null)
                            {
                                if (tempChild.name.StartsWith("LabEntry:"))
                                {
                                    startingUID = tempChild.name + startingUID;
                                    newUID      = "LabEntry: " + tempChild.GetSiblingIndex();
                                }
                                if (tempChild.name.EndsWith("Tab"))
                                {
                                    newUID = tempChild.name + "/" + newUID;
                                }
                                tempChild = tempChild.parent;
                            }
                            newUID = ds.transform.GetComponent <TabManager>().getCurrentSection() + "/" + newUID;

                            startingUID = newUID.Remove(newUID.LastIndexOf("/") + 1) + startingUID;
                            //Debug.Log ("starting: " + startingUID + ", new: " + newUID);

                            //If the dialogue entry has been moved, adjust the dictionary accordingly
                            if (child.name.Equals("DialoguePin"))
                            {
                                if (ds.GetDialogues().ContainsKey(startingUID))
                                {
                                    string dialogueXML = ds.GetDialogues()[startingUID]; //Dialogue data
                                    if (Regex.Matches(startingUID, "LabEntry").Count != Regex.Matches(newUID, "LabEntry").Count)
                                    {
                                        var labEntry = child;
                                        while (!labEntry.name.Contains("LabEntry"))
                                        {
                                            if (labEntry.parent)
                                            {
                                                labEntry = labEntry.parent;
                                            }
                                            else
                                            {
                                                break;
                                            }
                                        }

                                        newUID += "LabEntry: " + labEntry.GetSiblingIndex();
                                    }

                                    //If there was no dialogue where this dialogue was moved to
                                    if (!ds.GetDialogues().ContainsKey(newUID))
                                    {
                                        ds.GetDialogues().Remove(startingUID);
                                        //ds.AddDialogue (newUID, dialogueXML.Replace (startingUID, newUID));
                                    }
                                    // if (ds.correctlyOrderedDialogues.ContainsKey(newUID)) {
                                    ds.correctlyOrderedDialogues.Add(newUID, dialogueXML.Replace(startingUID, newUID));
                                    //}

                                    xml += dialogueXML.Replace(startingUID, newUID);
                                }
                                else
                                {
                                    xml = xml.Substring(0, xml.Length - ("<" + child.name + ">").Length);
                                    continue;
                                }
                            }

                            //If the quiz entry has been moved, adjust the dictionary accordingly
                            if (child.name.Equals("QuizPin"))
                            {
                                if (ds.GetQuizes().ContainsKey(startingUID))
                                {
                                    string quizXML = ds.GetQuizes()[startingUID]; //Quiz data
                                    if (Regex.Matches(startingUID, "LabEntry").Count != Regex.Matches(newUID, "LabEntry").Count)
                                    {
                                        var labEntry = child;
                                        while (!labEntry.name.Contains("LabEntry"))
                                        {
                                            if (labEntry.parent)
                                            {
                                                labEntry = labEntry.parent;
                                            }
                                            else
                                            {
                                                break;
                                            }
                                        }

                                        newUID += "LabEntry: " + labEntry.GetSiblingIndex();
                                    }

                                    //If there was no quiz where this quiz was moved to
                                    if (!ds.GetQuizes().ContainsKey(newUID))
                                    {
                                        ds.GetQuizes().Remove(startingUID);
                                        //ds.AddQuiz (newUID, quizXML.Replace (startingUID, newUID));
                                    }
                                    if (ds.correctlyOrderedQuizes.ContainsKey(newUID))
                                    {
                                        ds.correctlyOrderedQuizes.Add(newUID, quizXML.Replace(startingUID, newUID));
                                    }
                                    xml += quizXML.Replace(startingUID, newUID);
                                }
                                else
                                {
                                    xml = xml.Substring(0, xml.Length - ("<" + child.name + ">").Length);
                                    continue;
                                }
                            }
                            //Debug.Log (string.Join ("-----", ds.GetDialogues ().Select (x => x.Key + "DATA::::" + x.Value).ToArray()));
                        }

                        xml += "</" + child.name + ">";
                    }
                }
                else if (child.tag.Equals("Image") && child.GetComponent <OpenImageUploadPanelScript>())
                {
                    startingUID = child.GetComponent <OpenImageUploadPanelScript>().GetGuid();
                    xml        += "<Image>" + startingUID + "</Image>";
                }
                if (child == nextChild)
                {
                    nextChild = null;
                }
            }
        }
        Debug.Log("Current section's XML: " + xml);

        return(xml);
    }
예제 #4
0
    public void ApprovedPinRemove(GameObject pin)
    {
        //Dropdown pDrop = pin.transform.parent.parent.Find ("AddPinButton").GetComponentInChildren<Dropdown> ();
        //pDrop.AddOptions (new List<Dropdown.OptionData>(){new Dropdown.OptionData ("Quiz", pin.transform.Find ("ItemIcon").GetComponent<Image> ().sprite)});
        //pDrop.GetComponent<PinTabScript>().myOptions.Add (pin.name.Remove (pin.name.Length - "pin".Length));

        DataScript ds         = GameObject.Find("GaudyBG").GetComponent <DataScript> ();
        string     uniquePath = "";

        Debug.Log(pin.transform.name);
        Transform tempPin = pin.transform;

        if (!tempPin.GetComponentInParent <HistoryFieldManagerScript> ())
        {
            Transform uniqueParent = tempPin;
            uniquePath = "";
            while (uniqueParent.parent != null && !uniqueParent.parent.name.Equals("Content"))
            {
                if (uniqueParent.parent.GetComponent <HistoryFieldManagerScript> () != null)
                {
                    break;
                }
                uniqueParent = uniqueParent.parent;
            }
            uniquePath = uniqueParent.name;

            while (!uniqueParent.name.Equals(ds.GetComponent <TabManager>().getCurrentTab() + "Tab"))
            {
                uniqueParent = uniqueParent.parent;
                if (uniqueParent == null)
                {
                    break;
                }
                uniquePath = uniqueParent.name + "/" + uniquePath;
            }
            uniquePath = ds.GetComponent <TabManager>().getCurrentSection() + "/" + uniquePath;
        }
        else
        {
            while (tempPin != null)
            {
                if (tempPin.name.StartsWith("LabEntry:"))
                {
                    //uniquePath = "LabEntry: " + tempPin.GetSiblingIndex() + uniquePath;
                    uniquePath = tempPin.name + uniquePath;
                }
                if (tempPin.name.EndsWith("Tab"))
                {
                    uniquePath = tempPin.name + "/" + uniquePath;
                }
                tempPin = tempPin.parent;
            }
            uniquePath = ds.GetComponent <TabManager>().getCurrentSection() + "/" + uniquePath;
        }
        Debug.Log("Removing: " + uniquePath);
        switch (pin.transform.name)
        {
        case "DialoguePin":
            ds.GetDialogues().Remove(uniquePath);
            break;

        case "QuizPin":
            Dictionary <string, string> quizes = ds.GetQuizes();
            string quizData = "";
            if (quizes.ContainsKey(uniquePath))
            {
                quizData = quizes [uniquePath];
            }
            else
            {
                break;
            }
            ds.GetQuizes().Remove(uniquePath);
            List <string> imagesToRemove = new List <string> ();
            foreach (string key in ds.GetImageKeys())
            {
                if (quizData.Contains("<Image>" + key + "</Image>"))
                {
                    Debug.Log("Removing image: " + key);
                    imagesToRemove.Add(key);
                }
            }

            foreach (string s in imagesToRemove)
            {
                quizes.Remove(s);
            }
            break;

        case "FlagPin":
            ds.GetFlags().Remove(uniquePath);
            break;

        case "EventPin":
            // Wipe event input
            break;
        }

        if (pin.transform.Find("Item Background Off"))
        {
            pin.transform.Find("Item Background Off").gameObject.SetActive(true);
            pin.transform.Find("Item Background On").gameObject.SetActive(false);
        }
        else
        {
            Destroy(pin.gameObject);
        }
    }
예제 #5
0
    /**
     * Adds the active tab to the dictionary
     */
    public void AddToDictionary()
    {
        //GetSectionImages ();

        //If another tab has specified another AddToDictionary method, use that one
        if (MethodToCall != null)
        {
            MethodToCall();
            if (!sameTab)
            {
                MethodToCall = null;
            }
            return;
        }
        else
        {
            if (currentTab == null)
            {
                return;
            }

            string xml       = "<data>";
            string imageData = "<images>";
            int    imgCount  = 0;

            //string customName = ds.GetData (currentSection).getTabInfo (currentTab.name + currentTab.GetComponent<Text>().text).customName;
            //xml += "<customName>" + customName + "</customName><data>";

            //Sets up the XML string to be passed into the dictionary
            allChildren = currentTab.GetComponentsInChildren <Transform>();
            Transform nextChild = null;
            string    UID       = "";
            foreach (Transform child in allChildren)
            {
                //Debug.Log(child.name);
                if (child != null)
                {
                    if (child.tag.Equals("Image"))   //Handle images
                    {
                        Sprite img = child.GetComponent <Image>().sprite;
                        imageData += "<image" + imgCount + ">";

                        UID        = child.GetComponent <OpenImageUploadPanelScript>().GetGuid();
                        imageData += "<key>" + UID + "</key>";
                        //imageData += "<key>" + currentSection + currentTab.transform.Find ("TabButtonLinkToText").GetComponent<Text>().text + "</key>";
                        string imgRef;
                        if ((imgRef = ds.GetImage(currentSection + currentTab.transform.Find("TabButtonLinkToText").GetComponent <TextMeshProUGUI>().text).referenceName) != null)
                        {
                            imageData += imgRef;
                        }
                        else
                        {
                            imageData += "<width>" + img.texture.width + "</width><height>" + img.texture.height + "</height>";
                            Texture2D dictTexture = img.texture;
                            Texture2D newTexture  = new Texture2D(dictTexture.width, dictTexture.height, TextureFormat.ARGB32, false);
                            newTexture.SetPixels(0, 0, dictTexture.width, dictTexture.height, dictTexture.GetPixels());
                            newTexture.Apply();
                            byte[] bytes      = newTexture.EncodeToPNG();
                            string base64Data = Convert.ToBase64String(bytes);
                            imageData += "<data>" + base64Data + "</data>";
                        }
                        imageData += "</image" + imgCount + ">";
                        imgCount++;
                    }
                    else if (child.GetComponent <HistoryFieldManagerScript>() != null)
                    {
                        xml += child.GetComponent <HistoryFieldManagerScript>().getData();
                        Transform tempChild = child;
                        while (nextChild == null)
                        {
                            if (tempChild.GetSiblingIndex() + 1 == tempChild.parent.childCount)
                            {
                                tempChild = tempChild.parent;
                            }
                            else
                            {
                                nextChild = tempChild.parent.GetChild(tempChild.GetSiblingIndex() + 1);
                            }
                        }
                    }
                    else if (nextChild == null && (child.name.ToLower().EndsWith("value") || child.name.ToLower().EndsWith("toggle") || child.tag.Equals("Value")))     //Input object/field
                    {
                        if (child.gameObject.GetComponent <Toggle>() != null)
                        {
                            if (true)  // || child.gameObject.GetComponent<Toggle> ().isOn) { //Leaving as true for now. May change later
                            {
                                xml += "<" + child.name + ">";
                                xml += child.gameObject.GetComponent <Toggle>().isOn;
                                xml += "</" + child.name + ">";
                            }
                        }
                        else if (child.name.ToLower().EndsWith("toggle") || child.name.ToLower().EndsWith("radio"))
                        {
                            continue;
                        }
                        else
                        {
                            xml += "<" + child.name + ">";

                            //Handle reading the child
                            if (child.gameObject.GetComponent <InputField>() != null)
                            {
                                xml += UnityWebRequest.EscapeURL(child.gameObject.GetComponent <InputField>().text);
                            }
                            else if (child.gameObject.GetComponent <Text>() != null)
                            {
                                xml += UnityWebRequest.EscapeURL(child.gameObject.GetComponent <Text>().text);
                            }
                            else if (child.gameObject.GetComponent <Dropdown>() != null)
                            {
                                xml += UnityWebRequest.EscapeURL(child.gameObject.GetComponent <Dropdown>().captionText.text);
                            }
                            else if (child.name.Equals("DialoguePin") || child.name.Equals("QuizPin") || child.name.Equals("FlagPin") || child.name.Equals("EventPin"))
                            {
                                Transform uniqueParent = child;
                                string    path         = "";
                                while (uniqueParent.parent != null && !uniqueParent.parent.name.Equals("Content"))
                                {
                                    uniqueParent = uniqueParent.parent;
                                }
                                path = uniqueParent.name;
                                while (!uniqueParent.name.EndsWith("Tab"))  //Once you hit the Tab container
                                {
                                    uniqueParent = uniqueParent.parent;
                                    path         = uniqueParent.name + "/" + path;
                                }
                                path = getCurrentSection() + "/" + path;

                                //If the dialogue entry has been moved, adjust the dictionary accordingly
                                if (child.name.Equals("DialoguePin") && ds.GetDialogues().ContainsKey(path))
                                {
                                    string dialogueXML = ds.GetDialogues()[path]; //Dialogue data
                                    ds.AddDialogue(path, dialogueXML);

                                    xml += dialogueXML;
                                }
                                else if (child.name.Equals("DialoguePin"))
                                {
                                    xml = xml.Substring(0, xml.Length - ("<" + child.name + ">").Length);
                                    continue;
                                }

                                //If the quiz entry has been moved, adjust the dictionary accordingly
                                if (child.name.Equals("QuizPin") && ds.GetQuizes().ContainsKey(path))
                                {
                                    string quizXML = ds.GetQuizes()[path]; //Quiz data
                                    ds.AddQuiz(path, quizXML);
                                    xml += quizXML;
                                }
                                else if (child.name.Equals("QuizPin"))
                                {
                                    xml = xml.Substring(0, xml.Length - ("<" + child.name + ">").Length);
                                    continue;
                                }

                                if (child.name.Equals("FlagPin") && ds.GetFlags().ContainsKey(path))
                                {
                                    string flagXML = ds.GetFlags()[path]; //Dialogue data
                                    ds.AddFlag(path, flagXML);

                                    xml += flagXML;
                                }
                                else if (child.name.Equals("FlagPin"))
                                {
                                    xml = xml.Substring(0, xml.Length - ("<" + child.name + ">").Length);
                                    continue;
                                }
                            }

                            xml += "</" + child.name + ">";
                        }
                    }
                    if (child == nextChild)
                    {
                        nextChild = null;
                    }
                }
            }
            imageData += "</images>";
            xml       += "</data>";

            //Add the current Tab to the Dictionary. Replace any existing tab if it exists
            if (ds == null)
            {
                ds = GameObject.Find("GaudyBG").GetComponentInChildren <DataScript>();
            }
            //ds.AddData (currentSection, tabName, xml);
            ds.AddData(currentSection, currentTab.name.Substring(0, currentTab.name.Length - 3), xml);
            Debug.Log("Saved value: " + xml);
        }
    }
예제 #6
0
    /**
     * Called when removing a tab from the edit tab panel
     */
    public void removeTab()
    {
        //Debug.Log (tObject.text);
        tm.AddToDictionary();
        string tabData = ds.GetData(tm.getCurrentSection(), tabName.text);

        ds.RemoveTab(tabName.text);
        tm.DestroyCurrentTab();
        tm.TabButtonContentPar.transform.Find(tabName.text + "TabButton");
        if (!tabName.text.Contains("/"))
        {
            Destroy(tm.TabButtonContentPar.transform.Find(tabName.text + "TabButton").gameObject);
        }
        else
        {
            for (int i = 0; i < tm.TabButtonContentPar.transform.childCount; i++)
            {
                if (tm.TabButtonContentPar.transform.GetChild(i).name.Equals(tabName.text + "TabButton"))
                {
                    Destroy(tm.TabButtonContentPar.transform.GetChild(i).gameObject);
                    break;                     //break out of the loop
                }
            }
        }
        if (ds.GetData(tm.getCurrentSection()).GetTabList().Count != 0)
        {
            TabInfoScript newTabInfo = ds.GetData(tm.getCurrentSection()).GetTabInfo(ds.GetData(tm.getCurrentSection()).GetTabList() [0]);
            tm.setTabName(newTabInfo.customName);
            tm.SwitchTab(ds.GetData(tm.getCurrentSection()).GetTabList() [0]);
        }
        else
        {
            //BG.transform.Find ("TabSelectorBG").gameObject.SetActive (true);
            GameObject tabSelectorPrefab = Instantiate(Resources.Load("Writer/Prefabs/Panels/TabSelectorBG")) as GameObject;
            tabSelectorPrefab.transform.SetParent(BG.transform, false);

            if (tabSelectorPrefab.transform.Find("TabSelectorPanel/RowTitle/CancelButton"))
            {
                tabSelectorPrefab.transform.Find("TabSelectorPanel/RowTitle/CancelButton").gameObject.SetActive(false);
            }
        }
        //Debug.Log (ds.GetData (tm.getCurrentSection()).getTabList ()[0]);
        tabEditPrefab.transform.Find(TitleValuePath).GetComponent <TMP_InputField>().text = "";
        //tabEditPrefab.gameObject.SetActive (false);
        if (tabName.text.StartsWith("Background_InfoTab"))
        {
            ds.transform.Find("TabSelectorBG/TabSelectorPanel/Content/ScrollView/Viewport/Content/BackgroundInfoTabPanel").gameObject.SetActive(true);
        }

        Destroy(tabEditPrefab);

        List <string> keyList = ds.GetImageKeys();        //  ds.GetImages ().Keys.ToList();

        foreach (string key in keyList)
        {
            if (tabData.Contains("<Image>" + key + "</Image>"))
            {
                Debug.Log("Removing Image: " + key);
                ds.RemoveImage(key);
                //ds.GetImages ().Remove (key);
            }
        }

        keyList = ds.GetDialogues().Keys.ToList();
        foreach (string key in keyList)
        {
            if (key.StartsWith(tm.getCurrentSection() + "/" + tabName.text + "Tab"))
            {
                ds.GetDialogues().Remove(key);
            }
        }

        keyList = ds.GetQuizes().Keys.ToList();
        foreach (string key in keyList)
        {
            if (key.StartsWith(tm.getCurrentSection() + "/" + tabName.text + "Tab"))
            {
                ds.GetQuizes().Remove(key);
            }
        }
    }