Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void OnGUI (){
- // The Inventory Manager must be called ("InventoryManager" and you must have only one.)
- if (GameObject.Find("InventoryManager")) {
- itemListObject = GameObject.Find("InventoryManager");
- itemList = GameObject.Find("InventoryManager").GetComponent<ItemList>().items;
- }
- if (deleteWarning) {
- GUILayout.Space(40);
- GUILayout.BeginHorizontal ();
- GUILayout.Space(20);
- GUILayout.Label (warningString, EditorStyles.boldLabel, GUILayout.ExpandWidth(false));
- GUILayout.EndHorizontal ();
- GUILayout.Space(20);
- GUILayout.BeginHorizontal ();
- GUILayout.Space(20);
- if (GUILayout.Button("KEEP Item", GUILayout.ExpandWidth(false))) {
- warningString = itemList[viewIndex-1].itemName + " SAVED";
- deleteWarning = false;
- }
- GUILayout.Space(20);
- if (GUILayout.Button("DELETE Item", GUILayout.ExpandWidth(false))) {
- warningString = itemList[viewIndex-1].itemName + " DELETED";
- deleteWarning = false;
- DeleteItem ();
- }
- GUILayout.EndHorizontal ();
- } else if (itemList != null && itemList.Length > 0) {
- if (newItem) {
- SetNewItemFocus ();
- }
- GUILayout.Label ("Inventory Item Editor", EditorStyles.boldLabel);
- GUILayout.BeginHorizontal ();
- viewIndex = EditorGUILayout.IntField ("Current Item", viewIndex, GUILayout.ExpandWidth(false));
- EditorGUILayout.LabelField ("of " + itemList.Length.ToString() + " items", "", GUILayout.ExpandWidth(false));
- GUILayout.EndHorizontal ();
- if (viewIndex > itemList.Length)
- viewIndex = itemList.Length;
- if (viewIndex < 1)
- viewIndex = 1;
- GUILayout.Space(5);
- GUILayout.BeginHorizontal ();
- GUILayout.Space(10);
- if (GUILayout.Button("Prev", GUILayout.ExpandWidth(false))) {
- if (viewIndex > 1)
- viewIndex --;
- GUI.FocusControl ("clearFocus");
- warningString = "";
- }
- if (GUILayout.Button("Next", GUILayout.ExpandWidth(false))) {
- if (viewIndex < itemList.Length) {
- viewIndex ++;
- GUI.FocusControl ("clearFocus");
- warningString = "";
- }
- }
- GUILayout.Space(30);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement