Advertisement
LittleAngel

Untitled

Mar 10th, 2011
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.12 KB | None | 0 0
  1. void OnGUI (){
  2. // The Inventory Manager must be called ("InventoryManager" and you must have only one.)
  3. if (GameObject.Find("InventoryManager")) {
  4. itemListObject = GameObject.Find("InventoryManager");
  5. itemList = GameObject.Find("InventoryManager").GetComponent<ItemList>().items;
  6. }
  7.  
  8. if (deleteWarning) {
  9. GUILayout.Space(40);
  10.  
  11.  
  12. GUILayout.BeginHorizontal ();
  13. GUILayout.Space(20);
  14. GUILayout.Label (warningString, EditorStyles.boldLabel, GUILayout.ExpandWidth(false));
  15. GUILayout.EndHorizontal ();
  16.  
  17. GUILayout.Space(20);
  18.  
  19. GUILayout.BeginHorizontal ();
  20. GUILayout.Space(20);
  21. if (GUILayout.Button("KEEP Item", GUILayout.ExpandWidth(false))) {
  22. warningString = itemList[viewIndex-1].itemName + " SAVED";
  23. deleteWarning = false;
  24. }
  25. GUILayout.Space(20);
  26. if (GUILayout.Button("DELETE Item", GUILayout.ExpandWidth(false))) {
  27. warningString = itemList[viewIndex-1].itemName + " DELETED";
  28. deleteWarning = false;
  29. DeleteItem ();
  30. }
  31. GUILayout.EndHorizontal ();
  32.  
  33. } else if (itemList != null && itemList.Length > 0) {
  34.  
  35. if (newItem) {
  36. SetNewItemFocus ();
  37. }
  38.  
  39. GUILayout.Label ("Inventory Item Editor", EditorStyles.boldLabel);
  40.  
  41. GUILayout.BeginHorizontal ();
  42. viewIndex = EditorGUILayout.IntField ("Current Item", viewIndex, GUILayout.ExpandWidth(false));
  43. EditorGUILayout.LabelField ("of " + itemList.Length.ToString() + " items", "", GUILayout.ExpandWidth(false));
  44. GUILayout.EndHorizontal ();
  45.  
  46. if (viewIndex > itemList.Length)
  47. viewIndex = itemList.Length;
  48. if (viewIndex < 1)
  49. viewIndex = 1;
  50.  
  51. GUILayout.Space(5);
  52.  
  53. GUILayout.BeginHorizontal ();
  54. GUILayout.Space(10);
  55. if (GUILayout.Button("Prev", GUILayout.ExpandWidth(false))) {
  56. if (viewIndex > 1)
  57. viewIndex --;
  58. GUI.FocusControl ("clearFocus");
  59. warningString = "";
  60. }
  61. if (GUILayout.Button("Next", GUILayout.ExpandWidth(false))) {
  62. if (viewIndex < itemList.Length) {
  63. viewIndex ++;
  64. GUI.FocusControl ("clearFocus");
  65. warningString = "";
  66. }
  67. }
  68.  
  69. GUILayout.Space(30);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement