public void Login(System.Action <string, object> callback) { if (mLoggedIn) { callback(null, null); return; } mAuthCallback += callback; Hub.RunInBackground = true; if (!mInternalSDKLoggedIn) { EWanGameSdk.login(); } else { mInternalSDKLoggedIn = false; mLoggedIn = true; if (mAuthCallback != null) { Hashtable data = new Hashtable() { { "openid", mOpenId }, { "token", mToken }, { "sign", mSign }, }; mAuthCallback(null, data); mAuthCallback = null; } } }
public void InitializeSDK(object options, System.Action <string, bool> callback) { if (mInitialized) { EB.Debug.LogWarning("EWanSDKManager.InitializeSDK: Initialized"); callback(null, true); return; } if (Application.platform != RuntimePlatform.Android) { callback(null, false); return; } mInitCallback += callback; if (!mInitializing) { mInitializing = true; Hub.RunInBackground = true; new GameObject("ewan_plugin_listener", typeof(SparxEWanSDKManager)); EWanGameSdk.initSDK(); } }
public void Logout() { //if (mLoggedIn) //{ mLoggedIn = false; //} EWanGameSdk.logout(); }
public void ExitSDK(Action <int> callback) { if (mInitialized) { Hub.RunInBackground = true; mExitSDKCallback += callback; EWanGameSdk.exitSDK(); } }
public override void OnLoggedIn() { var user = Hub.LoginManager.LocalUser; string serverid = user.WorldId.ToString(); string servername = string.Empty; string roleid = user.Id.Value.ToString(); string rolename = user.Name; int rolelevel = user.Level; string extend = "login role"; //EB.Debug.LogError("unityTest OnLoggedIn collectData"); EWanGameSdk.collectData(serverid, servername, roleid, rolename, rolelevel, extend); }
public void OnInitResult(int code, string msg) { EB.Debug.Log("OnInitResult:code={0} msg={1}", code, msg); mInitializing = false; Hub.RunInBackground = false; mInitialized = true; if (mInitCallback != null) { mInitCallback(null, mInitialized); mInitCallback = null; } //EB.Debug.LogError("unityTest OnInitResult collectData"); EWanGameSdk.collectData("1", "servername", "roleid", "rolename", 1, "create role"); }
//public void DestroySDK() //{ // if (mInitialized) // { // mInitialized = false; // mLoggedIn = false; // mAuthCallback = null; // mInitCallback = null; // mPayCallback = null; // XiaoMiGameSdk.exitSDK(); // } //} public void Pay(EB.IAP.Item item, EB.IAP.Transaction transaction, System.Action <int, object> callback) { if (!mInitialized) { EB.Debug.LogError("EWanSDKManager.Pay: not initialized"); callback(EWanStatusCode.FAIL, null); return; } mPayCallback += callback; var user = Hub.Instance.LoginManager.LocalUser; int worldId = user.WorldId; string diamondName = Localizer.GetString("ID_RESOURCE_NAME_HC"); EWanGameSdk.pay(item.cost, worldId.ToString(), diamondName, item.value, transaction.transactionId); }
public bool IsHasSwitchAccount() { return(EWanGameSdk.isHasSwitchAccount()); }
public bool IsHasPlatform() { return(EWanGameSdk.isHasPlatform()); }
public void DestroySDK() { EWanGameSdk.destroySDK(); }