public IEnumerable <RlEvent> handleAbs(RlEvent e) { Force.nonNull(e, "RlEventHub.handleAny()"); if (!this.concHubs.TryGetValue(e.GetType(), out var concHub)) { // we don't have any handler for that. think about `NotYetDecided` action yield break; } foreach (var ev in concHub.handleAbs(e)) { yield return(ev); } }
/// <summary> The nestable <c>RlEvent</c> handling </summary> static IEnumerable <RlGameProgress> processEvent(AnyRlEvHub evHub, RlEvent ev) { yield return(RlGameProgress.event_(ev)); foreach (var evNested in evHub.handleAbs(ev)) { // nest events enabled foreach (var report in RlGameState.processEvent(evHub, evNested)) { if (report == null) { continue; } yield return(report); } } }
/// <summary> Downcasts give event to <c>T</c> and dispaches them to the handlers. </summary> IEnumerable <RlEvent> IConcRlEvHub.handleAbs(RlEvent ev) => this.handleConc(ev as T);