|
@@ -0,0 +1,30 @@
|
|
|
+using System.Collections;
|
|
|
+using System.Collections.Generic;
|
|
|
+using UnityEngine;
|
|
|
+
|
|
|
+public class AliplayManager : UnitySingleton<AliplayManager> {
|
|
|
+
|
|
|
+ private AndroidJavaObject androidUnityTool;
|
|
|
+
|
|
|
+ public void Init()
|
|
|
+ {
|
|
|
+ androidUnityTool = new AndroidJavaObject("com.dashgame.unity.UnityTool");
|
|
|
+ androidUnityTool.Call("setResponseGameObject", this.name);
|
|
|
+ }
|
|
|
+
|
|
|
+ public void Pay(){
|
|
|
+
|
|
|
+ AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
|
|
|
+ AndroidJavaObject currentActivity = jc.GetStatic<AndroidJavaObject>("currentActivity");
|
|
|
+
|
|
|
+ //Pay(string orderInfo, Activity activity)
|
|
|
+ androidUnityTool.Call("pay", "a=3", currentActivity); // 传递的参数需与服务器协商
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ public void OnPayResult(string result)
|
|
|
+ {
|
|
|
+ //if result=9000 means pay success;
|
|
|
+ }
|
|
|
+
|
|
|
+}
|