示例#1
0
        public override void DoGUI(IGUIDrawer drawer)
        {
            drawer.ImportantLabel("Keywords:");
            drawer.BeginToolbarHorizontal();
            m_AutoRefreshKeyword.Set(drawer.ToolbarToggle(m_AutoRefreshKeyword, "自动刷新"));
            if (!m_AutoRefreshKeyword &&
                drawer.ToolbarButton(false, "刷新"))
            {
                RefreshShaderKeywords();
            }
            m_OnlyDisplayEnabledKeyword.Set(drawer.ToolbarToggle(m_OnlyDisplayEnabledKeyword, "只显示已启用"));
            if (drawer.ToolbarButton(false, "Log"))
            {
                LogShaderKeywords();
            }
            drawer.EndHorizontal();

            drawer.BeginToolbarHorizontal();
            float rowWidth = 0;
            bool  dirty    = false;

            for (int iKeyword = 0; iKeyword < m_GlobalKeywords.Count; iKeyword++)
            {
                KeywordItem iterKeyword = m_GlobalKeywords[iKeyword];
                if (m_OnlyDisplayEnabledKeyword &&
                    !iterKeyword.Enable)
                {
                    continue;
                }

                if (drawer.ToolbarButton(iterKeyword.Enable, iterKeyword.Content.text))
                {
                    dirty = true;
                    if (iterKeyword.Enable)
                    {
                        Shader.DisableKeyword(iterKeyword.KeywordName);
                    }
                    else
                    {
                        Shader.EnableKeyword(iterKeyword.KeywordName);
                    }
                }

                drawer.CalcMinMaxWidth_Button(iterKeyword.Content, out float minWidth, out float maxWidth);
                rowWidth += maxWidth;
                if (rowWidth >= drawer.GetPanelWidth() * 0.64f)
                {
                    rowWidth = 0;
                    drawer.EndHorizontal();
                    drawer.BeginToolbarHorizontal();
                }
            }
            drawer.EndHorizontal();

            if (dirty ||
                m_AutoRefreshKeyword)
            {
                RefreshShaderKeywords();
            }
        }
    private void _ToErrorLogs(AdsorptionWindowCollectLostMethods.Error[] errors)
    {
        var stage = new AdsorptionErrorLog(errors);

        _Drawer          = stage;
        stage.DoneEvent += _ToInput;
        _Machine.Push(stage);
    }
    private void _ToCollectLostMethods()
    {
        var stage = new AdsorptionWindowCollectLostMethods();

        _Drawer          = stage;
        stage.DoneEvent += _ToErrorLogs;
        _Machine.Push(stage);
    }
    private void _ToWatingCompile()
    {
        var stage = new AdsorptionWindowWaitCompile();

        _Drawer          = stage;
        stage.DoneEvent += _ToCollectLostMethods;
        _Machine.Push(stage);
    }
    private void _ToInput()
    {
        var stage = new AdsorptionWindowCreate();

        _Drawer          = stage;
        stage.DoneEvent += _ToWatingCompile;
        _Machine.Push(stage);
    }
    public AdsorptionWindow()
    {
        _Machine = new StageMachine();



        _Drawer = this;
    }
        private void DoGUI_DebugPanel(IGUIDrawer drawer)
        {
            drawer.BeginToolbarHorizontal();
            s_UpdateRepaint = drawer.ToolbarToggle(s_UpdateRepaint, "每帧更新");
            m_EditStyle.Set(drawer.ToolbarToggle(m_EditStyle, "编辑主题"));
            drawer.EndHorizontal();

            if (m_EditStyle)
            {
                drawer.ImportantLabel("编辑主题:");
                ((EditorGUIDrawer)drawer).DoGUI();
                drawer.Space();
            }
        }
 public abstract void DoGUI(IGUIDrawer drawer);