bool OnTextEvent(TextEvent e, Action continuation) { var eventManager = Resolve <IEventManager>(); var mapManager = Resolve <IMapManager>(); var(useEventText, textSourceId) = eventManager.Context?.Source switch { EventSource.Map map => (false, (int)map.MapId), EventSource.EventSet eventSet => (true, (int)eventSet.EventSetId), _ => (false, (int)mapManager.Current.MapId) }; var textEvent = useEventText ? (BaseTextEvent) new EventTextEvent( (EventSetId)textSourceId, e.TextId, e.Location, e.PortraitId) : new MapTextEvent( (MapDataId)textSourceId, e.TextId, e.Location, e.PortraitId); return(OnBaseTextEvent(textEvent, continuation)); }
bool OnPartyMemberTextEvent(PartyMemberTextEvent e, Action continuation) { var state = Resolve <IGameState>(); var party = Resolve <IParty>(); var sheet = state.GetPartyMember(e.MemberId ?? party.Leader); var eventManager = Resolve <IEventManager>(); var mapManager = Resolve <IMapManager>(); var(useEventText, textSourceId) = eventManager.Context?.Source switch { EventSource.Map map => (false, (int)map.MapId), EventSource.EventSet eventSet => (true, (int)eventSet.EventSetId), _ => (false, (int)mapManager.Current.MapId) }; var textEvent = useEventText ? (BaseTextEvent) new EventTextEvent( (EventSetId)textSourceId, e.TextId, TextLocation.TextInWindowWithPortrait, sheet.PortraitId) : new MapTextEvent( (MapDataId)textSourceId, e.TextId, TextLocation.TextInWindowWithPortrait, sheet.PortraitId); return(OnBaseTextEvent(textEvent, continuation)); }