Esempio n. 1
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));
            });
        }
Esempio 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();
                 }
             });
        }
Esempio n. 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UciOptionsController"/> class.
 /// </summary>
 /// <param name="engineBridge">The engine bridge.</param>
 /// <param name="logger">The logger.</param>
 public UciOptionsController(
     EngineBridge engineBridge,
     ILogger <UciOptionsController> logger)
 {
     this.engineBridge = engineBridge;
     this.logger       = logger;
 }
Esempio n. 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="IdController"/> class.
 /// </summary>
 /// <param name="engineBridge">The engine bridge.</param>
 /// <param name="logger">The logger.</param>
 public IdController(
     EngineBridge engineBridge,
     ILogger <IdController> logger)
 {
     this.engineBridge = engineBridge;
     this.logger       = logger;
 }
Esempio n. 5
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);
                }
            });
        }
Esempio n. 6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="EvaluationApiController"/> class.
 /// </summary>
 /// <param name="engineBridge">The engine bridge.</param>
 /// <param name="logger">The logger.</param>
 public EvaluationApiController(
     EngineBridge engineBridge,
     ILogger <EvaluationApiController> logger)
 {
     this.engineBridge = engineBridge;
     this.logger       = logger;
 }
        public PatternsApplicationContext(String guid)
        {
            try
            {
                Bridge = new EngineBridge();

                Host = new ServiceHost(this);
                NetNamedPipeBinding binding = new NetNamedPipeBinding()
                {
                    MaxReceivedMessageSize = 2147483647,
                    CloseTimeout           = new TimeSpan(0, 1, 0),
                    OpenTimeout            = new TimeSpan(0, 1, 0),
                    ReceiveTimeout         = new TimeSpan(0, 3, 0),
                    SendTimeout            = new TimeSpan(0, 1, 0)
                };

                Host.AddServiceEndpoint((typeof(IPatternsProcessorMessages)), binding, "net.pipe://localhost/Child_" + guid);
                Host.Open();

                PatternsProcessorSettings.Source.TraceEvent(TraceEventType.Verbose, 210, "Patterns Processor (PID={0}, GUID={1}): ServiceHost initialized",
                                                            PatternsProcessorSettings.Instance.ProcessId, PatternsProcessorSettings.Instance.ProcessGUID);

                m_InactivityTimer          = new Timer();
                m_InactivityTimer.Interval = PatternsProcessorInactivityTimerSec * 1000;
                m_InactivityTimer.Tick    += InactivityTimer_Tick;
                m_InactivityTimer.Enabled  = true;
            }
            catch (Exception ex)
            {
                PatternsProcessorSettings.Source.TraceEvent(TraceEventType.Error, 215, "Patterns Processor (PID={0}, GUID={1}): Process initialization failed. \r\n {2}",
                                                            PatternsProcessorSettings.Instance.ProcessId, PatternsProcessorSettings.Instance.ProcessGUID, ex);
                throw ex;
            }
        }
Esempio n. 8
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);
            });
        }
Esempio n. 9
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);
 }
Esempio n. 10
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);
 }
Esempio n. 11
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);
                }
            });
        }
Esempio n. 12
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);
            });
        }
Esempio n. 13
0
 public void UserAdd(string properties)
 {
     EngineBridge.GetInstance().CallHandler(new Command.Builder()
                                            .Service(TDSTapDBConstants.TDS_TAPDB_SERVICE)
                                            .Method("userAdd")
                                            .Args("userAdd", properties)
                                            .CommandBuilder());
 }
Esempio n. 14
0
 public void EnableLog(bool enable)
 {
     EngineBridge.GetInstance().CallHandler(new Command.Builder()
                                            .Service(TDSTapDBConstants.TDS_TAPDB_SERVICE)
                                            .Method("enableLog")
                                            .Args("enableLog", enable)
                                            .CommandBuilder());
 }
Esempio n. 15
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());
 }
Esempio n. 16
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));
        }
Esempio n. 17
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);
        }
Esempio 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);
        }
Esempio n. 19
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);
            });
        }
Esempio n. 20
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);
        }
Esempio n. 21
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);
        }
Esempio 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);
        }
Esempio n. 23
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);
        }
Esempio n. 24
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);
        }
Esempio n. 25
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);
 }
Esempio n. 26
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);
        }
Esempio n. 27
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); });
        }
Esempio n. 28
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);
        }
Esempio n. 29
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);
        }
Esempio n. 30
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);
        }