Last change
on this file was 362, checked in by chronos, 6 months ago |
- Added: Close button on more forms for better touch screen devices support.
|
File size:
1.4 KB
|
Line | |
---|
1 | unit FormUnitMoves;
|
---|
2 |
|
---|
3 | interface
|
---|
4 |
|
---|
5 | uses
|
---|
6 | Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ComCtrls,
|
---|
7 | StdCtrls, FormEx, Game;
|
---|
8 |
|
---|
9 | type
|
---|
10 |
|
---|
11 | { TFormUnitMoves }
|
---|
12 |
|
---|
13 | TFormUnitMoves = class(TFormEx)
|
---|
14 | ButtonClose: TButton;
|
---|
15 | ListView1: TListView;
|
---|
16 | procedure ButtonCloseClick(Sender: TObject);
|
---|
17 | procedure FormShow(Sender: TObject);
|
---|
18 | procedure ListView1Data(Sender: TObject; Item: TListItem);
|
---|
19 | public
|
---|
20 | Game: TGame;
|
---|
21 | procedure ReloadList;
|
---|
22 | end;
|
---|
23 |
|
---|
24 |
|
---|
25 | implementation
|
---|
26 |
|
---|
27 | uses
|
---|
28 | Player;
|
---|
29 |
|
---|
30 | {$R *.lfm}
|
---|
31 |
|
---|
32 | { TFormUnitMoves }
|
---|
33 |
|
---|
34 | procedure TFormUnitMoves.ListView1Data(Sender: TObject; Item: TListItem);
|
---|
35 | begin
|
---|
36 | if Assigned(Game) and Assigned(Game.CurrentPlayer) then
|
---|
37 | with Game.CurrentPlayer do
|
---|
38 | if (Mode = pmHuman) and (Item.Index < Moves.Count) then
|
---|
39 | with TUnitMove(Moves[Item.Index]) do begin
|
---|
40 | Item.Caption := IntToStr(CellFrom.MapCell.Id);
|
---|
41 | Item.SubItems.Add(IntToStr(CellTo.Mapcell.Id));
|
---|
42 | Item.SubItems.Add(IntToStr(CountOnce));
|
---|
43 | Item.SubItems.Add(IntToStr(CountRepeat));
|
---|
44 | end;
|
---|
45 | end;
|
---|
46 |
|
---|
47 | procedure TFormUnitMoves.FormShow(Sender: TObject);
|
---|
48 | begin
|
---|
49 | ReloadList;
|
---|
50 | end;
|
---|
51 |
|
---|
52 | procedure TFormUnitMoves.ButtonCloseClick(Sender: TObject);
|
---|
53 | begin
|
---|
54 | Close;
|
---|
55 | end;
|
---|
56 |
|
---|
57 | procedure TFormUnitMoves.ReloadList;
|
---|
58 | begin
|
---|
59 | if Assigned(Game) and Assigned(Game.CurrentPlayer) and
|
---|
60 | (Game.CurrentPlayer.Mode = pmHuman) then
|
---|
61 | ListView1.Items.Count := Game.CurrentPlayer.Moves.Count
|
---|
62 | else ListView1.Items.Count := 0;
|
---|
63 | ListView1.Refresh;
|
---|
64 | end;
|
---|
65 |
|
---|
66 | end.
|
---|
67 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.