protected override OdinMenuTree BuildMenuTree() { var tree = new OdinMenuTree(true); tree.DefaultMenuStyle.IconSize = 28.00f; tree.Config.DrawSearchToolbar = true; // Adds the character overview table. CharacterOverview.Instance.UpdateCharacterOverview(); tree.Add("Characters", new CharacterTable(CharacterOverview.Instance.AllCharacters)); // Adds all cahracters. tree.AddAllAssetsAtPath("Characters", "Assets/Plugins/Sirenix", typeof(Character), true, true); // Add all scriptable object items. tree.AddAllAssetsAtPath("", "Assets/Plugins/Sirenix/Demos/SAMPLE - RPG Editor/Items", typeof(Item), true) .ForEach(this.AddDragHandles); // Add drag handles to items, so they can be easily dragged into the inventory if characters etc... tree.EnumerateTree().Where(x => x.Value as Item).ForEach(AddDragHandles); // Add icons to characters and items. tree.EnumerateTree().AddIcons <Character>(x => x.Icon); tree.EnumerateTree().AddIcons <Item>(x => x.Icon); return(tree); }
protected override OdinMenuTree BuildMenuTree() { var tree = new OdinMenuTree(true); tree.DefaultMenuStyle.IconSize = 28.00f; //图标大小 tree.Config.DrawSearchToolbar = true; //搜索栏 //角色预览页 MonsterOverview.Instance.UpdataMonsterOverview(); tree.Add("Monsters", new MonsterTable(MonsterOverview.Instance.AllMonsters)); //增加所有角色到左边 tree.AddAllAssetsAtPath("Resources/ScriptsObject/MonsterSet", "Assets", typeof(MonsterSet), true, true); //添加所有的模块到左边 tree.AddAllAssetsAtPath("Resources/ScriptsObject/ModuleSet", "Assets", typeof(ModuleSet), true, true); //拖拽功能 tree.EnumerateTree().Where(x => x.Value as ModuleSet).ForEach(AddDragHandles); //添加所有的技能到左边 tree.AddAllAssetsAtPath("Resources/ScriptsObject/SkillSet", "Assets", typeof(SkillSet), true, true); //拖拽功能 tree.EnumerateTree().Where(x => x.Value as SkillSet).ForEach(AddDragHandles); //添加图标 tree.EnumerateTree().AddIcons <MonsterSet>(x => x.monsterIcon); tree.EnumerateTree().AddIcons <ModuleSet>(x => x.moduleIconA); tree.EnumerateTree().AddIcons <SkillSet>(x => x.skillIconA); return(tree); }
protected override OdinMenuTree BuildMenuTree() { CardLibraryInfo cardLibraryInfo = CardLibraryCommand.GetLibraryInfo(); var tree = new OdinMenuTree(true); tree.DefaultMenuStyle.Height = 60; tree.DefaultMenuStyle.IconSize = 48.00f; tree.Config.DrawSearchToolbar = true; CardLibraryCommand.Init(); tree.Add("单人模式牌库", cardLibraryInfo); foreach (var levelLibrary in cardLibraryInfo.levelLibries.Where(library => library.isSingleMode)) { tree.Add($"单人模式牌库/{levelLibrary.level}", levelLibrary); foreach (var sectarianCardLibrary in levelLibrary.sectarianCardLibraries) { tree.Add($"单人模式牌库/{levelLibrary.level}/{sectarianCardLibrary.sectarian}", sectarianCardLibrary); foreach (var rankLibrary in sectarianCardLibrary.rankLibraries) { tree.Add($"单人模式牌库/{levelLibrary.level}/{sectarianCardLibrary.sectarian}/{rankLibrary.rank}", rankLibrary); foreach (var cardModel in rankLibrary.cardModelInfos) { tree.Add($"单人模式牌库/{levelLibrary.level}/{sectarianCardLibrary.sectarian}/{rankLibrary.rank}/{cardModel.cardName}", cardModel); } } } } tree.Add("多人模式牌库", cardLibraryInfo); foreach (var levelLibrary in cardLibraryInfo.levelLibries.Where(library => !library.isSingleMode)) { foreach (var sectarianCardLibrary in levelLibrary.sectarianCardLibraries) { tree.Add($"多人模式牌库/{sectarianCardLibrary.sectarian}", sectarianCardLibrary); foreach (var rankLibrary in sectarianCardLibrary.rankLibraries) { tree.Add($"多人模式牌库/{sectarianCardLibrary.sectarian}/{rankLibrary.rank}", rankLibrary); foreach (var cardModel in rankLibrary.cardModelInfos) { tree.Add($"多人模式牌库/{sectarianCardLibrary.sectarian}/{rankLibrary.rank}/{cardModel.cardName}", cardModel); } } } } //tree.EnumerateTree().AddIcons<CardLibraryInfo>(x => x.singleIcon); tree.EnumerateTree().AddIcons <SectarianCardLibrary>(x => x.icon); tree.EnumerateTree().AddIcons <RankLibrary>(x => x.icon); tree.EnumerateTree().AddIcons <CardModelInfo>(x => x.icon); instance = this; return(tree); }
public void LoadItem <T>(ref OdinMenuTree t) where T : ItemConfig <T> { ItemConfig <T> .Reload(); if (ItemConfig <T> .Count > 0) { foreach (var item in ItemConfig <T> .Datas) { t.Add(item.Value.物品名字, item.Value); t.EnumerateTree().AddIcons <T>(x => x.GetSprite()); t.EnumerateTree().ForEach(AddDragHandles <T>); } } }
protected override OdinMenuTree BuildMenuTree() { var setting = GetOrCreateSetting(); OdinMenuTree tree = new OdinMenuTree(supportsMultiSelect: true) { { "Setting", setting }, }; var paths = setting.AssetPaths; for (int i = 0; i < paths.Count; i++) { if (paths[i].AssetPath != string.Empty) { tree.AddAssetAtPath(paths[i].Name, paths[i].AssetPath); } if (paths[i].FolderPath != string.Empty) { tree.AddAllAssetsAtPath(paths[i].Name, paths[i].FolderPath, typeof(ScriptableObject), true); } } tree.EnumerateTree().AddIcons <IGetIcon>(x => x.GetIcon()); tree.DefaultMenuStyle.IconSize = 34f; tree.DefaultMenuStyle.IconPadding = 0f; tree.DefaultMenuStyle.SetIconOffset(-5f); tree.DefaultMenuStyle.SetOffset(5f); tree.Config.DrawSearchToolbar = true; return(tree); }
protected override OdinMenuTree BuildMenuTree() { var tree = new OdinMenuTree(); tree.DefaultMenuStyle = OdinMenuStyle.TreeViewStyle; // tree.Add("Menu Style", tree.DefaultMenuStyle); tree.Selection.SupportsMultiSelect = false; tree.Add("AB管理", new ABManager()); tree.Add("DLL管理", new DLLManager()); tree.Add("Manifest", AssetDatabase.LoadAssetAtPath <UnityEngine.Object>("Assets/Manifest.asset")); tree.Add("配置", Resources.Load <LWGlobalConfig>("LWGlobalConfig")); tree.Add("其他", new OtherToolManger()); tree.AddAllAssetsAtPath("序列化文件", "Assets/LWFramework/Editor", typeof(ScriptableObject), true, true); //var allAssets = AssetDatabase.GetAllAssetPaths() // .Where(x => x.StartsWith("Assets/")) // .OrderBy(x => x); //foreach (var path in allAssets) //{ // tree.AddAssetAtPath(path.Substring("Assets/".Length), path); //} tree.EnumerateTree().AddThumbnailIcons(); return(tree); }
protected override OdinMenuTree BuildMenuTree() { AddTreeElement(); var tree = new OdinMenuTree(); tree.DefaultMenuStyle.IconSize = 15; tree.Config.DrawSearchToolbar = true; tree.Config.SearchToolbarHeight = 30; tree.DefaultMenuStyle.Height = 25; foreach (var i in dic) { if (i.Value == null || i.Value.Count == 0) { tree.Add(i.Key, null); } else { foreach (var x in i.Value) { var key = i.Key + "/" + x._name; tree.Add(key, x, x.icon); } } } tree.EnumerateTree().Where(x => x.Value as Element).ForEach(AddDragHandles); tree.SortMenuItemsByName(); return(tree); }
protected override OdinMenuTree BuildMenuTree() { var tree = new OdinMenuTree(); tree.Selection.SupportsMultiSelect = false; tree.Add("Settings", GeneralDrawerConfig.Instance); tree.Add("Utilities", new TextureUtilityEditor()); tree.Add("Utilities/MyStruct", new MyStruct()); tree.AddAllAssetsAtPath("Odin Settings", "", typeof(ScriptableObject), true, true); return(tree); var tree2 = new OdinMenuTree(); tree2.DefaultMenuStyle = OdinMenuStyle.TreeViewStyle; tree2.Add("Menu Style", tree2.DefaultMenuStyle); var allAssets = AssetDatabase.GetAllAssetPaths() .Where(x => x.StartsWith("Assets/")) .OrderBy(x => x); foreach (var path in allAssets) { tree2.AddAssetAtPath(path.Substring("Assets/".Length), path); } tree2.EnumerateTree().AddThumbnailIcons(); return(tree2); }
protected override OdinMenuTree BuildMenuTree() { var tree = new OdinMenuTree(true); tree.DefaultMenuStyle.IconSize = 28.00f; tree.Config.DrawSearchToolbar = true; // CharacterOverview.Instance.UpdateCharacterOverview(); lst.Add(new OdinCharacterWrapper() { Name = "32" }); //左边框名称+右边的布局 tree.Add("左边", lst); tree.EnumerateTree().AddIcons <Character>(x => x.Icon); tree.EnumerateTree().AddIcons <Item>(x => x.Icon); return(tree); }
protected override OdinMenuTree BuildMenuTree() { var tree = new OdinMenuTree(false); tree.DefaultMenuStyle.SetHeight(50); tree.DefaultMenuStyle.SetIconSize(40); tree.Config.DrawSearchToolbar = true; tree.AddAssetAtPath("UnitTypes", GV.UnitSoPath + GV.UnitTypesAsset, typeof(UnitTypes)).AddIcon(EditorIcons.Globe); tree.Add("Player", null, EditorIcons.Flag); tree.Add("Player/PlayerUnits", null, TextureManager.Instance.GetFirstLike("Man_1_nobg")); tree.AddAllAssetsAtPath("Player/PlayerUnits", GV.UnitSoPath, typeof(PlayerUnitData), true, true); tree.EnumerateTree().AddIcons <PlayerUnitData>(x => x.icon); tree.AddAssetAtPath("Player/Inventory", GV.InventorySoPath + GV.EditorInventoryAsset).AddIcon(TextureManager.Instance.GetFirstLike("bag")); tree.Add("EnemyUnits", null, EditorIcons.Crosshair); tree.AddAllAssetsAtPath("EnemyUnits", GV.UnitSoPath, typeof(EnemyUnitData), true, true); tree.EnumerateTree().AddIcons <EnemyUnitData>(x => x.icon); tree.Add("Abilities", null, EditorIcons.GridImageTextList); tree.AddAllAssetsAtPath("Abilities", GV.AbilitiesSoPath, typeof(Ability), true).ForEach(AddDragHandles); tree.EnumerateTree().Where(x => x.Value as Item).ForEach(AddDragHandles); tree.EnumerateTree().AddIcons <Ability>(x => x.icon); tree.Add("Items", null, EditorIcons.ShoppingBasket); tree.Add("Items/Weapons", null, TextureManager.Instance.GetFirstLike("sword_nobg")); tree.AddAllAssetsAtPath("Items/Weapons", GV.ItemsSoPath, typeof(Weapon), true).ForEach(AddDragHandles); tree.EnumerateTree().Where(x => x.Value as Item).ForEach(AddDragHandles); tree.EnumerateTree().AddIcons <Item>(x => x.icon); tree.Add("Items/Armor", null, TextureManager.Instance.GetFirstLike("armor")); tree.AddAllAssetsAtPath("Items/Armor", GV.ItemsSoPath, typeof(Armor), true).ForEach(AddDragHandles); tree.EnumerateTree().Where(x => x.Value as Item).ForEach(AddDragHandles); tree.EnumerateTree().AddIcons <Item>(x => x.icon); tree.Add("Items/Consumables", null, TextureManager.Instance.GetFirstLike("potion_nobg")); tree.AddAllAssetsAtPath("Items/Consumables", GV.ItemsSoPath, typeof(Consumable), true).ForEach(AddDragHandles); tree.EnumerateTree().Where(x => x.Value as Item).ForEach(AddDragHandles); tree.EnumerateTree().AddIcons <Item>(x => x.icon); return(tree); }
protected override OdinMenuTree BuildMenuTree() { _tree = new OdinMenuTree(true); _tree.DefaultMenuStyle.IconSize = 28.00f; _tree.Config.DrawSearchToolbar = true; SkillConfig.Reload(); if (SkillConfig.Count > 0) { foreach (var item in SkillConfig.Datas) { // Adds the character overview table. _tree.Add(item.Value.skill_name, item.Value); _tree.EnumerateTree().AddIcons <SkillConfig>(x => x.GetSprite()); _tree.EnumerateTree().ForEach(AddDragHandles); } } return(_tree); }
protected override OdinMenuTree BuildMenuTree() { CardLibrarySaveData SaveData = Resources.Load <CardLibrarySaveData>("SaveData"); SaveData.Init(); var tree = new OdinMenuTree(true); tree.DefaultMenuStyle.Height = 60; tree.DefaultMenuStyle.IconSize = 48.00f; tree.Config.DrawSearchToolbar = true; //CardModelInfo instance = new CardModelInfo(); //tree.Add("卡组编辑", instance); tree.Add("卡牌列表", SaveData); if (SaveData.SingleCardLibrarieDatas != null) { foreach (var SingleLibrary in SaveData.SingleCardLibrarieDatas) { tree.Add($@"卡牌列表/{SingleLibrary.sectarian}", SingleLibrary); if (SingleLibrary.CardModelInfos != null) { foreach (var CardModel in SingleLibrary.CardModelInfos) { //Debug.Log($@"卡牌列表/{SingleLibrary.sectarian}/{CardModel.CardName}"); tree.Add($@"卡牌列表/{SingleLibrary.sectarian}/{CardModel.CardName}", CardModel); } } } } //for (int i = 0; i < SaveData.SingleCardLibrarieDatas.Count; i++) //{ // tree.Add($@"卡牌列表/{i}", SaveData.SingleCardLibrarieDatas[i]); // for (int i = 0; i < SaveData.SingleCardLibrarieDatas[i].CardModelInfos.Count; i++) // { // tree.Add($@"卡牌列表/{i}", SaveData.SingleCardLibrarieDatas[i]); // } //} tree.EnumerateTree().AddIcons <CardLibrarySaveData>(x => x.Icon); tree.EnumerateTree().AddIcons <CardLibrarySaveData.SingleCardLibrary>(x => x.Icon); tree.EnumerateTree().AddIcons <CardLibrarySaveData.SingleCardLibrary.CardModelInfo>(x => x.Icon); return(tree); }
protected override OdinMenuTree BuildMenuTree() { _dbList.Clear(); var tree = new OdinMenuTree(true); tree.DefaultMenuStyle.IconSize = 28.00f; tree.Config.DrawSearchToolbar = true; var ids = AssetDatabase.FindAssets("t:ScriptableDatabase"); for (int i = 0; i < ids.Length; i++) { var obj = AssetDatabase.LoadAssetAtPath <ScriptableDatabase>(AssetDatabase.GUIDToAssetPath(ids[i])); if (obj != null) { _dbList.Add(obj); } } RefreshDbs(); for (int i = 0; i < _dbList.Count; i++) { var db = _dbList[i]; var dbTable = db.GetEditorWindow(); if (dbTable != null) { tree.Add(db.name, dbTable); } else { tree.AddObjectAtPath(db.name, db, false); } var dbObjs = db.AllObjects; if (dbObjs == null) { continue; } foreach (var dbObj in dbObjs) { if (dbObj == null) { continue; } tree.AddAssetAtPath(db.name + "/" + dbObj.name, AssetDatabase.GetAssetPath(dbObj)); } } tree.EnumerateTree().AddIcons <ICustomPreview>(m => m.GetPreviewTexture()); return(tree); }
protected override OdinMenuTree BuildMenuTree() { var tree = new OdinMenuTree(true); tree.DefaultMenuStyle = CaomaoGUIStyle.DefaultMenuStyle; tree.Config.DrawSearchToolbar = true; tree.AddObjectAtPath("本地化操作", this.operatorIns); tree.AddAllAssetsAtPath("本地化ScriptableObject文件", this.operatorIns.SBFolderPath, true, false); tree.AddAllAssetsAtPath("本地化Excel文件", this.operatorIns.ExcelFolderPath, true, false); tree.AddAssetAtPath("脚本常量模板", this.operatorIns.TemplateFilePath); tree.EnumerateTree().AddThumbnailIcons(); return(tree); }
protected override OdinMenuTree BuildMenuTree() { var tree = new OdinMenuTree(false); tree.DefaultMenuStyle.IconSize = 28.00f; tree.Config.DrawSearchToolbar = true; tree.Add("NPCS", null); tree.Add("NPCS/None", null); //If you decide to use the DialogueEditorSettings, you can use it as such, after you Create one //tree.AddAllAssetsAtPath("NPCS",DialogueEditorSettings.instance.NPCPath,typeof(NPCDialogue),true); try { //Try to avoid null ref exception tree.AddAllAssetsAtPath("NPCS", "", typeof(NPCDialogue), true); tree.EnumerateTree().AddIcons <NPCDialogue>(x => x.icon); } catch { } return(tree); }
protected override OdinMenuTree BuildMenuTree() { var tree = new OdinMenuTree(true); var customMenuStyle = new OdinMenuStyle { BorderPadding = 0f, AlignTriangleLeft = true, TriangleSize = 26f, TrianglePadding = 0f, Offset = 20f, Height = 43, IconPadding = 0f, BorderAlpha = 0.323f }; tree.DefaultMenuStyle = customMenuStyle; tree.Config.DrawSearchToolbar = true; // Adds the custom menu style to the tree, so that you can play around with it. // Once you are happy, you can press Copy C# Snippet copy its settings and paste it in code. // And remove the "Menu Style" menu item from the tree. tree.AddObjectAtPath("Menu Style", customMenuStyle); for (int i = 0; i < 5; i++) { var customObject = new SomeCustomClass() { Name = i.ToString() }; var customMenuItem = new MyCustomMenuItem(tree, customObject); tree.AddMenuItemAtPath("Custom Menu Items", customMenuItem); } tree.AddAllAssetsAtPath("Scriptable Objects in Plugins Tree", "Plugins", typeof(ScriptableObject), true, false); tree.AddAllAssetsAtPath("Scriptable Objects in Plugins Flat", "Plugins", typeof(ScriptableObject), true, true); tree.AddAllAssetsAtPath("Only Configs has Icons", "Plugins/Sirenix", true, false); tree.EnumerateTree() .AddThumbnailIcons() .SortMenuItemsByName(); return(tree); }
protected override OdinMenuTree BuildMenuTree() { var tree = new OdinMenuTree(true); tree.AddObjectAtPath("Game Settings", GameSettings.Instance); var patterns = Resources.LoadAll <Pattern> ("RythmPatterns"); foreach (var pattern in patterns) { tree.Add($"Patterns/{pattern.PatternName}", pattern); } tree.EnumerateTree() .AddThumbnailIcons() .SortMenuItemsByName(); return(tree); }
protected override OdinMenuTree BuildMenuTree() { var tree = new OdinMenuTree(); tree.DefaultMenuStyle = OdinMenuStyle.TreeViewStyle; tree.Add("Menu Style", tree.DefaultMenuStyle); var allAssets = AssetDatabase.GetAllAssetPaths() .Where(x => x.StartsWith("Assets/")) .OrderBy(x => x); foreach (var path in allAssets) { tree.AddAssetAtPath(path.Substring("Assets/".Length), path); } tree.EnumerateTree().AddThumbnailIcons(); return(tree); }
protected override OdinMenuTree BuildMenuTree() { var tree = new OdinMenuTree(true); tree.DefaultMenuStyle.IconSize = 28.00f; tree.Config.DrawSearchToolbar = true; tree.Add("Overview", new AllEquipment()); tree.Add("Loadouts", new Loadouts()); tree.AddAllAssetsAtPath("Frames", "Assets/Resources/Equipment/Frames/", typeof(Frame), true, true) .SortMenuItemsByName() .ForEach(this.AddDragHandles); tree.AddAllAssetsAtPath("Weapons/Main Weapons", "Assets/Resources/Equipment/Weapons/", typeof(MainWeapon), true, true) .SortMenuItemsByName() .ForEach(this.AddDragHandles); tree.AddAllAssetsAtPath("Weapons/Sub Weapons", "Assets/Resources/Equipment/Weapons/", typeof(SubWeapon), true) .SortMenuItemsByName() .ForEach(this.AddDragHandles); tree.AddAllAssetsAtPath("Mods", "Assets/Resources/Equipment/Mods/", typeof(Mod), true) .SortMenuItemsByName() .ForEach(this.AddDragHandles); // Add icons to characters and items. // tree.EnumerateTree().AddIcons<Character>(x => x.Icon); // tree.EnumerateTree().AddIcons<Item>(x => x.Icon); // Add drag handles to items, so they can be easily dragged into the inventory if characters etc... tree.EnumerateTree().Where(x => x.ObjectInstance as Equipment) .ForEach(AddDragHandles); return(tree); }
protected override OdinMenuTree BuildMenuTree() { var tree = new OdinMenuTree(true) { DefaultMenuStyle = { IconSize = 28.00f }, Config = { DrawSearchToolbar = true } }; if (SODatabaseSettings.Path == string.Empty) { inSettings = true; tree.AddMenuItemAtPath(new HashSet <OdinMenuItem>(), string.Empty, new OdinMenuItem(tree, "Settings", SODatabaseSettings.Instance)); return(tree); } AddAllAssetsAtPath(tree, SODatabaseSettings.Path, typeof(DataNode)); Texture folderIcon = (Texture2D)AssetDatabase.LoadAssetAtPath("Packages/com.nuclearband.sodatabase/Editor/folderIcon.png", typeof(Texture2D)); tree.EnumerateTree().AddIcons <FolderHolder>(x => folderIcon); tree.SortMenuItemsByName(); tree.Selection.SelectionChanged += SelectionChanged; return(tree); }
protected override void BuildSelectionTree(OdinMenuTree tree) { // Setup tree.Config.DrawSearchToolbar = true; tree.Config.UseCachedExpandedStates = false; tree.Selection.SupportsMultiSelect = false; tree.Config.DefaultMenuStyle.IndentAmount += 13; this.staticMethodMenuItemStyle = tree.Config.DefaultMenuStyle.Clone(); this.staticMethodMenuItemStyle.IconPadding = 0; this.staticMethodMenuItemStyle.Offset -= this.staticMethodMenuItemStyle.IconSize; // Add methods if (this.gameObjectTarget) { this.AddMethods(tree, typeof(GameObject), this.gameObjectTarget, Flags.InstancePublic); this.AddMethods(tree, typeof(GameObject), null, Flags.StaticAnyVisibility); var components = this.gameObjectTarget.GetComponents(typeof(Component)); foreach (var c in components) { this.AddMethods(tree, c.GetType(), c, Flags.InstancePublic); this.AddMethods(tree, c.GetType(), null, Flags.StaticAnyVisibility); } } else if (this.target) { this.AddMethods(tree, this.target.GetType(), this.target, Flags.InstancePublic); this.AddMethods(tree, this.target.GetType(), null, Flags.StaticAnyVisibility); } else { // If there is no target provided then just show static methods from UnityEngine.Object? this.AddMethods(tree, typeof(UnityEngine.Object), null, Flags.StaticPublic); // Include others? // this.AddMethods(tree, typeof(UnityEngine.SceneManagement.SceneManager), null, Flags.StaticPublic); } // Add icons foreach (var item in tree.EnumerateTree()) { if (item.Value is DelegateInfo) { continue; } if (item.ChildMenuItems.Count == 0) { continue; } var child = item.ChildMenuItems[0]; if (child.Value is DelegateInfo) { var del = (DelegateInfo)child.Value; item.IconGetter = () => GUIHelper.GetAssetThumbnail(null, del.Method.DeclaringType, true); } } // Expand first, if there is only one root menu item. if (tree.MenuItems.Count == 1) { tree.MenuItems[0].Toggled = true; } }