-
Notifications
You must be signed in to change notification settings - Fork 0
/
fTournier.Yaku.cs
88 lines (73 loc) · 2.59 KB
/
fTournier.Yaku.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Search;
using Tournier;
using Output;
using System.Windows.Forms;
using Viewer;
namespace TenhouViewerUI
{
public partial class fTournier : NestedForm
{
private string YakuLang = "en";
private void BuildYakuTable()
{
PlayerManage PM = RP.UserField as PlayerManage;
List<Search.Result> Results = new List<Search.Result>();
foreach (var R in RP.Results)
{
Search.Result Res = new Search.Result(R);
for (int i = 0; i < Res.R.PlayerCount; i++)
{
if (PM.Banned.Contains(Res.R.Players[i].NickName)) Res.PlayerMark[i] = true;
}
Results.Add(Res);
}
List<Tournier.Result> Temp = new Tournier.Tournier(Results).Analyze();
int[] Yaku = new int[55];
for (int j = 0; j < 55; j++) Yaku[j] = 0;
// Calc yaku
for (int i = 0; i < Temp.Count; i++)
{
Tournier.Result R = Temp[i];
for (int j = 0; j < 55; j++) Yaku[j] += R.Yaku[j];
}
List<ListViewItem> LV = new List<ListViewItem>();
for (int i = 0; i < Yaku.Length; i++)
{
if (Yaku[i] == 0) continue;
ListViewItem I = new ListViewItem();
I.Tag = i;
I.Text = YakuName.GetYakuName(YakuLang, i);
I.SubItems.Add(Convert.ToString(Yaku[i]));
LV.Add(I);
}
lYaku.BeginUpdate();
lYaku.Items.Clear();
lYaku.Items.AddRange(LV.ToArray());
lYaku.EndUpdate();
ResizeColumns(lYaku, YakuCols);
}
private void mYakuLang_DropDownOpening(object sender, EventArgs e)
{
mYakuLangEN.Checked = (YakuLang.CompareTo("en") == 0);
mYakuLangJP.Checked = (YakuLang.CompareTo("jp") == 0);
mYakuLangRU.Checked = (YakuLang.CompareTo("ru") == 0);
}
private void mYakuLanguage_Click(object sender, EventArgs e)
{
YakuLang = (sender as ToolStripDropDownItem).Tag.ToString();
Settings.Default.YakuLang = YakuLang;
// Обновим названия
lYaku.BeginUpdate();
foreach (ListViewItem I in lYaku.Items)
{
int Y = (int)I.Tag;
I.Text = YakuName.GetYakuName(YakuLang, Y);
}
lYaku.EndUpdate();
}
}
}