@@ -30,6 +30,13 @@ public class AdSettingsEditor : Editor
30
30
private SerializedProperty _enableGDPRTestMode ;
31
31
private SerializedProperty _admobDevicesTest ;
32
32
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
+
33
40
void Initialize ( )
34
41
{
35
42
_adSettings = target as AdSettings ;
@@ -53,6 +60,12 @@ void Initialize()
53
60
_enableGDPR = serializedObject . FindProperty ( "enableGDPR" ) ;
54
61
_enableGDPRTestMode = serializedObject . FindProperty ( "enableGDPRTestMode" ) ;
55
62
_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" ) ;
56
69
}
57
70
58
71
public override void OnInspectorGUI ( )
@@ -68,62 +81,80 @@ public override void OnInspectorGUI()
68
81
EditorGUILayout . PropertyField ( _adNetwork ) ;
69
82
GUILayout . Space ( 10 ) ;
70
83
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
+
73
97
EditorUtility . SetDirty ( target ) ;
74
98
serializedObject . ApplyModifiedProperties ( ) ;
75
99
}
76
100
77
101
void DrawMax ( )
78
102
{
79
103
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 ) ;
93
114
}
94
115
95
116
void DrawAdmob ( )
96
117
{
97
118
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 )
99
129
{
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
+ }
113
132
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..." ) ;
124
142
}
125
143
}
126
144
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
+
127
158
void GuiLine ( int i_height = 1 )
128
159
{
129
160
Rect rect = EditorGUILayout . GetControlRect ( false , i_height ) ;
0 commit comments