AliPay方法参数调整

main
Yuntao Hu 2024-09-14 19:15:13 +08:00
parent c3a3bf171f
commit cfeb5a7698
2 changed files with 2 additions and 25 deletions

View File

@ -29,8 +29,6 @@ public class IAPHandle : IDetailedStoreListener
private Action<List<string>> _onRestore;
private bool _isInitialized;
AndroidJavaObject _currentActivity;
AndroidJavaObject _intent;
/// <summary>
/// 当前购买商品
@ -47,16 +45,6 @@ public class IAPHandle : IDetailedStoreListener
{
DebugUtil.LogError("异常:" + exception);
}
#if PLATFORM_ANDROID
try
{
InitializeIntent();
}
catch (Exception exception)
{
DebugUtil.LogError("异常:" + exception);
}
#endif
}
#region 初始化
@ -75,18 +63,6 @@ public class IAPHandle : IDetailedStoreListener
OnInitUnityServiceError(exception.Message);
}
}
private void InitializeIntent()
{
AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
if (unityPlayer == null)
{
Debug.LogError("unityPlayer is null");
return;
}
_currentActivity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
_intent = new AndroidJavaObject("android.content.Intent", _currentActivity, new AndroidJavaClass("com.phxh.dev.nld.PayActivity"));
}
private void OnInitUnityServiceError(string message)
{
@ -438,7 +414,8 @@ public class IAPHandle : IDetailedStoreListener
return;
}
AndroidJavaObject currentActivity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
currentActivity.Call("AliPay", orderInfo, "AliPayListener", "AliPayCallback");
AndroidJavaObject utils = new AndroidJavaObject("com.phxh.dev.nld.PayActivity");
utils.Call("AliPay", orderInfo, currentActivity, "AliPayListener", "AliPayCallback");
}
catch (Exception e)
{