Changeset 277 for trunk


Ignore:
Timestamp:
Feb 5, 2019, 11:17:27 PM (6 years ago)
Author:
chronos
Message:
  • Added: Forms for list of unit kinds and unit kind.
Location:
trunk
Files:
4 added
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormGameSystem.lfm

    r276 r277  
    1010  OnClose = FormClose
    1111  OnCreate = FormCreate
     12  OnDestroy = FormDestroy
    1213  OnShow = FormShow
    1314  LCLVersion = '1.8.4.0'
     
    3738    Top = 528
    3839    Width = 113
    39     Anchors = [akRight]
     40    Anchors = [akRight, akBottom]
    4041    Caption = 'Cancel'
    4142    ModalResult = 2
     
    5758    Top = 16
    5859    Width = 744
    59     ActivePage = TabSheetGeneral
     60    ActivePage = TabSheetUnits
    6061    Anchors = [akTop, akLeft, akRight, akBottom]
    61     TabIndex = 0
     62    TabIndex = 1
    6263    TabOrder = 4
    6364    object TabSheetGeneral: TTabSheet
  • trunk/Forms/UFormGameSystem.pas

    r276 r277  
    77uses
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
    9   ComCtrls, UGameSystem;
     9  ComCtrls, UGameSystem, UFormUnitKinds;
    1010
    1111type
     
    3030    procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
    3131    procedure FormCreate(Sender: TObject);
     32    procedure FormDestroy(Sender: TObject);
    3233    procedure FormShow(Sender: TObject);
    3334  private
    3435    FGameSystem: TGameSystem;
     36    FormUnitKinds: TFormUnitKinds;
    3537    procedure SetGameSystem(AValue: TGameSystem);
    36 
    3738  public
    3839    property GameSystem: TGameSystem read FGameSystem write SetGameSystem;
     
    8990  Core.ThemeManager1.UseTheme(Self);
    9091  Core.CoolTranslator1.TranslateComponentRecursive(Self);
     92  FormUnitKinds := TFormUnitKinds.Create(nil);
     93  FormUnitKinds.ManualDock(TabSheetUnits, nil, alClient);
     94  FormUnitKinds.Align := alClient;
     95  FormUnitKinds.Visible := True;
     96end;
     97
     98procedure TFormGameSystem.FormDestroy(Sender: TObject);
     99begin
     100  FormUnitKinds.Free;
    91101end;
    92102
     
    99109begin
    100110  if FGameSystem = AValue then Exit;
     111  if Assigned(FGameSystem) then FormUnitKinds.UnitKinds := nil;
    101112  FGameSystem := AValue;
     113  if Assigned(FGameSystem) then FormUnitKinds.UnitKinds := GameSystem.UnitKinds;
    102114end;
    103115
  • trunk/Forms/UFormGameSystems.pas

    r276 r277  
    124124    if FormGameSystem.ShowModal = mrOk then begin
    125125      FormGameSystem.SaveData(TempEntry);
    126       TGameSystem(ListView1.Selected.Data).Assign(TempEntry);
     126      GameSystems.Add(TempEntry);
     127      TempEntry := nil;
    127128      UpdateList;
    128129      UpdateInterface;
     
    197198  AModify.Enabled := Assigned(FGameSystems) and Assigned(ListView1.Selected);
    198199  AAdd.Enabled := Assigned(FGameSystems);
    199   ASelectAll.Enabled := True;
     200  ASelectAll.Enabled := ListView1.Items.Count > 0;
    200201end;
    201202
  • trunk/Languages/xtactics.cs.po

    r276 r277  
    261261
    262262#: tformgamesystems.aclone.caption
     263msgctxt "tformgamesystems.aclone.caption"
    263264msgid "Clone"
    264265msgstr "Klonovat"
     
    275276
    276277#: tformgamesystems.aselectall.caption
     278msgctxt "tformgamesystems.aselectall.caption"
    277279msgid "Select all"
    278280msgstr "Vybrat vše"
     
    851853msgstr "Obecné"
    852854
     855#: tformunitkind.buttoncancel.caption
     856#, fuzzy
     857msgctxt "tformunitkind.buttoncancel.caption"
     858msgid "Cancel"
     859msgstr "Zrušit"
     860
     861#: tformunitkind.buttonok.caption
     862#, fuzzy
     863msgctxt "tformunitkind.buttonok.caption"
     864msgid "OK"
     865msgstr "OK"
     866
     867#: tformunitkind.caption
     868msgid "Unit kind"
     869msgstr ""
     870
     871#: tformunitkind.labelhealth.caption
     872msgid "Health:"
     873msgstr ""
     874
     875#: tformunitkind.labelname.caption
     876#, fuzzy
     877msgctxt "tformunitkind.labelname.caption"
     878msgid "Name:"
     879msgstr "Jméno:"
     880
     881#: tformunitkinds.aadd.caption
     882#, fuzzy
     883msgctxt "tformunitkinds.aadd.caption"
     884msgid "Add"
     885msgstr "Přidat"
     886
     887#: tformunitkinds.aclone.caption
     888#, fuzzy
     889msgctxt "tformunitkinds.aclone.caption"
     890msgid "Clone"
     891msgstr "Klonovat"
     892
     893#: tformunitkinds.amodify.caption
     894#, fuzzy
     895msgctxt "tformunitkinds.amodify.caption"
     896msgid "Modify"
     897msgstr "Upravit"
     898
     899#: tformunitkinds.aremove.caption
     900#, fuzzy
     901msgctxt "tformunitkinds.aremove.caption"
     902msgid "Remove"
     903msgstr "Odstranit"
     904
     905#: tformunitkinds.aselectall.caption
     906#, fuzzy
     907msgctxt "tformunitkinds.aselectall.caption"
     908msgid "Select all"
     909msgstr "Vybrat vše"
     910
     911#: tformunitkinds.caption
     912msgid "Unit kinds"
     913msgstr ""
     914
     915#: tformunitkinds.listview1.columns[0].caption
     916#, fuzzy
     917msgctxt "tformunitkinds.listview1.columns[0].caption"
     918msgid "Name"
     919msgstr "Jméno"
     920
    853921#: tformunitmoves.caption
    854922msgctxt "tformunitmoves.caption"
     
    9751043
    9761044#: uformgamesystems.sremoveitems
     1045msgctxt "uformgamesystems.sremoveitems"
    9771046msgid "Remove items"
    9781047msgstr "Odstranit položky"
    9791048
    9801049#: uformgamesystems.sremoveitemsquery
     1050msgctxt "uformgamesystems.sremoveitemsquery"
    9811051msgid "Do you want to remove selected items?"
    9821052msgstr "Opravdu chcete odstranit vybrané položky?"
     
    11231193msgstr "Člověk"
    11241194
     1195#: uformunitkinds.snewunitkind
     1196msgid "New unit kind"
     1197msgstr ""
     1198
     1199#: uformunitkinds.sremoveitems
     1200#, fuzzy
     1201msgctxt "uformunitkinds.sremoveitems"
     1202msgid "Remove items"
     1203msgstr "Odstranit položky"
     1204
     1205#: uformunitkinds.sremoveitemsquery
     1206#, fuzzy
     1207msgctxt "uformunitkinds.sremoveitemsquery"
     1208msgid "Do you want to remove selected items?"
     1209msgstr "Opravdu chcete odstranit vybrané položky?"
     1210
    11251211#: ugame.scomputer
    11261212msgctxt "ugame.scomputer"
     
    12041290msgid "64-bit UInt read overflow."
    12051291msgstr "Přetečení při čtení 64-bit UInt"
     1292
  • trunk/Languages/xtactics.po

    r276 r277  
    251251
    252252#: tformgamesystems.aclone.caption
     253msgctxt "tformgamesystems.aclone.caption"
    253254msgid "Clone"
    254255msgstr ""
     
    265266
    266267#: tformgamesystems.aselectall.caption
     268msgctxt "tformgamesystems.aselectall.caption"
    267269msgid "Select all"
    268270msgstr ""
     
    836838msgstr ""
    837839
     840#: tformunitkind.buttoncancel.caption
     841msgctxt "tformunitkind.buttoncancel.caption"
     842msgid "Cancel"
     843msgstr ""
     844
     845#: tformunitkind.buttonok.caption
     846msgctxt "tformunitkind.buttonok.caption"
     847msgid "OK"
     848msgstr ""
     849
     850#: tformunitkind.caption
     851msgid "Unit kind"
     852msgstr ""
     853
     854#: tformunitkind.labelhealth.caption
     855msgid "Health:"
     856msgstr ""
     857
     858#: tformunitkind.labelname.caption
     859msgctxt "tformunitkind.labelname.caption"
     860msgid "Name:"
     861msgstr ""
     862
     863#: tformunitkinds.aadd.caption
     864msgctxt "tformunitkinds.aadd.caption"
     865msgid "Add"
     866msgstr ""
     867
     868#: tformunitkinds.aclone.caption
     869msgctxt "tformunitkinds.aclone.caption"
     870msgid "Clone"
     871msgstr ""
     872
     873#: tformunitkinds.amodify.caption
     874msgctxt "tformunitkinds.amodify.caption"
     875msgid "Modify"
     876msgstr ""
     877
     878#: tformunitkinds.aremove.caption
     879msgctxt "tformunitkinds.aremove.caption"
     880msgid "Remove"
     881msgstr ""
     882
     883#: tformunitkinds.aselectall.caption
     884msgctxt "tformunitkinds.aselectall.caption"
     885msgid "Select all"
     886msgstr ""
     887
     888#: tformunitkinds.caption
     889msgid "Unit kinds"
     890msgstr ""
     891
     892#: tformunitkinds.listview1.columns[0].caption
     893msgctxt "tformunitkinds.listview1.columns[0].caption"
     894msgid "Name"
     895msgstr ""
     896
    838897#: tformunitmoves.caption
    839898msgctxt "tformunitmoves.caption"
     
    9601019
    9611020#: uformgamesystems.sremoveitems
     1021msgctxt "uformgamesystems.sremoveitems"
    9621022msgid "Remove items"
    9631023msgstr ""
    9641024
    9651025#: uformgamesystems.sremoveitemsquery
     1026msgctxt "uformgamesystems.sremoveitemsquery"
    9661027msgid "Do you want to remove selected items?"
    9671028msgstr ""
     
    11001161msgstr ""
    11011162
     1163#: uformunitkinds.snewunitkind
     1164msgid "New unit kind"
     1165msgstr ""
     1166
     1167#: uformunitkinds.sremoveitems
     1168msgctxt "uformunitkinds.sremoveitems"
     1169msgid "Remove items"
     1170msgstr ""
     1171
     1172#: uformunitkinds.sremoveitemsquery
     1173msgctxt "uformunitkinds.sremoveitemsquery"
     1174msgid "Do you want to remove selected items?"
     1175msgstr ""
     1176
    11021177#: ugame.scomputer
    11031178msgctxt "ugame.scomputer"
  • trunk/UCore.pas

    r275 r277  
    518518    with UnitKinds.AddNew('Unit') do begin
    519519      Moves := 1;
    520       Stack := 99;
     520      Power := 99;
    521521    end;
    522522  end;
     
    526526    with UnitKinds.AddNew('Scout') do begin
    527527      Moves := 1;
    528       Stack := 1;
     528      Power := 1;
    529529    end;
    530530    with UnitKinds.AddNew('Settler') do begin
    531531      Moves := 1;
    532       Stack := 1;
     532      Power := 1;
    533533    end;
    534534  end;
     
    554554    with UnitKinds.AddNew('Demon 132') do begin
    555555      Moves := 4;
    556       Stack := 10;
     556      Power := 10;
    557557    end;
    558558    with UnitKinds.AddNew('Troll 142') do begin
    559559      Moves := 3;
    560       Stack := 10;
     560      Power := 10;
    561561    end;
    562562    with UnitKinds.AddNew('Ranger 132') do begin
    563563      Moves := 10;
    564       Stack := 10;
     564      Power := 10;
    565565    end;
    566566    with UnitKinds.AddNew('Buggy') do begin
    567567      Moves := 10;
    568       Stack := 10;
     568      Power := 10;
    569569    end;
    570570  end;
  • trunk/UGame.pas

    r276 r277  
    347347        StartCell.Player := Player;
    348348        if not Assigned(StartCell.OneUnit) then
    349           StartCell.OneUnit := Units.AddNew(GameSystem.UnitKinds[0], Player.StartUnits);
     349          StartCell.OneUnit := Self.Units.AddNew(GameSystem.UnitKinds[0], Player.StartUnits);
    350350        StartCell.OneUnit.Power := Player.StartUnits;
    351351        StartCell.OneUnit.Kind := GameSystem.UnitKinds[0];
  • trunk/UGameSystem.pas

    r276 r277  
    9999  UnitsSplitMerge := Source.UnitsSplitMerge;
    100100  EmptyCellsNeutral := Source.EmptyCellsNeutral;
     101  UnitKinds.Assign(Source.UnitKinds);
    101102end;
    102103
  • trunk/UUnit.pas

    r265 r277  
    1919    Moves: Integer;
    2020    Cost: Integer;
    21     Stack: Integer;
     21    Power: Integer;
    2222    ViewRange: Integer;
     23    procedure Assign(Source: TUnitKind);
    2324    procedure LoadFromNode(Node: TDOMNode);
    2425    procedure SaveToNode(Node: TDOMNode);
     
    8990{ TUnitKind }
    9091
     92procedure TUnitKind.Assign(Source: TUnitKind);
     93begin
     94  Id := Source.Id;
     95  Name := Source.Name;
     96  PowerAttack := Source.PowerAttack;
     97  PowerDefense := Source.PowerDefense;
     98  Moves := Source.Moves;
     99  Cost := Source.Cost;
     100  Power := Source.Power;
     101  ViewRange := Source.ViewRange;
     102end;
     103
    91104procedure TUnitKind.LoadFromNode(Node: TDOMNode);
    92105begin
    93106  Id := ReadInteger(Node, 'Id', 0);
    94107  Name := ReadString(Node, 'Name', '');
    95   Stack := ReadInteger(Node, 'Stack', 0);
     108  Power := ReadInteger(Node, 'Stack', 0);
    96109  Cost := ReadInteger(Node, 'Cost', 0);
    97110  Moves := ReadInteger(Node, 'Moves', 0);
     
    105118  WriteInteger(Node, 'Id', Id);
    106119  WriteString(Node, 'Name', Name);
    107   WriteInteger(Node, 'Stack', Stack);
     120  WriteInteger(Node, 'Stack', Power);
    108121  WriteInteger(Node, 'Cost', Cost);
    109122  WriteInteger(Node, 'Moves', Moves);
  • trunk/xtactics.lpi

    r275 r277  
    109109      </Item7>
    110110    </RequiredPackages>
    111     <Units Count="38">
     111    <Units Count="40">
    112112      <Unit0>
    113113        <Filename Value="xtactics.lpr"/>
     
    303303        <IsPartOfProject Value="True"/>
    304304        <ComponentName Value="FormGameSystem"/>
     305        <HasResources Value="True"/>
    305306        <ResourceBaseClass Value="Form"/>
    306307      </Unit36>
     
    309310        <IsPartOfProject Value="True"/>
    310311        <ComponentName Value="FormGameSystems"/>
     312        <HasResources Value="True"/>
    311313        <ResourceBaseClass Value="Form"/>
    312314      </Unit37>
     315      <Unit38>
     316        <Filename Value="Forms/UFormUnitKind.pas"/>
     317        <IsPartOfProject Value="True"/>
     318        <ComponentName Value="FormUnitKind"/>
     319        <ResourceBaseClass Value="Form"/>
     320      </Unit38>
     321      <Unit39>
     322        <Filename Value="Forms/UFormUnitKinds.pas"/>
     323        <IsPartOfProject Value="True"/>
     324        <ComponentName Value="FormUnitKinds"/>
     325        <HasResources Value="True"/>
     326        <ResourceBaseClass Value="Form"/>
     327      </Unit39>
    313328    </Units>
    314329  </ProjectOptions>
  • trunk/xtactics.lpr

    r238 r277  
    1111  CoolTranslator, TemplateGenerics
    1212  { you can add units after this },
    13   SysUtils, UFormMain, CoolStreaming;
     13  SysUtils, UFormMain, CoolStreaming, UFormUnitKind;
    1414
    1515{$R *.res}
Note: See TracChangeset for help on using the changeset viewer.