コード例 #1
0
        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);
        }
コード例 #2
0
        private static void OpenWindow()
        {
            CardMenu window = GetWindow <CardMenu>();

            window.position = GUIHelper.GetEditorWindowRect().AlignCenter(700, 700);
        }