예제 #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);
        }
예제 #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;
 }
예제 #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();
 }
예제 #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);
            }
        }
예제 #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);
            }
        }
예제 #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;
        }
예제 #7
0
 bool IEngineComponent.IsCompatibleTo(IEngineComponent component)
 {
     return(IsCompatibleTo(component));
 }
예제 #8
0
 protected abstract bool IsCompatibleTo(IEngineComponent component);
예제 #9
0
 protected override bool IsCompatibleTo(IEngineComponent component)
 {
     return(!(component is Mouse));
 }
예제 #10
0
 bool IEngineComponent.IsCompatibleTo(IEngineComponent component)
 {
     return true;
 }
예제 #11
0
 bool IEngineComponent.IsCompatibleTo(IEngineComponent component)
 {
     return(true);
 }
예제 #12
0
 bool IEngineComponent.IsCompatibleTo(IEngineComponent component)
 {
     return(!(component is GameLoop));
 }
예제 #13
0
 bool IEngineComponent.IsCompatibleTo(IEngineComponent component)
 {
     return !(component is Renderer);
 }
예제 #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;
        }
예제 #15
0
 protected override bool IsCompatibleTo(IEngineComponent component)
 {
     return !(component is DebugConsole);
 }
예제 #16
0
 protected override bool IsCompatibleTo(IEngineComponent component)
 {
     return(true);
 }
예제 #17
0
 bool IEngineComponent.IsCompatibleTo(IEngineComponent component)
 {
     return IsCompatibleTo(component);
 }
예제 #18
0
 protected abstract bool IsCompatibleTo(IEngineComponent component);
예제 #19
0
 protected override bool IsCompatibleTo(IEngineComponent component)
 {
     return true;
 }
예제 #20
0
 bool IEngineComponent.IsCompatibleTo(IEngineComponent component)
 {
     return(!(component is Renderer));
 }
예제 #21
0
 bool IEngineComponent.IsCompatibleTo(IEngineComponent component)
 {
     return !(component is AudioEngine);
 }
 public void AddComponent(IEngineComponent Component)
 {
     Components.Add(Component);
 }
예제 #23
0
 bool IEngineComponent.IsCompatibleTo(IEngineComponent component)
 {
     return !(component is GameLoop);
 }
예제 #24
0
 public void AddComponent(IEngineComponent component)
 {
     AddComponent(component, false);
 }
예제 #25
0
 protected override bool IsCompatibleTo(IEngineComponent component)
 {
     return(!(component is VisualStudioTrace));
 }
예제 #26
0
 bool IEngineComponent.IsCompatibleTo(IEngineComponent component)
 {
     return(!(component is AudioEngine));
 }
예제 #27
0
 public void AddComponentDelayed(IEngineComponent component)
 {
     AddComponent(component, true);
 }
예제 #28
0
 protected override bool IsCompatibleTo(IEngineComponent component)
 {
     return(!(component is DebugConsole));
 }
예제 #29
0
 protected override bool IsCompatibleTo(IEngineComponent component)
 {
     return !(component is VisualStudioTrace);
 }