private Transform container; //The entry we're moving. /** * Used for objects (mostly entries/panels used by HistoryFieldManagerScript) which need to move * This script should be placed on the object that will be clicked on */ /** * Initialize most variables */ void Awake() { hover = false; cursor = GameObject.Find("CursorContainer").GetComponent <CECursor>(); hm = transform.GetComponentInParent <HistoryFieldManagerScript> (); if (hm.isStatic == true) { container = transform.parent.parent; } else if (hm.isQuizPanel && !transform.parent.name.StartsWith("QuizQuestionOption")) { //Awake is run before the name change to LabEntry takes effect container = transform.parent; while (!container.parent.Equals(hm.transform)) { container = container.parent; } } else { container = transform.parent; } entries = new List <Transform> (); foreach (Transform entry in container.parent.GetComponentsInChildren <Transform>()) { if (entry.parent == container.parent && entry.name != container.name) { entries.Add(entry); } } if (hm.isQuizPanel) { if (hm.GetComponentInParent <DialogueManagerScript>() || hm.GetComponentInParent <ReaderDialogueManagerScript>()) { Transform temp = transform; while (temp != null && !temp.name.Equals("ScrollView")) { temp = temp.parent; } if (temp == null) { print("Could not find ScrollView in parents!"); return; } scrollRectTransform = temp.GetComponent <RectTransform>(); } else { scrollRectTransform = hm.parentTab.transform.Find("QuizEditorPanel/Content/ScrollView").GetComponent <RectTransform>(); } } else { scrollRectTransform = hm.parentTab.transform.Find("Scroll View").GetComponent <RectTransform> (); } scrollScrollRect = scrollRectTransform.transform.GetComponent <DragOverrideScript> (); rt = container.GetComponent <RectTransform>(); dMPos = 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(); }
/** * Removes the specified object */ public void ApprovedRemove(GameObject obj) { HistoryFieldManagerScript hm = null; Transform t = transform; while (t != null && t.parent.GetComponent <HistoryFieldManagerScript> () == null) { t = t.parent; } if (t == null) { return; } else { hm = t.parent.GetComponent <HistoryFieldManagerScript> (); } hm.RemovePanelEntry(obj); }
public void CreateEntry() { hm = GameObject.Find("GaudyBG").GetComponent <TabManager> ().TabContentPar.transform.GetComponentInChildren <HistoryFieldManagerScript>(); hm.AddEntryFromPanel(); }