@@ -29,23 +29,24 @@ private interface IPropSetting
2929 void DeleteIgnore ( ) ;
3030 }
3131
32- private class PropSetting < T > : IPropSetting where T : struct
32+ private class PropSetting < T > : IPropSetting
3333 {
3434 private const string fmtTitle = "{0} (current = {1})" ;
35- private const string fmtRecommendBtn = "Use recommended (current = {0})" ;
36- private const string fmtRecommendBtnWithPosefix = "Use recommended (current = {0}) - {1}" ;
37-
38- private string m_ignoreKey ;
39- private string m_settingTitle ;
35+ private const string fmtRecommendBtn = "Use recommended ({0})" ;
36+ private const string fmtRecommendBtnWithPosefix = "Use recommended ({0}) - {1}" ;
4037
41- public string settingTitle { get { return m_settingTitle ; } set { m_settingTitle = value ; m_ignoreKey = editorPrefsPrefix + value . Replace ( " " , "" ) ; } }
38+ private string m_settingTitle ;
39+ private string m_settingTrimedTitle ;
40+ private string ignoreKey { get { return editorPrefsPrefix + m_settingTrimedTitle ; } }
41+
42+ public string settingTitle { get { return m_settingTitle ; } set { m_settingTitle = value ; m_settingTrimedTitle = value . Replace ( " " , "" ) ; } }
4243 public string recommendBtnPostfix ;
4344 public string toolTip = string . Empty ;
4445 public Func < T > currentValueFunc = null ;
4546 public Action < T > setValueFunc = null ;
4647 public T recommendedValue = default ( T ) ;
4748
48- public bool IsIgnored ( ) { return EditorPrefs . HasKey ( m_ignoreKey ) ; }
49+ public bool IsIgnored ( ) { return EditorPrefs . HasKey ( ignoreKey ) ; }
4950
5051 public bool IsUsingRecommendedValue ( ) { return EqualityComparer < T > . Default . Equals ( currentValueFunc ( ) , recommendedValue ) ; }
5152
@@ -87,12 +88,12 @@ public void AcceptRecommendValue()
8788
8889 public void DoIgnore ( )
8990 {
90- EditorPrefs . SetBool ( m_ignoreKey , true ) ;
91+ EditorPrefs . SetBool ( ignoreKey , true ) ;
9192 }
9293
9394 public void DeleteIgnore ( )
9495 {
95- EditorPrefs . DeleteKey ( m_ignoreKey ) ;
96+ EditorPrefs . DeleteKey ( ignoreKey ) ;
9697 }
9798 }
9899
@@ -173,7 +174,7 @@ public void DeleteIgnore()
173174
174175 new PropSetting < bool > ( )
175176 {
176- settingTitle = "Default is Fullscreen" ,
177+ settingTitle = "Default Is Fullscreen" ,
177178 currentValueFunc = ( ) => PlayerSettings . defaultIsFullScreen ,
178179 setValueFunc = ( v ) => PlayerSettings . defaultIsFullScreen = v ,
179180 recommendedValue = false ,
@@ -475,7 +476,7 @@ public void OnGUI()
475476 if ( drawCount == 0 )
476477 {
477478 EditorGUILayout . HelpBox ( "Recommended project settings:" , MessageType . Warning ) ;
478-
479+
479480 settingScrollPosition = GUILayout . BeginScrollView ( settingScrollPosition , GUILayout . ExpandHeight ( true ) ) ;
480481 }
481482
@@ -501,16 +502,11 @@ public void OnGUI()
501502 if ( GUILayout . Button ( "Accept All(" + drawCount + ")" ) )
502503 {
503504 foreach ( var setting in s_settings ) { if ( ! setting . IsIgnored ( ) ) { setting . AcceptRecommendValue ( ) ; } }
504-
505- EditorUtility . DisplayDialog ( "Accept All" , "You made the right choice!" , "Ok" ) ;
506505 }
507506
508507 if ( GUILayout . Button ( "Ignore All(" + drawCount + ")" ) )
509508 {
510- if ( EditorUtility . DisplayDialog ( "Ignore All" , "Are you sure?" , "Yes, Ignore All Settings" , "Cancel" ) )
511- {
512- foreach ( var setting in s_settings ) { if ( ! setting . IsIgnored ( ) && ! setting . IsUsingRecommendedValue ( ) ) { setting . DoIgnore ( ) ; } }
513- }
509+ foreach ( var setting in s_settings ) { if ( ! setting . IsIgnored ( ) && ! setting . IsUsingRecommendedValue ( ) ) { setting . DoIgnore ( ) ; } }
514510 }
515511 }
516512 GUILayout . EndHorizontal ( ) ;
0 commit comments