Ejemplo n.º 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 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();
            }
        }