Ejemplo n.º 1
0
        public void SetDispatcherFor(ProgramContext context)
        {
            // Return existing one, or make a new one for it:
            if (mapping.ContainsKey(context))
            {
                CurrentDispatcher = mapping[context];
                return;
            }

            KOSGameEventDispatcher newDispatcher = new KOSGameEventDispatcher(Shared);

            mapping.Add(context, newDispatcher);
            CurrentDispatcher = newDispatcher;
        }
Ejemplo n.º 2
0
        public void RemoveDispatcherFor(ProgramContext context)
        {
            // First, unset the current dispatcher if the context
            // being removed is for the current dispatcher:
            KOSGameEventDispatcher contextDispatcher;

            mapping.TryGetValue(context, out contextDispatcher);
            if (contextDispatcher == CurrentDispatcher)
            {
                CurrentDispatcher = null;
            }

            // Then get rid of the mapping for this context:
            mapping.Remove(context);
        }
Ejemplo n.º 3
0
 public void Clear()
 {
     mapping.Clear();
     CurrentDispatcher = null;
 }
Ejemplo n.º 4
0
 public GameEventDispatchManager(SharedObjects shared)
 {
     Shared            = shared;
     mapping           = new Dictionary <ProgramContext, KOSGameEventDispatcher>();
     CurrentDispatcher = null;
 }