Changeset 134 for trunk/Forms/UFormPlayer.pas
- Timestamp:
- Jul 5, 2017, 6:24:55 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormPlayer.pas
r90 r134 7 7 uses 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, 9 ColorBox, UGame;9 ColorBox, Menus, Spin, UGame; 10 10 11 11 type … … 18 18 CheckBoxDefensive: TCheckBox; 19 19 ColorBox1: TColorBox; 20 ComboBox 1: TComboBox;20 ComboBoxMode: TComboBox; 21 21 ComboBoxAgressivity: TComboBox; 22 22 EditName: TEdit; … … 25 25 Label3: TLabel; 26 26 Label4: TLabel; 27 Label5: TLabel; 28 SpinEditStartUnits: TSpinEdit; 29 procedure ComboBoxModeChange(Sender: TObject); 30 procedure FormShow(Sender: TObject); 27 31 private 28 32 { private declarations } 29 33 public 30 34 procedure Translate; 35 procedure UpdateInterface; 31 36 procedure Load(Player: TPlayer); 32 37 procedure Save(Player: TPlayer); … … 43 48 SHuman = 'Human'; 44 49 SComputer = 'Computer'; 45 SAgroNotAttacking = 'Not attacking';46 50 SAgroLow = 'Low'; 47 51 SAgroMedium = 'Medium'; … … 50 54 { TFormPlayer } 51 55 56 procedure TFormPlayer.ComboBoxModeChange(Sender: TObject); 57 begin 58 UpdateInterface; 59 end; 60 61 procedure TFormPlayer.FormShow(Sender: TObject); 62 begin 63 UpdateInterface; 64 end; 65 52 66 procedure TFormPlayer.Translate; 53 67 var 54 68 LastIndex: Integer; 55 69 begin 56 with ComboBox 1do begin70 with ComboBoxMode do begin 57 71 LastIndex := ItemIndex; 58 72 Clear; … … 71 85 end; 72 86 87 procedure TFormPlayer.UpdateInterface; 88 begin 89 ComboBoxAgressivity.Visible := ComboBoxMode.ItemIndex = 1; 90 CheckBoxDefensive.Visible := ComboBoxMode.ItemIndex = 1; 91 Label4.Visible := ComboBoxMode.ItemIndex = 1; 92 end; 93 73 94 procedure TFormPlayer.Load(Player: TPlayer); 74 95 begin 75 96 EditName.Text := Player.Name; 76 ComboBox 1.ItemIndex := Integer(Player.Mode);97 ComboBoxMode.ItemIndex := Integer(Player.Mode); 77 98 ColorBox1.Selected := Player.Color; 78 Label4.Visible := Player.Mode = pmComputer;79 ComboBoxAgressivity.Visible := Player.Mode = pmComputer;80 99 ComboBoxAgressivity.ItemIndex := Integer(Player.Agressivity); 81 CheckBoxDefensive.Visible := Player.Mode = pmComputer;82 100 CheckBoxDefensive.Checked := Player.Defensive; 101 SpinEditStartUnits.Value := Player.StartUnits; 102 UpdateInterface; 83 103 end; 84 104 … … 86 106 begin 87 107 Player.Name := EditName.Text; 88 Player.Mode := TPlayerMode(ComboBox 1.ItemIndex);108 Player.Mode := TPlayerMode(ComboBoxMode.ItemIndex); 89 109 Player.Color := ColorBox1.Selected; 90 110 Player.Agressivity := TComputerAgressivity(ComboBoxAgressivity.ItemIndex); 91 111 Player.Defensive := CheckBoxDefensive.Checked; 112 Player.StartUnits := SpinEditStartUnits.Value; 92 113 end; 93 114
Note:
See TracChangeset
for help on using the changeset viewer.