AliManager.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using System;
  2. using ET;
  3. using UnityEngine;
  4. using GFGGame.Launcher;
  5. namespace GFGGame
  6. {
  7. public class AliManagerr : SingletonBase<AliManagerr>
  8. {
  9. public void Init()
  10. {
  11. AliPayManagerInit.Instance.aliSDKListener = new AliPaySDKListener();
  12. }
  13. //支付宝支付
  14. public void Pay(string orderStr)
  15. {
  16. AliPayManagerInit.Instance.ShowSwitchPayment(orderStr);
  17. }
  18. //微信支付
  19. public void PayVx(string appId, string mchId, string prepayId, string packageValue,
  20. string nonceStr, string timestamp, string sign, string callBackObjectName = "AliPayGameObject",
  21. string callBackFuncName = "VxPayReceive")
  22. {
  23. AliPayManagerInit.Instance.VxShowSwitchPayment(appId, mchId, prepayId, packageValue,
  24. nonceStr, timestamp, sign, callBackObjectName, callBackFuncName);
  25. }
  26. }
  27. /// <summary>
  28. /// SDK回调
  29. /// </summary>
  30. public class AliPaySDKListener : IAliSDKListener
  31. {
  32. public void AliPayReceiveAb(string message)
  33. {
  34. Debug.Log("Game.HotUpdate AliPayReceiveAb: " + message);
  35. }
  36. public void VxPayReceiveAb(string message)
  37. {
  38. if (message == "0")
  39. {
  40. ViewManager.Hide<StorePayPropView>();
  41. }
  42. else
  43. {
  44. PromptController.Instance.ShowFloatTextPrompt("支付失败");
  45. }
  46. Debug.Log("Game.HotUpdate VxPayReceiveAb: " + message);
  47. }
  48. }
  49. }