我是一个初学者的德尔福用户。我有这个 while 循环,而不是只有一个玩家 (player1),我想有很多玩家,写成 Player[i]。我已经编辑了我的课程,它可以让我添加 [I]
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;
我的 MYPlayer 类如下
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;