public void Pay(EB.IAP.Item item, EB.IAP.Transaction transaction, System.Action <int> callback) { EB.Debug.Log("WeChatSDKManager.Pay"); if (!mInitialized) { EB.Debug.LogError("WeChatSDKManager.Pay: not initialized"); callback(WeChatSDKResultCode.PayFailed); return; } mPayCallback += callback; object extraInfo = EB.JSON.Parse(transaction.payload); string partnerid = EB.Dot.String("partnerid", extraInfo, string.Empty); string prepayid = EB.Dot.String("prepayid", extraInfo, string.Empty); string package = EB.Dot.String("package", extraInfo, string.Empty); string noncestr = EB.Dot.String("noncestr", extraInfo, string.Empty); string timestamp = EB.Dot.String("timestamp", extraInfo, string.Empty); string sign = EB.Dot.String("sign", extraInfo, string.Empty); int je = (int)item.cost; string mark = transaction.transactionId; string name = item.longName; EB.Debug.Log("WeChatSDKManager.Pay: je = {0}, mark={1}, name = {2}", je, mark, name); WeChatSDK.Pay(partnerid, prepayid, package, noncestr, timestamp, sign); }
public void Init(Action <string, bool> callback, Action <string> tipCallBack) { EB.Debug.Log("WeChatSDKManager.Init"); if (mInitialized) { EB.Debug.LogWarning("WeChatSDKManager.Init: Initialized"); callback(null, true); return; } if (Application.platform != RuntimePlatform.Android) { callback(null, false); return; } mInitCallback += callback; mTipCallback += tipCallBack; Hub.RunInBackground = true; new GameObject("WeChat_listener", typeof(SparxWeChatSDKManager)); WeChatSDK.Init(); }
public void Login(Action <string, object> callback) { EB.Debug.Log("WeChatSDKManager.Login"); if (!mInitialized) { EB.Debug.LogError("WeChatSDKManager.Login: not initialized"); callback("WeChatSDKManager not initialized", null); return; } if (mLoggedIn) { Hashtable data = new Hashtable() { { "sessionid", mSid }, { "accountid", mAid } }; callback(null, data); return; } mAuthCallback += callback; Hub.RunInBackground = true; WeChatSDK.Login(); }