AliManager.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. #if GFGZSB
  12. AliPayManagerInit.Instance.aliSDKListener = new AliPaySDKListener();
  13. #endif
  14. }
  15. //支付宝支付
  16. public void Pay(string orderStr)
  17. {
  18. AliPayManagerInit.Instance.ShowSwitchPayment(orderStr);
  19. }
  20. //微信支付
  21. public void PayVx(string appId, string mchId, string prepayId, string packageValue,
  22. string nonceStr, string timestamp, string sign, string callBackObjectName = "AliPayGameObject",
  23. string callBackFuncName = "VxPayReceive")
  24. {
  25. AliPayManagerInit.Instance.VxShowSwitchPayment(appId, mchId, prepayId, packageValue,
  26. nonceStr, timestamp, sign, callBackObjectName, callBackFuncName);
  27. }
  28. }
  29. #if GFGZSB
  30. /// <summary>
  31. /// SDK回调
  32. /// </summary>
  33. public class AliPaySDKListener : IAliSDKListener
  34. {
  35. public void AliPayReceiveAb(string message)
  36. {
  37. Debug.Log("Game.HotUpdate AliPayReceiveAb: " + message);
  38. }
  39. public void VxPayReceiveAb(string message)
  40. {
  41. if (message == "0")
  42. {
  43. ViewManager.Hide<StorePayPropView>();
  44. }
  45. else
  46. {
  47. PromptController.Instance.ShowFloatTextPrompt("支付失败");
  48. }
  49. Debug.Log("Game.HotUpdate VxPayReceiveAb: " + message);
  50. }
  51. }
  52. #endif
  53. }