update: 更新iOS配置
							parent
							
								
									7d3907665f
								
							
						
					
					
						commit
						ec534cbd3d
					
				|  | @ -11,9 +11,9 @@ public class AdjustSettings : ScriptableObject | ||||||
|     [SerializeField] |     [SerializeField] | ||||||
|     private bool _iOSFrameworkAdSupport = true; |     private bool _iOSFrameworkAdSupport = true; | ||||||
|     [SerializeField] |     [SerializeField] | ||||||
|     private bool _iOSFrameworkAdServices = false; |     private bool _iOSFrameworkAdServices = true; | ||||||
|     [SerializeField] |     [SerializeField] | ||||||
|     private bool _iOSFrameworkAppTrackingTransparency = false; |     private bool _iOSFrameworkAppTrackingTransparency = true; | ||||||
|     [SerializeField] |     [SerializeField] | ||||||
|     private bool _iOSFrameworkStoreKit = false; |     private bool _iOSFrameworkStoreKit = false; | ||||||
|     [SerializeField] |     [SerializeField] | ||||||
|  |  | ||||||
|  | @ -12,7 +12,9 @@ namespace Guru.Editor.Adjust | ||||||
| 
 | 
 | ||||||
|         private static string CodeReplaceSample = |         private static string CodeReplaceSample = | ||||||
|             "AssetDatabase.GUIDToAssetPath(guids[0]).Replace(\"AdjustSettings.cs\", \"AdjustSettings.asset\")"; |             "AssetDatabase.GUIDToAssetPath(guids[0]).Replace(\"AdjustSettings.cs\", \"AdjustSettings.asset\")"; | ||||||
|          | 
 | ||||||
|  |         private static string CodeIOSFrameworkAdServices = "private bool _iOSFrameworkAdServices"; | ||||||
|  |         private static string CodeIOSFrameworkATT = "private bool _iOSFrameworkAppTrackingTransparency"; | ||||||
|          |          | ||||||
|          |          | ||||||
|          |          | ||||||
|  | @ -74,6 +76,21 @@ namespace Guru.Editor.Adjust | ||||||
|             for (int i = 0; i < lines.Count; i++) |             for (int i = 0; i < lines.Count; i++) | ||||||
|             { |             { | ||||||
|                 line = lines[i]; |                 line = lines[i]; | ||||||
|  |                 if (line.Contains(CodeIOSFrameworkAdServices) && line.Contains("false")) | ||||||
|  |                 { | ||||||
|  |                     lines[i] = line.Replace("false", "true"); // 允许引入AdService | ||||||
|  |                     isDirty = true; | ||||||
|  |                     continue; | ||||||
|  |                 } | ||||||
|  |                  | ||||||
|  |                 if (line.Contains(CodeIOSFrameworkATT) && line.Contains("false")) | ||||||
|  |                 { | ||||||
|  |                     lines[i] = line.Replace("false", "true"); // 允许引入AdService | ||||||
|  |                     isDirty = true; | ||||||
|  |                     continue; | ||||||
|  | 
 | ||||||
|  |                 } | ||||||
|  |                  | ||||||
|                 if (line.Contains(CodeReplaceSample) && !line.Contains("//")) |                 if (line.Contains(CodeReplaceSample) && !line.Contains("//")) | ||||||
|                 { |                 { | ||||||
|                     lines[i] = $"//{line}"; |                     lines[i] = $"//{line}"; | ||||||
|  |  | ||||||
|  | @ -1,10 +1,9 @@ | ||||||
| using System.IO; |  | ||||||
| using UnityEditor; |  | ||||||
| using UnityEngine; |  | ||||||
| 
 |  | ||||||
| namespace Guru.Editor.Adjust | namespace Guru.Editor.Adjust | ||||||
| { | { | ||||||
|      |     using System.IO; | ||||||
|  |     using UnityEditor; | ||||||
|  |     using UnityEngine; | ||||||
|  | 
 | ||||||
|     /// <summary> |     /// <summary> | ||||||
|     /// 修改器API |     /// 修改器API | ||||||
|     /// </summary> |     /// </summary> | ||||||
|  | @ -24,7 +23,7 @@ namespace Guru.Editor.Adjust | ||||||
|             get |             get | ||||||
|             { |             { | ||||||
| #if GURU_SDK_DEV | #if GURU_SDK_DEV | ||||||
|                 return $"__upm/{PackageName}/Adjust/Editor";   |                 return $"__packages/{PackageName}/Adjust/Editor";   | ||||||
| #endif | #endif | ||||||
|                 return $"Packages/{PackageName}/Adjust/Editor"; |                 return $"Packages/{PackageName}/Adjust/Editor"; | ||||||
|             } |             } | ||||||
|  | @ -85,23 +84,25 @@ namespace Guru.Editor.Adjust | ||||||
| 
 | 
 | ||||||
|             // Make a new one |             // Make a new one | ||||||
|             var settings = ScriptableObject.CreateInstance<AdjustSettings>(); |             var settings = ScriptableObject.CreateInstance<AdjustSettings>(); | ||||||
|  |             SerializedObject so = new SerializedObject(settings); | ||||||
|  |             SerializedProperty p; | ||||||
|  |             p = so.FindProperty("m_EditorClassIdentifier._iOSFrameworkAdSupport"); // 引入 AdSupport | ||||||
|  |             if (p != null)  p.boolValue = true; | ||||||
|  |             p = so.FindProperty("m_EditorClassIdentifier._iOSFrameworkAdServices"); // 引入 AdServices | ||||||
|  |             if (p != null)  p.boolValue = true; | ||||||
|  |             so.ApplyModifiedProperties(); | ||||||
|             AssetDatabase.CreateAsset(settings, AdjustSettingsAssetPath); |             AssetDatabase.CreateAsset(settings, AdjustSettingsAssetPath); | ||||||
|             AssetDatabase.SaveAssetIfDirty(settings); |             AssetDatabase.SaveAssetIfDirty(settings); | ||||||
|             AssetDatabase.Refresh(); |             AssetDatabase.Refresh(); | ||||||
| 
 |  | ||||||
|             Debug.Log($"[Guru] <color=#88ff00>--- Create AdjustSettings at:</color> \n{AdjustSettingsAssetPath}"); |             Debug.Log($"[Guru] <color=#88ff00>--- Create AdjustSettings at:</color> \n{AdjustSettingsAssetPath}"); | ||||||
| 
 |  | ||||||
|             return settings; |             return settings; | ||||||
|         } |         } | ||||||
|          |          | ||||||
|         #endregion |         #endregion | ||||||
| 
 |          | ||||||
| 
 |         public static void ApplyMods() | ||||||
|         public static void ApllyMods() |  | ||||||
|         { |         { | ||||||
|              |              | ||||||
|         } |         } | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
|     } |     } | ||||||
| } | } | ||||||
		Loading…
	
		Reference in New Issue