public void Weapons() { scrollPosition = GUILayout.BeginScrollView(scrollPosition); for (int i = 0; i < WeaponDatabase.GetAssetCount(); i++) { WeaponAsset asset = WeaponDatabase.GetAt(i); if (asset != null) { GUILayout.BeginHorizontal(EditorStyles.toolbar); GUILayout.Label(string.Format("ID: {0}", asset.ID.ToString("D3")), GUILayout.Width(60)); bool clicked = GUILayout.Toggle(asset.ID == activeID, asset.Name, ToggleButtonStyle); if (clicked != (asset.ID == activeID)) { if (clicked) { activeID = asset.ID; GUI.FocusControl(null); } else { activeID = -1; } } if (GUILayout.Button("x", EditorStyles.toolbarButton, GUILayout.Width(30)) && EditorUtility.DisplayDialog("Delete Stat Type", "Are you sure you want to delete " + asset.Name + " Weapon?", "Delete", "Cancel")) { WeaponDatabase.Instance.RemoveAt(i); } GUILayout.EndHorizontal(); if (activeID == asset.ID) { EditorGUI.BeginChangeCheck(); GUILayout.BeginVertical("Box"); GUILayout.BeginHorizontal(); //ITEM SPRITE GUILayout.BeginVertical(GUILayout.Width(75)); //begin vertical asset.Icon = (Sprite)EditorGUILayout.ObjectField(asset.Icon, typeof(Sprite), false, GUILayout.Width(72), GUILayout.Height(72)); GUILayout.Label("Item Sprite", GUILayout.Width(72)); GUILayout.EndVertical(); //end vertical //ITEM CLASS GUILayout.BeginVertical(); //begin vertical GUILayout.Label("Item Class: " + asset.IType.ToString(), EditorStyles.boldLabel); //NAME GUILayout.BeginHorizontal(); GUILayout.Label("Name", GUILayout.Width(80)); asset.Name = EditorGUILayout.TextField(asset.Name); GUILayout.EndHorizontal(); //DESCRIPTION GUILayout.BeginHorizontal(); GUILayout.Label("Description", GUILayout.Width(80)); asset.Description = EditorGUILayout.TextArea(asset.Description, GUILayout.MinHeight(30)); GUILayout.EndHorizontal(); //COST GUILayout.BeginHorizontal(); GUILayout.Label("Cost", GUILayout.Width(80)); asset.Cost = EditorGUILayout.IntField(asset.Cost); GUILayout.EndHorizontal(); //STACKABLE GUILayout.BeginHorizontal(); GUILayout.Label("Stackable", GUILayout.Width(80)); GUILayout.BeginVertical(); asset.Stackable = EditorGUILayout.BeginToggleGroup("Enabled", asset.Stackable); GUILayout.BeginHorizontal(); GUILayout.Label("Stack Size", GUILayout.Width(80)); asset.StackSize = EditorGUILayout.IntSlider(asset.StackSize, 2, 64); GUILayout.EndHorizontal(); GUILayout.EndVertical(); GUILayout.EndHorizontal(); EditorGUILayout.EndToggleGroup(); GUILayout.BeginHorizontal(); GUILayout.Label("Level", GUILayout.Width(80)); asset.Level = EditorGUILayout.IntSlider(asset.Level, 1, 99); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Weight", GUILayout.Width(80)); asset.Weight = EditorGUILayout.IntSlider(asset.Weight, 0, 99); GUILayout.EndHorizontal(); GUILayout.Label("Weapon Variables", EditorStyles.boldLabel); GUILayout.BeginHorizontal(); GUILayout.Label("Weap Type", GUILayout.Width(80)); asset.WType = (WeaponType)EditorGUILayout.EnumPopup(asset.WType); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Durability", GUILayout.Width(80)); asset.Durability = EditorGUILayout.IntField(asset.Durability); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Attack Range", GUILayout.Width(80)); asset.AttackRange = EditorGUILayout.IntSlider(asset.AttackRange, 1, 20); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Weap Dmg", GUILayout.Width(80)); asset.WeaponDamage = EditorGUILayout.IntSlider(asset.WeaponDamage, 0, 99); GUILayout.EndHorizontal(); GUILayout.EndVertical(); GUILayout.EndHorizontal(); GUILayout.EndVertical(); if (EditorGUI.EndChangeCheck()) { EditorUtility.SetDirty(WeaponDatabase.Instance); } } } } GUILayout.EndScrollView(); }