private async void ActorInteractionBus_NewEvent(object sender, NewActorInteractionEventArgs e) { await Task.Factory.StartNew(() => { NewEventHandlerInner(e); }, CancellationToken.None, TaskCreationOptions.None, _taskScheduler); }
private void NewEventHandlerInner(NewActorInteractionEventArgs e) { var currentLanguage = _uiSettingService.CurrentLanguage; switch (e.ActorInteractionEvent) { case DamageActorInteractionEvent interactionEvent: var damageLog = GetDamageLog(currentLanguage, interactionEvent); _logService.Log(damageLog); if (interactionEvent.DamageEfficientCalcResult.TargetSuccessfullUsedArmor) { var usedArmorLog = $"{interactionEvent.TargetActor} successfully used armor rank: {interactionEvent.DamageEfficientCalcResult.ArmorRank}, roll: {interactionEvent.DamageEfficientCalcResult.FactArmorSaveRoll}, success: {interactionEvent.DamageEfficientCalcResult.SuccessArmorSaveRoll}."; _logService.Log(usedArmorLog); } CreateDamageIndication(interactionEvent); break; case DodgeActorInteractionEvent interactionEvent: _logService.Log($"{interactionEvent.Actor} defends {interactionEvent.PersonDefenceItem}, roll: {interactionEvent.FactToHitRoll}, success: {interactionEvent.SuccessToHitRoll}"); CreateDodgeIndication(interactionEvent); break; case PureMissActorInteractionEvent interactionEvent: _logService.Log($"{interactionEvent.Actor} missed."); CreateMissIndication(interactionEvent); break; } }
private void ActorInteractionBus_NewEvent(object sender, NewActorInteractionEventArgs e) { switch (e.ActorInteractionEvent) { case DamageActorInteractionEvent interactionEvent: _logService.Log($"{interactionEvent.Actor} damage {interactionEvent.TargetActor} on {interactionEvent.DamageEfficientCalcResult.ResultEfficient}"); if (interactionEvent.DamageEfficientCalcResult.TargetSuccessfullUsedArmor) { _logService.Log($"{interactionEvent.TargetActor} successfully used armor rank: {interactionEvent.DamageEfficientCalcResult.ArmorRank}, roll: {interactionEvent.DamageEfficientCalcResult.FactArmorSaveRoll}, success: {interactionEvent.DamageEfficientCalcResult.SuccessArmorSaveRoll}."); } CreateDamageIndication(interactionEvent); break; case DodgeActorInteractionEvent interactionEvent: _logService.Log($"{interactionEvent.Actor} defends {interactionEvent.PersonDefenceItem}, roll: {interactionEvent.FactToHitRoll}, success: {interactionEvent.SuccessToHitRoll}"); CreateDodgeIndication(interactionEvent); break; case PureMissActorInteractionEvent interactionEvent: _logService.Log($"{interactionEvent.Actor} missed."); CreateMissIndication(interactionEvent); break; } }
private void EventMessageBus_NewEvent(object sender, NewActorInteractionEventArgs e) { RaisedActorInteractionEvents.Add(e.ActorInteractionEvent); }