/// <summary> /// Ctor. /// </summary> /// <param name="playerSavePivot">Player save file.</param> public PlayerSaveStatsWindow(PlayerSavePivot playerSavePivot) { InitializeComponent(); // General LblFirstGame.Content = playerSavePivot.FirstGame?.ToString(DateFormat) ?? NoValue; LblLatestGame.Content = playerSavePivot.LastGame?.ToString(DateFormat) ?? NoValue; LblGamesCount.Content = playerSavePivot.GameCount; LblRoundsCount.Content = playerSavePivot.RoundCount; // Raw stats LblBankruptCount.Content = playerSavePivot.BankruptCount; LblOpenedHands.Content = playerSavePivot.OpenedHandCount; LblRiichiCount.Content = playerSavePivot.RiichiCount; LblRonCount.Content = playerSavePivot.RonCount; LblTsumoCount.Content = playerSavePivot.TsumoCount; LblYakumanCount.Content = playerSavePivot.YakumanCount; // Percentage stats LblGamesPercent.Content = $"1th: {ToPercent(playerSavePivot.ByPositionCount[0], playerSavePivot.GameCount)}\n" + $"2nd: {ToPercent(playerSavePivot.ByPositionCount[1], playerSavePivot.GameCount)}\n" + $"3th: {ToPercent(playerSavePivot.ByPositionCount[2], playerSavePivot.GameCount)}\n" + $"4th: {ToPercent(playerSavePivot.ByPositionCount[3], playerSavePivot.GameCount)}"; LblBankruptPercent.Content = ToPercent(playerSavePivot.BankruptCount, playerSavePivot.GameCount); LblOpenedHandsPercent.Content = ToPercent(playerSavePivot.OpenedHandCount, playerSavePivot.RoundCount); LblRiichiPercent.Content = ToPercent(playerSavePivot.RiichiCount, playerSavePivot.RoundCount); LblRonPercent.Content = ToPercent(playerSavePivot.RonCount, playerSavePivot.RoundCount); LblTsumoPercent.Content = ToPercent(playerSavePivot.TsumoCount, playerSavePivot.RoundCount); LblYakumanPercent.Content = ToPercent(playerSavePivot.YakumanCount, playerSavePivot.RoundCount); }
private void BtnStart_Click(object sender, RoutedEventArgs e) { SaveConfiguration(); Hide(); new MainWindow( TxtPlayerName.Text, (InitialPointsRulePivot)CbbPointsRule.SelectedIndex, (EndOfGameRulePivot)CbbEndOfGameRule.SelectedIndex, PlayerSavePivot.GetOrCreateSave(), ChkUseRedDoras.IsChecked == true, ChkUseNagashiMangan.IsChecked == true, ChkUseRenhou.IsChecked == true ).ShowDialog(); // The configuration might be updated in-game. LoadConfiguration(); ShowDialog(); }
private void PlayerStatsHlk_Click(object sender, RoutedEventArgs e) { new PlayerSaveStatsWindow(PlayerSavePivot.GetOrCreateSave()).ShowDialog(); }
/// <summary> /// Constructor. /// </summary> /// <param name="playerName">Human player name.</param> /// <param name="pointRule">Indicates the initial points count for every players.</param> /// <param name="endOfGameRule">The ruel to end a game.</param> /// <param name="save">Player save file.</param> /// <param name="useRedDoras">Indicates if red doras should be used.</param> /// <param name="useNagashiMangan"><c>True</c> to use the yaku 'Nagashi Mangan'.</param> /// <param name="useRenhou"><c>True</c> to use the yakuman 'Renhou'.</param> public MainWindow(string playerName, InitialPointsRulePivot pointRule, EndOfGameRulePivot endOfGameRule, PlayerSavePivot save, bool useRedDoras, bool useNagashiMangan, bool useRenhou) { InitializeComponent(); LblHumanPlayer.Content = playerName; _game = new GamePivot(playerName, pointRule, endOfGameRule, save, useRedDoras, useNagashiMangan, useRenhou); _tickSound = new System.Media.SoundPlayer(Properties.Resources.tick); _overlayStoryboard = FindResource("StbHideOverlay") as Storyboard; Storyboard.SetTarget(_overlayStoryboard, GrdOverlayCall); ApplyConfigurationToOverlayStoryboard(); SetChronoTime(); FixWindowDimensions(); NewRoundRefresh(); InitializeAutoPlayWorker(); BindConfiguration(); ContentRendered += delegate(object sender, EventArgs evt) { RunAutoPlay(); }; }