diff --git a/Editor/GuruManager/Helper/PushIconHelper.cs b/Editor/GuruManager/Helper/AndroidPushIconHelper.cs similarity index 82% rename from Editor/GuruManager/Helper/PushIconHelper.cs rename to Editor/GuruManager/Helper/AndroidPushIconHelper.cs index 4800772..955d655 100644 --- a/Editor/GuruManager/Helper/PushIconHelper.cs +++ b/Editor/GuruManager/Helper/AndroidPushIconHelper.cs @@ -7,7 +7,7 @@ namespace Guru.Editor using UnityEngine; using System.IO; - public class PushIconHelper + public class AndroidPushIconHelper { public static readonly int targetWidth = 96; // 目标宽度 public static readonly int targetHeight = 96; @@ -50,19 +50,28 @@ namespace Guru.Editor { MakeTextureReadable(source); - Texture2D result = new Texture2D(newWidth, newHeight); - Color[] newColors = new Color[newWidth * newHeight]; - - for (int y = 0; y < newHeight; y++) - { - for (int x = 0; x < newWidth; x++) - { - // 应用一些缩放逻辑来获取新的颜色值 - newColors[x + y * newWidth] = source.GetPixelBilinear((float)x / newWidth * source.width, (float)y / newHeight * source.height); - } - } - - result.SetPixels(newColors); + // Texture2D result = new Texture2D(newWidth, newHeight); + // Color[] newColors = new Color[newWidth * newHeight]; + // + // for (int y = 0; y < newHeight; y++) + // { + // for (int x = 0; x < newWidth; x++) + // { + // // 应用一些缩放逻辑来获取新的颜色值 + // newColors[x + y * newWidth] = source.GetPixelBilinear((float)x / newWidth * source.width, (float)y / newHeight * source.height); + // } + // } + // + // result.SetPixels(newColors); + // result.Apply(); + // return result; + + + RenderTexture rt=new RenderTexture(newWidth, newHeight,24); + RenderTexture.active = rt; + Graphics.Blit(source,rt); + Texture2D result=new Texture2D(newWidth,newHeight); + result.ReadPixels(new Rect(0,0,newWidth,newHeight),0,0); result.Apply(); return result; } diff --git a/Editor/GuruManager/Helper/PushIconHelper.cs.meta b/Editor/GuruManager/Helper/AndroidPushIconHelper.cs.meta similarity index 100% rename from Editor/GuruManager/Helper/PushIconHelper.cs.meta rename to Editor/GuruManager/Helper/AndroidPushIconHelper.cs.meta diff --git a/Editor/GuruManager/Helper/MainManifestDoc.cs b/Editor/GuruManager/Helper/MainManifestDoc.cs index 3a6177d..f4b79f3 100644 --- a/Editor/GuruManager/Helper/MainManifestDoc.cs +++ b/Editor/GuruManager/Helper/MainManifestDoc.cs @@ -76,9 +76,12 @@ namespace Guru.Editor _isReady = false; if (File.Exists(docPath)) { - _docPath = docPath; var xmlStr = File.ReadAllText(docPath); - ReadFromXml(xmlStr); + ReadFromXml(xmlStr, docPath); + } + else + { + Debug.LogError($"--- File not found: {docPath}"); } } @@ -87,7 +90,7 @@ namespace Guru.Editor { _doc = new XmlDocument(); _doc.LoadXml(xmlStr); - _docPath = docPath; + if(!string.IsNullOrEmpty(docPath)) _docPath = docPath; Init(); } @@ -117,10 +120,10 @@ namespace Guru.Editor { if (_isReady) { - if(string.IsNullOrEmpty(docPath)) docPath = _docPath; - if (!string.IsNullOrEmpty(docPath)) + if (!string.IsNullOrEmpty(docPath)) _docPath = docPath; + if (!string.IsNullOrEmpty(_docPath)) { - var dir = Directory.GetParent(docPath); + var dir = Directory.GetParent(_docPath); if(!dir.Exists) dir.Create(); _doc.Save(_docPath); @@ -228,6 +231,14 @@ namespace Guru.Editor item.SetAttribute(valueName, NamespaceAndroid, value); } + + + public void SetPermission(string key, string value, string valueName = "value", string keyName = "name") + { + _metadataList = _applicationNode?.SelectNodes("meta-data") ?? null; + + + } #endregion diff --git a/Editor/GuruManager/Manager/GuruSDKManager.cs b/Editor/GuruManager/Manager/GuruSDKManager.cs index 848edd6..8a8197a 100644 --- a/Editor/GuruManager/Manager/GuruSDKManager.cs +++ b/Editor/GuruManager/Manager/GuruSDKManager.cs @@ -395,10 +395,13 @@ namespace Guru.Editor GUI_OnConfigEnabled(); } + +#if UNITY_ANDROID GUILayout.Space(10); - // Push - GUI_PushIconMaker(); + GUI_PushIconMaker(); +#endif + } @@ -1017,9 +1020,8 @@ namespace Guru.Editor private void GUI_PushIconMaker() { float btnH = 24; - - - _showSegmentPush = EditorGUILayout.Foldout(_showSegmentPush, "[ Push Icon ]"); + + _showSegmentPush = EditorGUILayout.Foldout(_showSegmentPush, "[ Android Push Icon ]"); // EditorGUILayout.LabelField("[ Push Icon ]", StyleItemTitle); @@ -1040,7 +1042,7 @@ namespace Guru.Editor { GUI_Button("CREATE PUSH ASSETS", () => { - if (PushIconHelper.SetPushIconAssets(_pushIconTexture, _pushIconColor)) + if (AndroidPushIconHelper.SetPushIconAssets(_pushIconTexture, _pushIconColor)) { EditorUtility.DisplayDialog("Set Push Icon", "Push Icon assets created success!", "OK"); }