void Update() { ToggleContainer(); if (iLockUse > 0) { GetComponent <Button>().interactable = false; iLockUse -= Time.deltaTime; } else { GetComponent <Button>().interactable = true; } if (!completedMovement && isOpen) { DataBaseMain.MoveAllUIElementsDown(dbMain.dObjectsList, this.gameObject, thisIndexNumber); privateMoveTime -= Time.deltaTime; if (privateMoveTime <= 0) { completedMovement = true; } } if (!completedMovement && !isOpen) { DataBaseMain.MoveAllUIElementsUp(dbMain.dObjectsList, this.gameObject, thisIndexNumber); privateMoveTime -= Time.deltaTime; if (privateMoveTime <= 0) { completedMovement = true; } } }
void Awake() { if (dbMain == null) { dbMain = FindObjectOfType <DataBaseMain>(); } if (!foundAllElements) { FindAllNeededUIElements(); } isOpen = false; }
public override void OnInspectorGUI() { thisDataBaseMain = (DataBaseMain)target; GUILayout.Label("Database Objects"); EditorGUI.indentLevel = 1; objectOpen = EditorGUILayout.Foldout(objectOpen, "Objects"); if (objectOpen) { for (int i = 0; i < thisDataBaseMain.dObjectsList.Count; i++) { EditorGUI.indentLevel = 2; EditorGUILayout.Foldout(false, (thisDataBaseMain.dObjectsList[i].oIndexNumber + " " + thisDataBaseMain.dObjectsList[i].oName)); } } EditorGUI.indentLevel = 1; floraOpen = EditorGUILayout.Foldout(floraOpen, "Flora"); if (floraOpen) { for (int i = 0; i < thisDataBaseMain.dObjectsFloraList.Count; i++) { EditorGUI.indentLevel = 2; EditorGUILayout.Foldout(false, thisDataBaseMain.dObjectsFloraList[i].oName); } } EditorGUI.indentLevel = 1; faunaOpen = EditorGUILayout.Foldout(faunaOpen, "Fuana"); if (faunaOpen) { for (int i = 0; i < thisDataBaseMain.dObjectsFaunaList.Count; i++) { EditorGUI.indentLevel = 2; EditorGUILayout.Foldout(false, thisDataBaseMain.dObjectsFaunaList[i].oName); } } EditorGUI.indentLevel = 1; planetOpen = EditorGUILayout.Foldout(planetOpen, "Planets"); if (planetOpen) { for (int i = 0; i < thisDataBaseMain.dObjectsPlanetList.Count; i++) { EditorGUI.indentLevel = 2; EditorGUILayout.Foldout(false, thisDataBaseMain.dObjectsPlanetList[i].oName); } } EditorGUI.indentLevel = 1; if (GUILayout.Button("Find Database Objects")) { DataBaseMain.FindAllDatabaseObjects(thisDataBaseMain.dObjectsList); DataBaseMain.SortAllDataBaseObjects(thisDataBaseMain.dObjectsList); DataBaseMain.AddObjectsToSubLists(thisDataBaseMain.dObjectsList, thisDataBaseMain.dObjectsFloraList, thisDataBaseMain.dObjectsFaunaList, thisDataBaseMain.dObjectsPlanetList); DataBaseMain.SortAllDataBaseObjects(thisDataBaseMain.dObjectsFloraList); DataBaseMain.SortAllDataBaseObjects(thisDataBaseMain.dObjectsFaunaList); DataBaseMain.SortAllDataBaseObjects(thisDataBaseMain.dObjectsPlanetList); DataBaseMain.RemoveDuplicatesInDataBases(thisDataBaseMain.dObjectsList, thisDataBaseMain.dObjectsFloraList, thisDataBaseMain.dObjectsFaunaList, thisDataBaseMain.dObjectsPlanetList); objectOpen = true; floraOpen = true; faunaOpen = true; planetOpen = true; Debug.Log("HitButton"); } if (GUILayout.Button("Instantiate UI")) { DataBaseMain.InstantiateUIElements(thisDataBaseMain.dObjectsList, thisDataBaseMain.dataBaseCanvasInvis); } if (GUILayout.Button("Reset UI")) { if (thisDataBaseMain.dataBaseCanvasInvis == null) { thisDataBaseMain.dataBaseCanvasInvis = GameObject.Find("DatabaseUIPanelInvis"); } List <GameObject> children = new List <GameObject>(); foreach (Transform child in thisDataBaseMain.dataBaseCanvasInvis.transform) { children.Add(child.gameObject); } children.ForEach(child => DestroyImmediate(child)); } if (GUILayout.Button("Reset Everything")) { DataBaseMain.ResetAllDatabases(thisDataBaseMain.dObjectsList, thisDataBaseMain.dObjectsFloraList, thisDataBaseMain.dObjectsFaunaList, thisDataBaseMain.dObjectsPlanetList, thisDataBaseMain.dataBaseCanvasInvis); } }