public string Info() { string param = ""; switch (type) { case IItemType.Amulet: param = "Уровень защиты : "; break; case IItemType.Armor: param = "Уровень защиты : "; break; case IItemType.EmptyScroll: param = ""; break; case IItemType.Food: param = "Минус к голоду :"; break; case IItemType.ScrollOfAir: param = "Уровень заклинания : "; break; case IItemType.ScrollOfEarth: param = "Уровень заклинания : "; break; case IItemType.ScrollOfFire: param = "Уровень заклинания : "; break; case IItemType.ScrollOfGod: param = "Уровень заклинания : "; break; case IItemType.ScrollOfWater: param = "Уровень заклинания : "; break; case IItemType.Weapon: param = "Урон : "; break; } string t = "" + name + '\n' + "(" + type + ")" + '\n' + param + value + '\n' + "Цена предмета : " + sellCount + '\n' + "Описание предмета : " + IItemAsset.GetIntro(IItemAsset.GetIDByName(name)) + '\n' + "Бонусы : " + bonuses.ToText(); return(t); }
private void OnGUI() { IItem[] basicItems = LoadBasicItems(); if (Exist()) { if (GUILayout.Button("LoadFromFile")) { items = LoadSaved(); } } using (EditorGUILayout.ScrollViewScope s = new EditorGUILayout.ScrollViewScope(scroll)) { scroll = s.scrollPosition; GUILayout.Label("Basic items : "); for (int i = 0; i < basicItems.Length; i++) { GUILayout.Box("" + '\n' + basicItems [i].name); GUILayout.Box(IItemAsset.LoadTexture(IItemAsset.GetIDByName(basicItems[i].name))); GUILayout.Label(basicItems [i].intro); GUILayout.Label("Cost : " + basicItems [i].sellCount); GUILayout.Label("ID : " + i); GUILayout.Label("Type : " + basicItems [i].type); GUILayout.Label("Value : " + basicItems [i].value); } GUILayout.Label("" + '\n' + "Available to edit items : " + '\n'); if (GUILayout.Button("Add item")) { AddItem(); } for (int i = 0; i < items.Length; i++) { items [i].name = EditorGUILayout.TextField("Item name", items [i].name); items [i].intro = EditorGUILayout.TextArea(items [i].intro); items [i].sellCount = EditorGUILayout.IntField("Item cost", items [i].sellCount); items [i].value = EditorGUILayout.IntField("Item value", items [i].value); items [i].type = (IItemType)EditorGUILayout.EnumPopup(items [i].type); if (GUILayout.Button("Remove item")) { RemoveItem(i); } } } if (GUILayout.Button("Save items")) { Save(); } }