示例#1
0
        void LoadLoggerConfig()
        {
            DataElement loggerConfig = GetConfiguration("logger");

            if (loggerConfig.IsNull)
            {
                return;
            }

            int         defaultThreshold = 0;
            DataElement defaultModule    = loggerConfig[CoreLogger.DefaultModuleName];

            if (!defaultModule.IsNull)
            {
                defaultThreshold = CoreLogger.Severity.ParseSeverity(defaultModule);
            }

            CoreLogger.LogDebug(LoggerModules.GameApplication, "/////////////////////////// setting logger thresholds ////////////////////////");

            foreach (string moduleName in CoreLogger.Modules)
            {
                CoreLogger.SetThreshold(moduleName, defaultThreshold);
            }

            CoreLogger.SetThreshold(defaultThreshold);

            foreach (KeyValuePair <string, DataElement> kvp in loggerConfig.GetDataPairs())
            {
                string moduleName      = kvp.Key;
                int    moduleThreshold = CoreLogger.Severity.ParseSeverity(kvp.Value);

                CoreLogger.SetThreshold(moduleName, moduleThreshold);
            }
        }
        public override void Execute()
        {
            CoreLogger.LogDebug(LoggerModules.SocialServices, "Execute IsLoggedIn " + isLoggedIn);

            socialStateModel.WaitingForSocialLogin = false;


            if (!isLoggedIn)
            {
                //toggleLoadingDialogSignal.Dispatch(false);
                return;
            }

            SocialConnectData socialConnectData = new SocialConnectData();

            socialConnectData.network         = SocialNetwork.Facebook;
            socialConnectData.email           = socialNetworkService.Email;
            socialConnectData.photoUrl        = socialNetworkService.PhotoUrl;
            socialConnectData.userName        = socialNetworkService.UserName;
            socialConnectData.userId          = socialNetworkService.UserId;
            socialConnectData.userToken       = socialNetworkService.UserToken;
            socialConnectData.initiatedByUser = true;

            socialSync.ConnectToNetwork(socialConnectData);
        }
        /*
         * private ServerTime _serverTime;
         * public ServerTime ServerTime { get { return _serverTime; } }
         *
         * private ModelSyncService _modelSyncService;
         * public ModelSyncService ModelSyncService { get { return _modelSyncService; } }
         */

        protected override IEnumerator ModuleInitializer()
        {
            Debug.Log("GameDbInitializer - ModuleInitializer start --------------------------------------------1");

            _gameDB = new GameDB();

            if (Application.loadedLevelName.Contains("Upload") && Application.isEditor)
            {
                _gameDB.InitLocalDB();
            }
            else
            {
                _gameDB.InitDB();
            }

            /*
             * _serverTime = new ServerTime();
             *
             * _modelSyncService = new ModelSyncService();
             * _modelSyncService.Init(_gameDB,this,_serverTime);
             * //yield return StartCoroutine(_modelSyncService.PregameConnect());
             * //StartCoroutine(_modelSyncService.AsyncLoop());
             *
             * _modelSyncService.Start();
             *
             * yield return StartCoroutine(_modelSyncService.WaitForState(ModelSyncService.SyncLoopState.Connected));
             */

            CoreLogger.LogDebug("GameDbInitializer", "done with Init");

            Debug.Log("GameDbInitializer - ModuleInitializer end --------------------------------------------2");

            yield break;
        }
        public TItemView AddItem()
        {
            TItemView itemView = null;

            GameObject itemGo = AddItemGo();

            if (itemGo == null)
            {
                return(itemView);
            }

            itemGo.transform.SetParent(transform, false);

            itemView = itemGo.GetComponentOrInterface <TItemView> ();

            if (itemView == null)
            {
                CoreLogger.LogError("GenericViewList", "AddItem " + itemGo + " missing component " + typeof(TItemView));
                Destroy(itemGo);
                return(itemView);
            }

            _itemList.Add(itemView);
            gameObjectList.Add(itemGo);

            OnItemAdded(itemView, itemGo);

            return(itemView);
        }
示例#5
0
        public void Init()
        {
            Debug.Log("SocialSync.Init");

            _coroutineFactory  = GameApplication.Instance.CoroutineFactory;
            _connectionHandler = new ConnectionHandler();
            _connectionHandler.Init(gameDB, _coroutineFactory);
            _loggerModule = CoreLogger.RegisterModule(GetType().Name);

            SocialStateData socialData = socialStateModel.GetState();

            _socialConnectionStatus = new Dictionary <SocialNetwork, bool>();
            _socialConnectionStatus.Add(SocialNetwork.Facebook, (socialData.facebookId != ""));
            _socialConnectionStatus.Add(SocialNetwork.GameCenter, (socialData.gameCenterId != ""));
            _socialConnectionStatus.Add(SocialNetwork.PlayServices, (socialData.googlePlayId != ""));
            _socialUserId = new Dictionary <SocialNetwork, string>();
            _socialUserId.Add(SocialNetwork.Facebook, socialData.facebookId);
            _socialUserId.Add(SocialNetwork.GameCenter, socialData.gameCenterId);
            _socialUserId.Add(SocialNetwork.PlayServices, socialData.googlePlayId);

            Data.DataElement connConfig = GameApplication.GetConfiguration("connection");
            if (!connConfig.IsNull)
            {
                _fakeFacebookId     = (!connConfig.ContainsKey(_configKeyFakeFacebookId)) ? "0" : (string)connConfig[_configKeyFakeFacebookId];
                _fakeGameCenterId   = (!connConfig.ContainsKey(_configKeyFakeGameCenterId)) ? "0" : (string)connConfig[_configKeyFakeGameCenterId];
                _fakePlayServicesId = (!connConfig.ContainsKey(_configKeyFakePlayServicesId)) ? "0" : (string)connConfig[_configKeyFakePlayServicesId];
            }
        }
示例#6
0
        /// <summary>
        /// Loads the framework resource of the given name. The method will look for the resource in
        /// the cascading search path for framework resources - currently, that means first the
        /// LocalFramework folder, then the Framework folder (both must be under a "Resources"
        /// parent somewhere.
        /// </summary>
        /// <returns>The framework resource.</returns>
        /// <param name="name">Name.</param>
        public static TResource LoadFrameworkResource <TResource>(string name)
            where TResource : Object
        {
            //string pathSeaparator = Path.AltDirectorySeparatorChar;
            string pathSeparator = "/";

            string localResourcePath         = "Local" + s_frameworkResourcePath;
            string platformLocalResourcePath = Application.platform.ToString() + pathSeparator + localResourcePath;
            string platformResourcePath      = Application.platform.ToString() + pathSeparator + s_frameworkResourcePath;

            TResource resource = Resources.Load <TResource>(platformLocalResourcePath + pathSeparator + name);

            if (resource == null)
            {
                CoreLogger.LogInfo(LoggerModules.GameApplication, string.Format("resource {0} not found in {1}, looking in {2}...", name, platformLocalResourcePath, localResourcePath));
                resource = Resources.Load <TResource>(localResourcePath + pathSeparator + name);
                if (resource == null)
                {
                    CoreLogger.LogInfo(LoggerModules.GameApplication, string.Format("resource {0} not found in {1}, looking in {2}...", name, localResourcePath, platformResourcePath));
                    resource = Resources.Load <TResource>(platformResourcePath + pathSeparator + name);
                    if (resource == null)
                    {
                        CoreLogger.LogInfo(LoggerModules.GameApplication, string.Format("resource {0} not found in {1}, looking in {2}...", name, platformResourcePath, s_frameworkResourcePath));
                        resource = Resources.Load <TResource>(s_frameworkResourcePath + pathSeparator + name);
                    }
                }
            }

            if (resource == null)
            {
                CoreLogger.LogWarning(LoggerModules.GameApplication, string.Format("resource {0} not found in framework paths!", name));
            }

            return(resource);
        }
示例#7
0
        IService FetchService(Type serviceType)
        {
            //an active provider already assigned to this service?
            IService serviceProvider;

            if (_serviceProviders.TryGetValue(serviceType, out serviceProvider))
            {
                return(serviceProvider);
            }

            //do we even know this service?
            if (!_unprovidedServices.Contains(serviceType))
            {
                CoreLogger.LogNotice(_loggerModule, string.Format("requested service {0} is not known to this container!", serviceType.Name));
                return(null);
            }

            //do we have an active provider for this service? an active provider is probably already providing other services,
            //but can provide this as well
            IService activeProvider = _activeProviders.Where(p => p.GetType().GetInterfaces().Contains(serviceType)).FirstOrDefault();

            if (activeProvider != null)
            {
                CoreLogger.LogDebug(_loggerModule, string.Format("adding service {0}, provided by {1}", serviceType.Name, activeProvider.GetType().Name));
                _serviceProviders[serviceType] = activeProvider;
                return(activeProvider);
            }

            return(null);
        }
示例#8
0
        public void Get <TService>(System.Action <TaskEnding, TService> handler)
            where TService : IService
        {
            IService service = FetchService(typeof(TService));

            if (service != null)
            {
                handler(TaskEnding.Done, (TService)service);
                return;
            }

            //no active provider - see if we can activate a dormant provider

            CoreLogger.LogDebug(_loggerModule, string.Format("adding service {0}, now looking for provider...", typeof(TService).Name));

            _taskFactory.FromEnumerableAction(() =>
                                              ActivateServiceProvider(typeof(TService), s => {
                if (s == null)
                {
                    handler(TaskEnding.Cancelled, default(TService));
                }
                else
                {
                    handler(TaskEnding.Done, (TService)s);
                }
            })).Start(-1);
        }
示例#9
0
        void EnqueueServiceResolution <TService>(System.Action <TService> setter, bool blocking)
            where TService : class, IService
        {
            if (blocking)
            {
                _taskQueue.Enqueue(() => {
                    TService service = _serviceResolver.Get <TService>();
                    setter(service);
                });
                return;
            }

            bool     found        = false;
            TService foundService = null;

            _taskQueue.Enqueue(() => {
                _serviceResolver.Get <TService>((result, service) => {
                    foundService = service;
                    setter(service);
                    found = true;
                });
            });

            _taskQueue.Parallelize(() => found, -1, string.Format("find service {0}", typeof(TService).Name)).Done += result => {
                CoreLogger.LogDebug(LoggerModules.GameApplication, string.Format("done preparing service {0}: {1}; provider is: {2}", typeof(TService).Name, result,
                                                                                 foundService == null ? "null" : foundService.GetType().Name));
            };
        }
示例#10
0
        public override void Execute()
        {
            CoreLogger.LogDebug("LoadBindingsCommand", "Execute");

            List <BindingData> bindings = gsdkConfigModel.GetBindings();

            foreach (BindingData binding in bindings)
            {
                try
                {
                    string json = LitJson.JsonMapper.ToJson(new List <BindingData> {
                        binding
                    });
                    injectionBinder.ConsumeBindings(json);

                    Debug.Log("BindingLoading - Successfully binded: " + binding.ToString());
                }
                catch (InjectionException ex)
                {
                    Debug.Log("BindingLoading - did not load binding: " + binding);
                }
                catch (BinderException ex)
                {
                    Debug.Log("BindingLoading - did not load binding: " + binding);
                    Debug.LogWarning(ex.ToString());
                }
            }

            LoadNullBindings();
        }
示例#11
0
        /// <summary>
        /// This is the part of the initialization sequence which is always synchronous -
        /// it merely creates an instance of the GameApplication object, without doing any
        /// initialization - there's no need to make it async., since it's fast anyway.
        /// It's called by both the sync. and asnyc. versions of the CreateInstance method.
        /// </summary>
        /// <returns>The or get.</returns>
        public static GameApplication CreateOrGet()
        {
            //if an instance has already been created, don't create a new one
            s_instance = FindObjectOfType <GameApplication>();
            if (s_instance != null)
            {
                CoreLogger.LogDebug(LoggerModules.GameApplication, "an instance of GameApplication has miraculously appeared...");
                return(s_instance);
            }

            //we want to create the instance as it is defined in the resources folder
            GameApplication instance;

            Object prefab = LoadFrameworkResource(s_applicationResourceName);

            if (prefab == null)
            {
                //no prefab found - we can still create a default
                Debug.LogError(string.Format("Unable to load {0}.prefab - creating object with defaults", s_applicationResourceName));
                GameObject appObj = new GameObject();
                instance = appObj.AddComponent <GameApplication>();
            }
            else
            {
                GameObject appObj = Instantiate(prefab) as GameObject;
                instance = appObj.GetComponent <GameApplication>();
            }

            GameObject.DontDestroyOnLoad(instance);

            return(instance);
        }
示例#12
0
        IEnumerator Loop()
        {
            CoreLogger.LogDebug(LoggerModules.Tasks, string.Format("dispatcher {0} starting up!", name));

            while (true)
            {
                int count = 0;
                while (_news.Count > 0 && (count < actionsPerIteration || actionsPerIteration < 0))
                {
                    _post.Add(_news.Dequeue());
                    count++;
                }

                foreach (Entry entry in _post)
                {
                    entry.delay--;
                    if (entry.delay == 0)
                    {
                        try
                        {
                            entry.action();
                        } catch (System.Exception ex)
                        {
                            CoreLogger.LogError(LoggerModules.Tasks, string.Format("Error in Dispatcher Action: {0}\n Stack Trace:{1}", ex.Message, ex.StackTrace));
                        }
                    }
                }

                _post.RemoveAll(e => e.delay == 0);

                yield return(null);
            }
        }
示例#13
0
 public override void Execute()
 {
     CoreLogger.LogDebug("ShowRateUsCommand", "Execute");
     if (rateUsService.ShouldShowRateUs())
     {
         modalityManager.Add(new AppModalHandle("GamePopups/RateUsModal", IModalMaskType.Masked), true);
     }
 }
示例#14
0
 void EnqueueAddProviders()
 {
     _taskQueue.Enqueue(() => {
         _serviceResolver.AddProviders(GetComponentsInChildren(typeof(IService)).Cast <IService>());
     }, "Add Service Providers to Service Resolver").Done += result => {
         CoreLogger.LogDebug(LoggerModules.GameApplication, string.Format("done finding service providers: {0}", result));
     };
 }
示例#15
0
 //[Conditional("DEBUG")]
 public static void Assert(bool condition, string log = "")
 {
     if (!condition)
     {
         CoreLogger.LogError(log);
         throw new UnityException(log);
     }
 }
示例#16
0
        public TModule Get <TModule>()
            where TModule : IModule
        {
            IModule module;

            if (_modules.TryGetValue(typeof(TModule), out module))
            {
                return((TModule)module);
            }

            if (!_availableModules.TryGetValue(typeof(TModule), out module))
            {
                return(default(TModule));
            }

            if (_modulesInInitState.ContainsKey(module))
            {
                CoreLogger.LogError(LoggerModules.GameApplication, string.Format("module {0} is initializing and cannot be retrieved at the moment", module.GetType().Name));
                return(default(TModule));
            }

            ITask init = module.GetInitializer(this);

            if (init == null)
            {
                CoreLogger.LogDebug(LoggerModules.GameApplication, string.Format("unable to retrieve initializer for module {0} failed", module.GetType().Name));
                _failedModules[typeof(TModule)] = module;
                _availableModules.Remove(typeof(TModule));
                return(default(TModule));
            }

            _modulesInInitState[module] = init;
            TaskEnding result = init.Handle();

            _modulesInInitState.Remove(module);

            if (result.IsOk())
            {
                CoreLogger.LogDebug(LoggerModules.GameApplication, string.Format("successfully initialized module {0}", module.GetType().Name));
                _modules[typeof(TModule)] = module;
                _availableModules.Remove(typeof(TModule));
            }
            else
            {
                CoreLogger.LogDebug(LoggerModules.GameApplication, string.Format("failed to initialize module {0}", module.GetType().Name));
                _failedModules[typeof(TModule)] = module;
                _availableModules.Remove(typeof(TModule));
                return(default(TModule));
            }

            if (_started)
            {
                module.StartModule();
                CoreLogger.LogDebug(LoggerModules.GameApplication, string.Format("starting module {0}", module.GetType().Name));
            }

            return((TModule)module);
        }
示例#17
0
        public void Init()
        {
            _class        = GetType().Name;
            _loggerModule = CoreLogger.RegisterModule(_class);

            Load();

            syncConfigsSignal.AddListener(OnConfigSync);
        }
示例#18
0
 static LoggerModules()
 {
     SceneManager    = CoreLogger.RegisterModule("SceneManager");
     SocialServices  = CoreLogger.RegisterModule("SocialServices");
     AssetManager    = CoreLogger.RegisterModule("AssetManager");
     GameApplication = CoreLogger.RegisterModule("GameApplication");
     Tasks           = CoreLogger.RegisterModule("Tasks");
     InputSystem     = CoreLogger.RegisterModule("InputSystem");
 }
示例#19
0
 void EnqueueCreateResolvers()
 {
     _taskQueue.Enqueue(() => {
         CreateServiceResolver();
         CreateModuleContainer();
     }, "Create Resolvers").Done += result => {
         CoreLogger.LogDebug(LoggerModules.GameApplication, string.Format("done creating module containers: {0}", result));
     };
 }
示例#20
0
        public void Init(int fromStage, int toStage, System.Action handler)
        {
            CoreLogger.LogDebug(LoggerModules.GameApplication, string.Format("requesgted non blocking initialization of modules stages {0} to {1}; total available: {2}", fromStage, toStage, _availableModules.Count));

            int pending = 0;

            ICollection <ITask> tasks = new List <ITask>();

            IList <KeyValuePair <Type, IModule> > modulesToRemove = new List <KeyValuePair <Type, IModule> >();

            foreach (KeyValuePair <Type, IModule> kvp in _availableModules.Where(kvp => (kvp.Value.Stage >= fromStage) && (kvp.Value.Stage <= toStage)))
            {
                //always remember to create a local-scoped variable within foreach loops that use lambdas!!!
                IModule localModule = kvp.Value;

                if (!_modules.ContainsKey(localModule.GetType()))
                {
                    ITask init = localModule.GetInitializer(this);
                    if (init != null)
                    {
                        tasks.Add(init);

                        CoreLogger.LogDebug(LoggerModules.GameApplication, string.Format("located module {0} - starting init", localModule.GetType().Name));

                        init.Done += result => {
                            if (result.IsOk())
                            {
                                CoreLogger.LogDebug(LoggerModules.GameApplication, string.Format("successfully done with module {0} ({1}); {2} modules remaining", localModule.GetType().Name, result, pending));
                                _modules[localModule.GetType()] = localModule;
                            }
                            else
                            {
                                CoreLogger.LogDebug(LoggerModules.GameApplication, string.Format("failed with module {0} ({1}); {2} modules remaining", localModule.GetType().Name, result, pending));
                                _failedModules[localModule.GetType()] = localModule;
                            }
                        };
                    }
                    else
                    {
                        CoreLogger.LogError(LoggerModules.GameApplication, string.Format("failed to retrieve initializer for module {0}", localModule.GetType().Name));
                        _failedModules[localModule.GetType()] = localModule;
                    }
                }
            }

            _taskFactory.Parallelize(tasks).Start(result => {
                handler();
            });

            foreach (KeyValuePair <Type, IModule> toRemove in modulesToRemove)
            {
                _availableModules.Remove(toRemove);
            }
        }
示例#21
0
 public virtual void ManualStart()
 {
     if (!_running)
     {
         _loop = Run();
         StartCoroutine(_loop);
     }
     else
     {
         CoreLogger.LogNotice(name, "TaskQueue.ManualStart called when queue already handling!");
     }
 }
示例#22
0
        IService ActivateServiceProvider(Type serviceType)
        {
            //non-active providers that implement the requested interface, sorted by priority
            List <ProviderWithPriority> dormantProviders = _dormantProviders.Where(p => p.Provider.GetType().GetInterfaces().Contains(serviceType)).ToList();

            dormantProviders.Sort((p1, p2) => p1.Priority.CompareTo(p2.Priority));
//			IEnumerable<TBase> dormantProviders = _dormantProviders.Where(p => p.Provider.GetType().GetInterfaces().Contains(serviceType))
//				.OrderBy(p => p.Priority).Select(p => p.Provider);

            foreach (IService dormantProvider in dormantProviders.Select(p => p.Provider))
            {
                if (InitNow(dormantProvider))
                {
                    CoreLogger.LogDebug(_loggerModule, string.Format("successfully iniialized provider {0} for service {1}", dormantProvider.GetType().Name, serviceType.Name));
                    _serviceProviders[serviceType] = dormantProvider;
                    _dormantProviders.Remove(_dormantProviders.First(p => p.Provider == dormantProvider));
                    _activeProviders.Add(dormantProvider);
                    _unprovidedServices.Remove(serviceType);
                    return(dormantProvider);
                }
                else
                {
                    CoreLogger.LogDebug(_loggerModule, string.Format("failed to initalize provider {0} for service {1}", dormantProvider.GetType().Name, serviceType.Name));
                    _dormantProviders.Remove(_dormantProviders.First(p => p.Provider == dormantProvider));
                    _failedProviders.Add(dormantProvider);
                }
            }

            foreach (KeyValuePair <Type, System.Func <IService> > kvp in _providerFactories)
            {
                if (kvp.Key.GetInterfaces().Contains(serviceType))
                {
                    IService provider = kvp.Value();
                    if (provider != null)
                    {
                        if (InitNow(provider))
                        {
                            CoreLogger.LogDebug(_loggerModule, string.Format("successfully iniialized provider {0} for service {1}", provider.GetType().Name, serviceType.Name));
                            _serviceProviders[serviceType] = provider;
                            _activeProviders.Add(provider);
                            _unprovidedServices.Remove(serviceType);
                            return(provider);
                        }
                        else
                        {
                            CoreLogger.LogDebug(_loggerModule, string.Format("failed to initalize provider for service {0}", serviceType.Name));
                        }
                    }
                }
            }

            return(null);
        }
示例#23
0
        private IEnumerator ShowSplashScreen()
        {
            _renderer.sprite = null;

            int numTasks = Count;

            CoreLogger.LogDebug(_loggerModule, string.Format("starting with {0} sprites and {1} tasks...", segments.Length, numTasks));

            if (segments.Length < 1)
            {
                while (TasksPending)
                {
                    yield return(new WaitForEndOfFrame());
                }

                CoreLogger.LogDebug(_loggerModule, string.Format("finished with 0 sprites and {0} tasks", numTasks));

                Done();
                yield break;
            }

            int i = 0;

            while (TasksPending)
            {
                _captureCamera.Capture();
                if (_renderer.sprite != null)
                {
                    _switchTime = Time.time;
                }
                yield return(null);

                SplashScreenSegment segment = segments[_splashIndex];
                float waitTime = SetSprite(segment);

                yield return(new WaitForSeconds(waitTime));

                i++;
                if (cyclic)
                {
                    _splashIndex = (_splashIndex + 1) % segments.Length;
                }
                else
                {
                    _splashIndex = Mathf.Min(_splashIndex + 1, segments.Length - 1);
                }
            }

            CoreLogger.LogDebug(_loggerModule, string.Format("done showing {0} sprites out of {1}, with {2} tasks", i, segments.Length, numTasks));

            Done();
        }
示例#24
0
 void OnApplicationFocus(bool focusStatus)
 {
     if (focusStatus)
     {
         CoreLogger.LogInfo(LoggerModules.GameApplication, string.Format("Game gained focus at time: {0}", Time.realtimeSinceStartup));
         GainedFocus();
     }
     else
     {
         CoreLogger.LogInfo(LoggerModules.GameApplication, string.Format("Game lost focus at time: {0}", Time.realtimeSinceStartup));
         LostFocus();
     }
 }
示例#25
0
        public void Invoke()
        {
            _callbacks.RemoveAll((c) => !c.IsAlive);

            foreach (WeakReference <TDelegate> callback in _callbacks)
            {
                System.Delegate method = callback.Target as System.Delegate;
                if (method != null)
                {
                    CoreLogger.LogInfo(string.Format("calling delegate {0}", callback.Target));
                }
            }
        }
        public override void Execute()
        {
            CoreLogger.LogDebug("AchievementsButtonCommand", "Execute");

            socialService.ShowAchievements();

            //socialNetworkService.Init();

            //          GeneralDialogData data = new GeneralDialogData();
            //          data.buttons.Add(new BasicDialogButtonData("button1"));
            //          data.isCloseOnOutSideTap=false;
            //          generalDialog.Show(data);
        }
示例#27
0
        public void StartProviders()
        {
            CoreLogger.LogDebug(_loggerModule, string.Format("resolver starting all providers..."));

            foreach (Type serviceType in _unprovidedServices)
            {
                IService provider = Get(serviceType);
                if (provider != null)
                {
                    CoreLogger.LogDebug(_loggerModule, string.Format("resolver will now provide for service {0} with {1}", serviceType.Name, provider.GetType().Name));
                }
            }
        }
示例#28
0
        public void AddProvider(IService provider, int priority = 0)
        {
            //check if it is already here - either as an active provider, or as a dormant one
            if (IsProviderKnown(provider))
            {
                CoreLogger.LogDebug(_loggerModule, string.Format("provider {0} already handled by this container", provider.GetType().Name));
                return;
            }

            //if not, it is first a dormant one
            _dormantProviders.Add(new ProviderWithPriority {
                Provider = provider, Priority = priority
            });
        }
示例#29
0
        void ImplementToggle(GameObject itemGo)
        {
            Toggle toggle = itemGo.GetComponent <Toggle>();

            if (toggle == null)
            {
                CoreLogger.LogError("ToggleViewList", "ImplementToggle missing Toggle component");
                return;
            }

            toggle.group = _toggleGroup;
            toggle.isOn  = false;
            toggle.onValueChanged.AddListener(OnToggleValueChanged);
        }
示例#30
0
        public IService Get(Type serviceType)
        {
            IService service = FetchService(serviceType);

            if (service != null)
            {
                return(service);
            }

            //no active provider - see if we can activate a dormant provider

            CoreLogger.LogDebug(_loggerModule, string.Format("adding service {0}, now looking for provider...", serviceType.Name));

            return(ActivateServiceProvider(serviceType));
        }