Changeset 275 for trunk/Forms


Ignore:
Timestamp:
Feb 3, 2019, 11:28:03 PM (6 years ago)
Author:
chronos
Message:
  • Added: New forms for game systems management.
  • Added: Allow to load/save game system from/to file system as .xts file.
Location:
trunk/Forms
Files:
4 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormNew.lfm

    r274 r275  
    1818  object PageControl1: TPageControl
    1919    Left = 4
    20     Height = 692
    21     Top = 4
     20    Height = 636
     21    Top = 60
    2222    Width = 806
    23     ActivePage = TabSheetRules
     23    ActivePage = TabSheetMode
    2424    Align = alClient
    2525    BorderSpacing.Around = 4
    26     TabIndex = 3
     26    TabIndex = 0
    2727    TabOrder = 0
    2828    OnChange = PageControl1Change
    2929    object TabSheetMode: TTabSheet
    3030      Caption = 'Mode'
    31       ClientHeight = 652
     31      ClientHeight = 596
    3232      ClientWidth = 796
    3333      object Panel3: TPanel
    3434        Left = 0
    35         Height = 652
     35        Height = 596
    3636        Top = 0
    3737        Width = 796
    3838        Align = alClient
    3939        BevelOuter = bvNone
    40         ClientHeight = 652
     40        ClientHeight = 596
    4141        ClientWidth = 796
    4242        TabOrder = 0
     
    103103        object ListViewServers: TListView
    104104          Left = 26
    105           Height = 420
     105          Height = 364
    106106          Top = 181
    107107          Width = 334
     
    131131          Left = 27
    132132          Height = 31
    133           Top = 613
     133          Top = 557
    134134          Width = 94
    135135          Action = AServerAdd
     
    140140          Left = 240
    141141          Height = 31
    142           Top = 613
     142          Top = 557
    143143          Width = 94
    144144          Action = AServerRemove
     
    149149          Left = 136
    150150          Height = 30
    151           Top = 613
     151          Top = 557
    152152          Width = 94
    153153          Action = AServerModify
     
    159159    object TabSheetPlayers: TTabSheet
    160160      Caption = 'Players'
    161       ClientHeight = 652
     161      ClientHeight = 596
    162162      ClientWidth = 796
    163163      object Panel2: TPanel
     
    241241    object TabSheetMap: TTabSheet
    242242      Caption = 'Map'
    243       ClientHeight = 652
     243      ClientHeight = 596
    244244      ClientWidth = 796
    245245      OnShow = TabSheetMapShow
     
    542542    object TabSheetRules: TTabSheet
    543543      Caption = 'Rules'
    544       ClientHeight = 652
     544      ClientHeight = 596
    545545      ClientWidth = 796
    546546      object Panel4: TPanel
     
    754754  object PanelChat: TPanel
    755755    Left = 820
    756     Height = 700
    757     Top = 0
     756    Height = 644
     757    Top = 56
    758758    Width = 391
    759759    Align = alRight
     
    763763  object Splitter1: TSplitter
    764764    Left = 814
    765     Height = 700
    766     Top = 0
     765    Height = 644
     766    Top = 56
    767767    Width = 6
    768768    Align = alRight
    769769    ResizeAnchor = akRight
     770  end
     771  object Panel5: TPanel
     772    Left = 0
     773    Height = 56
     774    Top = 0
     775    Width = 1211
     776    Align = alTop
     777    BevelOuter = bvNone
     778    ClientHeight = 56
     779    ClientWidth = 1211
     780    TabOrder = 4
     781    object Label16: TLabel
     782      Left = 12
     783      Height = 26
     784      Top = 16
     785      Width = 121
     786      Caption = 'Game system:'
     787      ParentColor = False
     788    end
     789    object ComboBoxGameSystem: TComboBox
     790      Left = 176
     791      Height = 43
     792      Top = 9
     793      Width = 254
     794      ItemHeight = 0
     795      Style = csDropDownList
     796      TabOrder = 0
     797    end
     798    object ButtonGameSystems: TButton
     799      Left = 443
     800      Height = 38
     801      Top = 12
     802      Width = 113
     803      Caption = 'Manage'
     804      OnClick = ButtonGameSystemsClick
     805      TabOrder = 1
     806    end
    770807  end
    771808  object ActionList1: TActionList
  • trunk/Forms/UFormNew.pas

    r274 r275  
    2525    Button2: TButton;
    2626    Button3: TButton;
     27    ButtonGameSystems: TButton;
    2728    ButtonRandomize: TButton;
    2829    ButtonCancel: TButton;
     
    4142    CheckBoxUnitsMoveImmediately: TCheckBox;
    4243    CheckBoxVoid: TCheckBox;
     44    ComboBoxGameSystem: TComboBox;
    4345    ComboBoxGridType: TComboBox;
    4446    ComboBoxMapShape: TComboBox;
     
    5456    Label14: TLabel;
    5557    Label15: TLabel;
     58    Label16: TLabel;
    5659    Label2: TLabel;
    5760    Label3: TLabel;
     
    117120    procedure AServerModifyExecute(Sender: TObject);
    118121    procedure AServerRemoveExecute(Sender: TObject);
     122    procedure ButtonGameSystemsClick(Sender: TObject);
    119123    procedure ButtonImageBrowseClick(Sender: TObject);
    120124    procedure ButtonRandomizeClick(Sender: TObject);
     
    169173    procedure MapPreviewPaint;
    170174    procedure MapPreviewRedraw;
     175    procedure ReloadGameSystemsMenu;
    171176  public
    172177    procedure Translate;
     
    186191
    187192uses
    188   UFormPlayer, UFormChat, UCore, UFormServer, UClientGUI, UFormClient;
     193  UFormPlayer, UFormChat, UCore, UFormServer, UClientGUI, UFormClient,
     194  UFormGameSystems;
    189195
    190196resourcestring
     
    403409end;
    404410
     411procedure TFormNew.ReloadGameSystemsMenu;
     412var
     413  I: Integer;
     414  LastSystem: Pointer;
     415begin
     416  if ComboBoxGameSystem.ItemIndex <> -1 then
     417    LastSystem := ComboBoxGameSystem.Items.Objects[ComboBoxGameSystem.ItemIndex]
     418    else LastSystem := nil;
     419  ComboBoxGameSystem.Items.BeginUpdate;
     420  try
     421    while ComboBoxGameSystem.Items.Count > Core.GameSystems.Count do
     422      ComboBoxGameSystem.Items.Delete(ComboBoxGameSystem.Items.Count - 1);
     423    while ComboBoxGameSystem.Items.Count < Core.GameSystems.Count do
     424      ComboBoxGameSystem.Items.Add('');
     425    for I := 0 to Core.GameSystems.Count - 1 do begin
     426      ComboBoxGameSystem.Items[I] := Core.GameSystems[I].Name;
     427      ComboBoxGameSystem.Items.Objects[I] := Core.GameSystems[I];
     428    end;
     429    if Assigned(LastSystem) then
     430      ComboBoxGameSystem.ItemIndex := ComboBoxGameSystem.Items.IndexOfObject(LastSystem);
     431    if (ComboBoxGameSystem.ItemIndex = -1) and (ComboBoxGameSystem.Items.Count > 0) then
     432      ComboBoxGameSystem.ItemIndex := 0;
     433  finally
     434    ComboBoxGameSystem.Items.EndUpdate;
     435  end;
     436end;
     437
    405438procedure TFormNew.MapPreviewPaint;
    406439var
     
    525558  Core.PersistentForm.Load(Self);
    526559  Core.ThemeManager1.UseTheme(Self);
     560  ReloadGameSystemsMenu;
    527561  ReloadView;
    528562  //Height := Trunc(1.5 * Height);
     
    678712      ServerList.Items.Delete(I);
    679713    ReloadView;
     714  end;
     715end;
     716
     717procedure TFormNew.ButtonGameSystemsClick(Sender: TObject);
     718begin
     719  FormGameSystems := TFormGameSystems.Create(nil);
     720  try
     721    FormGameSystems.GameSystems := Core.GameSystems;
     722    FormGameSystems.ShowModal;
     723    ReloadGameSystemsMenu;
     724  finally
     725    FreeAndNil(FormGameSystems);
    680726  end;
    681727end;
Note: See TracChangeset for help on using the changeset viewer.