diff --git a/Demo/API_V2/.gitignore b/Demo/API_V2/.gitignore index 07c470e7c..857764cf6 100644 --- a/Demo/API_V2/.gitignore +++ b/Demo/API_V2/.gitignore @@ -83,3 +83,7 @@ crashlytics-build.properties # Idea .idea/ + +.vscode/ +wxbuild/ +wxbuild2/ diff --git a/Demo/API_V2/Assets/API/APISO.asset b/Demo/API_V2/Assets/API/APISO.asset index 30bbaaddf..266bed70a 100644 --- a/Demo/API_V2/Assets/API/APISO.asset +++ b/Demo/API_V2/Assets/API/APISO.asset @@ -19,8 +19,8 @@ MonoBehaviour: - {fileID: 11400000, guid: 9977a581037b84833a32b508e00eb1a2, type: 2} - {fileID: 11400000, guid: 56f316e0e10ba419bbf19bd7a68bfc4c, type: 2} - {fileID: 11400000, guid: 6f0972f5fdc56c543b23c9873d760bf5, type: 2} - - {fileID: 11400000, guid: 7ef06699cee7846b7823e4cc421418eb, type: 2} - {fileID: 11400000, guid: a461b8cd70d9e4e23ad1cc953bec31e9, type: 2} + - {fileID: 11400000, guid: 7ef06699cee7846b7823e4cc421418eb, type: 2} - {fileID: 11400000, guid: 55de20d536f8c4689bbd80553d87fe46, type: 2} - {fileID: 11400000, guid: f2c56d751bb7c4c398db7c1db352517d, type: 2} - {fileID: 11400000, guid: b4a6196f623dd4435a4f3bd70af92d06, type: 2} diff --git a/Demo/API_V2/Assets/API/Ad/AdWithAudio/AdWithAudio.cs b/Demo/API_V2/Assets/API/Ad/AdWithAudio/AdWithAudio.cs index b5e37cbb3..6f956a903 100644 --- a/Demo/API_V2/Assets/API/Ad/AdWithAudio/AdWithAudio.cs +++ b/Demo/API_V2/Assets/API/Ad/AdWithAudio/AdWithAudio.cs @@ -1,11 +1,7 @@ using System; using System.Collections; -using System.Collections.Generic; using UnityEngine; -using UnityEngine.Audio; using UnityEngine.Networking; -using UnityEngine.Networking; -using UnityEngine.UI; using WeChatWASM; public class AdWithAudio : Details diff --git a/Demo/API_V2/Assets/API/Base/Get.meta b/Demo/API_V2/Assets/API/Base/GetInfo.meta similarity index 100% rename from Demo/API_V2/Assets/API/Base/Get.meta rename to Demo/API_V2/Assets/API/Base/GetInfo.meta diff --git a/Demo/API_V2/Assets/API/Base/Get/GetInfo.cs b/Demo/API_V2/Assets/API/Base/GetInfo/GetInfo.cs similarity index 51% rename from Demo/API_V2/Assets/API/Base/Get/GetInfo.cs rename to Demo/API_V2/Assets/API/Base/GetInfo/GetInfo.cs index 54e75aeef..3f4d2d35c 100644 --- a/Demo/API_V2/Assets/API/Base/Get/GetInfo.cs +++ b/Demo/API_V2/Assets/API/Base/GetInfo/GetInfo.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; using LitJson; -using UnityEngine; using WeChatWASM; public class GetInfo : Details @@ -9,31 +6,21 @@ public class GetInfo : Details private void Start() { // 绑定额外的按钮操作 - GameManager.Instance.detailsController.BindExtraButtonAction(0, getSystemSetting); - GameManager.Instance.detailsController.BindExtraButtonAction(1, getSystemInfoSync); - GameManager.Instance.detailsController.BindExtraButtonAction(2, getSystemInfoAsync); - GameManager.Instance.detailsController.BindExtraButtonAction(3, getSystemInfo); - GameManager.Instance.detailsController.BindExtraButtonAction(4, getDeviceInfo); - GameManager.Instance.detailsController.BindExtraButtonAction(5, getAppBaseInfo); - GameManager.Instance.detailsController.BindExtraButtonAction(6, getAppAuthorizeSetting); - GameManager.Instance.detailsController.BindExtraButtonAction(7, getLaunchOptionsSync); - GameManager.Instance.detailsController.BindExtraButtonAction(8, getEnterOptionsSync); + GameManager.Instance.detailsController.BindExtraButtonAction(0, getAppAuthorizeSetting); + GameManager.Instance.detailsController.BindExtraButtonAction(1, getDeviceInfo); + GameManager.Instance.detailsController.BindExtraButtonAction(2, getWindowInfo); + GameManager.Instance.detailsController.BindExtraButtonAction(3, getAppBaseInfo); + // GameManager.Instance.detailsController.BindExtraButtonAction(1, getSystemInfoSync); + // GameManager.Instance.detailsController.BindExtraButtonAction(2, getSystemInfoAsync); + // GameManager.Instance.detailsController.BindExtraButtonAction(3, getSystemInfo); + GameManager.Instance.detailsController.BindExtraButtonAction(4, getLaunchOptionsSync); + GameManager.Instance.detailsController.BindExtraButtonAction(5, getEnterOptionsSync); } // 测试 API protected override void TestAPI(string[] args) { - getWindowInfo(); - } - - public void getWindowInfo() - { - var res = WX.GetWindowInfo(); - - // 访问成功,显示结果 - WX.ShowModal( - new ShowModalOption() { content = "Access Success, Result: " + JsonMapper.ToJson(res) } - ); + getSystemSetting(); } public void getSystemSetting() @@ -46,9 +33,9 @@ public void getSystemSetting() ); } - public void getSystemInfoSync() + public void getAppAuthorizeSetting() { - var res = WX.GetSystemInfoSync(); + var res = WX.GetAppAuthorizeSetting(); // 访问成功,显示结果 WX.ShowModal( @@ -56,58 +43,6 @@ public void getSystemInfoSync() ); } - public void getSystemInfoAsync() - { - WX.GetSystemInfoAsync( - new GetSystemInfoAsyncOption - { - success = (res) => - { - WX.ShowModal( - new ShowModalOption() - { - content = "Access Success, Result: " + JsonMapper.ToJson(res) - } - ); - }, - fail = (res) => - { - Debug.Log("fail:" + res.errMsg); - }, - complete = (res) => - { - Debug.Log("complete!"); - } - } - ); - } - - public void getSystemInfo() - { - WX.GetSystemInfo( - new GetSystemInfoOption - { - success = (res) => - { - WX.ShowModal( - new ShowModalOption() - { - content = "Access Success, Result: " + JsonMapper.ToJson(res) - } - ); - }, - fail = (res) => - { - Debug.Log("fail:" + res.errMsg); - }, - complete = (res) => - { - Debug.Log("complete!"); - } - } - ); - } - public void getDeviceInfo() { var res = WX.GetDeviceInfo(); @@ -118,9 +53,9 @@ public void getDeviceInfo() ); } - public void getAppBaseInfo() + public void getWindowInfo() { - var res = WX.GetAppBaseInfo(); + var res = WX.GetWindowInfo(); // 访问成功,显示结果 WX.ShowModal( @@ -128,9 +63,9 @@ public void getAppBaseInfo() ); } - public void getAppAuthorizeSetting() + public void getAppBaseInfo() { - var res = WX.GetAppAuthorizeSetting(); + var res = WX.GetAppBaseInfo(); // 访问成功,显示结果 WX.ShowModal( @@ -138,9 +73,71 @@ public void getAppAuthorizeSetting() ); } - public void getEnterOptionsSync() + // public void getSystemInfoSync() + // { + // var res = WX.GetSystemInfoSync(); + // + // // 访问成功,显示结果 + // WX.ShowModal( + // new ShowModalOption() { content = "Access Success, Result: " + JsonMapper.ToJson(res) } + // ); + // } + // + // public void getSystemInfoAsync() + // { + // WX.GetSystemInfoAsync( + // new GetSystemInfoAsyncOption + // { + // success = (res) => + // { + // WX.ShowModal( + // new ShowModalOption() + // { + // content = "Access Success, Result: " + JsonMapper.ToJson(res) + // } + // ); + // }, + // fail = (res) => + // { + // Debug.Log("fail:" + res.errMsg); + // }, + // complete = (res) => + // { + // Debug.Log("complete!"); + // } + // } + // ); + // } + // + // public void getSystemInfo() + // { + // WX.GetSystemInfo( + // new GetSystemInfoOption + // { + // success = (res) => + // { + // WX.ShowModal( + // new ShowModalOption() + // { + // content = "Access Success, Result: " + JsonMapper.ToJson(res) + // } + // ); + // }, + // fail = (res) => + // { + // Debug.Log("fail:" + res.errMsg); + // }, + // complete = (res) => + // { + // Debug.Log("complete!"); + // } + // } + // ); + // } + + public void getLaunchOptionsSync() { - var res = WX.GetEnterOptionsSync(); + var res = WX.GetLaunchOptionsSync(); // 访问成功,显示结果 WX.ShowModal( @@ -148,9 +145,9 @@ public void getEnterOptionsSync() ); } - public void getLaunchOptionsSync() + public void getEnterOptionsSync() { - var res = WX.GetLaunchOptionsSync(); + var res = WX.GetEnterOptionsSync(); // 访问成功,显示结果 WX.ShowModal( diff --git a/Demo/API_V2/Assets/API/Base/Get/GetInfo.cs.meta b/Demo/API_V2/Assets/API/Base/GetInfo/GetInfo.cs.meta similarity index 100% rename from Demo/API_V2/Assets/API/Base/Get/GetInfo.cs.meta rename to Demo/API_V2/Assets/API/Base/GetInfo/GetInfo.cs.meta diff --git a/Demo/API_V2/Assets/API/Base/Get/GetInfoSO.asset b/Demo/API_V2/Assets/API/Base/GetInfo/GetInfoSO.asset similarity index 62% rename from Demo/API_V2/Assets/API/Base/Get/GetInfoSO.asset rename to Demo/API_V2/Assets/API/Base/GetInfo/GetInfoSO.asset index 9f27e6ab5..a53c872fd 100644 --- a/Demo/API_V2/Assets/API/Base/Get/GetInfoSO.asset +++ b/Demo/API_V2/Assets/API/Base/GetInfo/GetInfoSO.asset @@ -14,20 +14,16 @@ MonoBehaviour: m_EditorClassIdentifier: entryScriptTypeName: GetInfo entryName: "\u83B7\u53D6\u7CFB\u7EDF\u548C\u8BBE\u5907\u4FE1\u606F" - entryAPI: "getWindowInfo\uFF5CgetSystemSetting\ngetSystemInfoSync \uFF5CgetSystemInfoAsync\ngetSystemInfo - \uFF5CgetDeviceInfo\ngetAppBaseInfo \uFF5CgetAppAuthorizeSetting\ngetEnterOptionsSync - \uFF5C getLaunchOptionsSync" - entryDescription: + entryAPI: "getSystemSetting\uFF5CgetAppAuthorizeSetting\ngetDeviceInfo\uFF5CgetWindowInfo\ngetAppBaseInfo\ngetEnterOptionsSync\uFF5CgetLaunchOptionsSync" + entryDescription: "\u4ECE\u57FA\u7840\u5E93 2.20.1 \u5F00\u59CB\uFF0Cwx.getSystemInfo(Sync/Async)\u505C\u6B62\u7EF4\u62A4 + " optionList: [] - initialButtonText: "\u83B7\u53D6\u7A97\u53E3\u4FE1\u606F" + initialButtonText: "\u83B7\u53D6\u8BBE\u5907\u8BBE\u7F6E" extraButtonList: - - buttonText: "\u83B7\u53D6\u8BBE\u5907\u8BBE\u7F6E " - - buttonText: "\u83B7\u53D6\u7CFB\u7EDF\u4FE1\u606F-\u540C\u6B65" - - buttonText: "\u83B7\u53D6\u7CFB\u7EDF\u4FE1\u606F-\u5F02\u6B65" - - buttonText: "\u83B7\u53D6\u7CFB\u7EDF\u4FE1\u606F" + - buttonText: "\u83B7\u53D6\u5FAE\u4FE1APP\u6388\u6743\u8BBE\u7F6E" - buttonText: "\u83B7\u53D6\u8BBE\u5907\u57FA\u7840\u4FE1\u606F" + - buttonText: "\u83B7\u53D6\u7A97\u53E3\u4FE1\u606F" - buttonText: "\u83B7\u53D6\u5FAE\u4FE1APP\u57FA\u7840\u4FE1\u606F" - - buttonText: "\u83B7\u53D6\u5FAE\u4FE1APP\u6388\u6743\u8BBE\u7F6E" - buttonText: "\u83B7\u53D6\u5C0F\u6E38\u620F\u51B7\u542F\u52A8\u65F6\u7684\u53C2\u6570" - buttonText: "\u83B7\u53D6\u5C0F\u6E38\u620F\u6253\u5F00\u7684\u53C2\u6570" initialResultList: [] diff --git a/Demo/API_V2/Assets/API/Base/Get/GetInfoSO.asset.meta b/Demo/API_V2/Assets/API/Base/GetInfo/GetInfoSO.asset.meta similarity index 100% rename from Demo/API_V2/Assets/API/Base/Get/GetInfoSO.asset.meta rename to Demo/API_V2/Assets/API/Base/GetInfo/GetInfoSO.asset.meta diff --git a/Demo/API_V2/Assets/API/Facility/FacilitySO.asset b/Demo/API_V2/Assets/API/Facility/FacilitySO.asset index bfec71ac1..1d7a79ba0 100644 --- a/Demo/API_V2/Assets/API/Facility/FacilitySO.asset +++ b/Demo/API_V2/Assets/API/Facility/FacilitySO.asset @@ -15,10 +15,10 @@ MonoBehaviour: categoryName: "\u8BBE\u5907" categorySprite: {fileID: 21300000, guid: fcbb6947b033746dabecaec0f84b0434, type: 3} entryList: - - {fileID: 11400000, guid: a24af43ae51914d26b0bf637c283dab2, type: 2} - - {fileID: 11400000, guid: 4eba2c9f2f2064e4081be74302ca4c33, type: 2} - {fileID: 11400000, guid: bbbc9b983d6d34ad3bac2921509f612f, type: 2} - {fileID: 11400000, guid: c17ae0ce755f04419b700825b20fd386, type: 2} + - {fileID: 11400000, guid: a24af43ae51914d26b0bf637c283dab2, type: 2} + - {fileID: 11400000, guid: 4eba2c9f2f2064e4081be74302ca4c33, type: 2} - {fileID: 11400000, guid: ac09abff5d8bc48bbabd08bde820b58b, type: 2} - {fileID: 11400000, guid: 3bf339b994c544db3860ddf0a0dc8e20, type: 2} - {fileID: 11400000, guid: e92d94924be504167a342e42e1162f21, type: 2} diff --git a/Demo/API_V2/Assets/API/Facility/Screen/Screen.cs b/Demo/API_V2/Assets/API/Facility/Screen/Screen.cs index 376225d5d..f00e2589f 100644 --- a/Demo/API_V2/Assets/API/Facility/Screen/Screen.cs +++ b/Demo/API_V2/Assets/API/Facility/Screen/Screen.cs @@ -10,7 +10,7 @@ public class Screen : Details private bool _isListening1 = false; private System.Random random = new System.Random(); - private readonly Action _onUserCaptureScreen = (res) => + private readonly Action _onUserCaptureScreen = (res) => { WX.ShowToast(new ShowToastOption { title = "截屏触发" }); var result = "_onUserCaptureScreen\n" + JsonMapper.ToJson(res); diff --git a/Demo/API_V2/Assets/API/FileSystem/FileSystemSO.asset b/Demo/API_V2/Assets/API/FileSystem/FileSystemSO.asset index de37f67d4..9ebe077a8 100644 --- a/Demo/API_V2/Assets/API/FileSystem/FileSystemSO.asset +++ b/Demo/API_V2/Assets/API/FileSystem/FileSystemSO.asset @@ -24,7 +24,7 @@ MonoBehaviour: - {fileID: 11400000, guid: 65ab1b01a722b4542a14fcf9decca3de, type: 2} - {fileID: 11400000, guid: 19b80cb144f0c4ea28a4ddca7a2c2f09, type: 2} - {fileID: 11400000, guid: 0aa5d76237c844275add1612c47bddaa, type: 2} - - {fileID: 11400000, guid: 65a826f5f949544d8990e673231bb80f, type: 2} - {fileID: 11400000, guid: 73c05fc1ffae94ec1b69a00ee261d529, type: 2} + - {fileID: 11400000, guid: 65a826f5f949544d8990e673231bb80f, type: 2} - {fileID: 11400000, guid: 3a901e80b59ad4aafbe373ee6a8df2d8, type: 2} - {fileID: 11400000, guid: e7ea0be62dc6543b0a8dc629489c5e7e, type: 2} diff --git a/Demo/API_V2/Assets/API/Media/WXVideo/WXvideo.cs b/Demo/API_V2/Assets/API/Media/WXVideo/WXvideo.cs index 48f3cb794..dcbd8e81d 100644 --- a/Demo/API_V2/Assets/API/Media/WXVideo/WXvideo.cs +++ b/Demo/API_V2/Assets/API/Media/WXVideo/WXvideo.cs @@ -19,7 +19,7 @@ void Start() private void AutoPlayVideo() { - var systemInfo = WX.GetSystemInfoSync(); + var windowInfo = GameManager.Instance.WindowInfo; _video = WX.CreateVideo( new WXCreateVideoParam() { @@ -31,8 +31,8 @@ private void AutoPlayVideo() autoplay = true, showCenterPlayBtn = false, underGameView = true, - width = ((int)systemInfo.screenWidth), - height = ((int)systemInfo.screenHeight), + width = ((int)windowInfo.screenWidth), + height = ((int)windowInfo.screenHeight), } ); _video.OnPlay(() => diff --git a/Demo/API_V2/Assets/API/Network/UDPSocket/UDPSocket.cs b/Demo/API_V2/Assets/API/Network/UDPSocket/UDPSocket.cs index 9cc52d771..0bda08a80 100644 --- a/Demo/API_V2/Assets/API/Network/UDPSocket/UDPSocket.cs +++ b/Demo/API_V2/Assets/API/Network/UDPSocket/UDPSocket.cs @@ -1,6 +1,3 @@ -using System; -using System.Collections.Generic; -using LitJson; using UnityEngine; using WeChatWASM; @@ -84,9 +81,7 @@ private void write() { if (_udpSocket != null && _connected) { - Debug.LogError("接口有bug暂未修复 当前为placeholder"); - /* - UDPSocketWriteOption option = new UDPSocketWriteOption() + UDPSocketSendOption option = new UDPSocketSendOption() { address = "www.oooceanworld.com", port = 8101 @@ -100,7 +95,7 @@ private void write() option.message = _bufferData; } _udpSocket.Write(option); - */ + Debug.Log("Message: " + option.message); } else { diff --git a/Demo/API_V2/Assets/API/Network/UnityWebRequest/WebRequest.cs b/Demo/API_V2/Assets/API/Network/UnityWebRequest/WebRequest.cs index eb254f09a..e40ac65a7 100644 --- a/Demo/API_V2/Assets/API/Network/UnityWebRequest/WebRequest.cs +++ b/Demo/API_V2/Assets/API/Network/UnityWebRequest/WebRequest.cs @@ -42,7 +42,7 @@ IEnumerator Get() yield return webRequest.SendWebRequest(); - if (webRequest.isHttpError || webRequest.isNetworkError) + if (webRequest.result is UnityWebRequest.Result.ProtocolError or UnityWebRequest.Result.ConnectionError) Debug.Log(webRequest.error); else { @@ -62,7 +62,7 @@ IEnumerator Post() yield return webRequest.SendWebRequest(); - if (webRequest.isHttpError || webRequest.isNetworkError) + if (webRequest.result is UnityWebRequest.Result.ProtocolError or UnityWebRequest.Result.ConnectionError) Debug.Log(webRequest.error); else { diff --git a/Demo/API_V2/Assets/API/OpenInterface/GameClub/GameClub.cs b/Demo/API_V2/Assets/API/OpenInterface/GameClub/GameClub.cs index 9b7775f54..5f8d398f2 100644 --- a/Demo/API_V2/Assets/API/OpenInterface/GameClub/GameClub.cs +++ b/Demo/API_V2/Assets/API/OpenInterface/GameClub/GameClub.cs @@ -1,8 +1,5 @@ using System; using System.Collections; -using System.Collections.Generic; -using System.Threading; -using LitJson; using UnityEngine; using WeChatWASM; @@ -29,17 +26,17 @@ IEnumerator CreateGameClubButton(float delay) Vector2 size = GameManager.Instance.detailsController.GetInitialButtonSize(); Vector2 position = GameManager.Instance.detailsController.GetButtonPosition(0); - var systemInfo = WX.GetSystemInfoSync(); + var windowInfo = GameManager.Instance.WindowInfo; _gameClubButton = WX.CreateGameClubButton( new WXCreateGameClubButtonParam() { type = GameClubButtonType.text, style = new GameClubButtonStyle() { - left = Math.Abs((int)(position.x / systemInfo.pixelRatio)), - top = Math.Abs((int)(position.y / systemInfo.pixelRatio)), - width = (int)(size.x * systemInfo.screenWidth / 1080f), - height = (int)(size.y * systemInfo.screenWidth / 1080f), + left = Math.Abs((int)(position.x / windowInfo.pixelRatio)), + top = Math.Abs((int)(position.y / windowInfo.pixelRatio)), + width = (int)(size.x * windowInfo.screenWidth / 1080f), + height = (int)(size.y * windowInfo.screenWidth / 1080f), } } ); @@ -82,7 +79,7 @@ private void getGameClubData() WX.GetGameClubData(option); } - private bool _isGameClubShow = false; + // private bool _isGameClubShow = false; // 切换游戏圈按钮显示/隐藏 private void GameClubButtonSwitch() diff --git a/Demo/API_V2/Assets/API/OpenInterface/SystemButton/SystemButton.cs b/Demo/API_V2/Assets/API/OpenInterface/SystemButton/SystemButton.cs index 807352672..fb62fa47a 100644 --- a/Demo/API_V2/Assets/API/OpenInterface/SystemButton/SystemButton.cs +++ b/Demo/API_V2/Assets/API/OpenInterface/SystemButton/SystemButton.cs @@ -1,7 +1,6 @@ using System; using System.Collections; using System.Collections.Generic; -using System.Threading; using UnityEngine; using WeChatWASM; @@ -59,7 +58,7 @@ IEnumerator CreateFeedbackButton(float delay) Vector2 size = GameManager.Instance.detailsController.GetInitialButtonSize(); Vector2 position = GameManager.Instance.detailsController.GetButtonPosition(0); - var systemInfo = WX.GetSystemInfoSync(); + var windowInfo = GameManager.Instance.WindowInfo; _feedbackButton = WX.CreateFeedbackButton( new CreateOpenSettingButtonOption() { @@ -67,10 +66,10 @@ IEnumerator CreateFeedbackButton(float delay) text = "", style = new OptionStyle() { - left = Math.Abs((int)(position.x / systemInfo.pixelRatio)), - top = Math.Abs((int)(position.y / systemInfo.pixelRatio)), - width = (int)(size.x * systemInfo.screenWidth / 1080f), - height = (int)(size.y * systemInfo.screenWidth / 1080f), + left = Math.Abs((int)(position.x / windowInfo.pixelRatio)), + top = Math.Abs((int)(position.y / windowInfo.pixelRatio)), + width = (int)(size.x * windowInfo.screenWidth / 1080f), + height = (int)(size.y * windowInfo.screenWidth / 1080f), } } ); @@ -89,7 +88,7 @@ protected override void TestAPI(string[] args) ); } - private bool _isFeedbackShow = true; + // private bool _isFeedbackShow = true; // 切换意见反馈按钮显示/隐藏 private void FeedbackButtonSwitch() diff --git a/Demo/API_V2/Assets/API/OpenInterface/UserInfo/UserInfo.cs b/Demo/API_V2/Assets/API/OpenInterface/UserInfo/UserInfo.cs index 1cd9e79f8..abb6217f8 100644 --- a/Demo/API_V2/Assets/API/OpenInterface/UserInfo/UserInfo.cs +++ b/Demo/API_V2/Assets/API/OpenInterface/UserInfo/UserInfo.cs @@ -30,9 +30,9 @@ IEnumerator SetTimeout(float delay) Vector2 position = GameManager.Instance.detailsController.GetButtonPosition(-1); Debug.Log(position); Debug.Log(size); - var systemInfo = WX.GetSystemInfoSync(); - var canvasWidth = (int)(systemInfo.screenWidth * systemInfo.pixelRatio); - var canvasHeight = (int)(systemInfo.screenHeight * systemInfo.pixelRatio); + var windowInfo = GameManager.Instance.WindowInfo; + var canvasWidth = (int)(windowInfo.screenWidth * windowInfo.pixelRatio); + var canvasHeight = (int)(windowInfo.screenHeight * windowInfo.pixelRatio); _button = WX.CreateUserInfoButton( Math.Abs((int)position.x), Math.Abs((int)position.y), diff --git a/Demo/API_V2/Assets/API/Payment/requestMidasPayment.meta b/Demo/API_V2/Assets/API/Payment/RequestMidasPayment.meta similarity index 100% rename from Demo/API_V2/Assets/API/Payment/requestMidasPayment.meta rename to Demo/API_V2/Assets/API/Payment/RequestMidasPayment.meta diff --git a/Demo/API_V2/Assets/API/Payment/requestMidasPayment/RequestMidasPayment.cs b/Demo/API_V2/Assets/API/Payment/RequestMidasPayment/RequestMidasPayment.cs similarity index 100% rename from Demo/API_V2/Assets/API/Payment/requestMidasPayment/RequestMidasPayment.cs rename to Demo/API_V2/Assets/API/Payment/RequestMidasPayment/RequestMidasPayment.cs diff --git a/Demo/API_V2/Assets/API/Payment/requestMidasPayment/RequestMidasPayment.cs.meta b/Demo/API_V2/Assets/API/Payment/RequestMidasPayment/RequestMidasPayment.cs.meta similarity index 100% rename from Demo/API_V2/Assets/API/Payment/requestMidasPayment/RequestMidasPayment.cs.meta rename to Demo/API_V2/Assets/API/Payment/RequestMidasPayment/RequestMidasPayment.cs.meta diff --git a/Demo/API_V2/Assets/API/Payment/requestMidasPayment/RequestMidasPaymentSO.asset b/Demo/API_V2/Assets/API/Payment/RequestMidasPayment/RequestMidasPaymentSO.asset similarity index 100% rename from Demo/API_V2/Assets/API/Payment/requestMidasPayment/RequestMidasPaymentSO.asset rename to Demo/API_V2/Assets/API/Payment/RequestMidasPayment/RequestMidasPaymentSO.asset diff --git a/Demo/API_V2/Assets/API/Payment/requestMidasPayment/RequestMidasPaymentSO.asset.meta b/Demo/API_V2/Assets/API/Payment/RequestMidasPayment/RequestMidasPaymentSO.asset.meta similarity index 100% rename from Demo/API_V2/Assets/API/Payment/requestMidasPayment/RequestMidasPaymentSO.asset.meta rename to Demo/API_V2/Assets/API/Payment/RequestMidasPayment/RequestMidasPaymentSO.asset.meta diff --git a/Demo/API_V2/Assets/Scenes/MainScene.unity b/Demo/API_V2/Assets/Scenes/MainScene.unity index 2f6830b24..1d3f8729d 100644 --- a/Demo/API_V2/Assets/Scenes/MainScene.unity +++ b/Demo/API_V2/Assets/Scenes/MainScene.unity @@ -38,7 +38,7 @@ RenderSettings: m_ReflectionIntensity: 1 m_CustomReflection: {fileID: 0} m_Sun: {fileID: 170076734} - m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1} + m_IndirectSpecularColor: {r: 0.44657886, g: 0.49641275, b: 0.5748176, a: 1} m_UseRadianceAmbientProbe: 0 --- !u!157 &3 LightmapSettings: @@ -4354,8 +4354,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 540, y: -132.5} - m_SizeDelta: {x: 1080, y: 265} + m_AnchoredPosition: {x: 540, y: -131.21495} + m_SizeDelta: {x: 1000, y: 262.4299} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &212991225 MonoBehaviour: @@ -4426,9 +4426,9 @@ MonoBehaviour: m_IgnoreLayout: 0 m_MinWidth: -1 m_MinHeight: -1 - m_PreferredWidth: -1 + m_PreferredWidth: 1000 m_PreferredHeight: -1 - m_FlexibleWidth: 1 + m_FlexibleWidth: -1 m_FlexibleHeight: 1 m_LayoutPriority: 1 --- !u!1 &216882796 @@ -6075,7 +6075,7 @@ LightingSettings: m_AlbedoBoost: 1 m_IndirectOutputScale: 1 m_UsingShadowmask: 1 - m_BakeBackend: 1 + m_BakeBackend: 2 m_LightmapMaxSize: 512 m_BakeResolution: 10 m_Padding: 2 @@ -7128,7 +7128,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 540, y: -978} + m_AnchoredPosition: {x: 540, y: -975.42993} m_SizeDelta: {x: 1080, y: 150} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &381792922 @@ -7598,7 +7598,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 540, y: -621} + m_AnchoredPosition: {x: 540, y: -618.42993} m_SizeDelta: {x: 1080, y: 60} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &397394217 @@ -13699,8 +13699,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 540, y: -444.5} - m_SizeDelta: {x: 1080, y: 265} + m_AnchoredPosition: {x: 540, y: -443.21497} + m_SizeDelta: {x: 1080, y: 262.4299} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &685545881 MonoBehaviour: @@ -24723,8 +24723,8 @@ MonoBehaviour: m_EditorClassIdentifier: detailsController: {fileID: 0} font: {fileID: 0} - _mainCanvas: {fileID: 0} - _detailsCanvas: {fileID: 0} + mainCanvas: {fileID: 0} + detailsCanvas: {fileID: 0} --- !u!4 &1274177269 Transform: m_ObjectHideFlags: 0 @@ -24850,7 +24850,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 540, y: -745} + m_AnchoredPosition: {x: 540, y: -742.42993} m_SizeDelta: {x: 1080, y: 160} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1282634320 @@ -26210,7 +26210,7 @@ RectTransform: m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} m_AnchoredPosition: {x: 540, y: -250} - m_SizeDelta: {x: 1080, y: 1670} + m_SizeDelta: {x: 1080, y: 1054.0748} m_Pivot: {x: 0.5, y: 1} --- !u!114 &1360900113 MonoBehaviour: @@ -29690,7 +29690,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 540, y: -1067} + m_AnchoredPosition: {x: 540, y: -1064.4299} m_SizeDelta: {x: 1080, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1590868810 @@ -39117,7 +39117,7 @@ RectTransform: m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: -603} + m_SizeDelta: {x: 0, y: 10.355103} m_Pivot: {x: 0, y: 1} --- !u!114 &2027702115 MonoBehaviour: @@ -39686,7 +39686,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 540, y: -864} + m_AnchoredPosition: {x: 540, y: -861.42993} m_SizeDelta: {x: 1080, y: 50} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &2054762711 diff --git a/Demo/API_V2/Assets/Scripts/APIController.cs b/Demo/API_V2/Assets/Scripts/APIController.cs index ec9ad2a36..cc44ce0ef 100644 --- a/Demo/API_V2/Assets/Scripts/APIController.cs +++ b/Demo/API_V2/Assets/Scripts/APIController.cs @@ -29,7 +29,7 @@ private void Start() // 根据系统安全区域调整标题的位置 title.anchoredPosition = new Vector2( title.anchoredPosition.x, - -125f - (float)GameManager.Instance.systemInfo.safeArea.top + -125f - (float)GameManager.Instance.WindowInfo.safeArea.top ); } diff --git a/Demo/API_V2/Assets/Scripts/DetailsController.cs b/Demo/API_V2/Assets/Scripts/DetailsController.cs index 5bd43a251..2967703e9 100644 --- a/Demo/API_V2/Assets/Scripts/DetailsController.cs +++ b/Demo/API_V2/Assets/Scripts/DetailsController.cs @@ -64,18 +64,16 @@ public class DetailsController : MonoBehaviour private void Start() { - var res = WX.GetMenuButtonBoundingClientRect(); - var info = WX.GetSystemInfoSync(); - float height = (float)res.height; - float safeArea = (float)GameManager.Instance.systemInfo.safeArea.top; + var clientRect = GameManager.Instance.MenuButtonBoundingClientRect; + var info = GameManager.Instance.WindowInfo; // 根据系统安全区域调整标题和返回按钮的位置 titleTransform.anchoredPosition = new Vector2( titleTransform.anchoredPosition.x, - -(float)((res.top + res.height / 4) * info.pixelRatio) + -(float)((clientRect.top + clientRect.height / 4) * info.pixelRatio) ); backButtonTransform.anchoredPosition = new Vector2( backButtonTransform.anchoredPosition.x, - -(float)((res.top + res.height / 4) * info.pixelRatio) + -(float)((clientRect.top + clientRect.height / 4) * info.pixelRatio) ); } @@ -104,42 +102,6 @@ private void ClearDetails() RemoveAllResult(); } - // 获取gap block并修改其最低高度 - public void getGapBlock(GameObject parentGameObject) - { - var canvas = parentGameObject.GetComponentInParent(); - Transform foreTransform = canvas.transform.Find("Foreground"); - if (foreTransform != null) - { - Transform scrollViewTransform = foreTransform.Find("Scroll View"); - if (scrollViewTransform != null) - { - Transform viewportTransform = scrollViewTransform.Find("Viewport"); - if (viewportTransform != null) - { - Transform contentTransform = viewportTransform.Find("Content"); - if (contentTransform != null) - { - Transform[] gapBlockTransforms = new Transform[2]; - gapBlockTransforms[0] = contentTransform.Find("Gap Block"); - gapBlockTransforms[1] = contentTransform.Find("Gap Block2"); - - foreach (Transform gapBlockTransform in gapBlockTransforms) - { - if (gapBlockTransform != null) - { - GameObject gapBlockObject = gapBlockTransform.gameObject; - LayoutElement layoutElement = - gapBlockObject.GetComponent(); - layoutElement.minHeight = 150; - } - } - } - } - } - } - } - // 初始化详情信息 public void Init(EntrySO so) { @@ -150,20 +112,6 @@ public void Init(EntrySO so) APIText.text = so.entryAPI; descriptionText.text = so.entryDescription; - // 限制 Text 的宽度 - Transform parentTransform = descriptionText.transform.parent; - GameObject parentGameObject = parentTransform.gameObject; - LayoutElement layoutElement = parentGameObject.GetComponent(); - if (layoutElement != null) - { - layoutElement.ignoreLayout = true; - - RectTransform rectTransform = parentGameObject.GetComponent(); - rectTransform.sizeDelta = new Vector2(1000f, rectTransform.sizeDelta.y); - - getGapBlock(parentGameObject); - } - _details = (Details)gameObject.AddComponent(entrySO.EntryScriptType); _details.Init(entrySO); @@ -189,13 +137,6 @@ public void Init(EntrySO so) extraButtonBlock.GetComponentInChildren().text = button.buttonText; } - // 添加一个新的透明按钮 - var extraButton = Instantiate(buttonBlockPrefab, buttonsTransform); - extraButtonBlockObjects.Add(extraButton); - extraButton.GetComponentInChildren().text = ""; - Color transparentColor = new Color(0, 0, 0, 0); - extraButton.GetComponentInChildren