source: trunk/Nation.pas

Last change on this file was 317, checked in by chronos, 6 months ago
  • Modified: Remove U prefix from unit names.
  • Modified: Use TFormEx for all forms for code simplification.
File size: 1.3 KB
Line 
1unit Nation;
2
3interface
4
5uses
6 Classes, SysUtils, Graphics, ItemList;
7
8type
9
10 { TNation }
11
12 TNation = class(TItem)
13 Color: TColor;
14 class function GetFields: TItemFields; override;
15 procedure GetValue(Index: Integer; out Value); override;
16 procedure SetValue(Index: Integer; var Value); override;
17 class function GetClassSysName: string; override;
18 class function GetClassName: string; override;
19 end;
20
21 { TNations }
22
23 TNations = class(TItemList)
24 class function GetItemClass: TItemClass; override;
25 end;
26
27resourcestring
28 SNation = 'Nation';
29 SColor = 'Color';
30
31
32implementation
33
34uses
35 Common;
36
37{ TNation }
38
39class function TNation.GetFields: TItemFields;
40begin
41 Result := inherited;
42 Result.AddField(2, 'Color', SColor, dtColor);
43end;
44
45procedure TNation.GetValue(Index: Integer; out Value);
46begin
47 if Index = 1 then string(Value) := Name
48 else if Index = 2 then TColor(Value) := Color
49 else inherited;
50end;
51
52procedure TNation.SetValue(Index: Integer; var Value);
53begin
54 if Index = 1 then Name := string(Value)
55 else if Index = 2 then Color := TColor(Value)
56 else inherited;
57end;
58
59class function TNation.GetClassSysName: string;
60begin
61 Result := 'Nation';
62end;
63
64class function TNation.GetClassName: string;
65begin
66 Result := SNation;
67end;
68
69{ TNations }
70
71class function TNations.GetItemClass: TItemClass;
72begin
73 Result := TNation;
74end;
75
76end.
77
Note: See TracBrowser for help on using the repository browser.