Ejemplo n.º 1
0
        // called to create a non-derived event for simple things;
        // but keep other classes limited to calling specific factory
        // methods
        protected static EventOfHurt CreateGeneric(
            EEventType evt, ESubsystem src,
            ESubsystem dest = ESubsystem.Dispatcher,
            Tuple <EventOfHurt, DateTime>[] reasons = null
            )
        {
            EventOfHurt RetVal;

            if (dest == null)
            {
                dest = ESubsystem.Dispatcher;
            }
            List <Tuple <EventOfHurt, DateTime> > ReasonList =
                new List <Tuple <EventOfHurt, DateTime> >();

            if (reasons != null)
            {
                ReasonList.AddRange(reasons);
            }
            // the initializer after the constructor allows for a
            // lot more flexibility than e.g., optional params
            RetVal = new EventOfHurt(evt, src)
            {
                myEventReferences = ReasonList
            };
            return(RetVal);
        }
Ejemplo n.º 2
0
        // some of the specific methods can just return a generic
        // non-derived event
        public static EventOfHurt CreateTickerTimerEvent(
            EEventType evt, ESubsystem dest
            )
        {
            ESubsystem src = ESubsystem.TickerTimer;

            return(CreateGeneric(evt, src, dest, null));
        }
Ejemplo n.º 3
0
        // some may return actual derived classes
        public static EventOfHurt CreatePlayerActionEvent(
            EEventType evt, ESubsystem dest,
            Tuple <EventOfHurt, DateTime>[] reasons
            )
        {
            PlayerEvent PE = new PlayerActionEvent(42);

            return(PE);
        }
Ejemplo n.º 4
0
 // we'll be using factor methods to create events
 // so keep constructors private; no default constructor
 private EventOfHurt(
     EEventType evt,
     ESubsystem src,
     ESubsystem dest = ESubsystem.Dispatcher
     )
 {
     EventType       = evt;
     SourceSubsystem = src;
     DestSubsystem   = dest;
     EventId         = Guid.NewGuid();
     Timestamp       = DateTime.UtcNow;
 }
Ejemplo n.º 5
0
 public SubsystemParser(ushort subsystem)
 {
     subsys = (ESubsystem)subsystem;
 }