public TrickOverViewPreview(AExample_Base aExampleBase)
 {
     m_Example = aExampleBase;
     this.m_DrawCallbaclAction = m_Example.DrawUI;
     try
     {
         this.highlightedCode = SyntaxHighlighter.Parse(m_Example.GetTrickOverViewInfo().Code);
     }
     catch (Exception exception)
     {
         Debug.LogError($"条目{aExampleBase.GetTrickOverViewInfo().Name}的代码块高亮失败,原因是:{exception}");
         this.highlightedCode = m_Example.GetTrickOverViewInfo().Code;
         this.showRaw         = true;
     }
 }
        public TrickOverViewInfo(string name, string description, string category, string code, string codePath,
                                 Type type, string picPath = "", string videoPath = "")
        {
            this.Name        = name;
            this.Description = description;
            this.Category    = category;

            this.Code     = code;
            this.CodePath = codePath;

            this.m_Example = AllTrickOverViewUtilities.GetExampleByType(type);

            this.PicPath   = picPath;
            this.VideoPath = videoPath;
        }
        public TrickOverViewItem(AExample_Base aExampleBase)
        {
            this.DrawCodeExample = true;
            if (aExampleBase == null)
            {
                Debug.LogError("AExampleBase数据为空,请检查类型");
                return;
            }
            m_Example = aExampleBase;

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

            this.tabGroup.RegisterTab(m_Example.GetTrickOverViewInfo().Name);
        }
Esempio n. 4
0
        static AllTrickOverViewUtilities()
        {
            Assembly assembly = Assembly.GetAssembly(typeof(AllTrickOverViewUtilities));

            Type[] types = assembly.GetTypes();

            foreach (var type in types)
            {
                object[] objects = type.GetCustomAttributes(typeof(TrickOverViewAttribute), true);
                if (objects.Length == 0 || type.IsAbstract)
                {
                    continue;
                }

                AExample_Base temp = Activator.CreateInstance(type) as AExample_Base;
                AllTrickOverViewExamples.Add(type, temp);
                AllTrickOverViewItems.Add(type, new TrickOverViewItem(temp));
            }
        }
Esempio n. 5
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);
        }