update: 优化 GuruService 导入, 实时更新配置数据
							parent
							
								
									7b6e8c7cbe
								
							
						
					
					
						commit
						78f9e3b330
					
				|  | @ -16,6 +16,7 @@ namespace Guru.Editor | |||
|         private const string FACEBOOK_SETTINGS_PATH = "Assets/FacebookSDK/SDK/Resources/FacebookSettings.asset"; | ||||
|         private const string ANDROID_PLUGINS_DIR = "Assets/Plugins/Android"; | ||||
|         private const string KeyMaxAutoUpdateEnabled = "com.applovin.auto_update_enabled"; | ||||
|         private const string TYPE_SCRIPTABLE_OBJECT = "ScriptableObject"; | ||||
|          | ||||
|         private static string ANDROID_KEYSTORE_NAME = "guru_key.jks"; | ||||
|         private static string GuruKeyStore => $"{ANDROID_PLUGINS_DIR}/{ANDROID_KEYSTORE_NAME}"; | ||||
|  | @ -33,7 +34,7 @@ namespace Guru.Editor | |||
|             } | ||||
|         } | ||||
| 
 | ||||
|         private GuruServicesConfig _servicesConfig; | ||||
|         private GuruServicesConfig _serviceConfig; | ||||
|         private static GUIStyle _itemTitleStyle; | ||||
|         private static GUIStyle StyleItemTitle | ||||
|         { | ||||
|  | @ -74,8 +75,10 @@ namespace Guru.Editor | |||
|         private void OnEnable() | ||||
|         { | ||||
|             titleContent = new GUIContent("Guru SDK Manager"); | ||||
|             _servicesConfig = EditorGuruServiceIO.LoadConfig(); | ||||
|             if (_servicesConfig != null) | ||||
| 
 | ||||
|             ReadServiceConfig(); | ||||
|              | ||||
|             if (_serviceConfig != null) | ||||
|             { | ||||
|                 Debug.Log($"<color=#88ff00>[Guru] Load <guru-services> success.</color>"); | ||||
|                 CheckServicesCompletion(); | ||||
|  | @ -88,14 +91,21 @@ namespace Guru.Editor | |||
|             _model ??= SDKMgrModel.Load(); | ||||
| 
 | ||||
|             InitPushIcon(); | ||||
| 
 | ||||
|             // if (_servicesConfig?.UseCustomKeystore() ?? false) | ||||
|             // { | ||||
|             //     InitCustomKeystore(); | ||||
|             // } | ||||
|              | ||||
|         } | ||||
| 
 | ||||
|          | ||||
|          | ||||
|         /// <summary> | ||||
|         /// Read service from the service file again to ensure the data is latest fixed. | ||||
|         /// Ensure it is not null.  | ||||
|         /// </summary> | ||||
|         private void ReadServiceConfig() | ||||
|         { | ||||
|             var config = EditorGuruServiceIO.LoadConfig(); | ||||
|             if (config != null) | ||||
|             { | ||||
|                 _serviceConfig = config; | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         #region Service Checker | ||||
| 
 | ||||
|  | @ -127,7 +137,7 @@ namespace Guru.Editor | |||
|             string mk_warn = " ( ! ) "; | ||||
|             string mk_star = " ( \u2605 ) "; | ||||
|             string check_passed = $"{MARK_INDENT}{mk_yes} All items passed!"; | ||||
|             if (_servicesConfig == null) | ||||
|             if (_serviceConfig == null) | ||||
|             { | ||||
|                 AddResultLine($"{mk_yes} guru-services is missing", CheckStatus.Failed); | ||||
|                 AddResultLine($"Please contact Guru tech support to get help.", CheckStatus.Failed); | ||||
|  | @ -137,10 +147,10 @@ namespace Guru.Editor | |||
|             { | ||||
|                 bool passed = true; | ||||
|                 AddResultLine($"{mk_star} <guru-services> exists!"); | ||||
|                 if (_servicesConfig.app_settings != null  | ||||
|                     && !string.IsNullOrEmpty(_servicesConfig.app_settings.bundle_id)) | ||||
|                 if (_serviceConfig.app_settings != null  | ||||
|                     && !string.IsNullOrEmpty(_serviceConfig.app_settings.bundle_id)) | ||||
|                 { | ||||
|                     AddResultLine($"{MARK_INDENT}  +  {MARK_INDENT}{_servicesConfig.app_settings.bundle_id}"); | ||||
|                     AddResultLine($"{MARK_INDENT}  +  {MARK_INDENT}{_serviceConfig.app_settings.bundle_id}"); | ||||
|                 } | ||||
| 
 | ||||
|                 AddResultLine($"--------------------------------"); | ||||
|  | @ -148,7 +158,7 @@ namespace Guru.Editor | |||
|                 //-------- APP Settings -------- | ||||
|                 passed = true; | ||||
|                 AddResultLine($"[ App ]"); | ||||
|                 if (_servicesConfig.app_settings == null) | ||||
|                 if (_serviceConfig.app_settings == null) | ||||
|                 { | ||||
|                     passed = false; | ||||
|                     AddResultLine($"{MARK_INDENT}{mk_no} settings is missing!", CheckStatus.Failed); | ||||
|  | @ -156,31 +166,31 @@ namespace Guru.Editor | |||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|                     if (_servicesConfig.app_settings.app_id.IsNullOrEmpty()) | ||||
|                     if (_serviceConfig.app_settings.app_id.IsNullOrEmpty()) | ||||
|                     { | ||||
|                         passed = false; | ||||
|                         AddResultLine($"{MARK_INDENT}{mk_no} AppID is missing!", CheckStatus.Failed); | ||||
|                         _serviceCriticalFail++; | ||||
|                     } | ||||
|                     if (_servicesConfig.app_settings.bundle_id.IsNullOrEmpty()) | ||||
|                     if (_serviceConfig.app_settings.bundle_id.IsNullOrEmpty()) | ||||
|                     { | ||||
|                         passed = false; | ||||
|                         AddResultLine($"{MARK_INDENT}{mk_no} BundleID is missing!", CheckStatus.Failed); | ||||
|                         _serviceCriticalFail++; | ||||
|                     } | ||||
|                     if (_servicesConfig.app_settings.product_name.IsNullOrEmpty()) | ||||
|                     if (_serviceConfig.app_settings.product_name.IsNullOrEmpty()) | ||||
|                     { | ||||
|                         passed = false; | ||||
|                         AddResultLine($"{MARK_INDENT}{mk_no} Product Name is missing!", CheckStatus.Failed); | ||||
|                         _serviceCriticalFail++; | ||||
|                     } | ||||
|                     if (_servicesConfig.app_settings.support_email.IsNullOrEmpty()) | ||||
|                     if (_serviceConfig.app_settings.support_email.IsNullOrEmpty()) | ||||
|                     { | ||||
|                         passed = false; | ||||
|                         AddResultLine($"{MARK_INDENT}{mk_no} Support Email is missing!", CheckStatus.Failed); | ||||
|                         _serviceNormalFail++; | ||||
|                     } | ||||
|                     if (_servicesConfig.app_settings.custom_keystore) | ||||
|                     if (_serviceConfig.app_settings.custom_keystore) | ||||
|                     { | ||||
|                         AddResultLine($"{MARK_INDENT}{mk_warn} Using Custom Keystore.", CheckStatus.Warning); | ||||
|                     } | ||||
|  | @ -191,7 +201,7 @@ namespace Guru.Editor | |||
|                 //-------- ADS Settings -------- | ||||
|                 passed = true; | ||||
|                 AddResultLine($"[ Ads ]"); | ||||
|                 if (_servicesConfig.ad_settings == null) | ||||
|                 if (_serviceConfig.ad_settings == null) | ||||
|                 { | ||||
|                     passed = false; | ||||
|                     AddResultLine($"{MARK_INDENT}{mk_no} settings is missing!", CheckStatus.Failed); | ||||
|  | @ -199,73 +209,73 @@ namespace Guru.Editor | |||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|                     if (_servicesConfig.ad_settings.sdk_key.IsNullOrEmpty()) | ||||
|                     if (_serviceConfig.ad_settings.sdk_key.IsNullOrEmpty()) | ||||
|                     { | ||||
|                         passed = false; | ||||
|                         AddResultLine($"{MARK_INDENT}{mk_no} SDK Key is missing!", CheckStatus.Failed); | ||||
|                         _serviceCriticalFail++; | ||||
|                     } | ||||
|                     if (!IsArrayNotEmpty(_servicesConfig.ad_settings.admob_app_id)) | ||||
|                     if (!IsArrayNotEmpty(_serviceConfig.ad_settings.admob_app_id)) | ||||
|                     { | ||||
|                         passed = false; | ||||
|                         AddResultLine($"{MARK_INDENT}{mk_no} Admob ID is missing!", CheckStatus.Failed); | ||||
|                         _serviceCriticalFail++; | ||||
|                     } | ||||
|                     if (!IsArrayNotEmpty(_servicesConfig.ad_settings.max_ids_android)) | ||||
|                     if (!IsArrayNotEmpty(_serviceConfig.ad_settings.max_ids_android)) | ||||
|                     { | ||||
|                         passed = false; | ||||
|                         AddResultLine($"{MARK_INDENT}{mk_no} AppLovin Android IDs is missing!", CheckStatus.Failed); | ||||
|                         _serviceCriticalFail++; | ||||
|                     } | ||||
|                     if (!IsArrayNotEmpty(_servicesConfig.ad_settings.max_ids_ios)) | ||||
|                     if (!IsArrayNotEmpty(_serviceConfig.ad_settings.max_ids_ios)) | ||||
|                     { | ||||
|                         passed = false; | ||||
|                         AddResultLine($"{MARK_INDENT}{mk_no} AppLovin iOS IDs is missing!", CheckStatus.Failed); | ||||
|                         _serviceCriticalFail++; | ||||
|                     } | ||||
|                     if (!IsArrayNotEmpty(_servicesConfig.ad_settings.amazon_ids_android)) | ||||
|                     if (!IsArrayNotEmpty(_serviceConfig.ad_settings.amazon_ids_android)) | ||||
|                     { | ||||
|                         passed = false; | ||||
|                         AddResultLine($"{MARK_INDENT}{mk_warn} Amazon Android IDs is missing!", CheckStatus.Warning); | ||||
|                         _serviceNormalFail++; | ||||
|                     } | ||||
|                     if (!IsArrayNotEmpty(_servicesConfig.ad_settings.amazon_ids_ios)) | ||||
|                     if (!IsArrayNotEmpty(_serviceConfig.ad_settings.amazon_ids_ios)) | ||||
|                     { | ||||
|                         passed = false; | ||||
|                         AddResultLine($"{MARK_INDENT}{mk_warn} Amazon iOS IDs is missing!", CheckStatus.Warning); | ||||
|                         _serviceNormalFail++; | ||||
|                     } | ||||
|                     if (!IsArrayNotEmpty(_servicesConfig.ad_settings.pubmatic_ids_android)) | ||||
|                     if (!IsArrayNotEmpty(_serviceConfig.ad_settings.pubmatic_ids_android)) | ||||
|                     { | ||||
|                         passed = false; | ||||
|                         AddResultLine($"{MARK_INDENT}{mk_warn} Pubmatic Android IDs is missing!", CheckStatus.Warning); | ||||
|                         _serviceNormalFail++; | ||||
|                     } | ||||
|                     if (!IsArrayNotEmpty(_servicesConfig.ad_settings.pubmatic_ids_ios)) | ||||
|                     if (!IsArrayNotEmpty(_serviceConfig.ad_settings.pubmatic_ids_ios)) | ||||
|                     { | ||||
|                         passed = false; | ||||
|                         AddResultLine($"{MARK_INDENT}{mk_warn} Pubmatic iOS IDs is missing!", CheckStatus.Warning); | ||||
|                         _serviceNormalFail++; | ||||
|                     } | ||||
|                     if (!IsArrayNotEmpty(_servicesConfig.ad_settings.moloco_ids_android)) | ||||
|                     if (!IsArrayNotEmpty(_serviceConfig.ad_settings.moloco_ids_android)) | ||||
|                     { | ||||
|                         passed = false; | ||||
|                         AddResultLine($"{MARK_INDENT}{mk_warn} Moloco Android Test IDs is missing!", CheckStatus.Warning); | ||||
|                         _serviceNormalFail++; | ||||
|                     } | ||||
|                     if (!IsArrayNotEmpty(_servicesConfig.ad_settings.moloco_ids_ios)) | ||||
|                     if (!IsArrayNotEmpty(_serviceConfig.ad_settings.moloco_ids_ios)) | ||||
|                     { | ||||
|                         passed = false; | ||||
|                         AddResultLine($"{MARK_INDENT}{mk_warn} Moloco iOS Test IDs is missing!", CheckStatus.Warning); | ||||
|                         _serviceNormalFail++; | ||||
|                     } | ||||
|                     if (!IsArrayNotEmpty(_servicesConfig.ad_settings.tradplus_ids_android)) | ||||
|                     if (!IsArrayNotEmpty(_serviceConfig.ad_settings.tradplus_ids_android)) | ||||
|                     { | ||||
|                         passed = false; | ||||
|                         AddResultLine($"{MARK_INDENT}{mk_warn} Tradplus Android Test IDs is missing!", CheckStatus.Warning); | ||||
|                         _serviceNormalFail++; | ||||
|                     } | ||||
|                     if (!IsArrayNotEmpty(_servicesConfig.ad_settings.tradplus_ids_ios)) | ||||
|                     if (!IsArrayNotEmpty(_serviceConfig.ad_settings.tradplus_ids_ios)) | ||||
|                     { | ||||
|                         passed = false; | ||||
|                         AddResultLine($"{MARK_INDENT}{mk_warn} Tradplus iOS Test IDs is missing!", CheckStatus.Warning); | ||||
|  | @ -277,7 +287,7 @@ namespace Guru.Editor | |||
|                 //-------- Channels Settings -------- | ||||
|                 passed = true; | ||||
|                 AddResultLine($"[ Channels ]"); | ||||
|                 if (_servicesConfig.fb_settings == null) | ||||
|                 if (_serviceConfig.fb_settings == null) | ||||
|                 { | ||||
|                     passed = false; | ||||
|                     AddResultLine($"{MARK_INDENT}{mk_warn} Facebook settings is missing!", CheckStatus.Warning); | ||||
|  | @ -285,13 +295,13 @@ namespace Guru.Editor | |||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|                     if (_servicesConfig.fb_settings.fb_app_id.IsNullOrEmpty()) | ||||
|                     if (_serviceConfig.fb_settings.fb_app_id.IsNullOrEmpty()) | ||||
|                     { | ||||
|                         passed = false; | ||||
|                         AddResultLine($"{MARK_INDENT}{mk_warn} Facebook AppID is missing!", CheckStatus.Warning); | ||||
|                         _serviceNormalFail++; | ||||
|                     } | ||||
|                     if (_servicesConfig.fb_settings.fb_client_token.IsNullOrEmpty()) | ||||
|                     if (_serviceConfig.fb_settings.fb_client_token.IsNullOrEmpty()) | ||||
|                     { | ||||
|                         passed = false; | ||||
|                         AddResultLine($"{MARK_INDENT}{mk_warn} Facebook Client Token is missing!", CheckStatus.Warning); | ||||
|  | @ -299,7 +309,7 @@ namespace Guru.Editor | |||
|                     } | ||||
|                 } | ||||
| 
 | ||||
|                 if (_servicesConfig.adjust_settings == null) | ||||
|                 if (_serviceConfig.adjust_settings == null) | ||||
|                 { | ||||
|                     passed = false; | ||||
|                     AddResultLine($"{MARK_INDENT}{mk_warn} Adjust settings is missing!", CheckStatus.Warning); | ||||
|  | @ -307,14 +317,14 @@ namespace Guru.Editor | |||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|                     if(!IsArrayNotEmpty(_servicesConfig.adjust_settings.app_token)) | ||||
|                     if(!IsArrayNotEmpty(_serviceConfig.adjust_settings.app_token)) | ||||
|                     { | ||||
|                         passed = false; | ||||
|                         AddResultLine($"{MARK_INDENT}{mk_warn} Adjust AppToken is missing!", CheckStatus.Warning); | ||||
|                         _serviceNormalFail++; | ||||
|                     } | ||||
| 
 | ||||
|                     if (!IsArrayNotEmpty(_servicesConfig.adjust_settings.events)) | ||||
|                     if (!IsArrayNotEmpty(_serviceConfig.adjust_settings.events)) | ||||
|                     { | ||||
|                         passed = false; | ||||
|                         AddResultLine($"{MARK_INDENT}{mk_warn} Adjust Events is missing!", CheckStatus.Warning); | ||||
|  | @ -326,7 +336,7 @@ namespace Guru.Editor | |||
|                 //-------- IAP -------- | ||||
|                 passed = true; | ||||
|                 AddResultLine($"[ IAP ]"); | ||||
|                 if (!IsArrayNotEmpty(_servicesConfig.products)) | ||||
|                 if (!IsArrayNotEmpty(_serviceConfig.products)) | ||||
|                 { | ||||
|                     passed = false; | ||||
|                     AddResultLine($"{MARK_INDENT}{mk_warn} Product list is missing!", CheckStatus.Warning); | ||||
|  | @ -405,7 +415,7 @@ namespace Guru.Editor | |||
|             GUI_WindowTitle(); | ||||
|              | ||||
|             // CONTENT | ||||
|             if (_servicesConfig == null) | ||||
|             if (_serviceConfig == null) | ||||
|             { | ||||
|                 GUI_OnConfigDisabled(); | ||||
|             } | ||||
|  | @ -419,7 +429,7 @@ namespace Guru.Editor | |||
|             GUI_PushIconMaker(); | ||||
| 
 | ||||
|             // Keystore | ||||
|             // if (_servicesConfig != null && _servicesConfig.UseCustomKeystore()) | ||||
|             // if (_serviceConfig != null && _serviceConfig.UseCustomKeystore()) | ||||
|             // { | ||||
|             //     GUILayout.Space(10); | ||||
|             //     GUI_CustomKeystore(); | ||||
|  | @ -485,6 +495,7 @@ namespace Guru.Editor | |||
|             { | ||||
|                 GUI_Button("IMPORT ALL SETTINGS", () => | ||||
|                 { | ||||
|                     ReadServiceConfig(); // Read file again | ||||
|                     CheckAllComponents(); | ||||
|                 }, null, GUILayout.Height(btnH)); | ||||
|             } | ||||
|  | @ -494,6 +505,8 @@ namespace Guru.Editor | |||
|         } | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|         #endregion | ||||
|          | ||||
|         #region Check Components | ||||
|  | @ -540,7 +553,7 @@ namespace Guru.Editor | |||
|         private void ImportGuruSettings() | ||||
|         { | ||||
|             GuruSettings settings = null; | ||||
|             if (IsAssetExists(nameof(GuruSettings), GURU_SETTINGS_PATH)) | ||||
|             if (IsAssetExists(nameof(GuruSettings), TYPE_SCRIPTABLE_OBJECT, GURU_SETTINGS_PATH, true)) | ||||
|             { | ||||
|                 settings = AssetDatabase.LoadAssetAtPath<GuruSettings>(GURU_SETTINGS_PATH); | ||||
|             } | ||||
|  | @ -551,13 +564,13 @@ namespace Guru.Editor | |||
|                 AssetDatabase.CreateAsset(settings, GURU_SETTINGS_PATH); | ||||
|             } | ||||
|             settings.CompanyName = "Guru"; | ||||
|             settings.ProductName = _servicesConfig.app_settings.product_name; | ||||
|             settings.GameIdentifier = _servicesConfig.app_settings.bundle_id; | ||||
|             settings.PriacyUrl = _servicesConfig.app_settings.privacy_url; | ||||
|             settings.TermsUrl = _servicesConfig.app_settings.terms_url; | ||||
|             settings.SupportEmail = _servicesConfig.app_settings.support_email; | ||||
|             settings.AndroidStoreUrl = _servicesConfig.app_settings.android_store; | ||||
|             settings.IOSStoreUrl = _servicesConfig.app_settings.ios_store; | ||||
|             settings.ProductName = _serviceConfig.app_settings.product_name; | ||||
|             settings.GameIdentifier = _serviceConfig.app_settings.bundle_id; | ||||
|             settings.PriacyUrl = _serviceConfig.app_settings.privacy_url; | ||||
|             settings.TermsUrl = _serviceConfig.app_settings.terms_url; | ||||
|             settings.SupportEmail = _serviceConfig.app_settings.support_email; | ||||
|             settings.AndroidStoreUrl = _serviceConfig.app_settings.android_store; | ||||
|             settings.IOSStoreUrl = _serviceConfig.app_settings.ios_store; | ||||
|              | ||||
|             SerializedObject so = new SerializedObject(settings); | ||||
|             SerializedProperty n; | ||||
|  | @ -570,24 +583,24 @@ namespace Guru.Editor | |||
|             { | ||||
|                 // AppID | ||||
|                 p = n.serializedObject.FindProperty("IPMSetting.appID"); | ||||
|                 p.stringValue = _servicesConfig.app_settings.app_id; | ||||
|                 p.stringValue = _serviceConfig.app_settings.app_id; | ||||
|                 // BundleID | ||||
|                 p = n.serializedObject.FindProperty("IPMSetting.bundleId"); | ||||
|                 p.stringValue = _servicesConfig.app_settings.bundle_id; | ||||
|                 p.stringValue = _serviceConfig.app_settings.bundle_id; | ||||
|                 // tokenValidTime | ||||
|                 if (_servicesConfig.TokenValidTime() > 0) | ||||
|                 if (_serviceConfig.TokenValidTime() > 0) | ||||
|                 { | ||||
|                     p = n.serializedObject.FindProperty("IPMSetting.tokenValidTime"); | ||||
|                     p.intValue = _servicesConfig.TokenValidTime(); | ||||
|                     p.intValue = _serviceConfig.TokenValidTime(); | ||||
|                 } | ||||
|                 if (_servicesConfig.fb_settings != null) | ||||
|                 if (_serviceConfig.fb_settings != null) | ||||
|                 { | ||||
|                     // FB App ID | ||||
|                     p = n.serializedObject.FindProperty("IPMSetting.fbAppId"); | ||||
|                     p.stringValue = _servicesConfig.fb_settings.fb_app_id; | ||||
|                     p.stringValue = _serviceConfig.fb_settings.fb_app_id; | ||||
|                     // FB Client Token | ||||
|                     p = n.serializedObject.FindProperty("IPMSetting.fbClientToken"); | ||||
|                     p.stringValue = _servicesConfig.fb_settings.fb_client_token; | ||||
|                     p.stringValue = _serviceConfig.fb_settings.fb_client_token; | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
|  | @ -598,7 +611,7 @@ namespace Guru.Editor | |||
|                 p = n.serializedObject.FindProperty("AmazonSetting.Enable"); | ||||
|                 p.boolValue = true; | ||||
|                  | ||||
|                 arr = _servicesConfig.ad_settings.amazon_ids_android; | ||||
|                 arr = _serviceConfig.ad_settings.amazon_ids_android; | ||||
|                 if (IsArrayHasLength(arr, 4)) | ||||
|                 { | ||||
|                     p = n.serializedObject.FindProperty("AmazonSetting.Android.appID"); | ||||
|  | @ -611,7 +624,7 @@ namespace Guru.Editor | |||
|                     p.stringValue = arr[3]; | ||||
|                 } | ||||
| 
 | ||||
|                 arr = _servicesConfig.ad_settings.amazon_ids_ios; | ||||
|                 arr = _serviceConfig.ad_settings.amazon_ids_ios; | ||||
|                 if (IsArrayHasLength(arr, 4)) | ||||
|                 { | ||||
|                     p = n.serializedObject.FindProperty("AmazonSetting.iOS.appID"); | ||||
|  | @ -633,12 +646,12 @@ namespace Guru.Editor | |||
|                 p.boolValue = true; | ||||
| 
 | ||||
|                 p = n.serializedObject.FindProperty("PubmaticSetting.Android.storeUrl"); | ||||
|                 if(p != null) p.stringValue = _servicesConfig.app_settings.android_store; | ||||
|                 if(p != null) p.stringValue = _serviceConfig.app_settings.android_store; | ||||
| 
 | ||||
|                 p = n.serializedObject.FindProperty("PubmaticSetting.iOS.storeUrl"); | ||||
|                 if(p != null) p.stringValue = _servicesConfig.app_settings.ios_store; | ||||
|                 if(p != null) p.stringValue = _serviceConfig.app_settings.ios_store; | ||||
|                  | ||||
|                 arr = _servicesConfig.ad_settings.pubmatic_ids_android; | ||||
|                 arr = _serviceConfig.ad_settings.pubmatic_ids_android; | ||||
|                 if (IsArrayHasLength(arr, 3)) | ||||
|                 { | ||||
|                     p = n.serializedObject.FindProperty("PubmaticSetting.Android.bannerUnitID"); | ||||
|  | @ -649,7 +662,7 @@ namespace Guru.Editor | |||
|                     p.stringValue = arr[2]; | ||||
|                 } | ||||
| 
 | ||||
|                 arr = _servicesConfig.ad_settings.pubmatic_ids_ios; | ||||
|                 arr = _serviceConfig.ad_settings.pubmatic_ids_ios; | ||||
|                 if (IsArrayHasLength(arr, 3)) | ||||
|                 { | ||||
|                     p = n.serializedObject.FindProperty("PubmaticSetting.iOS.bannerUnitID"); | ||||
|  | @ -668,7 +681,7 @@ namespace Guru.Editor | |||
|                 p = n.serializedObject.FindProperty("MolocoSetting.Enable"); | ||||
|                 p.boolValue = true; | ||||
|                  | ||||
|                 arr = _servicesConfig.ad_settings.moloco_ids_android; | ||||
|                 arr = _serviceConfig.ad_settings.moloco_ids_android; | ||||
|                 if (IsArrayHasLength(arr, 3)) | ||||
|                 { | ||||
|                     p = n.serializedObject.FindProperty("MolocoSetting.Android.bannerTestUnitID"); | ||||
|  | @ -679,7 +692,7 @@ namespace Guru.Editor | |||
|                     p.stringValue = arr[2]; | ||||
|                 } | ||||
| 
 | ||||
|                 arr = _servicesConfig.ad_settings.moloco_ids_ios; | ||||
|                 arr = _serviceConfig.ad_settings.moloco_ids_ios; | ||||
|                 if (IsArrayHasLength(arr, 3)) | ||||
|                 { | ||||
|                     p = n.serializedObject.FindProperty("MolocoSetting.iOS.bannerTestUnitID"); | ||||
|  | @ -695,7 +708,7 @@ namespace Guru.Editor | |||
|             n = so.FindProperty("TradplusSetting"); | ||||
|             if (null != n) | ||||
|             { | ||||
|                 arr = _servicesConfig.ad_settings.tradplus_ids_android; | ||||
|                 arr = _serviceConfig.ad_settings.tradplus_ids_android; | ||||
|                 if (IsArrayHasLength(arr, 3)) | ||||
|                 { | ||||
|                     p = n.serializedObject.FindProperty("TradplusSetting.Android.bannerUnitID"); | ||||
|  | @ -706,7 +719,7 @@ namespace Guru.Editor | |||
|                     p.stringValue = arr[2]; | ||||
|                 } | ||||
|                  | ||||
|                 arr = _servicesConfig.ad_settings.tradplus_ids_ios; | ||||
|                 arr = _serviceConfig.ad_settings.tradplus_ids_ios; | ||||
|                 if (IsArrayHasLength(arr, 3)) | ||||
|                 { | ||||
|                     p = n.serializedObject.FindProperty("TradplusSetting.iOS.bannerUnitID"); | ||||
|  | @ -723,9 +736,9 @@ namespace Guru.Editor | |||
|             if (null != n) | ||||
|             { | ||||
|                 p = n.serializedObject.FindProperty("ADSetting.SDK_KEY"); | ||||
|                 p.stringValue = _servicesConfig.ad_settings.sdk_key; | ||||
|                 p.stringValue = _serviceConfig.ad_settings.sdk_key; | ||||
|                  | ||||
|                 arr = _servicesConfig.ad_settings.max_ids_android; | ||||
|                 arr = _serviceConfig.ad_settings.max_ids_android; | ||||
|                 if(IsArrayHasLength(arr, 3)) | ||||
|                 { | ||||
|                     p = n.serializedObject.FindProperty("ADSetting.Android_Banner_ID"); | ||||
|  | @ -736,7 +749,7 @@ namespace Guru.Editor | |||
|                     p.stringValue = arr[2]; | ||||
|                 } | ||||
|                  | ||||
|                 arr = _servicesConfig.ad_settings.max_ids_ios; | ||||
|                 arr = _serviceConfig.ad_settings.max_ids_ios; | ||||
|                 if (IsArrayHasLength(arr, 3)) | ||||
|                 { | ||||
|                     p = n.serializedObject.FindProperty("ADSetting.IOS_Banner_ID"); | ||||
|  | @ -751,13 +764,13 @@ namespace Guru.Editor | |||
|             //----------- AdjustSetting ------------------- | ||||
|             n = so.FindProperty("AdjustSetting"); | ||||
|             if (null != n  | ||||
|                 && IsArrayHasLength(_servicesConfig.adjust_settings.app_token, 2)) | ||||
|                 && IsArrayHasLength(_serviceConfig.adjust_settings.app_token, 2)) | ||||
|             { | ||||
|                 p = n.serializedObject.FindProperty("AdjustSetting.androidAppToken"); | ||||
|                 p.stringValue = _servicesConfig.adjust_settings.app_token[0]; | ||||
|                 p.stringValue = _serviceConfig.adjust_settings.app_token[0]; | ||||
|                  | ||||
|                 p = n.serializedObject.FindProperty("AdjustSetting.iOSAppToken"); | ||||
|                 p.stringValue = _servicesConfig.adjust_settings.app_token[1]; | ||||
|                 p.stringValue = _serviceConfig.adjust_settings.app_token[1]; | ||||
|             } | ||||
| 
 | ||||
|             //----------- AnalyticsSetting ------------------- | ||||
|  | @ -765,20 +778,20 @@ namespace Guru.Editor | |||
|             if (null != n) | ||||
|             { | ||||
|                 p = n.serializedObject.FindProperty("AnalyticsSetting.levelEndSuccessNum"); | ||||
|                 p.intValue = _servicesConfig.LevelEndSuccessNum(); | ||||
|                 p.intValue = _serviceConfig.LevelEndSuccessNum(); | ||||
|                 p = n.serializedObject.FindProperty("AnalyticsSetting.enalbeFirebaseAnalytics"); | ||||
|                 p.boolValue = _servicesConfig.IsFirebaseEnabled(); | ||||
|                 p.boolValue = _serviceConfig.IsFirebaseEnabled(); | ||||
|                 p = n.serializedObject.FindProperty("AnalyticsSetting.enalbeFacebookAnalytics"); | ||||
|                 p.boolValue = _servicesConfig.IsFacebookEnabled(); | ||||
|                 p.boolValue = _serviceConfig.IsFacebookEnabled(); | ||||
|                 p = n.serializedObject.FindProperty("AnalyticsSetting.enalbeAdjustAnalytics"); | ||||
|                 p.boolValue = _servicesConfig.IsAdjustEnabled(); | ||||
|                 p.boolValue = _serviceConfig.IsAdjustEnabled(); | ||||
|                 p = n.serializedObject.FindProperty("AnalyticsSetting.adjustEventList"); | ||||
|                 if (null != p && IsArrayNotEmpty(_servicesConfig.adjust_settings.events)) | ||||
|                 if (null != p && IsArrayNotEmpty(_serviceConfig.adjust_settings.events)) | ||||
|                 { | ||||
|                     p.ClearArray(); | ||||
|                     for (int i = 0; i < _servicesConfig.adjust_settings.events.Length; i++) | ||||
|                     for (int i = 0; i < _serviceConfig.adjust_settings.events.Length; i++) | ||||
|                     { | ||||
|                         arr = _servicesConfig.adjust_settings.events[i].Split(','); | ||||
|                         arr = _serviceConfig.adjust_settings.events[i].Split(','); | ||||
|                         if (IsArrayHasLength(arr, 3)) | ||||
|                         { | ||||
|                             p.InsertArrayElementAtIndex(i); | ||||
|  | @ -793,12 +806,12 @@ namespace Guru.Editor | |||
|              | ||||
|             //---------------- Productions ------------------------ | ||||
|             n = so.FindProperty("Products"); | ||||
|             if (n != null && IsArrayNotEmpty(_servicesConfig.products)) | ||||
|             if (n != null && IsArrayNotEmpty(_serviceConfig.products)) | ||||
|             { | ||||
|                 n.ClearArray(); | ||||
|                 for (int i = 0; i < _servicesConfig.products.Length; i++) | ||||
|                 for (int i = 0; i < _serviceConfig.products.Length; i++) | ||||
|                 { | ||||
|                     arr = _servicesConfig.products[i].Split(','); | ||||
|                     arr = _serviceConfig.products[i].Split(','); | ||||
|                     if (IsArrayHasLength(arr, 5)) | ||||
|                     { | ||||
|                         n.InsertArrayElementAtIndex(i); | ||||
|  | @ -832,7 +845,7 @@ namespace Guru.Editor | |||
|             EditorPrefs.SetBool(KeyMaxAutoUpdateEnabled, false); // 关闭Max自动升级功能 | ||||
|              | ||||
|             AppLovinSettings settings = null; | ||||
|             if (IsAssetExists(nameof(AppLovinSettings), APPLOVIN_SETTINGS_PATH)) | ||||
|             if (IsAssetExists(nameof(AppLovinSettings), TYPE_SCRIPTABLE_OBJECT, APPLOVIN_SETTINGS_PATH, true)) | ||||
|             { | ||||
|                 settings = AssetDatabase.LoadAssetAtPath<AppLovinSettings>(APPLOVIN_SETTINGS_PATH); | ||||
|             } | ||||
|  | @ -845,11 +858,11 @@ namespace Guru.Editor | |||
|             settings.SetAttributionReportEndpoint = true; | ||||
|             settings.QualityServiceEnabled = true; | ||||
|             settings.AddApsSkAdNetworkIds = true; | ||||
|             settings.SdkKey = _servicesConfig.ad_settings.sdk_key; | ||||
|             if (IsArrayHasLength(_servicesConfig.ad_settings.admob_app_id, 2)) | ||||
|             settings.SdkKey = _serviceConfig.ad_settings.sdk_key; | ||||
|             if (IsArrayHasLength(_serviceConfig.ad_settings.admob_app_id, 2)) | ||||
|             { | ||||
|                 settings.AdMobAndroidAppId = _servicesConfig.ad_settings.admob_app_id[0]; | ||||
|                 settings.AdMobIosAppId = _servicesConfig.ad_settings.admob_app_id[1]; | ||||
|                 settings.AdMobAndroidAppId = _serviceConfig.ad_settings.admob_app_id[0]; | ||||
|                 settings.AdMobIosAppId = _serviceConfig.ad_settings.admob_app_id[1]; | ||||
|             } | ||||
|             settings.ConsentFlowEnabled = false; | ||||
|             EditorUtility.SetDirty(settings); | ||||
|  | @ -860,9 +873,10 @@ namespace Guru.Editor | |||
|         private void ImportFacebookSettings() | ||||
|         { | ||||
|             FacebookSettings settings = null; | ||||
|             if (IsAssetExists(nameof(FacebookSettings), FACEBOOK_SETTINGS_PATH)) | ||||
|             string p = FindAssetPath(nameof(FacebookSettings), "ScriptableObject"); | ||||
|             if (!string.IsNullOrEmpty(p)) | ||||
|             { | ||||
|                 settings = AssetDatabase.LoadAssetAtPath<FacebookSettings>(FACEBOOK_SETTINGS_PATH); | ||||
|                 settings = AssetDatabase.LoadAssetAtPath<FacebookSettings>(p); | ||||
|             } | ||||
|             else | ||||
|             { | ||||
|  | @ -878,7 +892,7 @@ namespace Guru.Editor | |||
|             { | ||||
|                 n.ClearArray(); | ||||
|                 n.InsertArrayElementAtIndex(0); | ||||
|                 n.GetArrayElementAtIndex(0).stringValue = _servicesConfig.app_settings.product_name; | ||||
|                 n.GetArrayElementAtIndex(0).stringValue = _serviceConfig.app_settings.product_name; | ||||
|             } | ||||
| 
 | ||||
|             n = so.FindProperty("appIds"); | ||||
|  | @ -886,7 +900,7 @@ namespace Guru.Editor | |||
|             { | ||||
|                 n.ClearArray(); | ||||
|                 n.InsertArrayElementAtIndex(0); | ||||
|                 n.GetArrayElementAtIndex(0).stringValue = _servicesConfig.fb_settings.fb_app_id; | ||||
|                 n.GetArrayElementAtIndex(0).stringValue = _serviceConfig.fb_settings.fb_app_id; | ||||
|             } | ||||
|              | ||||
|             n = so.FindProperty("clientTokens"); | ||||
|  | @ -894,12 +908,12 @@ namespace Guru.Editor | |||
|             { | ||||
|                 n.ClearArray(); | ||||
|                 n.InsertArrayElementAtIndex(0); | ||||
|                 n.GetArrayElementAtIndex(0).stringValue = _servicesConfig.fb_settings.fb_client_token; | ||||
|                 n.GetArrayElementAtIndex(0).stringValue = _serviceConfig.fb_settings.fb_client_token; | ||||
|             } | ||||
| 
 | ||||
| 
 | ||||
|             string ks_path = GuruKeyStore; | ||||
|             if (_servicesConfig?.UseCustomKeystore() ?? false) | ||||
|             if (_serviceConfig?.UseCustomKeystore() ?? false) | ||||
|             { | ||||
|                 ks_path = _model?.KeyStorePath ?? ""; | ||||
|             } | ||||
|  | @ -920,7 +934,7 @@ namespace Guru.Editor | |||
| 
 | ||||
|         private void CheckAndroidKeyStore() | ||||
|         { | ||||
|             if (!_servicesConfig.UseCustomKeystore()) | ||||
|             if (!_serviceConfig.UseCustomKeystore()) | ||||
|             { | ||||
|                 DeployGuruKeystore(); | ||||
|             } | ||||
|  | @ -939,7 +953,7 @@ namespace Guru.Editor | |||
| 
 | ||||
|         private void ApplyMods() | ||||
|         { | ||||
|             PlayerSettings.applicationIdentifier = _servicesConfig.app_settings.bundle_id; // 设置包名 | ||||
|             PlayerSettings.applicationIdentifier = _serviceConfig.app_settings.bundle_id; // 设置包名 | ||||
|              | ||||
|             //-------- 部署 Android 相关的文件和资源 ---------- | ||||
|             AndroidManifestMod.Apply(); | ||||
|  | @ -963,9 +977,7 @@ namespace Guru.Editor | |||
|             content?.Invoke(); | ||||
|             GUI.color = c; | ||||
|         } | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|          | ||||
|         private void GUI_Button(string label, Action content, Color color, GUIStyle style = null, params GUILayoutOption[] options) | ||||
|         { | ||||
|             GUI_Color(color, ()=> GUI_Button(label, content, style, options)); | ||||
|  | @ -992,16 +1004,45 @@ namespace Guru.Editor | |||
|         #endregion | ||||
| 
 | ||||
|         #region Utils | ||||
|          | ||||
|         /// <summary> | ||||
|         /// 插着组件路径 | ||||
|         /// </summary> | ||||
|         /// <param name="assetName"></param> | ||||
|         /// <param name="typeName"></param> | ||||
|         /// <returns></returns> | ||||
|         private static string FindAssetPath(string assetName, string typeName = "") | ||||
|         { | ||||
|             string filter = assetName; | ||||
|             if (!string.IsNullOrEmpty(typeName)) filter = $"{assetName} t:{typeName}"; | ||||
|             var guids = AssetDatabase.FindAssets(filter); | ||||
| 
 | ||||
|             string p = ""; | ||||
|             if (guids != null && guids.Length > 0) | ||||
|             { | ||||
|                 for (int i = 0; i < guids.Length; i++) | ||||
|                 { | ||||
|                      p = AssetDatabase.GUIDToAssetPath(guids[i]); | ||||
|                     if (File.Exists(p.Replace("Assets", Application.dataPath))) | ||||
|                     { | ||||
|                         return p; | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|             return ""; | ||||
|         } | ||||
|          | ||||
|         /// <summary> | ||||
|         /// 获取Assets路径 | ||||
|         /// </summary> | ||||
|         /// <param name="filter"></param> | ||||
|         /// <param name="typeName"></param> | ||||
|         /// <param name="defaultPath"></param> | ||||
|         /// <param name="deleteOthers"></param> | ||||
|         /// <returns></returns> | ||||
|         private static bool IsAssetExists(string typeName, string defaultPath) | ||||
|         private static bool IsAssetExists(string assetName,string typeName, string defaultPath, bool deleteOthers = false) | ||||
|         { | ||||
|             bool result = false; | ||||
|             var guids = AssetDatabase.FindAssets($"t:{typeName}"); | ||||
|             var guids = AssetDatabase.FindAssets($"{assetName} t:{typeName}"); | ||||
|             string p = ""; | ||||
|             if (guids != null && guids.Length > 0) | ||||
|             { | ||||
|  | @ -1016,7 +1057,7 @@ namespace Guru.Editor | |||
|                         } | ||||
|                         else | ||||
|                         { | ||||
|                             File.Delete(p); | ||||
|                             if(deleteOthers) File.Delete(p); | ||||
|                         } | ||||
|                     } | ||||
|                 } | ||||
|  | @ -1071,8 +1112,6 @@ namespace Guru.Editor | |||
|         { | ||||
|             float btnH = 24; | ||||
|              | ||||
|              | ||||
|              | ||||
|             // EditorGUILayout.LabelField("[ Push Icon ]", StyleItemTitle); | ||||
|             _showSegmentPush = EditorGUILayout.Foldout(_showSegmentPush, "[ Android Push Icon ]"); | ||||
|             if (_showSegmentPush) | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue