public void SetLicencesCallback(TDSLicenseCallback callback)
        {
            Command command = new Command.Builder()
                .Service(TDSLicenseConstants.TDS_LICENSE_SERVICE)
                .Method("setLicenseCallback")
                .Callback(true)
                .CommandBuilder();
                
            EngineBridge.GetInstance().CallHandler(command, (result) =>
             {
                 Debug.Log("result:" + result.toJSON());
                 if (result.code != Result.RESULT_SUCCESS)
                 {
                     return;
                 }

                 if (string.IsNullOrEmpty(result.content))
                 {
                     return;
                 }

                 Dictionary<string, object> dic = Json.Deserialize(result.content) as Dictionary<string, object>;
                 string success = SafeDictionary.GetValue<string>(dic, "login") as string;

                 if (success.Equals("success"))
                 {
                     callback.OnLicenseSuccess();
                 }
             });
        }
        public void LoginByType(LoginType type, Action <TDSGlobalUser> callback, Action <TDSGlobalError> errorCallback)
        {
            var command = new Command.Builder()
                          .Args("loginByType", (int)type)
                          .Service(TDSGlobalBridgeName.LOGIN_SERVICE_NAME)
                          .Method("loginByType")
                          .Callback(true)
                          .OnceTime(false)
                          .CommandBuilder();

            EngineBridge.GetInstance().CallHandler(command, (result) =>
            {
                Debug.Log("login result:" + result.toJSON());

                if (!checkResultSuccess(result))
                {
                    errorCallback(new TDSGlobalError(TDSGlobalUnKnowError.UN_KNOW, $"Login Failed:{result.message}"));
                    return;
                }

                TDSGlobalUserWrapper userWrapper = new TDSGlobalUserWrapper(result.content);
                if (userWrapper.error != null)
                {
                    errorCallback(userWrapper.error);
                    return;
                }

                if (userWrapper.user != null)
                {
                    callback(userWrapper.user);
                }
            });
        }
        public void TrackUser(string userId)
        {
            Command command = new Command.Builder()
                              .Service(TDSGlobalBridgeName.SERVICE_NAME)
                              .Method("trackUser")
                              .Args("trackUser", userId)
                              .CommandBuilder();

            EngineBridge.GetInstance().CallHandler(command);
        }
        public void SetDLCCallbackWithParams(TDSDLCCallback callback, bool checkOnce, string publicKey)
        {
            Command command = new Command.Builder()
                .Service(TDSLicenseConstants.TDS_LICENSE_SERVICE)
                .Method("setDLCCallbackWithParams")
                .Callback(true)
                .Args("checkOnce", checkOnce)
                .Args("publicKey", publicKey)
                .CommandBuilder();
            EngineBridge.GetInstance().CallHandler(command, (result) =>
             {
                 Debug.Log("result:" + result.toJSON());
                 if (result.code != Result.RESULT_SUCCESS)
                 {
                     return;
                 }

                 if (string.IsNullOrEmpty(result.content))
                 {
                     return;
                 }

                 Dictionary<string, object> dic = Json.Deserialize(result.content) as Dictionary<string, object>;

                 string dlc = SafeDictionary.GetValue<string>(dic, "orderDLC") as string;
                 if (!string.IsNullOrEmpty(dlc))
                 {
                     int statusCode = SafeDictionary.GetValue<int>(dic, "orderStatus");
                     callback.OnOrderCallBack(dlc, statusCode);
                     return;
                 }

                 int code = SafeDictionary.GetValue<int>(dic, "queryCode");
                 string queryListJson = SafeDictionary.GetValue<string>(dic, "queryResult");

                 Dictionary<string, object> quertListDic = Json.Deserialize(queryListJson) as Dictionary<string, object>;

                 callback.OnQueryCallBack(code, quertListDic);
             });
        }
        public void IsExternalStorageManager(Action <bool> callback)
        {
            if (!Platform.isAndroid())
            {
                return;
            }
            var command = new Command.Builder()
                          .Service(TDSGlobalBridgeName.SERVICE_NAME)
                          .Method("isExternalStorageManager")
                          .Callback(true)
                          .CommandBuilder();

            EngineBridge.GetInstance().CallHandler(command, result =>
            {
                if (!checkResultSuccess(result))
                {
                    callback(false);
                    return;
                }

                callback("true".Equals(result.content));
            });
        }