Esempio n. 1
0
        protected override OdinMenuTree BuildMenuTree()
        {
            var tree = new OdinMenuTree(true);

            UIWindowMenu.LoadInstanceIfAssetExists();
            tree.AddObjectAtPath("UIManager工具", m_UIManagerMenu);//.AddThumbnailIcons();

            tree.AddObjectAtPath("UIWindow工具", UIWindowMenu.Instance);
            return(tree);
        }
Esempio n. 2
0
    protected override OdinMenuTree BuildMenuTree()
    {
        var tree = new OdinMenuTree();

        tree.DefaultMenuStyle         = CaomaoGUIStyle.DefaultMenuStyle;
        tree.Config.DrawSearchToolbar = true;
        tree.AddObjectAtPath("配置文件转换配置文件", this.m_dataToDataOperator);
        tree.AddObjectAtPath("配置文件转Class", this.m_dataToClassOperator);
        return(tree);
    }
    private void AddMethods(OdinMenuTree tree, Type type, UnityEngine.Object target, BindingFlags flags)
    {
        var methods = type.GetBaseClasses(true).SelectMany(x => x.GetMethods(flags));

        foreach (var mi in methods)
        {
            if (!ShouldIncludeMethod(mi))
            {
                continue;
            }

            var path = mi.DeclaringType.GetNiceName() + "/" + GetNiceShortMethodName(mi);

            if (this.seenMethods.Add(path))
            {
                var info = new DelegateInfo()
                {
                    Target = target, Method = mi
                };
                var menuItem = tree.AddObjectAtPath(path, info).Last();
                menuItem.SearchString = path;

                if (mi.IsStatic)
                {
                    menuItem.Style = this.staticMethodMenuItemStyle;
                    menuItem.Icon  = EditorIcons.StarPointer.Active;
                }
            }
        }
    }
Esempio n. 4
0
        protected override OdinMenuTree BuildMenuTree()
        {
            var tree = new OdinMenuTree(true);

            AssetPackageMenu.LoadInstanceIfAssetExists();
            tree.AddObjectAtPath("资源工具", AssetPackageMenu.Instance);
            return(tree);
        }
        protected override OdinMenuTree BuildMenuTree()
        {
            var tree = new OdinMenuTree(true);

            var customMenuStyle = new OdinMenuStyle
            {
                BorderPadding     = 0f,
                AlignTriangleLeft = true,
                TriangleSize      = 16f,
                TrianglePadding   = 0f,
                Offset            = 20f,
                Height            = 23,
                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", tree.DefaultMenuStyle)
            .AddThumbnailIcons();

            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)
            .AddThumbnailIcons()
            .SortMenuItemsByName();

            tree.AddAllAssetsAtPath("Scriptable Objects in Plugins Flat", "Plugins", typeof(ScriptableObject), true, true)
            .AddThumbnailIcons(true)
            .SortMenuItemsByName();

            tree.AddAllAssetsAtPath("Only Configs has Icons", "Plugins/Sirenix", true, false)
            .Where(x => x.ObjectInstance as ScriptableObject)
            .AddThumbnailIcons();

            return(tree);
        }
Esempio n. 6
0
        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);
        }
Esempio n. 7
0
        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);
        }
Esempio n. 8
0
        public void Setup(OdinMenuTree tree)
        {
            var assets = AssetUtilities.GetAllAssetsOfType <ScriptableObject>();

            foreach (var asset in assets)
            {
                var type = asset.GetType();

                // TODO: Remove namespace from path
                if (type.GetCustomAttribute <ShowInMenuAttribute>() != null)
                {
                    tree.AddObjectAtPath($"{Path}{type}/{asset.name}", asset);
                }
            }
        }
Esempio n. 9
0
        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);
        }
Esempio n. 10
0
 protected override void AddTree(OdinMenuTree tree)
 {
     tree.AddObjectAtPath("Unity 特性", null, false, MyEnumColor.Yellow);
     AddNew <MyBuJu>(tree, "自定义布局");
     AddNew <MyBuJu2>(tree, "自定义布局2");
     AddNew <TextTuiJin>(tree, "前文字推进");
     AddNew <MyNoNeed>(tree, "不需要变量也能显示");
     AddNew <MyDoList>(tree, "集合样式");
     AddNew <MyDoBtn>(tree, "按钮");
     AddNew <MyEnumEx>(tree, "枚举");
     AddNew <MyDoColor2>(tree, "颜色", MyEnumColor.Green);
     AddNew <MyDoShow>(tree, "显示 or 隐藏");
     AddNew <MyDoRead>(tree, "可改 or 不可改");
     AddNew <MyInFloat>(tree, "基础类型", "int、float");
     AddNew <MyDoGameObject>(tree, "基础类型", "GameObject");
     AddNew <MyDoColor>(tree, "特殊", "颜色取色");
     AddNew <MyDoProgress>(tree, "特殊", "水平的彩色条");
     AddNew <MyDoPath>(tree, "特殊", "取得文件或者文件夹路径");
     AddNew <MyDoBiaoGe>(tree, "特殊", "表格(不能实现)");
 }
Esempio n. 11
0
        void BuildSaveDataTree <T>(OdinMenuTree tree, string typeName)
        {
            var guids = AssetDatabase.FindAssets("t:" + typeName, new[] { "Assets/Data" });

            foreach (var guid in guids)
            {
                var assetPath = AssetDatabase.GUIDToAssetPath(guid);
                var asset     = AssetDatabase.LoadAssetAtPath(assetPath, typeof(ValueAsset <T>)) as ValueAsset <T>;
                if (!asset.useSaveFile)
                {
                    continue;
                }

                // remove 'assets/data/'
                string trimmedPath = assetPath.Substring(12);

                // remove '.asset'
                int length = trimmedPath.Length - 6;
                trimmedPath = trimmedPath.Substring(0, length);
                tree.AddObjectAtPath("Save Data/" + trimmedPath, asset).AddThumbnailIcons();
            }
        }
Esempio n. 12
0
 /// <summary>
 /// 单 Class 单个添加
 /// </summary>
 /// <typeparam name="T">那个类</typeparam>
 /// <param name="tree">树</param>
 /// <param name="subString">菜单项名</param>
 /// <param name="color">字体颜色</param>
 protected void AddNew <R>(OdinMenuTree tree, string subString, MyEnumColor color = MyEnumColor.Blue)
     where R : new()
 {
     tree.AddObjectAtPath(subString, MyType.NewTypeClass <R>(), false, color);
 }