Ejemplo n.º 1
0
 public void QueryDLC(string[] dlcList)
 {
     Dictionary<string, object> dic = new Dictionary<string, object>();
     dic.Add("dlcList", dlcList);
     Command command = new Command(TDSLicenseConstants.TDS_LICENSE_SERVICE, "queryDLC", true, dic);
     EngineBridge.GetInstance().CallHandler(command);
 }
Ejemplo n.º 2
0
        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();
                 }
             });
        }
Ejemplo n.º 3
0
        public void InlinePay(string orderId, string productId, string productName, string region, string serverid,
                              string roleId, string ext, Action <TDSGlobalInlinePayResult> callback)
        {
            var dic = new Dictionary <string, object>();

            dic.Add("orderId", orderId);
            dic.Add("productId", productId);
            dic.Add("productName", productName);
            dic.Add("region", region);
            dic.Add("serverId", serverid);
            dic.Add("roleId", roleId);
            dic.Add("ext", ext);
            Command command = new Command(TDSGlobalBridgeName.IAP_SERVICE_NAME, "inlinePay", true, dic);

            EngineBridge.GetInstance().CallHandler(command, (result) =>
            {
                Debug.Log("InlinePay bridge result:" + result.toJSON());
                if (!checkResultSuccess(result))
                {
                    var payResult = new TDSGlobalInlinePayResult(TDSGlobalUnKnowError.UN_KNOW,
                                                                 $"InlinePay Failed:{result.message}");

                    callback(payResult);
                    return;
                }

                callback(new TDSGlobalInlinePayResult(result.content));
            });
        }
Ejemplo n.º 4
0
        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);
                }
            });
        }
Ejemplo n.º 5
0
        public void QueryWithProductIds(string[] productIds, Action <List <TDSGlobalSkuDetail> > callback,
                                        Action <TDSGlobalError> errorCallback)
        {
            Dictionary <string, object> dic = new Dictionary <string, object>();

            dic.Add("queryWithProductIds", productIds);
            Command command = new Command(TDSGlobalBridgeName.IAP_SERVICE_NAME, "querySKUWithProductIds", true, dic);

            EngineBridge.GetInstance().CallHandler(command, (result) =>
            {
                if (!checkResultSuccess(result))
                {
                    errorCallback(new TDSGlobalError(TDSGlobalUnKnowError.UN_KNOW,
                                                     $"QueryWithProductIds Failed:{result.message}"));
                    return;
                }

                TDSGlobalSkuDetailWrapper wrapper = new TDSGlobalSkuDetailWrapper(result.content);
                if (wrapper == null)
                {
                    errorCallback(new TDSGlobalError(TDSGlobalUnKnowError.UN_KNOW,
                                                     $"QueryWithProductIds Parse Result Error:{result.content}"));
                    return;
                }

                if (wrapper.error != null)
                {
                    errorCallback(wrapper.error);
                    return;
                }

                callback(wrapper.products);
            });
        }
Ejemplo n.º 6
0
        public void FetchProfileForCurrentAccessToken(Action <TDSLoginProfile> profileCallback, Action <string> errorCallback)
        {
            Command command = new Command(TDSLoginConstants.TDS_LOGIN_SERVICE, "fetchProfileForCurrentAccessToken", true, null);

            EngineBridge.GetInstance().CallHandler(command, (result) =>
            {
                if (result.code != Result.RESULT_SUCCESS)
                {
                    errorCallback(result.message);
                    return;
                }

                if (string.IsNullOrEmpty(result.content))
                {
                    errorCallback(result.message);
                    return;
                }
                LoginWrapperBean <string> wrapperBean = new LoginWrapperBean <string>(result.content);
                if (wrapperBean.loginCallbackCode == 0)
                {
                    TDSLoginProfile profile = new TDSLoginProfile(wrapperBean.wrapper);
                    profileCallback(profile);
                    return;
                }
                errorCallback(wrapperBean.wrapper);
            });
        }
Ejemplo n.º 7
0
        public void Login(Action <TDSGlobalUser> callback, Action <TDSGlobalError> errorCallback)
        {
            Command command = new Command(TDSGlobalBridgeName.LOGIN_SERVICE_NAME, "login", true, null);

            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);
                }
            });
        }
Ejemplo n.º 8
0
 public void PurchaseDLC(string dlc)
 {
     Dictionary<string, object> dic = new Dictionary<string, object>();
     dic.Add("dlc", dlc);
     Command command = new Command(TDSLicenseConstants.TDS_LICENSE_SERVICE, "purchaseDLC", true, dic);
     EngineBridge.GetInstance().CallHandler(command);
 }
Ejemplo n.º 9
0
 public void EnableLog(bool enable)
 {
     EngineBridge.GetInstance().CallHandler(new Command.Builder()
                                            .Service(TDSTapDBConstants.TDS_TAPDB_SERVICE)
                                            .Method("enableLog")
                                            .Args("enableLog", enable)
                                            .CommandBuilder());
 }
Ejemplo n.º 10
0
 public void UserAdd(string properties)
 {
     EngineBridge.GetInstance().CallHandler(new Command.Builder()
                                            .Service(TDSTapDBConstants.TDS_TAPDB_SERVICE)
                                            .Method("userAdd")
                                            .Args("userAdd", properties)
                                            .CommandBuilder());
 }
Ejemplo n.º 11
0
        public void TrackEvent(string eventName)
        {
            Dictionary <string, object> dic = new Dictionary <string, object>();

            dic.Add("trackEvent", eventName);
            Command command = new Command(TDSGlobalBridgeName.SERVICE_NAME, "trackEvent", false, dic);

            EngineBridge.GetInstance().CallHandler(command);
        }
Ejemplo n.º 12
0
 public void DeviceInitialize(string properties)
 {
     EngineBridge.GetInstance().CallHandler(new Command.Builder()
                                            .Service(TDSTapDBConstants.TDS_TAPDB_SERVICE)
                                            .Method("deviceInitialize")
                                            .Args("deviceInitialize", properties)
                                            .Callback(true)
                                            .CommandBuilder());
 }
Ejemplo n.º 13
0
        public void SetLanguage(int languageType)
        {
            Dictionary <string, object> dic = new Dictionary <string, object>();

            dic.Add("setLanguage", languageType);
            Command command = new Command(TDSGlobalBridgeName.SERVICE_NAME, "changeLanguageType", false, dic);

            EngineBridge.GetInstance().CallHandler(command);
        }
Ejemplo n.º 14
0
 private TDSGlobalImpl()
 {
     Debug.Log("初始化TDSGlobalBridgeService");
     EngineBridge.GetInstance().Register(TDSGlobalBridgeName.SERVICE_CLZ, TDSGlobalBridgeName.SERVICE_IMPL);
     EngineBridge.GetInstance()
     .Register(TDSGlobalBridgeName.IAP_SERVICE_CLZ, TDSGlobalBridgeName.IAP_SERVICE_IMPL);
     EngineBridge.GetInstance()
     .Register(TDSGlobalBridgeName.LOGIN_SERVICE_CLZ, TDSGlobalBridgeName.LOGIN_SERVICE_IMPL);
 }
Ejemplo n.º 15
0
        public void OpenSceneEntryMoment(Orientation orientation, string sceneId)
        {
            Dictionary <string, object> dic = new Dictionary <string, object>();

            dic.Add("config", (int)orientation);
            dic.Add("sceneId", sceneId);
            InitOrientationSetting((int)orientation);
            EngineBridge.GetInstance().CallHandler(ConstructorCommand("openSceneEntryMoment", dic, true));
        }
Ejemplo n.º 16
0
        public void SetUser(string userId)
        {
            Dictionary <string, object> dic = new Dictionary <string, object>();

            dic.Add("userId", userId);
            Command command = new Command(TDSTapDBConstants.TDS_TAPDB_SERVICE, "setUser", false, dic);

            EngineBridge.GetInstance().CallHandler(command);
        }
Ejemplo n.º 17
0
        public void UnregisterStaticProperty(string propertyName)
        {
            Dictionary <string, object> dic = new Dictionary <string, object>();

            dic.Add("unregisterStaticProperty", propertyName);
            Command command = new Command(TDSTapDBConstants.TDS_TAPDB_SERVICE, "unregisterStaticProperty", false, dic);

            EngineBridge.GetInstance().CallHandler(command);
        }
Ejemplo n.º 18
0
        public void RegisterStaticProperties(string superProperties)
        {
            Dictionary <string, object> dic = new Dictionary <string, object>();

            dic.Add("registerStaticProperties", superProperties);
            Command command = new Command(TDSTapDBConstants.TDS_TAPDB_SERVICE, "registerStaticProperties", false, dic);

            EngineBridge.GetInstance().CallHandler(command);
        }
Ejemplo n.º 19
0
        public void SetLevel(int level)
        {
            Dictionary <string, object> dic = new Dictionary <string, object>();

            dic.Add("level", level);
            Command command = new Command(TDSTapDBConstants.TDS_TAPDB_SERVICE, "setLevel", false, dic);

            EngineBridge.GetInstance().CallHandler(command);
        }
Ejemplo n.º 20
0
        public void RegisterLoginCallback(LoginCallback callback)
        {
            Command command = new Command(TDSLoginConstants.TDS_LOGIN_SERVICE, "registerLoginCallback", true, null);

            EngineBridge.GetInstance().CallHandler(command, (result) =>
            {
                TDSLoginResultHandler.HandlerLoginResult(callback, result);
            });
        }
Ejemplo n.º 21
0
        public void Init(string clientId)
        {
            Dictionary <string, object> dic = new Dictionary <string, object>();

            dic.Add("clientID", clientId);
            Command command = new Command(TDSLoginConstants.TDS_LOGIN_SERVICE, "init", false, dic);

            EngineBridge.GetInstance().CallHandler(command);
        }
Ejemplo n.º 22
0
        public void StartLogin(string[] permissions)
        {
            Dictionary <string, object> dic = new Dictionary <string, object>();

            dic.Add("permissions", permissions);
            Command command = new Command(TDSLoginConstants.TDS_LOGIN_SERVICE, "startTapLogin", true, dic);

            EngineBridge.GetInstance().CallHandler(command);
        }
Ejemplo n.º 23
0
 /// <summary>
 /// Static constructor
 /// </summary>
 static RestaurantViewModel()
 {
     RestaurantViewModel.engineBridge   = EngineBridge.GetInstance();
     RestaurantViewModel.messageHandler = new StateMachineMessageHandler();
     RestaurantViewModel.engineBridge.Init(messageHandler);
     RestaurantViewModel.executorDict          = new Dictionary <int, SCXMLExecutor>();
     RestaurantViewModel.OrderingFormDict      = new Dictionary <int, View.OrderingForm>();
     RestaurantViewModel.RestaurantEntity      = new Restaurant();
     RestaurantViewModel.ActiveTaskHandlerList = new List <ITaskHandler>();
 }
Ejemplo n.º 24
0
        public void EnableTapDB(string gameVersion, string gameChannel)
        {
            Dictionary <string, object> dic = new Dictionary <string, object>();

            dic.Add("gameVersion", gameVersion);
            dic.Add("gameChannel", gameChannel);
            Command command = new Command(TDSCoreConstants.TDS_CORE_SERVICE, "enableTapDB", false, dic);

            EngineBridge.GetInstance().CallHandler(command);
        }
Ejemplo n.º 25
0
        public void ChangeConfig(bool isCN, bool roundCorner)
        {
            Dictionary <string, object> dic = new Dictionary <string, object>();

            dic.Add("regionType", isCN);
            dic.Add("roundCorner", roundCorner);
            Command command = new Command(TDSLoginConstants.TDS_LOGIN_SERVICE, "changeConfig", false, dic);

            EngineBridge.GetInstance().CallHandler(command);
        }
Ejemplo n.º 26
0
        public void Share(int shareFlavors, string imagePath, TDSGlobalShareCallback callback)
        {
            Dictionary <string, object> dic = new Dictionary <string, object>();

            dic.Add("imagePath", imagePath);
            dic.Add("shareWithType", shareFlavors);
            Command command = new Command(TDSGlobalBridgeName.SERVICE_NAME, "shareWithImage", true, dic);

            EngineBridge.GetInstance().CallHandler(command, (result) => { handlerShareCallback(result, callback); });
        }
Ejemplo n.º 27
0
        public void TrackUser(string userId)
        {
            Command command = new Command.Builder()
                              .Service(TDSGlobalBridgeName.SERVICE_NAME)
                              .Method("trackUser")
                              .Args("trackUser", userId)
                              .CommandBuilder();

            EngineBridge.GetInstance().CallHandler(command);
        }
Ejemplo n.º 28
0
        public void Report(string serverId, string roleId, string roleName)
        {
            Dictionary <string, object> dic = new Dictionary <string, object>();

            dic.Add("reportWithServerId", serverId);
            dic.Add("roleId", roleId);
            dic.Add("roleName", roleName);
            Command command = new Command(TDSGlobalBridgeName.SERVICE_NAME, "report", false, dic);

            EngineBridge.GetInstance().CallHandler(command);
        }
Ejemplo n.º 29
0
        public void Init(string clientId, bool isCN, bool roundCorner)
        {
            Dictionary <string, object> dic = new Dictionary <string, object>();

            dic.Add("clientID", clientId);
            dic.Add("regionType", isCN);
            dic.Add("roundCorner", roundCorner);
            Command command = new Command(TDSLoginConstants.TDS_LOGIN_SERVICE, "initWithClientID", false, dic);

            EngineBridge.GetInstance().CallHandler(command);
        }
Ejemplo n.º 30
0
 public void AdvertiserIDCollectionEnable(bool enable)
 {
     if (Platform.isIOS())
     {
         EngineBridge.GetInstance().CallHandler(new Command.Builder()
                                                .Service(TDSGlobalBridgeName.SERVICE_NAME)
                                                .Method("setAdvertiserIDCollectionEnable")
                                                .Args("setAdvertiserIDCollectionEnable", enable)
                                                .CommandBuilder());
     }
 }