Exemple #1
0
        public void DoAwake(IServiceContainer services)
        {
            Utils.StartServices();
            if (Instance != null)
            {
                Debug.LogError("LifeCycle Error: Awake more than once!!");
                return;
            }

            Instance              = this;
            _serviceContainer     = services as ServiceContainer;
            _registerService      = new EventRegisterService();
            _mgrContainer         = new ManagerContainer();
            _timeMachineContainer = new TimeMachineContainer();

            //AutoCreateManagers;
            var svcs = _serviceContainer.GetAllServices();

            foreach (var service in svcs)
            {
                _timeMachineContainer.RegisterTimeMachine(service as ITimeMachine);
                if (service is BaseService baseService)
                {
                    _mgrContainer.RegisterManager(baseService);
                }
            }

            _serviceContainer.RegisterService(_timeMachineContainer);
            _serviceContainer.RegisterService(_registerService);
        }
Exemple #2
0
 public void InitReference(IServiceContainer serviceContainer)
 {
     _resourceService      = serviceContainer.GetService <IResourceService>();
     _audioService         = serviceContainer.GetService <IAudioService>();
     _inputService         = serviceContainer.GetService <IInputService>();
     _mapService           = serviceContainer.GetService <IMapService>();
     _eventRegisterService = serviceContainer.GetService <IEventRegisterService>();
     _viewService          = serviceContainer.GetService <IViewService>();
     _unitService          = serviceContainer.GetService <IUnitService>();
     _randomService        = serviceContainer.GetService <IRandomService>();
     _timeMachineService   = serviceContainer.GetService <ITimeMachineService>();
     _constStateService    = serviceContainer.GetService <IConstGameStateService>();
     _gameStateService     = serviceContainer.GetService <IGameStateService>();
     _networkService       = serviceContainer.GetService <INetworkService>();
 }
 public virtual void InitReference(IServiceContainer serviceContainer, IManagerContainer mgrContainer)
 {
     _serviceContainer = serviceContainer;
     //通用Service
     _ecsFacadeService     = serviceContainer.GetService <IECSFacadeService>();
     _randomService        = serviceContainer.GetService <IRandomService>();
     _timeMachineService   = serviceContainer.GetService <ITimeMachineService>();
     _constStateService    = serviceContainer.GetService <IConstStateService>();
     _inputService         = serviceContainer.GetService <IInputService>();
     _viewService          = serviceContainer.GetService <IViewService>();
     _audioService         = serviceContainer.GetService <IAudioService>();
     _map2DService         = serviceContainer.GetService <IMap2DService>();
     _resService           = serviceContainer.GetService <IResService>();
     _effectService        = serviceContainer.GetService <IEffectService>();
     _eventRegisterService = serviceContainer.GetService <IEventRegisterService>();
 }
 public virtual void InitReference(IServiceContainer serviceContainer, IManagerContainer mgrContainer = null)
 {
     this._serviceContainer     = serviceContainer;
     this._ecsFactoryService    = serviceContainer.GetService <IECSFactoryService>();
     this._randomService        = serviceContainer.GetService <IRandomService>();
     this._timeMachineService   = serviceContainer.GetService <ITimeMachineService>();
     this._globalStateService   = serviceContainer.GetService <IGlobalStateService>();
     this._inputService         = serviceContainer.GetService <IInputService>();
     this._viewService          = serviceContainer.GetService <IViewService>();
     this._audioService         = serviceContainer.GetService <IAudioService>();
     this._map2DService         = serviceContainer.GetService <IMap2DService>();
     this._resService           = serviceContainer.GetService <IResService>();
     this._effectService        = serviceContainer.GetService <IEffectService>();
     this._eventRegisterService = serviceContainer.GetService <IEventRegisterService>();
     this._idService            = serviceContainer.GetService <IIdService>();
     this._debugService         = serviceContainer.GetService <IDebugService>();
 }
Exemple #5
0
 protected override void OnInit(BaseContext context, IServiceContainer services)
 {
     _context = (Context)context;
     //BuildInServices
     _randomService        = services.GetService <IRandomService>();
     _timeMachineService   = services.GetService <ITimeMachineService>();
     _globalStateService   = services.GetService <IGlobalStateService>();
     _viewService          = services.GetService <IViewService>();
     _audioService         = services.GetService <IAudioService>();
     _inputService         = services.GetService <IInputService>();
     _map2DService         = services.GetService <IMap2DService>();
     _resService           = services.GetService <IResService>();
     _effectService        = services.GetService <IEffectService>();
     _eventRegisterService = services.GetService <IEventRegisterService>();
     _idService            = services.GetService <IIdService>();
     _debugService         = services.GetService <IDebugService>();
     //GameServices
     _gameStateService  = services.GetService <IGameStateService>();
     _gameConfigService = services.GetService <IGameConfigService>();
     _gameEventService  = services.GetService <IGameEventService>();
 }