UnityEditor.AddShaderVariantWindow.Draw C# (CSharp) Method

Draw() private method

private Draw ( Rect windowRect ) : void
windowRect UnityEngine.Rect
return void
        private void Draw(Rect windowRect)
        {
            Rect rect = new Rect(2f, 2f, windowRect.width - 4f, 16f);
            this.DrawSectionHeader(ref rect, "Pick shader keywords to narrow down variant list:", false);
            this.DrawKeywordsList(ref rect, this.m_AvailableKeywords, true);
            this.DrawSectionHeader(ref rect, "Selected keywords:", true);
            this.DrawKeywordsList(ref rect, this.m_SelectedKeywords, false);
            this.DrawSectionHeader(ref rect, "Shader variants with these keywords (click to select):", true);
            if (this.m_FilteredVariants.Count > 0)
            {
                int b = (int) (this.CalcVerticalSpaceForVariants() / 16f);
                for (int i = 0; i < Mathf.Min(this.m_FilteredVariants.Count, b); i++)
                {
                    int index = this.m_FilteredVariants[i];
                    PassType type = (PassType) this.m_Data.types[index];
                    bool flag = this.m_SelectedVariants.Contains(index);
                    string text = type.ToString() + " " + string.Join(" ", this.m_Data.keywords[index]).ToLowerInvariant();
                    bool flag2 = GUI.Toggle(rect, flag, text, Styles.sMenuItem);
                    rect.y += rect.height;
                    if (flag2 && !flag)
                    {
                        this.m_SelectedVariants.Add(index);
                    }
                    else if (!flag2 && flag)
                    {
                        this.m_SelectedVariants.Remove(index);
                    }
                }
                if (this.m_FilteredVariants.Count > b)
                {
                    GUI.Label(rect, string.Format("[{0} more variants skipped]", this.m_FilteredVariants.Count - b), EditorStyles.miniLabel);
                    rect.y += rect.height;
                }
            }
            else
            {
                GUI.Label(rect, "No variants with these keywords");
                rect.y += rect.height;
            }
            rect.y = ((windowRect.height - 2f) - 6f) - 16f;
            rect.height = 16f;
            using (new EditorGUI.DisabledScope(this.m_SelectedVariants.Count == 0))
            {
                if (GUI.Button(rect, string.Format("Add {0} selected variants", this.m_SelectedVariants.Count)))
                {
                    Undo.RecordObject(this.m_Data.collection, "Add variant");
                    for (int j = 0; j < this.m_SelectedVariants.Count; j++)
                    {
                        int num5 = this.m_SelectedVariants[j];
                        ShaderVariantCollection.ShaderVariant variant = new ShaderVariantCollection.ShaderVariant(this.m_Data.shader, (PassType) this.m_Data.types[num5], this.m_Data.keywords[num5]);
                        this.m_Data.collection.Add(variant);
                    }
                    base.Close();
                    GUIUtility.ExitGUI();
                }
            }
        }