Ignore:
Timestamp:
Apr 24, 2019, 11:41:52 AM (6 years ago)
Author:
chronos
Message:
  • Added: Enable player checkbox.
File:
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormNewGame.pas

    r46 r47  
    1 unit UNewGameForm;
     1unit UFormNewGame;
    22
    33{$mode delphi}{$H+}
     
    1111type
    1212
    13   { TNewGameForm }
    14 
    15   TNewGameForm = class(TForm)
     13  { TFormNewGame }
     14
     15  TFormNewGame = class(TForm)
    1616    ButtonStart: TButton;
    1717    ButtonCancel: TButton;
     18    CheckBoxEnabled: TCheckBox;
    1819    ColorButton1: TColorButton;
    1920    ColorButton2: TColorButton;
     
    3536    Label9: TLabel;
    3637    ListView1: TListView;
     38    procedure CheckBoxEnabledChange(Sender: TObject);
    3739    procedure ColorButton1ColorChanged(Sender: TObject);
    3840    procedure ColorButton2ColorChanged(Sender: TObject);
     
    7375
    7476var
    75   NewGameForm: TNewGameForm;
     77  FormNewGame: TFormNewGame;
    7678
    7779
     
    8385  UCore;
    8486
    85 { TNewGameForm }
    86 
    87 procedure TNewGameForm.ListView1Change(Sender: TObject; Item: TListItem;
     87{ TFormNewGame }
     88
     89procedure TFormNewGame.ListView1Change(Sender: TObject; Item: TListItem;
    8890  Change: TItemChange);
    8991begin
     
    9294end;
    9395
    94 procedure TNewGameForm.ListView1CustomDrawSubItem(Sender: TCustomListView;
     96procedure TFormNewGame.ListView1CustomDrawSubItem(Sender: TCustomListView;
    9597  Item: TListItem; SubItem: Integer; State: TCustomDrawState;
    9698  var DefaultDraw: Boolean);
     
    104106end;
    105107
    106 procedure TNewGameForm.ListView1Data(Sender: TObject; Item: TListItem);
     108procedure TFormNewGame.ListView1Data(Sender: TObject; Item: TListItem);
    107109begin
    108110  if Item.Index < Players.Count then
     
    116118end;
    117119
    118 procedure TNewGameForm.ListView1SelectItem(Sender: TObject; Item: TListItem;
     120procedure TFormNewGame.ListView1SelectItem(Sender: TObject; Item: TListItem;
    119121  Selected: Boolean);
    120122begin
     
    129131    EditRight.Text := IntToStr(Keys.Right);
    130132    EditShoot.Text := IntToStr(Keys.Shoot);
     133    CheckBoxEnabled.Checked := Enabled;
    131134  end;
    132135  UpdateInterface;
    133136end;
    134137
    135 procedure TNewGameForm.ReloadList;
     138procedure TFormNewGame.ReloadList;
    136139begin
    137140  ListView1.Items.Count := Players.Count;
     
    139142end;
    140143
    141 procedure TNewGameForm.UpdateInterface;
     144procedure TFormNewGame.UpdateInterface;
    142145begin
    143146  EditUp.Enabled := Assigned(ListView1.Selected);
     
    149152  ColorButton1.Enabled := Assigned(ListView1.Selected);
    150153  ColorButton2.Enabled := Assigned(ListView1.Selected);
    151 end;
    152 
    153 procedure TNewGameForm.LoadData(Engine: TEngine);
     154  CheckBoxEnabled.Enabled := Assigned(ListView1.Selected);
     155end;
     156
     157procedure TFormNewGame.LoadData(Engine: TEngine);
    154158begin
    155159  Players.Assign(Engine.PlayerPool);
    156160end;
    157161
    158 procedure TNewGameForm.SaveData(Engine: TEngine);
     162procedure TFormNewGame.SaveData(Engine: TEngine);
    159163begin
    160164  Engine.PlayerPool.Assign(Players);
    161165end;
    162166
    163 procedure TNewGameForm.ColorButton1ColorChanged(Sender: TObject);
     167procedure TFormNewGame.ColorButton1ColorChanged(Sender: TObject);
    164168begin
    165169  if Assigned(ListView1.Selected) then
     
    170174end;
    171175
    172 procedure TNewGameForm.ColorButton2ColorChanged(Sender: TObject);
     176procedure TFormNewGame.CheckBoxEnabledChange(Sender: TObject);
     177begin
     178  if Assigned(ListView1.Selected) then
     179  with TPlayer(ListView1.Selected.Data) do begin
     180    Enabled := CheckBoxEnabled.Checked;
     181    ReloadList;
     182  end;
     183end;
     184
     185procedure TFormNewGame.ColorButton2ColorChanged(Sender: TObject);
    173186begin
    174187  if Assigned(ListView1.Selected) then
     
    179192end;
    180193
    181 procedure TNewGameForm.EditDownChange(Sender: TObject);
     194procedure TFormNewGame.EditDownChange(Sender: TObject);
    182195var
    183196  Value: Integer;
     
    190203end;
    191204
    192 procedure TNewGameForm.EditDownKeyDown(Sender: TObject; var Key: Word;
     205procedure TFormNewGame.EditDownKeyDown(Sender: TObject; var Key: Word;
    193206  Shift: TShiftState);
    194207begin
     
    196209end;
    197210
    198 procedure TNewGameForm.EditLeftChange(Sender: TObject);
     211procedure TFormNewGame.EditLeftChange(Sender: TObject);
    199212var
    200213  Value: Integer;
     
    207220end;
    208221
    209 procedure TNewGameForm.EditLeftKeyDown(Sender: TObject; var Key: Word;
     222procedure TFormNewGame.EditLeftKeyDown(Sender: TObject; var Key: Word;
    210223  Shift: TShiftState);
    211224begin
     
    213226end;
    214227
    215 procedure TNewGameForm.EditNameChange(Sender: TObject);
     228procedure TFormNewGame.EditNameChange(Sender: TObject);
    216229begin
    217230  if Assigned(ListView1.Selected) then
     
    222235end;
    223236
    224 procedure TNewGameForm.EditRightChange(Sender: TObject);
     237procedure TFormNewGame.EditRightChange(Sender: TObject);
    225238var
    226239  Value: Integer;
     
    233246end;
    234247
    235 procedure TNewGameForm.EditRightKeyDown(Sender: TObject; var Key: Word;
     248procedure TFormNewGame.EditRightKeyDown(Sender: TObject; var Key: Word;
    236249  Shift: TShiftState);
    237250begin
     
    239252end;
    240253
    241 procedure TNewGameForm.EditShootChange(Sender: TObject);
     254procedure TFormNewGame.EditShootChange(Sender: TObject);
    242255var
    243256  Value: Integer;
     
    250263end;
    251264
    252 procedure TNewGameForm.EditShootKeyDown(Sender: TObject; var Key: Word;
     265procedure TFormNewGame.EditShootKeyDown(Sender: TObject; var Key: Word;
    253266  Shift: TShiftState);
    254267begin
     
    256269end;
    257270
    258 procedure TNewGameForm.EditUpChange(Sender: TObject);
     271procedure TFormNewGame.EditUpChange(Sender: TObject);
    259272var
    260273  Value: Integer;
     
    267280end;
    268281
    269 procedure TNewGameForm.EditUpKeyDown(Sender: TObject; var Key: Word;
     282procedure TFormNewGame.EditUpKeyDown(Sender: TObject; var Key: Word;
    270283  Shift: TShiftState);
    271284begin
     
    273286end;
    274287
    275 procedure TNewGameForm.FormCreate(Sender: TObject);
     288procedure TFormNewGame.FormCreate(Sender: TObject);
    276289begin
    277290  Core.CoolTranslator1.TranslateComponentRecursive(Self);
     
    279292end;
    280293
    281 procedure TNewGameForm.FormDestroy(Sender: TObject);
     294procedure TFormNewGame.FormDestroy(Sender: TObject);
    282295begin
    283296  FreeAndNil(Players);
    284297end;
    285298
    286 procedure TNewGameForm.FormShow(Sender: TObject);
     299procedure TFormNewGame.FormShow(Sender: TObject);
    287300begin
    288301  ReloadList;
Note: See TracChangeset for help on using the changeset viewer.