예제 #1
0
 public void CheckRecommendation()
 {
     if (FailTest() && !EditorPrefs.HasKey(IgnoreKey))
     {
         EditorWindowUtils.HorizontalLine();
         EditorWindowUtils.BeginHorizontal();
         EditorWindowUtils.Label(Title, ToolTip, true);
         EditorWindowUtils.FlexibleSpace();
         EditorWindowUtils.Label("(?)  ", ToolTip, false);
         EditorWindowUtils.EndHorizontal();
         EditorWindowUtils.Label(string.Format(currentValue, UnitySetting), ToolTip, false);
         EditorWindowUtils.BeginHorizontal();
         if (ActionToPass != null) //button solution
         {
             EditorWindowUtils.Button(ActionToPass, string.Format(useRecommended, UnitySettingPass));
         }
         else //manual solution
         {
             EditorWindowUtils.Label(string.Format(changeToRecommended, UnitySettingPass), ToolTip, false);
         }
         EditorWindowUtils.FlexibleSpace();
         EditorWindowUtils.Button(() => { EditorPrefs.SetBool(IgnoreKey, true); IsIgnored = true; }, "Ignore");
         EditorWindowUtils.EndHorizontal();
     }
     EditorWindowUtils.Space(5);
 }
예제 #2
0
        public void OnGUI()
        {
            if (window == null)
            {
                Init();
            }
            EditorWindowUtils.TitleTexture(_bannerImage);

            if (issueCount == 0)
            {
                EditorWindowUtils.Space(2);
                var style = new GUIStyle(GUI.skin.label)
                {
                    alignment = TextAnchor.MiddleCenter, fontStyle = FontStyle.Bold
                };
                EditorWindowUtils.Label("Fantastic! You're good to go!", style);
            }
            else
            {
                EditorWindowUtils.HelpBox("Recommended Unity Editor settings for LeiaLoft SDK:", MessageType.Warning);
            }

            scrollPosition = EditorWindowUtils.BeginScrollView(scrollPosition);
            EditorWindowUtils.Space(5);

            if (recommendations != null)
            {
                for (int i = 0; i < recommendations.Count; i++)
                {
                    recommendations[i].CheckRecommendation();
                }
            }
            EditorWindowUtils.EndScrollView();
            EditorWindowUtils.BeginHorizontal();

            UndoableInputFieldUtils.BoolFieldWithTooltip(() => { forceShow = EditorPrefs.GetBool(editor_Recommendation_ForcePopUp, false); return(forceShow); }, b => { forceShow = b; EditorPrefs.SetBool(editor_Recommendation_ForcePopUp, b); }, "  Automatically Pop-up", "Display this window when LeiaLoft detects unrecommended Unity Settings. Alternatively, this widow can be opened from LeiaLoft-> Recommended Unity Settings", window);

            if (ignoreCount > 0)
            {
                EditorWindowUtils.Button(() =>
                {
                    for (int i = 0; i < recommendations.Count; i++)
                    {
                        if (EditorPrefs.HasKey(recommendations[i].IgnoreKey))
                        {
                            EditorPrefs.DeleteKey(recommendations[i].IgnoreKey);
                            recommendations[i].IsIgnored = false;
                        }
                    }
                }, string.Format("Reset Ignores ({0})", ignoreCount));
            }
            EditorWindowUtils.EndHorizontal();
            EditorWindowUtils.Space(2);
        }