private static void ResizeSprite(Component parent, GameEvent gameEvent, Dictionary<string, Object> handlerArgs)
 {
     SingletonFactory.LOG.Log("obj " + StringUtil.PadLeft(parent.ID, 5, '0') + " resized to " + handlerArgs["Height"] + "x" + handlerArgs["Width"], ComponentType.Rendering);
     RenderingComponent renderingParent = (RenderingComponent)parent;
     renderingParent.Model.Height = (double) handlerArgs["Height"];
     renderingParent.Model.Width = (double) handlerArgs["Width"];
 }
 private static void MoveMe(Component parent, GameEvent gameEvent, Dictionary<string, Object> handlerArgs)
 {
     // Speed and direction should come from the event
     MovementComponent movementParent = (MovementComponent)parent;
     movementParent.Direction = EventArgReadUtil.GetDirection(gameEvent);
     movementParent.Speed = EventArgReadUtil.GetSpeed(gameEvent);
 }
 public void Register(Component component)
 {
     getService(component.Type).Register(component);
     _ledger.Add(component.FullName, component);
     if(!_gameObjects.ContainsKey(component.ID)) {
         _gameObjects.Add(component.ID, component.Parent);
     }
 }
예제 #4
0
 public void Register(Component component)
 {
     if (component.Type == _validRegisterType)
     {
         _registrees.Add(component);
     }
     else
     {
         throw new Exception("Component of type " + component.Type.ToString() + ", object id " + component.Parent.ID + " cannot be registered to service of type " + _validRegisterType.ToString());
     }
 }
 private static void ChangeTexture(Component parent, GameEvent gameEvent, Dictionary<string, Object> handlerArgs)
 {
     if (parent is GuiRenderingComponent)
     {
         GuiRenderingComponent guiRenParent = (GuiRenderingComponent)parent;
         guiRenParent.SetTexture(EventArgReadUtil.GetGuiTextureType(gameEvent));
     }
     else
     {
         MultiTextureRenderingComponent multiTexParent = (MultiTextureRenderingComponent)parent;
         multiTexParent.SetTexture(EventArgReadUtil.GetTexture(gameEvent));
     }
 }
예제 #6
0
 // COMPONENT METHODS
 public void AddComponent(Component newChild)
 {
     newChild.Parent = this;
     _children.Add(newChild);
     SingletonFactory.GetServiceRegistrar().Register(newChild);
 }
 public void Unregister(Component component)
 {
     getService(component.Type).Unregister(component);
     _ledger.Remove(component.FullName);
 }
 private static void SetPosition(Component parent, GameEvent gameEvent, Dictionary<string, Object> handlerArgs)
 {
     RenderingComponent renderingParent = (RenderingComponent)parent;
     if (!EventArgReadUtil.GetIsRelative(gameEvent)) { renderingParent.Model.SetPosition(EventArgReadUtil.GetPositionVector(gameEvent)); }
     else { renderingParent.Model.Center += EventArgReadUtil.GetPositionVector(gameEvent); }
 }
 public GameEventHandler(Component parent, EventType typeToReactTo, HandleEvent HandleEvent)
 {
     _parent = parent;
     _typeToHandle = typeToReactTo;
     DoMyHandleEvent = HandleEvent;
 }
 public GameEventHandler(Component parent, EventType typeToReactTo)
     : this(parent, typeToReactTo, null)
 {
 }
        internal void AddEventHandlerFromDO(Component component, EventHandlerDO eventHandlerDO)
        {
            // TODO - add handling for thrown events

            SingletonFactory.GetEventHandlerDecorator().AddHandler(component, eventHandlerDO.Name, eventHandlerDO.TypeToHandle, eventHandlerDO.HandlerArgs);
        }
예제 #12
0
 public void Unregister(Component component)
 {
     _registrees.Remove(component);
 }