/** * 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); } } }