コード例 #1
0
 public void OnLoginCallback(int code, object msg)
 {
     EB.Debug.Log("VivoSDKManager.OnLoginResult:code={0}", code);
     Hub.RunInBackground = false;
     if (code == VivoStatusCode.SUCCESS)
     {
         VivoGameSDK.ShowVivoAssitView();
         if (mLoginCallback != null)
         {
             mLogined = true;
             string    nameStr   = EB.Dot.String("name", msg, string.Empty);
             string    openId    = EB.Dot.String("openid", msg, string.Empty);
             String    authtoken = EB.Dot.String("authtoken", msg, string.Empty);
             Hashtable data      = new Hashtable()
             {
                 { "name", nameStr },
                 { "openid", openId },
                 { "authtoken", authtoken }
             };
             mLoginCallback(null, data);
             mLoginCallback = null;
         }
     }
     else
     {
         if (mLoginCallback != null)
         {
             mLoginCallback(null, null);
             mLoginCallback = null;
         }
     }
 }
コード例 #2
0
        public void Login(Action <string, object> callback)
        {
            EB.Debug.Log("VivoSDKManager.Login");
            if (!mInitialized)
            {
                callback("VivoSD has not been inited", null);
                return;
            }

            mLoginCallback += callback;

            Hub.RunInBackground = true;
            VivoGameSDK.Login();
        }
コード例 #3
0
        //public override void Destroy(Action callback)
        //{
        //    if (!mInitialized)
        //    {
        //        callback();
        //        return;
        //    }
        //    ExitSDK(callback);
        //}

        public void InitSDK(object options, Action <string, bool> callback)
        {
            if (mInitialized)
            {
                EB.Debug.LogWarning("VivoSDKManager.InitializeSDK: Initialized");
                callback(null, true);
                return;
            }
            if (Application.platform != RuntimePlatform.Android)
            {
                callback(null, false);
                return;
            }
            mInitCallback      += callback;
            Hub.RunInBackground = true;
            new GameObject("vivo_plugin_listener", typeof(SparxVivoSDKManager));
            VivoGameSDK.InitSDK();
        }
コード例 #4
0
        public void Pay(EB.IAP.Item item, EB.IAP.Transaction transaction, System.Action <int, object> callback)
        {
            EB.Debug.Log("VivoSDKManager.Pay");
            if (!mInitialized)
            {
                EB.Debug.LogError("QiHooSDKManager.Pay: not initialized");
                callback(VivoStatusCode.FAIL, null);
                return;
            }

            mPayCallback += callback;
            var  user = Hub.Instance.LoginManager.LocalUser;
            long uid  = user.Id.Value;
            //int worldId = user.WorldId;
            string userName    = user.Name;
            int    level       = user.Level;
            int    vipLevel    = user.Vip;
            object payload     = JSON.Parse(transaction.payload);
            string accessKey   = EB.Dot.String("accessKey", payload, string.Empty);
            string orderNumber = EB.Dot.String("orderNumber", payload, string.Empty);

            VivoGameSDK.Pay(item.cents, level, item.longName, item.localizedDesc, vipLevel.ToString(), "noalliance", uid.ToString(), userName, "serverName", orderNumber, accessKey);
            //EB.Debug.LogError("price={0},level={1},productName={2},productDes={3},vip={4},party={5},roleId={6},roleName={7},serverName={8},transNo={9},accessKey={10}", item.cents, level, item.longName, item.localizedDesc, vipLevel.ToString(), "noalliance", uid.ToString(), userName, "serverName", orderNumber, accessKey);
        }
コード例 #5
0
 public void ExitSDK()
 {
     VivoGameSDK.ExitSDK();
 }
コード例 #6
0
 public void ReportAccountRoleInfo(String roleId, String roleLevel, String serviceArea, String roleName, String serviceAreaName)
 {
     VivoGameSDK.ReportAccountRoleInfo(roleId, roleLevel, serviceArea, roleName, serviceAreaName);
 }