update: 更新 Android Res 导入的Mod 工具
parent
636049d8c0
commit
af06ddade2
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 11c5c61708cec45b3886f7c93951d083
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -25,7 +25,6 @@ namespace Guru.Editor
|
|||
if (!IsManifestExist())
|
||||
{
|
||||
CopyManifest();
|
||||
return;
|
||||
}
|
||||
|
||||
var doc = new XmlDocument();
|
||||
|
|
@ -84,11 +83,10 @@ namespace Guru.Editor
|
|||
{
|
||||
if (File.Exists(TargetFullPath)) return;
|
||||
|
||||
var path = GuruEditorHelper.GetFilePath($"{nameof(AndroidManifestMod)}.cs t:Script");
|
||||
var path = GuruEditorHelper.GetFilePath($"{nameof(AndroidManifestMod)} t:Script");
|
||||
if (!string.IsNullOrEmpty(path))
|
||||
{
|
||||
var files = Path.GetFullPath($"{path}/../Files");
|
||||
var from = $"{files}/AndroidManifest.txt";
|
||||
var from = Path.GetFullPath($"{path}/../../Files/AndroidManifest.txt");
|
||||
if (File.Exists(from))
|
||||
{
|
||||
File.Copy(from, TargetFullPath);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Linq;
|
||||
|
||||
|
||||
namespace Guru.Editor
|
||||
{
|
||||
|
|
@ -6,6 +6,8 @@ namespace Guru.Editor
|
|||
using UnityEngine;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
public class AndroidProjectMod
|
||||
{
|
||||
private static readonly int TargetSDKVersion = 33;
|
||||
|
|
@ -93,8 +95,8 @@ namespace Guru.Editor
|
|||
|
||||
private static string GetMoveFilePath(string fileName)
|
||||
{
|
||||
var path = GuruEditorHelper.GetFilePath($"{nameof(AndroidProjectMod)}.cs t:Script");
|
||||
var files = Path.GetFullPath($"{path}/../Files");
|
||||
var path = GuruEditorHelper.GetFilePath($"{nameof(AndroidProjectMod)} t:Script");
|
||||
var files = Path.GetFullPath($"{path}/../../Files");
|
||||
return $"{files}/{fileName}";
|
||||
}
|
||||
private static void CopyFile(string fileName, string toPath)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,44 @@
|
|||
namespace Guru.Editor
|
||||
{
|
||||
using System.IO;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
public class AndroidResMod
|
||||
{
|
||||
private static readonly string ResName = "GuruSDKRes";
|
||||
private static string ResFullPath = Path.Combine(Application.dataPath, $"Plugins/Android/{ResName}.androidlib");
|
||||
|
||||
/// <summary>
|
||||
/// 应用补丁
|
||||
/// </summary>
|
||||
public static void Apply()
|
||||
{
|
||||
DeployAndroidRes();
|
||||
}
|
||||
|
||||
|
||||
private static void DeployAndroidRes()
|
||||
{
|
||||
var spath = GuruEditorHelper.GetFilePath($"{nameof(AndroidResMod)} t:Script");
|
||||
if (!string.IsNullOrEmpty(spath))
|
||||
{
|
||||
var from = Path.GetFullPath($"{spath}/../../Files/sdk_res");
|
||||
if (Directory.Exists(from))
|
||||
{
|
||||
var to = ResFullPath;
|
||||
if (Directory.Exists(to))
|
||||
{
|
||||
FileUtil.DeleteFileOrDirectory(ResFullPath);
|
||||
}
|
||||
|
||||
FileUtil.CopyFileOrDirectory(from, to);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c06b1730aac144929ca73fba2e481508
|
||||
timeCreated: 1706058636
|
||||
|
|
@ -461,17 +461,23 @@ namespace Guru.Editor
|
|||
|
||||
private void CheckAllComponents()
|
||||
{
|
||||
float progress = 0;
|
||||
string barTitle = "Setup All Components";
|
||||
EditorUtility.DisplayCancelableProgressBar(barTitle, "Start collect all components", 0);
|
||||
EditorUtility.DisplayCancelableProgressBar(barTitle, "Start collect all components", progress);
|
||||
Debug.Log("--- Setup All Components ---");
|
||||
ImportGuruSettings();
|
||||
EditorUtility.DisplayCancelableProgressBar(barTitle, "GuruSettings is done", 0.2f);
|
||||
ImportAppLovinSettings();
|
||||
EditorUtility.DisplayCancelableProgressBar(barTitle, "AppLovinSettings is done", 0.4f);
|
||||
ImportFacebookSettings();
|
||||
EditorUtility.DisplayCancelableProgressBar(barTitle, "FacebookSettings is done", 0.6f);
|
||||
ApplyMods();
|
||||
EditorUtility.DisplayCancelableProgressBar(barTitle, "All Mods is done", 0.8f);
|
||||
progress += 0.2f;
|
||||
EditorUtility.DisplayCancelableProgressBar(barTitle, "Setup Mods is done", progress);
|
||||
ImportGuruSettings();
|
||||
progress += 0.2f;
|
||||
EditorUtility.DisplayCancelableProgressBar(barTitle, "GuruSettings is done", progress);
|
||||
ImportAppLovinSettings();
|
||||
progress += 0.2f;
|
||||
EditorUtility.DisplayCancelableProgressBar(barTitle, "AppLovinSettings is done", progress);
|
||||
ImportFacebookSettings();
|
||||
progress += 0.2f;
|
||||
EditorUtility.DisplayCancelableProgressBar(barTitle, "FacebookSettings is done", progress);
|
||||
|
||||
|
||||
EditorGuruServiceIO.DeployLocalServiceFile(); // 部署文件
|
||||
|
||||
|
|
@ -816,6 +822,8 @@ namespace Guru.Editor
|
|||
n.stringValue = ANDROID_KEYSTORE_PATH;
|
||||
DeployKeystore();
|
||||
|
||||
Facebook.Unity.Editor.ManifestMod.GenerateManifest(); // 重新生成 Manifest
|
||||
|
||||
so.ApplyModifiedProperties();
|
||||
EditorUtility.SetDirty(settings);
|
||||
AssetDatabase.SaveAssetIfDirty(settings);
|
||||
|
|
@ -837,10 +845,14 @@ namespace Guru.Editor
|
|||
{
|
||||
PlayerSettings.applicationIdentifier = _servicesConfig.app_settings.bundle_id; // 设置包名
|
||||
|
||||
#if UNITY_ANDROID
|
||||
// #if UNITY_ANDROID
|
||||
//-------- 部署 Android 相关的文件和资源 ----------
|
||||
AndroidManifestMod.Apply();
|
||||
AndroidProjectMod.Apply();
|
||||
#endif
|
||||
AndroidResMod.Apply();
|
||||
// #endif
|
||||
|
||||
AssetDatabase.Refresh();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 564f0bbcf1fd419585ae00ce043208dc
|
||||
timeCreated: 1706057741
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a2f4fcc4fbae4ce0b6d49d96ba953082
|
||||
timeCreated: 1706057780
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 2b8b5d4f2c934dd98f968c0fe7918c2e
|
||||
timeCreated: 1706057798
|
||||
Loading…
Reference in New Issue