Exemplo n.º 1
0
        public void AddComponentToEntity(IEngineComponent component, uint id)
        {
            if (!Components.ContainsKey(component.GetType()))
            {
                Components.Add(component.GetType(), new Dictionary <uint, IEngineComponent>());
            }
            var components = Components[component.GetType()];

            components.Add(id, component);
        }
Exemplo n.º 2
0
 public Train(int id, string name, int maxSpeed, bool operated, ILogComponent trainLog,
              IEngineComponent engineComponent,
              IPassengerCartComponent passengerCartComponent)
 {
     this.ID                     = id;
     this.Name                   = name;
     this.MaxSpeed               = maxSpeed;
     this.Operated               = operated;
     this.LogComponent           = trainLog;
     this.EngineComponent        = engineComponent;
     this.PassengerCartComponent = passengerCartComponent;
 }
Exemplo n.º 3
0
 private void AddComponent(IEngineComponent component, bool delayStartUp)
 {
     Engine.Log.Write("Adding sub-system:");
     Engine.Log.IndentMore();
     Engine.Log.Write("* " + component.GetType().Name);
     Engine.Log.IndentMore();
     m_components.Add(component);
     if (!delayStartUp)
     {
         component.Startup();
         component.Started = true;
     }
     Engine.Log.IndentLess();
     Engine.Log.IndentLess();
 }
Exemplo n.º 4
0
        private static void OnComponentRemoved(IEngineComponent component)
        {
            GameLoop loop = component as GameLoop;

            if (loop != null)
            {
                OnGameLoopRemoved(loop);
            }

            if (component is Renderer)
            {
                OnRendererRemoved();
            }

            Logger logger = component as Logger;

            if (logger != null)
            {
                OnLoggerRemoved(logger);
            }
        }
Exemplo n.º 5
0
        private static void OnComponentAdded(IEngineComponent component)
        {
            GameLoop loop = component as GameLoop;

            if (loop != null)
            {
                OnGameLoopAdded(loop);
            }

            Renderer renderer = component as Renderer;

            if (renderer != null)
            {
                OnRendererAdded(renderer);
            }

            Logger logger = component as Logger;

            if (logger != null)
            {
                OnLoggerAdded(logger);
            }
        }
Exemplo n.º 6
0
        public RemoteCollectorEngineInitiator(
            int engineId,
            string engineName,
            bool interfaceAvailable,
            IEngineDAL engineDal,
            IThrottlingStatusProvider throttlingStatusProvider,
            IEngineComponent engineComponent)
        {
            if (engineName == null)
            {
                throw new ArgumentNullException(nameof(engineName));
            }
            IEngineDAL iengineDal = engineDal;

            if (iengineDal == null)
            {
                throw new ArgumentNullException(nameof(engineDal));
            }
            this._engineDal = iengineDal;
            IThrottlingStatusProvider ithrottlingStatusProvider = throttlingStatusProvider;

            if (ithrottlingStatusProvider == null)
            {
                throw new ArgumentNullException(nameof(throttlingStatusProvider));
            }
            this._throttlingStatusProvider = ithrottlingStatusProvider;
            IEngineComponent engineComponent1 = engineComponent;

            if (engineComponent1 == null)
            {
                throw new ArgumentNullException(nameof(engineComponent));
            }
            this._engineComponent    = engineComponent1;
            this.EngineId            = engineId;
            this.ServerName          = engineName.ToUpperInvariant();
            this._interfaceAvailable = interfaceAvailable;
        }
Exemplo n.º 7
0
 bool IEngineComponent.IsCompatibleTo(IEngineComponent component)
 {
     return(IsCompatibleTo(component));
 }
Exemplo n.º 8
0
 protected abstract bool IsCompatibleTo(IEngineComponent component);
Exemplo n.º 9
0
 protected override bool IsCompatibleTo(IEngineComponent component)
 {
     return(!(component is Mouse));
 }
Exemplo n.º 10
0
 bool IEngineComponent.IsCompatibleTo(IEngineComponent component)
 {
     return true;
 }
Exemplo n.º 11
0
 bool IEngineComponent.IsCompatibleTo(IEngineComponent component)
 {
     return(true);
 }
Exemplo n.º 12
0
 bool IEngineComponent.IsCompatibleTo(IEngineComponent component)
 {
     return(!(component is GameLoop));
 }
Exemplo n.º 13
0
 bool IEngineComponent.IsCompatibleTo(IEngineComponent component)
 {
     return !(component is Renderer);
 }
Exemplo n.º 14
0
        public void UnregisterEngineComponent(IEngineComponent component)
        {
            if (component is IUpdateable)
                OnUpdate -= (component as IUpdateable).Update;

            if (component is IRenderable)
                OnRender -= (component as IRenderable).Render;

            if (component is ILoadable) {
                OnLoadContent -= (component as ILoadable).LoadContent;
                OnUnloadContent -= (component as ILoadable).UnloadContent;
            }

            if(component is IHandleMouseButtonPressed)
                OnMousePressed -= (component as IHandleMouseButtonPressed).OnMousePressed;

            if(component is IHandleMouseButtonHeld)
                OnMouseHeld -= (component as IHandleMouseButtonHeld).OnMouseHeld;

            if(component is IHandleMouseButtonReleased)
                OnMouseReleased -= (component as IHandleMouseButtonReleased).OnMouseReleased;

            if (component is IHandleMouseMotion)
                OnMouseMoved -= (component as IHandleMouseMotion).OnMotion;

            if (component is IHandleMousePosition)
                OnMousePosition -= (component as IHandleMousePosition).OnPosition;

            if (component is IHandleMouseScrollWheel)
                OnMouseScroll -= (component as IHandleMouseScrollWheel).OnScrolled;

            if (component is IHandleKeyboardPressed)
                OnKeyboardPressed -= (component as IHandleKeyboardPressed).OnKeyboardPressed;

            if (component is IHandleKeyboardHeld)
                OnKeyboardHeld -= (component as IHandleKeyboardHeld).OnKeyboardHeld;

            if (component is IHandleKeyboardReleased)
                OnKeyboardReleased -= (component as IHandleKeyboardReleased).OnKeyboardReleased;
        }
Exemplo n.º 15
0
 protected override bool IsCompatibleTo(IEngineComponent component)
 {
     return !(component is DebugConsole);
 }
Exemplo n.º 16
0
 protected override bool IsCompatibleTo(IEngineComponent component)
 {
     return(true);
 }
Exemplo n.º 17
0
 bool IEngineComponent.IsCompatibleTo(IEngineComponent component)
 {
     return IsCompatibleTo(component);
 }
Exemplo n.º 18
0
 protected abstract bool IsCompatibleTo(IEngineComponent component);
Exemplo n.º 19
0
 protected override bool IsCompatibleTo(IEngineComponent component)
 {
     return true;
 }
Exemplo n.º 20
0
 bool IEngineComponent.IsCompatibleTo(IEngineComponent component)
 {
     return(!(component is Renderer));
 }
Exemplo n.º 21
0
 bool IEngineComponent.IsCompatibleTo(IEngineComponent component)
 {
     return !(component is AudioEngine);
 }
 public void AddComponent(IEngineComponent Component)
 {
     Components.Add(Component);
 }
Exemplo n.º 23
0
 bool IEngineComponent.IsCompatibleTo(IEngineComponent component)
 {
     return !(component is GameLoop);
 }
Exemplo n.º 24
0
 public void AddComponent(IEngineComponent component)
 {
     AddComponent(component, false);
 }
Exemplo n.º 25
0
 protected override bool IsCompatibleTo(IEngineComponent component)
 {
     return(!(component is VisualStudioTrace));
 }
Exemplo n.º 26
0
 bool IEngineComponent.IsCompatibleTo(IEngineComponent component)
 {
     return(!(component is AudioEngine));
 }
Exemplo n.º 27
0
 public void AddComponentDelayed(IEngineComponent component)
 {
     AddComponent(component, true);
 }
Exemplo n.º 28
0
 protected override bool IsCompatibleTo(IEngineComponent component)
 {
     return(!(component is DebugConsole));
 }
Exemplo n.º 29
0
 protected override bool IsCompatibleTo(IEngineComponent component)
 {
     return !(component is VisualStudioTrace);
 }