1 | unit UFormUnitMoves;
|
---|
2 |
|
---|
3 | {$mode delphi}
|
---|
4 |
|
---|
5 | interface
|
---|
6 |
|
---|
7 | uses
|
---|
8 | Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ComCtrls;
|
---|
9 |
|
---|
10 | type
|
---|
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 |
|
---|
25 | var
|
---|
26 | FormUnitMoves: TFormUnitMoves;
|
---|
27 |
|
---|
28 | implementation
|
---|
29 |
|
---|
30 | uses
|
---|
31 | UGame, UCore, UPlayer;
|
---|
32 |
|
---|
33 | {$R *.lfm}
|
---|
34 |
|
---|
35 | { TFormUnitMoves }
|
---|
36 |
|
---|
37 | procedure TFormUnitMoves.ListView1Data(Sender: TObject; Item: TListItem);
|
---|
38 | begin
|
---|
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 := IntToStr(CellFrom.MapCell.Id);
|
---|
44 | Item.SubItems.Add(IntToStr(CellTo.Mapcell.Id));
|
---|
45 | Item.SubItems.Add(IntToStr(CountOnce));
|
---|
46 | Item.SubItems.Add(IntToStr(CountRepeat));
|
---|
47 | end;
|
---|
48 | end;
|
---|
49 |
|
---|
50 | procedure TFormUnitMoves.FormShow(Sender: TObject);
|
---|
51 | begin
|
---|
52 | Core.PersistentForm.Load(Self);
|
---|
53 | Core.ThemeManager1.UseTheme(Self);
|
---|
54 | Core.CoolTranslator1.TranslateComponentRecursive(Self);
|
---|
55 | ReloadList;
|
---|
56 | end;
|
---|
57 |
|
---|
58 | procedure TFormUnitMoves.FormClose(Sender: TObject;
|
---|
59 | var CloseAction: TCloseAction);
|
---|
60 | begin
|
---|
61 | Core.PersistentForm.Save(Self);
|
---|
62 | end;
|
---|
63 |
|
---|
64 | procedure TFormUnitMoves.ReloadList;
|
---|
65 | begin
|
---|
66 | if Assigned(Core.Game) and Assigned(Core.Game.CurrentPlayer) and
|
---|
67 | (Core.Game.CurrentPlayer.Mode = pmHuman) then
|
---|
68 | ListView1.Items.Count := Core.Game.CurrentPlayer.Moves.Count
|
---|
69 | else ListView1.Items.Count := 0;
|
---|
70 | ListView1.Refresh;
|
---|
71 | end;
|
---|
72 |
|
---|
73 | end.
|
---|
74 |
|
---|