internal void RegisterService(HttpConnector connector)
        {
            RegisteredServices.Add(connector);
            _dict.Add(connector, null);

            connector.AddEventListener(HttpServiceProgressEvent.PROGRESS_CHANGE, OnChange);
        }
示例#2
0
        internal void RegisterService(HttpConnector connector)
        {
            RegisteredServices.Add(connector);
            _dict.Add(connector, null);

            connector.AddEventListener(HttpServiceProgressEvent.PROGRESS_CHANGE, OnChange);
        }
示例#3
0
        private void StartLoading()
        {
            Configuration.Instance.Deserilized = false;
            //Configuration.Instance.Initialized = false;

            #if DEBUG
            if (DebugMode)
                Debug.Log("ConfigLoader: loading configuration.");
            #endif
            if (AsyncMode)
            {
               var url = UnityEngine.Application.isEditor ? EditorConfigUrl : ConfigUrl;

            #if DEBUG
               if (DebugMode)
                    Debug.Log(string.Format("ConfigLoader: loading in Async mode [{0}]", url));
            #endif
                _connector = new HttpConnector
                                 {
                                     Url = url,
                                     CacheBuster = CacheBuster,
                                     FaultHandler = OnAsyncFault,
                                     ResponseMode = ResponseMode.WWW,
                                     Timeout = 30,
                                     //LogCalls = true
                                 };
                _connector.Send(new Responder(OnAsyncResult));
            }
            else
            {
            #if DEBUG
                if (DebugMode)
                    Debug.Log(string.Format("ConfigLoader: loading from Resources [{0}]", ConfigPath));
            #endif

                _config = Resources.Load(ConfigPath);

                if (null == _config)
                {
                    string msg = string.Format(ConfigurationException.LoadingError);
            #if DEBUG
                    if (DebugMode)
                        Debug.Log(msg);
            #endif
                    //Alert.Show(msg, "Configuration error");
                    if (null != ResultHandler)
                        ResultHandler(msg);
                }
                else
                {
                    Configuration.Instance.ProcessConfig(_config.ToString());
                    if (null != ResultHandler)
                        ResultHandler(Configuration.Instance.Application);
                }
            }
        }