public void InitWindows() { Skin = (GUISkin)Resources.Load("GUI/EditorGUI"); //windows init npcEditor = new NPCEditor(Skin, this); armorEditor = new ArmorEditor(Skin, this); arenaEditor = new ArenaEditor(Skin, this); enemyEditor = new EnemyEditor(Skin, this); currencyEditor = new CurrencyEditor(Skin, this); conversationEditor = new ConversationEditor(Skin, this); shopEditor = new ShopEditor(Skin, this); questEditor = new QuestEditor(Skin, this); itemEditor = new ItemEditor(Skin, this); minigameEditor = new MiniGameEditor(Skin, this); serviceEditor = new ServiceEditor(Skin, this); npcQuestEditor = new NPCQuestEditor(Skin, this); townEditor = new TownEditor(Skin, this); badgeEditor = new BadgeEditor(Skin, this); constructionEditor = new ConstructionEditor(Skin, this); loadWindows = false; }
public virtual void CreateEditors() { editors.Clear(); itemEditor = new EmptyEditor("Items editor", this); itemEditor.requiresDatabase = true; itemEditor.childEditors.Add(new ItemEditor("Item", "Items", this)); itemEditor.childEditors.Add(new ItemCategoryEditor("Item category", "Item categories", this)); itemEditor.childEditors.Add(new ItemPropertyEditor("Item property", "Item properties", this) { canReOrderItems = true }); itemEditor.childEditors.Add(new ItemRarityEditor("Item Rarity", "Item rarities", this) { canReOrderItems = true }); editors.Add(itemEditor); var currencyEditor = new CurrencyEditor("Curreny", "Currencies", this); currencyEditor.requiresDatabase = true; currencyEditor.canReOrderItems = true; editors.Add(currencyEditor); equipEditor = new EmptyEditor("Equip editor", this); equipEditor.requiresDatabase = true; equipEditor.childEditors.Add(new EquipEditor("Stats", this)); #if PLY_GAME equipEditor.childEditors.Add(new plyStatsEditor("Ply stats", this)); #endif equipEditor.childEditors.Add(new EquipTypeEditor("Equip type", "Equip types", this)); editors.Add(equipEditor); craftingEditor = new CraftingEmptyEditor("Crafting editor", this); craftingEditor.requiresDatabase = true; editors.Add(craftingEditor); languageEditor = new LanguageEditor("Language editor", "Language categories", this); editors.Add(languageEditor); settingsEditor = new SettingsEditor("Settings editor", "Settings categories", this); editors.Add(settingsEditor); }
protected virtual EditorItem GetEditorItem(CustomDataType type, string custom, PropertyInfo property) { RequiredAttribute required = property.GetCustomAttributes(typeof(RequiredAttribute), true).FirstOrDefault() as RequiredAttribute; EditorItem item; switch (type) { case CustomDataType.Boolean: item = new BoolEditor(Frame); break; case CustomDataType.Currency: item = new CurrencyEditor(Frame); break; case CustomDataType.Date: item = new DateEditor(Frame); break; case CustomDataType.DateTime: item = new DateTimeEditor(Frame); break; case CustomDataType.Default: item = new DefaultEditor(Frame); if (required != null) { ((DefaultEditor)item).IsAllowdEmpty = required.AllowEmptyStrings; } break; case CustomDataType.EmailAddress: item = new EmailAddressEditor(Frame); break; case CustomDataType.Html: item = new HtmlEditor(Frame); break; case CustomDataType.ImageUrl: item = new ImageUrlEditor(Frame); break; case CustomDataType.Image: item = new ImageEditor(Frame); break; case CustomDataType.Integer: item = new IntegerEditor(Frame); break; case CustomDataType.MultilineText: item = new MultilineTextEditor(Frame); if (required != null) { ((MultilineTextEditor)item).IsAllowdEmpty = required.AllowEmptyStrings; } break; case CustomDataType.Number: item = new NumberEditor(Frame); break; case CustomDataType.Password: item = new PasswordEditor(Frame); break; case CustomDataType.PhoneNumber: item = new PhoneNumberEditor(Frame); break; case CustomDataType.Sex: item = new SexEditor(Frame); break; case CustomDataType.Text: item = new DefaultEditor(Frame); break; case CustomDataType.Time: item = new TimeEditor(Frame); break; case CustomDataType.Url: item = new UrlEditor(Frame); break; default: switch (custom) { case "Enum": item = GetEnumEditorItem(property.PropertyType); break; case "Entity": item = new EntityEditor(Frame, property.PropertyType); break; case "Collection": item = new CollectionEditor(Frame, property.PropertyType.GetGenericArguments()[0]); break; default: throw new NotSupportedException("不支持自定义类型编辑器。"); } break; } if (required != null) { item.IsRequired = true; } return(item); }