1 | unit UFormPlayersStats;
|
---|
2 |
|
---|
3 | {$mode delphi}
|
---|
4 |
|
---|
5 | interface
|
---|
6 |
|
---|
7 | uses
|
---|
8 | Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ComCtrls,
|
---|
9 | Menus, ActnList, UGame;
|
---|
10 |
|
---|
11 | type
|
---|
12 |
|
---|
13 | { TFormPlayersStats }
|
---|
14 |
|
---|
15 | TFormPlayersStats = class(TForm)
|
---|
16 | ASpectate: TAction;
|
---|
17 | ActionList1: TActionList;
|
---|
18 | ListView1: TListView;
|
---|
19 | MenuItem1: TMenuItem;
|
---|
20 | PopupMenu1: TPopupMenu;
|
---|
21 | procedure ASpectateExecute(Sender: TObject);
|
---|
22 | procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
|
---|
23 | procedure FormShow(Sender: TObject);
|
---|
24 | procedure ListView1Data(Sender: TObject; Item: TListItem);
|
---|
25 | private
|
---|
26 |
|
---|
27 | public
|
---|
28 | procedure ReloadList;
|
---|
29 | end;
|
---|
30 |
|
---|
31 | var
|
---|
32 | FormPlayersStats: TFormPlayersStats;
|
---|
33 |
|
---|
34 |
|
---|
35 | implementation
|
---|
36 |
|
---|
37 | uses
|
---|
38 | UCore;
|
---|
39 |
|
---|
40 | {$R *.lfm}
|
---|
41 |
|
---|
42 | { TFormPlayersStats }
|
---|
43 |
|
---|
44 | procedure TFormPlayersStats.ListView1Data(Sender: TObject; Item: TListItem);
|
---|
45 | begin
|
---|
46 | with Core.Game do
|
---|
47 | if Item.Index < Players.Count then
|
---|
48 | with TPlayer(Players[Item.Index]) do begin
|
---|
49 | Item.Caption := Name;
|
---|
50 | Item.Data := Players[Item.Index];
|
---|
51 | Item.SubItems.Add(PlayerModeText[Mode]);
|
---|
52 | Item.SubItems.Add(IntToStr(TotalCells));
|
---|
53 | Item.SubItems.Add(IntToStr(TotalDiscovered));
|
---|
54 | Item.SubItems.Add(IntToStr(TotalCities));
|
---|
55 | Item.SubItems.Add(IntToStr(TotalUnits));
|
---|
56 | end;
|
---|
57 | end;
|
---|
58 |
|
---|
59 | procedure TFormPlayersStats.FormShow(Sender: TObject);
|
---|
60 | begin
|
---|
61 | Core.PersistentForm.Load(Self);
|
---|
62 | Core.CoolTranslator1.TranslateComponentRecursive(Self);
|
---|
63 | ReloadList;
|
---|
64 | end;
|
---|
65 |
|
---|
66 | procedure TFormPlayersStats.FormClose(Sender: TObject;
|
---|
67 | var CloseAction: TCloseAction);
|
---|
68 | begin
|
---|
69 | Core.PersistentForm.Save(Self);
|
---|
70 | end;
|
---|
71 |
|
---|
72 | procedure TFormPlayersStats.ASpectateExecute(Sender: TObject);
|
---|
73 | begin
|
---|
74 | if Assigned(ListView1.Selected) then
|
---|
75 | Core.Spectate(TPlayer(ListView1.Selected.Data));
|
---|
76 | end;
|
---|
77 |
|
---|
78 | procedure TFormPlayersStats.ReloadList;
|
---|
79 | begin
|
---|
80 | ListView1.Items.Count := Core.Game.Players.Count;
|
---|
81 | ListView1.Refresh;
|
---|
82 | end;
|
---|
83 |
|
---|
84 | end.
|
---|
85 |
|
---|