Beispiel #1
0
        public void Subscribe(fbEventHandler handler, EventType eventType)
        {
            if (!subscribers.ContainsKey(eventType))
            {
                subscribers.Add(eventType, new List <fbEventHandler>());
            }

            subscribers[eventType].Add(handler);
        }
Beispiel #2
0
 //moving this out like this and *MANUALLY* calling it in fbApplication.
 //this means that fbGame doesn't even need an engine reference any more.
 //that in turn means that we can keep an entire fbGame in our server
 //app, which acts exactly like a normal client would.
 //only difference is that we give it another eventhandler.
 public void SetupClientSideEventHandler(fbEngine engine)
 {
     EventHandler = new GameEventHandler(this, engine)
                    .Subscribe(engine, EventType.NameEvent)
                    .Subscribe(engine, EventType.UnitMoveEvent)
                    .Subscribe(engine, EventType.BuildStationEvent)
                    .Subscribe(engine, EventType.BuildUnitEvent)
                    .Subscribe(engine, EventType.CreateUnitEvent)
                    .Subscribe(engine, EventType.PlayerDisconnect)
                    .Subscribe(engine, EventType.SetProjectEvent)
                    .Subscribe(engine, EventType.ProjectFinishedEvent);
 }
Beispiel #3
0
 public void Unsubscribe(fbEventHandler handler, EventType eventType)
 {
     subscribers[eventType].Remove(handler);
 }