public TrickOverViewPreview(TrickOverViewInfo exampleInfo)
 {
     this.ExampleInfo          = exampleInfo;
     this.m_DrawCallbaclAction = (this.ExampleInfo.PreviewObject as AExample_Base).DrawUI;
     try
     {
         this.highlightedCode = SyntaxHighlighter.Parse(this.ExampleInfo.Code);
     }
     catch (Exception exception)
     {
         Debug.LogException(exception);
         this.highlightedCode = this.ExampleInfo.Code;
         this.showRaw         = true;
     }
 }
Beispiel #2
0
        public static void BuildMenuTree(OdinMenuTree tree)
        {
            foreach (var allTrickOverViewInfo in AllTrickOverViewExamples)
            {
                TrickOverViewInfo trickOverViewInfo = (allTrickOverViewInfo.Value).GetTrickOverViewInfo();
                OdinMenuItem      menuItem          =
                    new OdinMenuItem(tree, trickOverViewInfo.Name, allTrickOverViewInfo.Key)
                {
                    Value        = allTrickOverViewInfo.Key,
                    SearchString = trickOverViewInfo.Name + trickOverViewInfo.Description
                };
                tree.AddMenuItemAtPath(trickOverViewInfo.Category, menuItem);
            }

            tree.MenuItems.Sort(AllTrickOverViewUtilities.CategorySorter);
            tree.MarkDirty();
        }
Beispiel #3
0
        public TrickOverViewItem(Type type)
        {
            this.DrawCodeExample = true;
            AExample_Base aExampleBase =
                AllTrickOverViewUtilities.GetExampleByType(type);

            if (aExampleBase == null)
            {
                return;
            }

            TrickOverViewInfo trickOverViewInfo = aExampleBase.GetTrickOverViewInfo();

            this.Name        = trickOverViewInfo.Name;
            this.Description = trickOverViewInfo.Description;

            this.m_TrickOverViewPreviewDrawer = new TrickOverViewPreview(trickOverViewInfo);
            this.tabGroup = new GUITabGroup
            {
                ToolbarHeight = 30f
            };

            this.tabGroup.RegisterTab(trickOverViewInfo.Name);
        }