-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStats_Einlesen.pas
189 lines (163 loc) · 4.61 KB
/
Stats_Einlesen.pas
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
unit Stats_Einlesen;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls, OGame_Types, Prog_Unit, Clipbrd, Languages,
clipbrdfunctions, Stat_Points, ComCtrls, XPMan;
type
TFRM_Stats_Einlesen = class(TForm)
TabControl1: TTabControl;
ScrollBox1: TScrollBox;
pb_points: TPaintBox;
pb_fleet: TPaintBox;
pb_place_range: TPaintBox;
pb_research: TPaintBox;
Label5: TLabel;
Label4: TLabel;
Label2: TLabel;
Timer1: TTimer;
Panel1: TPanel;
Label3: TLabel;
TXT_punkte: TEdit;
TXT_Ally: TEdit;
TXT_fleet: TEdit;
Button1: TButton;
Button2: TButton;
XPManifest1: TXPManifest;
procedure pb_place_rangePaint(Sender: TObject);
procedure pb_pointsPaint(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure FormHide(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure TabControl1Change(Sender: TObject);
procedure FormResize(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure FormMouseWheel(Sender: TObject; Shift: TShiftState;
WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
procedure Button2Click(Sender: TObject);
private
place_hundred_count: integer;
nt: TStatNameType;
procedure refreshStats();
public
procedure refreshOwnPoints();
end;
implementation
uses main;
{$R *.DFM}
procedure TFRM_Stats_Einlesen.pb_place_rangePaint(Sender: TObject);
var i: integer;
begin
with TPaintBox(Sender) do
begin
Canvas.Pen.Style := psClear;
Canvas.Rectangle(Canvas.ClipRect);
i := 0;
while i < place_hundred_count do
begin
Canvas.TextOut(5,i*16+1,
IntToStr((i*100)+1) + ' - ' + IntToStr((i*100)+100));
inc(i);
end;
end;
end;
procedure TFRM_Stats_Einlesen.pb_pointsPaint(Sender: TObject);
var i: integer;
D: TDateTime;
St: TStatPoints;
pt: TStatPointType;
begin
case TComponent(Sender).Tag of
0: pt := sptPoints;
1: pt := sptFleet;
2: pt := sptResearch;
else
Exit;
end;
St := ODataBase.Statistic.StatisticType[nt, pt];
with TPaintBox(Sender) do
begin
Canvas.Pen.Style := psClear;
for i := 0 to St.Count-1 do
begin
d := St.Datum[i*100+1];
Canvas.Brush.Color := AlterToColor_dt(
ODataBase.FleetBoard.GameTime.Time - d,ODataBase.redHours[rh_Stats]);
Canvas.Rectangle(0,i*16,Width,i*16+16);
Canvas.TextOut(4,i*16+1,DateTimeToStr(d));
end;
end;
end;
procedure TFRM_Stats_Einlesen.FormCreate(Sender: TObject);
begin
if SaveCaptions then SaveAllCaptions(Self,LangFile);
if LoadCaptions then LoadAllCaptions(Self,LangFile);
DoubleBuffered := True;
end;
procedure TFRM_Stats_Einlesen.FormShow(Sender: TObject);
begin
refreshStats;
refreshOwnPoints;
Timer1.Enabled := true;
end;
procedure TFRM_Stats_Einlesen.FormHide(Sender: TObject);
begin
Timer1.Enabled := false;
end;
procedure TFRM_Stats_Einlesen.Timer1Timer(Sender: TObject);
begin
refreshStats;
end;
procedure TFRM_Stats_Einlesen.refreshStats;
var pt: TStatPointType;
i: integer;
begin
if TabControl1.TabIndex = 0 then
nt := sntPlayer
else
nt := sntAlliance;
place_hundred_count := 0;
for pt := low(pt) to high(pt) do
begin
i := ODataBase.Statistic.StatisticType[nt, pt].Count;
if (i > place_hundred_count) then
place_hundred_count := i;
end;
pb_place_range.Height := place_hundred_count*16;
pb_points.Height := pb_place_range.Height;
pb_fleet.Height := pb_place_range.Height;
pb_research.Height := pb_place_range.Height;
pb_points.Refresh;
pb_fleet.Refresh;
pb_research.Refresh;
end;
procedure TFRM_Stats_Einlesen.TabControl1Change(Sender: TObject);
begin
refreshStats;
end;
procedure TFRM_Stats_Einlesen.FormResize(Sender: TObject);
begin
ClientWidth := 519;
end;
procedure TFRM_Stats_Einlesen.Button1Click(Sender: TObject);
begin
ODataBase.Stats_own := ReadInt(TXT_punkte.Text, 1);
end;
procedure TFRM_Stats_Einlesen.refreshOwnPoints;
begin
TXT_punkte.Text := IntToStrKP(ODataBase.Stats_own);
end;
procedure TFRM_Stats_Einlesen.FormMouseWheel(Sender: TObject;
Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint;
var Handled: Boolean);
begin
ScrollBox1.VertScrollBar.Position :=
ScrollBox1.VertScrollBar.Position - (WheelDelta div 2);
handled := true;
end;
procedure TFRM_Stats_Einlesen.Button2Click(Sender: TObject);
begin
Close;
end;
end.