我是初学者戴尔菲的用户。我有这个循环,而不是只有一个玩家(玩家1),我希望有许多玩家,写成玩家。我编辑了班级,让我添加
while i < FMyPlayers.TeamCount do
begin
buttonSelected := MessageDlg( Placeing Unit: +FMyPlayers.Player[i].Values[ name ]+ . ,mtError, mbOKCancel, 0);
if buttonSelected = mrCancel then exit;
imageyouwant.LoadFromFile(thisdir+ char +FMyPlayers.Player[i].Values[ picon ]);
Hexmap1.ImageAHex(ImageYouWant , bsSolid, position);
FMyPlayers.Player[i].Add( pos= +inttostr(position.x)+inttostr(position.Y));
FMyPlayers.PlaceUnit := false;
end;
但是现在在我的班上,我犯错
property Player: array[1..20] of TStringList read P;
我的MYPPlayle类如下:
TPlayers = class
Private
p : array[1..20] of TStringList;
FPlaceUnit: Boolean;
FTeamCount: Integer;
Public
property Player: array[1..20] of TStringList read P;
property PlaceUnit : Boolean read FPlaceUnit write FPlaceUnit;
procedure AddPlayer (PlayerNo : integer; player : String);
property TeamCount : Integer read FTeamCount write FTeamCount;
constructor Create; virtual;
End;