Changeset 134 for trunk/Forms


Ignore:
Timestamp:
Jul 5, 2017, 6:24:55 PM (7 years ago)
Author:
chronos
Message:
  • Added: Player starts units can be configured in player dialog.
Location:
trunk/Forms
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormNew.lfm

    r130 r134  
    3939    Top = 4
    4040    Width = 669
    41     ActivePage = TabSheet2
     41    ActivePage = TabSheet1
    4242    Align = alTop
    4343    Anchors = [akTop, akLeft, akRight, akBottom]
    4444    BorderSpacing.Around = 4
    45     TabIndex = 1
     45    TabIndex = 0
    4646    TabOrder = 2
    4747    object TabSheet1: TTabSheet
     
    192192      object ComboBoxGridType: TComboBox
    193193        Left = 146
    194         Height = 34
     194        Height = 38
    195195        Top = 104
    196196        Width = 208
     
    206206      object ComboBoxMapShape: TComboBox
    207207        Left = 146
    208         Height = 34
     208        Height = 38
    209209        Top = 144
    210210        Width = 208
  • trunk/Forms/UFormPlayer.lfm

    r107 r134  
    11object FormPlayer: TFormPlayer
    22  Left = 470
    3   Height = 279
     3  Height = 344
    44  Top = 219
    55  Width = 522
    66  Caption = 'Player'
    7   ClientHeight = 279
     7  ClientHeight = 344
    88  ClientWidth = 522
    9   Constraints.MinHeight = 279
     9  Constraints.MinHeight = 344
    1010  Constraints.MinWidth = 522
     11  OnShow = FormShow
    1112  Position = poMainFormCenter
    12   LCLVersion = '1.4.4.0'
     13  LCLVersion = '1.6.4.0'
    1314  object Label1: TLabel
    14     Left = 28
    15     Height = 25
     15    Left = 24
     16    Height = 24
    1617    Top = 27
    17     Width = 51
     18    Width = 56
    1819    Caption = 'Name:'
    1920    ParentColor = False
    2021  end
    2122  object EditName: TEdit
    22     Left = 139
    23     Height = 33
     23    Left = 168
     24    Height = 34
    2425    Top = 27
    25     Width = 368
     26    Width = 339
    2627    Anchors = [akTop, akLeft, akRight]
    2728    TabOrder = 0
     
    3031    Left = 278
    3132    Height = 25
    32     Top = 242
     33    Top = 307
    3334    Width = 75
    3435    Anchors = [akRight, akBottom]
     
    4041    Left = 403
    4142    Height = 25
    42     Top = 242
     43    Top = 307
    4344    Width = 75
    4445    Anchors = [akRight, akBottom]
     
    4849    TabOrder = 2
    4950  end
    50   object ComboBox1: TComboBox
    51     Left = 139
    52     Height = 33
     51  object ComboBoxMode: TComboBox
     52    Left = 168
     53    Height = 34
    5354    Top = 72
    54     Width = 368
     55    Width = 339
    5556    Anchors = [akTop, akLeft, akRight]
    56     ItemHeight = 25
     57    ItemHeight = 0
    5758    ItemIndex = 0
    5859    Items.Strings = (
     
    6061      'Computer'
    6162    )
     63    OnChange = ComboBoxModeChange
    6264    Style = csDropDownList
    6365    TabOrder = 3
     
    6668  object Label2: TLabel
    6769    Left = 24
    68     Height = 25
     70    Height = 24
    6971    Top = 72
    70     Width = 51
     72    Width = 53
    7173    Caption = 'Mode:'
    7274    ParentColor = False
     
    7476  object Label3: TLabel
    7577    Left = 24
    76     Height = 25
     78    Height = 24
    7779    Top = 128
    78     Width = 47
     80    Width = 50
    7981    Caption = 'Color:'
    8082    ParentColor = False
    8183  end
    8284  object ColorBox1: TColorBox
    83     Left = 139
    84     Height = 28
     85    Left = 168
     86    Height = 38
    8587    Top = 120
    86     Width = 368
     88    Width = 339
    8789    Style = [cbStandardColors, cbExtendedColors, cbCustomColor, cbPrettyNames]
    8890    Anchors = [akTop, akLeft, akRight]
     
    9294  object Label4: TLabel
    9395    Left = 24
    94     Height = 25
     96    Height = 24
    9597    Top = 168
    96     Width = 90
     98    Width = 98
    9799    Caption = 'Agressivity:'
    98100    ParentColor = False
    99101  end
    100102  object ComboBoxAgressivity: TComboBox
    101     Left = 139
    102     Height = 33
     103    Left = 168
     104    Height = 34
    103105    Top = 168
    104     Width = 368
     106    Width = 339
    105107    Anchors = [akTop, akLeft, akRight]
    106     ItemHeight = 25
     108    ItemHeight = 0
    107109    Items.Strings = (
    108110      'Low'
     
    116118  object CheckBoxDefensive: TCheckBox
    117119    Left = 24
    118     Height = 29
     120    Height = 28
    119121    Top = 208
    120122    Width = 107
     
    122124    TabOrder = 6
    123125  end
     126  object Label5: TLabel
     127    Left = 24
     128    Height = 24
     129    Top = 248
     130    Width = 94
     131    Caption = 'Start units:'
     132    ParentColor = False
     133  end
     134  object SpinEditStartUnits: TSpinEdit
     135    Left = 224
     136    Height = 34
     137    Top = 240
     138    Width = 112
     139    MaxValue = 99
     140    TabOrder = 7
     141  end
    124142end
  • trunk/Forms/UFormPlayer.lrt

    r107 r134  
    33TFORMPLAYER.BUTTONCANCEL.CAPTION=Cancel
    44TFORMPLAYER.BUTTONOK.CAPTION=Ok
    5 TFORMPLAYER.COMBOBOX1.TEXT=Human
     5TFORMPLAYER.COMBOBOXMODE.TEXT=Human
    66TFORMPLAYER.LABEL2.CAPTION=Mode:
    77TFORMPLAYER.LABEL3.CAPTION=Color:
    88TFORMPLAYER.LABEL4.CAPTION=Agressivity:
    99TFORMPLAYER.CHECKBOXDEFENSIVE.CAPTION=Defensive
     10TFORMPLAYER.LABEL5.CAPTION=Start units:
  • trunk/Forms/UFormPlayer.pas

    r90 r134  
    77uses
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
    9   ColorBox, UGame;
     9  ColorBox, Menus, Spin, UGame;
    1010
    1111type
     
    1818    CheckBoxDefensive: TCheckBox;
    1919    ColorBox1: TColorBox;
    20     ComboBox1: TComboBox;
     20    ComboBoxMode: TComboBox;
    2121    ComboBoxAgressivity: TComboBox;
    2222    EditName: TEdit;
     
    2525    Label3: TLabel;
    2626    Label4: TLabel;
     27    Label5: TLabel;
     28    SpinEditStartUnits: TSpinEdit;
     29    procedure ComboBoxModeChange(Sender: TObject);
     30    procedure FormShow(Sender: TObject);
    2731  private
    2832    { private declarations }
    2933  public
    3034    procedure Translate;
     35    procedure UpdateInterface;
    3136    procedure Load(Player: TPlayer);
    3237    procedure Save(Player: TPlayer);
     
    4348  SHuman = 'Human';
    4449  SComputer = 'Computer';
    45   SAgroNotAttacking = 'Not attacking';
    4650  SAgroLow = 'Low';
    4751  SAgroMedium = 'Medium';
     
    5054{ TFormPlayer }
    5155
     56procedure TFormPlayer.ComboBoxModeChange(Sender: TObject);
     57begin
     58  UpdateInterface;
     59end;
     60
     61procedure TFormPlayer.FormShow(Sender: TObject);
     62begin
     63  UpdateInterface;
     64end;
     65
    5266procedure TFormPlayer.Translate;
    5367var
    5468  LastIndex: Integer;
    5569begin
    56   with ComboBox1 do begin
     70  with ComboBoxMode do begin
    5771    LastIndex := ItemIndex;
    5872    Clear;
     
    7185end;
    7286
     87procedure TFormPlayer.UpdateInterface;
     88begin
     89  ComboBoxAgressivity.Visible := ComboBoxMode.ItemIndex = 1;
     90  CheckBoxDefensive.Visible := ComboBoxMode.ItemIndex = 1;
     91  Label4.Visible := ComboBoxMode.ItemIndex = 1;
     92end;
     93
    7394procedure TFormPlayer.Load(Player: TPlayer);
    7495begin
    7596  EditName.Text := Player.Name;
    76   ComboBox1.ItemIndex := Integer(Player.Mode);
     97  ComboBoxMode.ItemIndex := Integer(Player.Mode);
    7798  ColorBox1.Selected := Player.Color;
    78   Label4.Visible := Player.Mode = pmComputer;
    79   ComboBoxAgressivity.Visible := Player.Mode = pmComputer;
    8099  ComboBoxAgressivity.ItemIndex := Integer(Player.Agressivity);
    81   CheckBoxDefensive.Visible := Player.Mode = pmComputer;
    82100  CheckBoxDefensive.Checked := Player.Defensive;
     101  SpinEditStartUnits.Value := Player.StartUnits;
     102  UpdateInterface;
    83103end;
    84104
     
    86106begin
    87107  Player.Name := EditName.Text;
    88   Player.Mode := TPlayerMode(ComboBox1.ItemIndex);
     108  Player.Mode := TPlayerMode(ComboBoxMode.ItemIndex);
    89109  Player.Color := ColorBox1.Selected;
    90110  Player.Agressivity := TComputerAgressivity(ComboBoxAgressivity.ItemIndex);
    91111  Player.Defensive := CheckBoxDefensive.Checked;
     112  Player.StartUnits := SpinEditStartUnits.Value;
    92113end;
    93114
Note: See TracChangeset for help on using the changeset viewer.