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 OnEvent(GameEvent gameEvent)
 {
     if (gameEvent.Type == _typeToHandle)
     {
         DoMyHandleEvent(_parent, gameEvent, _handlerArgs);
     }
 }
예제 #4
0
 public GameEvent GetGameEvent(string eventType, Object source, Dictionary<string, Object> eventArgs)
 {
     GameEvent gameEvent = new GameEvent(EventTypeUtil.GetTypeFromString(eventType));
     gameEvent.Source = source;
     if (eventArgs != null && eventArgs.Count > 0) { gameEvent.SetArgs(eventArgs); }
     return gameEvent;
 }
 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
 public void OnEvent(GameEvent gameEvent)
 {
     if (gameEvent.Source != _parent)
     {
         SingletonFactory.GetEventHub().SendEvent(gameEvent, _parent);
     }
     else
     {
         foreach(GameEventHandler handler in _handlers)
         {
             if (handler.TypeToHandle == gameEvent.Type)
             {
                 handler.OnEvent(gameEvent);
             }
         }
     }
 }
예제 #7
0
 public void OnEvent(GameEvent gameEvent)
 {
     gameEvent.Source = this;
     foreach (Component child in _children)
     {
         child.OnEvent(gameEvent);
     }
 }
 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); }
 }