close Warning: Can't synchronize with repository "(default)" (No changeset 184 in the repository). Look in the Trac log for more information.

source: trunk/Forms/UFormUnitMoves.pas

Last change on this file was 181, checked in by chronos, 6 years ago
  • Added: New window with players statistics.
File size: 1.6 KB
Line 
1unit UFormUnitMoves;
2
3{$mode delphi}
4
5interface
6
7uses
8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ComCtrls;
9
10type
11
12 { TFormUnitMoves }
13
14 TFormUnitMoves = class(TForm)
15 ListView1: TListView;
16 procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
17 procedure FormShow(Sender: TObject);
18 procedure ListView1Data(Sender: TObject; Item: TListItem);
19 private
20
21 public
22 procedure ReloadList;
23 end;
24
25var
26 FormUnitMoves: TFormUnitMoves;
27
28implementation
29
30uses
31 UGame, UCore;
32
33{$R *.lfm}
34
35{ TFormUnitMoves }
36
37procedure TFormUnitMoves.ListView1Data(Sender: TObject; Item: TListItem);
38begin
39 if Assigned(Core.Game) and Assigned(Core.Game.CurrentPlayer) then
40 with Core.Game.CurrentPlayer do
41 if (Mode = pmHuman) and (Item.Index < Moves.Count) then
42 with TUnitMove(Moves[Item.Index]) do begin
43 Item.Caption := CellFrom.ToString;
44 Item.SubItems.Add(CellTo.ToString);
45 Item.SubItems.Add(IntToStr(CountOnce));
46 Item.SubItems.Add(IntToStr(CountRepeat));
47 end;
48end;
49
50procedure TFormUnitMoves.FormShow(Sender: TObject);
51begin
52 Core.PersistentForm.Load(Self);
53 Core.CoolTranslator1.TranslateComponentRecursive(Self);
54 ReloadList;
55end;
56
57procedure TFormUnitMoves.FormClose(Sender: TObject;
58 var CloseAction: TCloseAction);
59begin
60 Core.PersistentForm.Save(Self);
61end;
62
63procedure TFormUnitMoves.ReloadList;
64begin
65 if Assigned(Core.Game) and Assigned(Core.Game.CurrentPlayer) and
66 (Core.Game.CurrentPlayer.Mode = pmHuman) then
67 ListView1.Items.Count := Core.Game.CurrentPlayer.Moves.Count
68 else ListView1.Items.Count := 0;
69 ListView1.Refresh;
70end;
71
72end.
73
Note: See TracBrowser for help on using the repository browser.