@@ -30,6 +30,13 @@ public class AdSettingsEditor : Editor
3030 private SerializedProperty _enableGDPRTestMode ;
3131 private SerializedProperty _admobDevicesTest ;
3232
33+ private SerializedProperty _androidAppKey ;
34+ private SerializedProperty _iOSAppKey ;
35+ private SerializedProperty _useTestAppKey ;
36+ private SerializedProperty _ironSourceBannerAdUnit ;
37+ private SerializedProperty _ironSourceInterstitialAdUnit ;
38+ private SerializedProperty _ironSourceRewardAdUnit ;
39+
3340 void Initialize ( )
3441 {
3542 _adSettings = target as AdSettings ;
@@ -53,6 +60,12 @@ void Initialize()
5360 _enableGDPR = serializedObject . FindProperty ( "enableGDPR" ) ;
5461 _enableGDPRTestMode = serializedObject . FindProperty ( "enableGDPRTestMode" ) ;
5562 _admobDevicesTest = serializedObject . FindProperty ( "admobDevicesTest" ) ;
63+ _androidAppKey = serializedObject . FindProperty ( "androidAppKey" ) ;
64+ _iOSAppKey = serializedObject . FindProperty ( "iOSAppKey" ) ;
65+ _useTestAppKey = serializedObject . FindProperty ( "useTestAppKey" ) ;
66+ _ironSourceBannerAdUnit = serializedObject . FindProperty ( "ironSourceBannerAdUnit" ) ;
67+ _ironSourceInterstitialAdUnit = serializedObject . FindProperty ( "ironSourceInterstitialAdUnit" ) ;
68+ _ironSourceRewardAdUnit = serializedObject . FindProperty ( "ironSourceRewardAdUnit" ) ;
5669 }
5770
5871 public override void OnInspectorGUI ( )
@@ -68,62 +81,80 @@ public override void OnInspectorGUI()
6881 EditorGUILayout . PropertyField ( _adNetwork ) ;
6982 GUILayout . Space ( 10 ) ;
7083 GuiLine ( 2 ) ;
71- DrawMax ( ) ;
72- DrawAdmob ( ) ;
84+ switch ( _adNetwork . enumValueIndex )
85+ {
86+ case ( int ) AdNetwork . Max :
87+ DrawMax ( ) ;
88+ break ;
89+ case ( int ) AdNetwork . Admob :
90+ DrawAdmob ( ) ;
91+ break ;
92+ case ( int ) AdNetwork . IronSource :
93+ DrawIronSource ( ) ;
94+ break ;
95+ }
96+
7397 EditorUtility . SetDirty ( target ) ;
7498 serializedObject . ApplyModifiedProperties ( ) ;
7599 }
76100
77101 void DrawMax ( )
78102 {
79103 GUILayout . Space ( 10 ) ;
80- if ( _adNetwork . enumValueIndex == ( int ) AdNetwork . Max )
81- {
82- EditorGUILayout . LabelField ( "APPLOVIN-MAX" , EditorStyles . boldLabel ) ;
83- GUILayout . Space ( 5 ) ;
84- EditorGUILayout . PropertyField ( _sdkKey ) ;
85- GUILayout . Space ( 5 ) ;
86- EditorGUILayout . PropertyField ( _applovinEnableAgeRestrictedUser ) ;
87- EditorGUILayout . PropertyField ( _maxBannerAdUnit ) ;
88- EditorGUILayout . PropertyField ( _maxInterstitialAdUnit ) ;
89- EditorGUILayout . PropertyField ( _maxRewardAdUnit ) ;
90- EditorGUILayout . PropertyField ( _maxRewardedInterstitialAdUnit ) ;
91- EditorGUILayout . PropertyField ( _maxAppOpenAdUnit ) ;
92- }
104+ EditorGUILayout . LabelField ( "APPLOVIN-MAX" , EditorStyles . boldLabel ) ;
105+ GUILayout . Space ( 5 ) ;
106+ EditorGUILayout . PropertyField ( _sdkKey ) ;
107+ GUILayout . Space ( 5 ) ;
108+ EditorGUILayout . PropertyField ( _applovinEnableAgeRestrictedUser ) ;
109+ EditorGUILayout . PropertyField ( _maxBannerAdUnit ) ;
110+ EditorGUILayout . PropertyField ( _maxInterstitialAdUnit ) ;
111+ EditorGUILayout . PropertyField ( _maxRewardAdUnit ) ;
112+ EditorGUILayout . PropertyField ( _maxRewardedInterstitialAdUnit ) ;
113+ EditorGUILayout . PropertyField ( _maxAppOpenAdUnit ) ;
93114 }
94115
95116 void DrawAdmob ( )
96117 {
97118 GUILayout . Space ( 10 ) ;
98- if ( _adNetwork . enumValueIndex == ( int ) AdNetwork . Admob )
119+ EditorGUILayout . LabelField ( "GOOGLE-ADMOB" , EditorStyles . boldLabel ) ;
120+ GUILayout . Space ( 5 ) ;
121+ EditorGUILayout . PropertyField ( _admobBannerAdUnit ) ;
122+ EditorGUILayout . PropertyField ( _admobInterstitialAdUnit ) ;
123+ EditorGUILayout . PropertyField ( _admobRewardAdUnit ) ;
124+ EditorGUILayout . PropertyField ( _admobRewardedInterstitialAdUnit ) ;
125+ EditorGUILayout . PropertyField ( _admobAppOpenAdUnit ) ;
126+ EditorGUILayout . PropertyField ( _admobEnableTestMode ) ;
127+ EditorGUILayout . PropertyField ( _enableGDPR ) ;
128+ if ( _enableGDPR . boolValue )
99129 {
100- EditorGUILayout . LabelField ( "GOOGLE-ADMOB" , EditorStyles . boldLabel ) ;
101- GUILayout . Space ( 5 ) ;
102- EditorGUILayout . PropertyField ( _admobBannerAdUnit ) ;
103- EditorGUILayout . PropertyField ( _admobInterstitialAdUnit ) ;
104- EditorGUILayout . PropertyField ( _admobRewardAdUnit ) ;
105- EditorGUILayout . PropertyField ( _admobRewardedInterstitialAdUnit ) ;
106- EditorGUILayout . PropertyField ( _admobAppOpenAdUnit ) ;
107- EditorGUILayout . PropertyField ( _admobEnableTestMode ) ;
108- EditorGUILayout . PropertyField ( _enableGDPR ) ;
109- if ( _enableGDPR . boolValue )
110- {
111- EditorGUILayout . PropertyField ( _enableGDPRTestMode ) ;
112- }
130+ EditorGUILayout . PropertyField ( _enableGDPRTestMode ) ;
131+ }
113132
114- EditorGUILayout . PropertyField ( _admobDevicesTest ) ;
115- GUILayout . Space ( 10 ) ;
116- GUI . enabled = false ;
117- EditorGUILayout . TextField ( "App Id Test" , "ca-app-pub-3940256099942544~3347511713" ) ;
118- GUI . enabled = true ;
119- GUILayout . Space ( 10 ) ;
120- if ( GUILayout . Button ( "Open GoogleAdmobSetting" , GUILayout . Height ( 20 ) ) )
121- {
122- EditorApplication . ExecuteMenuItem ( "Assets/Google Mobile Ads/Settings..." ) ;
123- }
133+ EditorGUILayout . PropertyField ( _admobDevicesTest ) ;
134+ GUILayout . Space ( 10 ) ;
135+ GUI . enabled = false ;
136+ EditorGUILayout . TextField ( "App Id Test" , "ca-app-pub-3940256099942544~3347511713" ) ;
137+ GUI . enabled = true ;
138+ GUILayout . Space ( 10 ) ;
139+ if ( GUILayout . Button ( "Open GoogleAdmobSetting" , GUILayout . Height ( 20 ) ) )
140+ {
141+ EditorApplication . ExecuteMenuItem ( "Assets/Google Mobile Ads/Settings..." ) ;
124142 }
125143 }
126144
145+ void DrawIronSource ( )
146+ {
147+ GUILayout . Space ( 10 ) ;
148+ EditorGUILayout . LabelField ( "IRON-SOURCE" , EditorStyles . boldLabel ) ;
149+ GUILayout . Space ( 5 ) ;
150+ EditorGUILayout . PropertyField ( _androidAppKey ) ;
151+ EditorGUILayout . PropertyField ( _iOSAppKey ) ;
152+ EditorGUILayout . PropertyField ( _useTestAppKey ) ;
153+ EditorGUILayout . PropertyField ( _ironSourceBannerAdUnit ) ;
154+ EditorGUILayout . PropertyField ( _ironSourceInterstitialAdUnit ) ;
155+ EditorGUILayout . PropertyField ( _ironSourceRewardAdUnit ) ;
156+ }
157+
127158 void GuiLine ( int i_height = 1 )
128159 {
129160 Rect rect = EditorGUILayout . GetControlRect ( false , i_height ) ;
0 commit comments