private void SetResultImg(ref WindowResultVehicle Result, int hits, int wounds = 0) { if (wounds * 4 <= hits) { Result.ImageBattleResult.Source = new BitmapImage(new Uri("Lose.png", UriKind.Relative)); } else if (wounds * 3 <= hits) { Result.ImageBattleResult.Source = new BitmapImage(new Uri("Mid.png", UriKind.Relative)); } else { Result.ImageBattleResult.Source = new BitmapImage(new Uri("Win.png", UriKind.Relative)); } }
//против техники void DisplayResult(CombatLib.Phases.PhaseHits.PhaseHitsVehicle Hits, CombatLib.Phases.PhaseWounds.PhaseWoundsVehicle Wounds = null, int S = -1, CombatLib.Phases.PhaseSaves.PhaseSavesVehicle Saves = null) { /*MessageBox.Show(Hits.ToString(), "Попадания", MessageBoxButton.OK); if (Wounds != null) MessageBox.Show(Wounds.ToString(), "Раны", MessageBoxButton.OK); if (Saves != null) MessageBox.Show(Saves.ToString(), "Спасброски", MessageBoxButton.OK);*/ WindowResultVehicle Result = new WindowResultVehicle(); if (Wounds == null) SetResultImg(ref Result, Hits.Hits); else SetResultImg(ref Result, Hits.Hits, Wounds.Wounds); Result.Show(); //Hits if (Hits.Condition > 6) { //hits Result.LabelHits.Content = "нельзя попасть"; Result.LabelAddHitCondInfo.Visibility = System.Windows.Visibility.Hidden; Result.LabelAddHitCondition.Visibility = System.Windows.Visibility.Hidden; //wounds Result.LabelPunchedWoundsInfo.Visibility = System.Windows.Visibility.Hidden; Result.LabelPunchedWounds.Visibility = System.Windows.Visibility.Hidden; Result.LabelSlidingWoundsInfo.Visibility = System.Windows.Visibility.Hidden; Result.LabelSlidingWounds.Visibility = System.Windows.Visibility.Hidden; Result.LabelStrengthInfo.Visibility = System.Windows.Visibility.Hidden; Result.LabelStrength.Visibility = System.Windows.Visibility.Hidden; //saves Result.LabelSaveInfo.Visibility = System.Windows.Visibility.Hidden; Result.LabelSaves.Visibility = System.Windows.Visibility.Hidden; //groups Result.GroupHits.Visibility = System.Windows.Visibility.Hidden; Result.GroupWounds.Visibility = System.Windows.Visibility.Hidden; Result.GroupSaves.Visibility = System.Windows.Visibility.Hidden; return; } else { Result.LabelHits.Content = Hits.Hits.ToString(); Result.LabelHitCondition.Content = Hits.Condition.ToString() + "+"; Result.TextBlockHitCubes.Text = Hits.HitCubesStr; Result.TextBlockHitCubes.TextWrapping = TextWrapping.Wrap; if (Hits.AdditionalCondition <= 6) { Result.LabelAddHitCondition.Content = Hits.AdditionalCondition.ToString() + "+"; } else { Result.LabelAddHitCondInfo.Visibility = System.Windows.Visibility.Hidden; Result.LabelAddHitCondition.Visibility = System.Windows.Visibility.Hidden; } } //Wounds if ((Wounds == null) || (Wounds.Condition > 14)) { //wounds Result.LabelPunchedWoundsInfo.Visibility = System.Windows.Visibility.Hidden; Result.LabelPunchedWounds.Visibility = System.Windows.Visibility.Hidden; Result.LabelSlidingWoundsInfo.Visibility = System.Windows.Visibility.Hidden; Result.LabelSlidingWounds.Visibility = System.Windows.Visibility.Hidden; Result.LabelStrengthInfo.Visibility = System.Windows.Visibility.Hidden; Result.LabelStrength.Visibility = System.Windows.Visibility.Hidden; //saves Result.LabelSaveInfo.Visibility = System.Windows.Visibility.Hidden; Result.LabelSaves.Visibility = System.Windows.Visibility.Hidden; //groups Result.GroupWounds.Visibility = System.Windows.Visibility.Hidden; Result.GroupSaves.Visibility = System.Windows.Visibility.Hidden; } if (Wounds == null) { //wounds Result.LabelWoundsInfo.Content = "не попал"; return; } else if (Wounds.Condition > 14) { //wounds Result.LabelWoundsInfo.Content = "нельзя ранить"; return; } else { Result.LabelPunchedWounds.Content = Wounds.PunchedWounds.ToString(); Result.LabelSlidingWounds.Content = Wounds.SlidingWounds.ToString(); Result.LabelWoundCondition.Content = Wounds.Condition.ToString() + "+"; Result.TextBlockWoundCubes.Text = Wounds.WoundCubesStr; Result.TextBlockWoundCubes.TextWrapping = TextWrapping.Wrap; Result.LabelStrength.Content = S.ToString(); } //Saves if ((Saves == null) && (Wounds.Wounds != 0)) { //saves Result.LabelSaveInfo.Visibility = System.Windows.Visibility.Hidden; Result.LabelSaves.Visibility = System.Windows.Visibility.Hidden; //groups Result.GroupSaves.Visibility = System.Windows.Visibility.Hidden; return; } if ((Saves == null) || (Saves.Condition > 6)) { //groups Result.GroupSaves.Visibility = System.Windows.Visibility.Hidden; } if (Saves == null) { //saves Result.LabelSaves.Content = "не ранил"; return; } else if (Saves.Condition > 6) { //saves Result.LabelSaves.Content = "нельзя спасти"; return; } else { Result.LabelSaves.Content = Saves.Saves.ToString(); Result.LabelSaveCondition.Content = Saves.Condition.ToString() + "+"; Result.TextBlockSaveCubes.Text = Saves.SaveCubesStr; Result.TextBlockSaveCubes.TextWrapping = TextWrapping.Wrap; } return; }