protected BaseStoredGameComponent(BaseStoredGameComponentSettings settings, IWorldCoreGameComponentContext worldContext)
            : base(settings, worldContext)
        {
            try
            {
                _idForFacts = settings.IdForFacts;

                var standaloneStorageSettings = new StandaloneStorageSettings();
                standaloneStorageSettings.Id      = settings.Id;
                standaloneStorageSettings.IsWorld = false;
                standaloneStorageSettings.AppFile = settings.HostFile;
                standaloneStorageSettings.Logger  = Logger;

                standaloneStorageSettings.ModulesStorage          = worldContext.ModulesStorage;
                standaloneStorageSettings.ParentStorage           = worldContext.StandaloneStorage;
                standaloneStorageSettings.LogicQueryParseAndCache = worldContext.LogicQueryParseAndCache;

#if DEBUG
                //Log($"standaloneStorageSettings = {standaloneStorageSettings}");
#endif
                HostStorage = new StandaloneStorage(standaloneStorageSettings);
            }
            catch (Exception e)
            {
                Log(e.ToString());

                throw e;
            }
        }
 void IDeferredInitialized.Initialize(IWorldCoreGameComponentContext worldContext)
 {
     if (_gameComponent == null)
     {
         _gameComponent = new HumanoidNPCGameComponent(_settings, worldContext);
     }
 }
 public HostSupportComponent(IEntityLogger logger, IPlatformSupport platformSupport, HumanoidNPCGameComponentContext internalContext, IWorldCoreGameComponentContext worldContext)
     : base(logger)
 {
     _internalContext     = internalContext;
     _worldContext        = worldContext;
     _invokerInMainThread = worldContext.InvokerInMainThread;
     _platformSupport     = platformSupport;
 }
Exemplo n.º 4
0
 protected BaseGameComponent(BaseGameComponentSettings settings, IWorldCoreGameComponentContext worldContext)
 {
     _instanceId = settings.InstanceId;
     worldContext.AddGameComponent(this);
     _worldContext        = worldContext;
     _invokerInMainThread = worldContext.InvokerInMainThread;
     _logger = _worldContext.CreateLogger(settings.Id);
 }
Exemplo n.º 5
0
        public GameObjectGameComponent(GameObjectSettings settings, IWorldCoreGameComponentContext worldContext)
            : base(settings, worldContext)
        {
            _hostEndpointsRegistry = new EndpointsRegistry(Logger);

            var platformEndpointsList = EndpointDescriber.GetEndpointsInfoList(settings.HostListener);

            _hostEndpointsRegistry.AddEndpointsRange(platformEndpointsList);
        }
        public HumanoidNPCGameComponent(HumanoidNPCSettings settings, IWorldCoreGameComponentContext worldContext)
            : base(settings, worldContext)
        {
            try
            {
#if DEBUG
                //Log($"settings = {settings}");
                //Log($"worldContext.TmpDir = {worldContext.TmpDir}");
                //Log($"worldContext.LogicQueryParseAndCache == null = {worldContext.LogicQueryParseAndCache == null}");
#endif

                var internalContext = new HumanoidNPCGameComponentContext();

                _idForFacts = settings.IdForFacts;

                internalContext.IdForFacts     = _idForFacts;
                internalContext.SelfInstanceId = settings.InstanceId;

                var tmpDir = Path.Combine(worldContext.TmpDir, settings.Id);

                Directory.CreateDirectory(worldContext.TmpDir);

                if (settings.VisionProvider != null)
                {
                    _visionComponent = new VisionComponent(Logger, settings.VisionProvider, internalContext, worldContext);
                    internalContext.VisionComponent = _visionComponent;
                }

                _hostSupport = new HostSupportComponent(Logger, settings.PlatformSupport, internalContext, worldContext);
                internalContext.HostSupportComponent = _hostSupport;

                var coreEngineSettings = new EngineSettings();
                coreEngineSettings.Id          = settings.Id;
                coreEngineSettings.AppFile     = settings.LogicFile;
                coreEngineSettings.Logger      = Logger;
                coreEngineSettings.SyncContext = worldContext.SyncContext;

                coreEngineSettings.ModulesStorage          = worldContext.ModulesStorage;
                coreEngineSettings.LogicQueryParseAndCache = worldContext.LogicQueryParseAndCache;
                coreEngineSettings.TmpDir           = tmpDir;
                coreEngineSettings.HostListener     = this;
                coreEngineSettings.DateTimeProvider = worldContext.DateTimeProvider;
                coreEngineSettings.HostSupport      = _hostSupport;

#if DEBUG
                //Log($"coreEngineSettings = {coreEngineSettings}");
#endif
                _coreEngine = new Engine(coreEngineSettings);
                internalContext.CoreEngine = _coreEngine;
            }
            catch (Exception e)
            {
                Log(e.ToString());

                throw e;
            }
        }
Exemplo n.º 7
0
        public VisionComponent(IEntityLogger logger, IVisionProvider visionProvider, HumanoidNPCGameComponentContext internalContext, IWorldCoreGameComponentContext worldContext)
            : base(logger)
        {
            _internalContext = internalContext;
            _selfInstanceId  = internalContext.SelfInstanceId;
            _worldContext    = worldContext;
            _visionProvider  = visionProvider;

            _activePeriodicObjectContext = new ActivePeriodicObjectContext(worldContext.SyncContext);
            _activeObject = new AsyncActivePeriodicObject(_activePeriodicObjectContext);
            _activeObject.PeriodicMethod = CommandLoop;
        }
Exemplo n.º 8
0
 void IDeferredInitialized.Initialize(IWorldCoreGameComponentContext worldContext)
 {
 }
Exemplo n.º 9
0
 public PlayerImlementation(PlayerSettings settings, IWorldCoreGameComponentContext context)
 {
 }
        protected BaseManualControllingGameComponent(BaseManualControllingGameComponentSettings settings, IWorldCoreGameComponentContext worldContext)
            : base(settings, worldContext)
        {
            BaseManualControllingGameComponentSettingsValidator.Validate(settings);

            var platformTypesConvertorsRegistry = worldContext.PlatformTypesConvertors;

            _endpointsRegistries = new List <IEndpointsRegistry>();

            _hostEndpointsRegistry = new EndpointsRegistry(Logger);
            _endpointsRegistries.Add(_hostEndpointsRegistry);

            var platformEndpointsList = EndpointDescriber.GetEndpointsInfoList(settings.HostListener);

            _hostEndpointsRegistry.AddEndpointsRange(platformEndpointsList);

            _endPointsResolver = new EndPointsResolver(Logger, platformTypesConvertorsRegistry);

            _endPointActivator = new EndPointActivator(Logger, platformTypesConvertorsRegistry, worldContext.InvokerInMainThread);

            _internalManualControlledObjectsList             = new List <IInternalManualControlledObject>();
            _internalManualControlledObjectsDict             = new Dictionary <IGameObject, InternalManualControlledObject>();
            _endpointsRegistryForManualControlledObjectsDict = new Dictionary <IGameObject, EndpointsProxyRegistryForDevices>();
        }
 public HumanoidNPCImplementation(HumanoidNPCSettings settings, IWorldCoreGameComponentContext worldContext)
 {
     _gameComponent = new HumanoidNPCGameComponent(settings, worldContext);
 }
Exemplo n.º 12
0
 public GameObjectImplementation(GameObjectSettings settings, IWorldCoreGameComponentContext context)
 {
     _gameComponent = new GameObjectGameComponent(settings, context);
 }
Exemplo n.º 13
0
 public PlaceImplementation(PlaceSettings settings, IWorldCoreGameComponentContext context)
 {
 }
 public TstBaseManualControllingGameComponent(BaseManualControllingGameComponentSettings settings, IWorldCoreGameComponentContext worldContext)
     : base(settings, worldContext)
 {
 }