Ejemplo n.º 1
0
        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;
                }
            }
        }
Ejemplo n.º 2
0
        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();
            }
        }
Ejemplo n.º 3
0
 public void Logout()
 {
     //if (mLoggedIn)
     //{
     mLoggedIn = false;
     //}
     EWanGameSdk.logout();
 }
Ejemplo n.º 4
0
 public void ExitSDK(Action <int> callback)
 {
     if (mInitialized)
     {
         Hub.RunInBackground = true;
         mExitSDKCallback   += callback;
         EWanGameSdk.exitSDK();
     }
 }
Ejemplo n.º 5
0
        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);
        }
Ejemplo n.º 6
0
        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");
        }
Ejemplo n.º 7
0
        //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);
        }
Ejemplo n.º 8
0
 public bool IsHasSwitchAccount()
 {
     return(EWanGameSdk.isHasSwitchAccount());
 }
Ejemplo n.º 9
0
 public bool IsHasPlatform()
 {
     return(EWanGameSdk.isHasPlatform());
 }
Ejemplo n.º 10
0
 public void DestroySDK()
 {
     EWanGameSdk.destroySDK();
 }