- Timestamp:
- Feb 3, 2019, 11:55:30 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormGameSystem.lfm
r275 r276 8 8 ClientWidth = 781 9 9 DesignTimePPI = 144 10 OnClose = FormClose 11 OnCreate = FormCreate 12 OnShow = FormShow 10 13 LCLVersion = '1.8.4.0' 11 14 object ButtonSave: TButton … … 14 17 Top = 528 15 18 Width = 113 16 Anchors = [ak Top, akLeft, akBottom]19 Anchors = [akLeft, akBottom] 17 20 Caption = 'Save' 18 21 OnClick = ButtonSaveClick … … 30 33 end 31 34 object ButtonCancel: TButton 32 Left = 47235 Left = 504 33 36 Height = 38 34 37 Top = 528 35 38 Width = 113 36 Anchors = [ak Left]39 Anchors = [akRight] 37 40 Caption = 'Cancel' 38 41 ModalResult = 2 … … 40 43 end 41 44 object ButtonOk: TButton 42 Left = 6 1645 Left = 647 43 46 Height = 38 44 Top = 52 947 Top = 528 45 48 Width = 113 46 Anchors = [ak Left, akBottom]49 Anchors = [akRight, akBottom] 47 50 Caption = 'OK' 48 51 ModalResult = 1 49 52 TabOrder = 3 53 end 54 object PageControl1: TPageControl 55 Left = 16 56 Height = 496 57 Top = 16 58 Width = 744 59 ActivePage = TabSheetGeneral 60 Anchors = [akTop, akLeft, akRight, akBottom] 61 TabIndex = 0 62 TabOrder = 4 63 object TabSheetGeneral: TTabSheet 64 Caption = 'General' 65 ClientHeight = 456 66 ClientWidth = 734 67 object CheckBoxEmptyCellsNeutral: TCheckBox 68 Left = 16 69 Height = 30 70 Top = 16 71 Width = 362 72 Caption = 'Set cells without player units as neutral' 73 TabOrder = 0 74 end 75 object CheckBoxUnitsSplitMerge: TCheckBox 76 Left = 16 77 Height = 30 78 Top = 55 79 Width = 231 80 Caption = 'Units can split or merge' 81 TabOrder = 1 82 end 83 object CheckBoxUnitsMoveImmediately: TCheckBox 84 Left = 16 85 Height = 30 86 Top = 95 87 Width = 234 88 Caption = 'Units move immediately' 89 TabOrder = 2 90 end 91 end 92 object TabSheetUnits: TTabSheet 93 Caption = 'Units' 94 end 50 95 end 51 96 object OpenDialog1: TOpenDialog -
trunk/Forms/UFormGameSystem.pas
r275 r276 7 7 uses 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, 9 UGameSystem;9 ComCtrls, UGameSystem; 10 10 11 11 type … … 18 18 ButtonSave: TButton; 19 19 ButtonLoad: TButton; 20 CheckBoxEmptyCellsNeutral: TCheckBox; 21 CheckBoxUnitsMoveImmediately: TCheckBox; 22 CheckBoxUnitsSplitMerge: TCheckBox; 20 23 OpenDialog1: TOpenDialog; 24 PageControl1: TPageControl; 21 25 SaveDialog1: TSaveDialog; 26 TabSheetGeneral: TTabSheet; 27 TabSheetUnits: TTabSheet; 22 28 procedure ButtonLoadClick(Sender: TObject); 23 29 procedure ButtonSaveClick(Sender: TObject); 30 procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); 31 procedure FormCreate(Sender: TObject); 32 procedure FormShow(Sender: TObject); 24 33 private 25 34 FGameSystem: TGameSystem; … … 38 47 implementation 39 48 49 {$R *.lfm} 50 51 uses 52 UCore; 53 40 54 resourcestring 41 55 SFileDialogFilter = 'xTactics game system (.xts)|*.xts|All files|*.*'; 42 43 44 {$R *.lfm}45 56 46 57 { TFormGameSystem } … … 62 73 SaveDialog1.InitialDir := ExtractFileDir(GameSystem.FileName); 63 74 SaveDialog1.FileName := ExtractFileName(GameSystem.FileName); 75 SaveDialog1.DefaultExt := GameSystemExt; 64 76 if SaveDialog1.Execute then begin 65 77 GameSystem.SaveToFile(SaveDialog1.FileName); 66 78 end; 79 end; 80 81 procedure TFormGameSystem.FormClose(Sender: TObject; 82 var CloseAction: TCloseAction); 83 begin 84 Core.PersistentForm.Save(Self); 85 end; 86 87 procedure TFormGameSystem.FormCreate(Sender: TObject); 88 begin 89 Core.ThemeManager1.UseTheme(Self); 90 Core.CoolTranslator1.TranslateComponentRecursive(Self); 91 end; 92 93 procedure TFormGameSystem.FormShow(Sender: TObject); 94 begin 95 Core.PersistentForm.Load(Self); 67 96 end; 68 97 … … 75 104 procedure TFormGameSystem.LoadData(GameSystem: TGameSystem); 76 105 begin 77 106 Self.GameSystem := GameSystem; 107 CheckBoxEmptyCellsNeutral.Checked := GameSystem.EmptyCellsNeutral; 108 CheckBoxUnitsSplitMerge.Checked := GameSystem.UnitsSplitMerge; 109 CheckBoxUnitsMoveImmediately.Checked := GameSystem.UnitsMoveImmediately; 78 110 end; 79 111 80 112 procedure TFormGameSystem.SaveData(GameSystem: TGameSystem); 81 113 begin 82 114 GameSystem.EmptyCellsNeutral := CheckBoxEmptyCellsNeutral.Checked; 115 GameSystem.UnitsSplitMerge := CheckBoxUnitsSplitMerge.Checked; 116 GameSystem.UnitsMoveImmediately := CheckBoxUnitsMoveImmediately.Checked; 83 117 end; 84 118 -
trunk/Forms/UFormGameSystems.pas
r275 r276 67 67 SRemoveItems = 'Remove items'; 68 68 SRemoveItemsQuery = 'Do you want to remove selected items?'; 69 69 SNewGameSystem = 'New game system'; 70 70 71 71 { TFormGameSystems } … … 96 96 with TGameSystem(ListView1.Selected.Data) do begin 97 97 TempEntry := TGameSystem.Create; 98 TempEntry.Assign(TGameSystem(ListView1.Selected.Data)); 98 99 FormGameSystem := TFormGameSystem.Create(Self); 99 100 try … … 101 102 if FormGameSystem.ShowModal = mrOk then begin 102 103 FormGameSystem.SaveData(TempEntry); 104 TGameSystem(ListView1.Selected.Data).Assign(TempEntry); 103 105 UpdateList; 104 106 UpdateInterface; … … 118 120 FormGameSystem := TFormGameSystem.Create(Self); 119 121 try 122 TempEntry.FileName := SNewGameSystem + GameSystemExt; 120 123 FormGameSystem.LoadData(TempEntry); 121 124 if FormGameSystem.ShowModal = mrOk then begin 122 125 FormGameSystem.SaveData(TempEntry); 126 TGameSystem(ListView1.Selected.Data).Assign(TempEntry); 123 127 UpdateList; 124 128 UpdateInterface; … … 165 169 if Item.Index < ListView1.Items.Count then 166 170 with TGameSystem(GameSystems[Item.Index]) do begin 167 Item.Caption := Name;171 Item.Caption := GetName; 168 172 Item.Data := GameSystems[Item.Index]; 169 173 end; -
trunk/Forms/UFormNew.lfm
r275 r276 21 21 Top = 60 22 22 Width = 806 23 ActivePage = TabSheet Mode23 ActivePage = TabSheetRules 24 24 Align = alClient 25 25 BorderSpacing.Around = 4 26 TabIndex = 026 TabIndex = 3 27 27 TabOrder = 0 28 28 OnChange = PageControl1Change … … 546 546 object Panel4: TPanel 547 547 Left = 0 548 Height = 652548 Height = 596 549 549 Top = 0 550 550 Width = 796 551 551 Align = alClient 552 552 BevelOuter = bvNone 553 ClientHeight = 652553 ClientHeight = 596 554 554 ClientWidth = 796 555 555 TabOrder = 0 … … 694 694 end 695 695 end 696 object CheckBoxEmptyCellsNeutral: TCheckBox697 Left = 336698 Height = 30699 Top = 62700 Width = 362701 Caption = 'Set cells without player units as neutral'702 TabOrder = 5703 end704 object CheckBoxUnitsSplitMerge: TCheckBox705 Left = 336706 Height = 30707 Top = 101708 Width = 231709 Caption = 'Units can split or merge'710 TabOrder = 6711 end712 object CheckBoxUnitsMoveImmediately: TCheckBox713 Left = 336714 Height = 30715 Top = 141716 Width = 234717 Caption = 'Units move immediately'718 TabOrder = 7719 end720 696 end 721 697 end -
trunk/Forms/UFormNew.pas
r275 r276 33 33 ButtonPlayerModify: TButton; 34 34 ButtonPlayerRemove: TButton; 35 CheckBoxUnitsSplitMerge: TCheckBox;36 CheckBoxEmptyCellsNeutral: TCheckBox;37 35 CheckBoxBridges: TCheckBox; 38 36 CheckBoxCity: TCheckBox; … … 40 38 CheckBoxFogOfWar: TCheckBox; 41 39 CheckBoxSymetricMap: TCheckBox; 42 CheckBoxUnitsMoveImmediately: TCheckBox;43 40 CheckBoxVoid: TCheckBox; 44 41 ComboBoxGameSystem: TComboBox; … … 192 189 uses 193 190 UFormPlayer, UFormChat, UCore, UFormServer, UClientGUI, UFormClient, 194 UFormGameSystems ;191 UFormGameSystems, UGameSystem; 195 192 196 193 resourcestring … … 367 364 SpinEditTurns.Value := StayAliveForDefinedTurns; 368 365 SpinEditSpecialCells.Value := SpecialCaptureCellCount; 369 CheckBoxEmptyCellsNeutral.Checked := GameSystem.EmptyCellsNeutral; 370 CheckBoxUnitsSplitMerge.Checked := GameSystem.UnitsSplitMerge; 371 CheckBoxUnitsMoveImmediately.Checked := GameSystem.UnitsMoveImmediately; 366 ComboBoxGameSystem.ItemIndex := ComboBoxGameSystem.Items.IndexOf(GameSystemName); 372 367 end; 373 368 end; … … 398 393 StayAliveForDefinedTurns := SpinEditTurns.Value; 399 394 SpecialCaptureCellCount := SpinEditSpecialCells.Value; 400 GameSystem.EmptyCellsNeutral := CheckBoxEmptyCellsNeutral.Checked; 401 GameSystem.UnitsSplitMerge := CheckBoxUnitsSplitMerge.Checked; 402 GameSystem.UnitsMoveImmediately := CheckBoxUnitsMoveImmediately.Checked; 395 GameSystem := TGameSystem(ComboBoxGameSystem.Items.Objects[ComboBoxGameSystem.ItemIndex]); 396 GameSystemName := GameSystem.GetName; 403 397 end; 404 398 end; … … 424 418 ComboBoxGameSystem.Items.Add(''); 425 419 for I := 0 to Core.GameSystems.Count - 1 do begin 426 ComboBoxGameSystem.Items[I] := Core.GameSystems[I]. Name;420 ComboBoxGameSystem.Items[I] := Core.GameSystems[I].GetName; 427 421 ComboBoxGameSystem.Items.Objects[I] := Core.GameSystems[I]; 428 422 end; … … 558 552 Core.PersistentForm.Load(Self); 559 553 Core.ThemeManager1.UseTheme(Self); 560 ReloadGameSystemsMenu;561 554 ReloadView; 562 555 //Height := Trunc(1.5 * Height); … … 773 766 procedure TFormNew.Load(Server: TServer); 774 767 begin 768 ReloadGameSystemsMenu; 775 769 with Server do begin 776 770 RadioButtonModeLocal.Checked := Mode = smLocal; -
trunk/Languages/xtactics.cs.po
r275 r276 230 230 msgstr "Herní systém" 231 231 232 #: tformgamesystem.checkboxemptycellsneutral.caption 233 msgctxt "tformgamesystem.checkboxemptycellsneutral.caption" 234 msgid "Set cells without player units as neutral" 235 msgstr "Nastavit buňky bez jednotek hráče jako neutrální" 236 237 #: tformgamesystem.checkboxunitsmoveimmediately.caption 238 msgctxt "tformgamesystem.checkboxunitsmoveimmediately.caption" 239 msgid "Units move immediately" 240 msgstr "Okamžitý pohyb jednotek" 241 242 #: tformgamesystem.checkboxunitssplitmerge.caption 243 msgctxt "tformgamesystem.checkboxunitssplitmerge.caption" 244 msgid "Units can split or merge" 245 msgstr "Dělení nebo slučování jednotek" 246 247 #: tformgamesystem.tabsheetgeneral.caption 248 msgctxt "tformgamesystem.tabsheetgeneral.caption" 249 msgid "General" 250 msgstr "Obecné" 251 252 #: tformgamesystem.tabsheetunits.caption 253 msgctxt "tformgamesystem.tabsheetunits.caption" 254 msgid "Units" 255 msgstr "Jednotky" 256 232 257 #: tformgamesystems.aadd.caption 233 258 msgctxt "tformgamesystems.aadd.caption" … … 489 514 msgstr "Cyklická mapa" 490 515 491 #: tformnew.checkboxemptycellsneutral.caption492 msgid "Set cells without player units as neutral"493 msgstr "Nastavit buňky bez jednotek hráče jako neutrální"494 495 516 #: tformnew.checkboxfogofwar.caption 496 517 msgid "Fog of war" … … 500 521 msgid "Symetric map" 501 522 msgstr "Symetrická mapa" 502 503 #: tformnew.checkboxunitsmoveimmediately.caption504 msgid "Units move immediately"505 msgstr "Okamžitý pohyb jednotek"506 507 #: tformnew.checkboxunitssplitmerge.caption508 msgid "Units can split or merge"509 msgstr "Dělení nebo slučování jednotek"510 523 511 524 #: tformnew.checkboxvoid.caption … … 834 847 835 848 #: tformsettings.tabsheetgeneral.caption 849 msgctxt "tformsettings.tabsheetgeneral.caption" 836 850 msgid "General" 837 851 msgstr "Obecné" … … 955 969 msgid "xTactics game system (.xts)|*.xts|All files|*.*" 956 970 msgstr "xTactics herní systém (.xts)|*.xts|Všechny soubory|*.*" 971 972 #: uformgamesystems.snewgamesystem 973 msgid "New game system" 974 msgstr "Nový herní systém" 957 975 958 976 #: uformgamesystems.sremoveitems -
trunk/Languages/xtactics.po
r275 r276 220 220 msgstr "" 221 221 222 #: tformgamesystem.checkboxemptycellsneutral.caption 223 msgctxt "tformgamesystem.checkboxemptycellsneutral.caption" 224 msgid "Set cells without player units as neutral" 225 msgstr "" 226 227 #: tformgamesystem.checkboxunitsmoveimmediately.caption 228 msgctxt "tformgamesystem.checkboxunitsmoveimmediately.caption" 229 msgid "Units move immediately" 230 msgstr "" 231 232 #: tformgamesystem.checkboxunitssplitmerge.caption 233 msgctxt "tformgamesystem.checkboxunitssplitmerge.caption" 234 msgid "Units can split or merge" 235 msgstr "" 236 237 #: tformgamesystem.tabsheetgeneral.caption 238 msgctxt "tformgamesystem.tabsheetgeneral.caption" 239 msgid "General" 240 msgstr "" 241 242 #: tformgamesystem.tabsheetunits.caption 243 msgctxt "tformgamesystem.tabsheetunits.caption" 244 msgid "Units" 245 msgstr "" 246 222 247 #: tformgamesystems.aadd.caption 223 248 msgctxt "tformgamesystems.aadd.caption" … … 476 501 msgstr "" 477 502 478 #: tformnew.checkboxemptycellsneutral.caption479 msgid "Set cells without player units as neutral"480 msgstr ""481 482 503 #: tformnew.checkboxfogofwar.caption 483 504 msgid "Fog of war" … … 486 507 #: tformnew.checkboxsymetricmap.caption 487 508 msgid "Symetric map" 488 msgstr ""489 490 #: tformnew.checkboxunitsmoveimmediately.caption491 msgid "Units move immediately"492 msgstr ""493 494 #: tformnew.checkboxunitssplitmerge.caption495 msgid "Units can split or merge"496 509 msgstr "" 497 510 … … 819 832 820 833 #: tformsettings.tabsheetgeneral.caption 834 msgctxt "tformsettings.tabsheetgeneral.caption" 821 835 msgid "General" 822 836 msgstr "" … … 939 953 #: uformgamesystem.sfiledialogfilter 940 954 msgid "xTactics game system (.xts)|*.xts|All files|*.*" 955 msgstr "" 956 957 #: uformgamesystems.snewgamesystem 958 msgid "New game system" 941 959 msgstr "" 942 960 -
trunk/UGame.pas
r275 r276 684 684 end; 685 685 if ExtractFileDir(FileName) <> '' then 686 ForceDirectories UTF8(ExtractFileDir(FileName));686 ForceDirectories(ExtractFileDir(FileName)); 687 687 WriteXMLFile(Doc, FileName); 688 688 finally -
trunk/UGameSystem.pas
r275 r276 6 6 7 7 uses 8 Classes, SysUtils, fgl, UUnit, DOM, XMLRead, XMLWrite, UXMLUtils, XMLConf; 8 Classes, SysUtils, fgl, UUnit, DOM, XMLRead, XMLWrite, UXMLUtils, XMLConf, 9 FileUtil; 9 10 10 11 type … … 14 15 15 16 TGameSystem = class 16 Name: string;17 FileName: string; 17 18 MaxPlayerCount: Integer; 18 19 UnitKinds: TUnitKinds; … … 20 21 EmptyCellsNeutral: Boolean; 21 22 UnitsMoveImmediately: Boolean; 22 FileName: string;23 23 constructor Create; 24 24 destructor Destroy; override; 25 25 procedure Clear; 26 function GetName: string; 26 27 procedure Assign(Source: TGameSystem); 27 28 procedure LoadFromNode(Node: TDOMNode); … … 40 41 end; 41 42 43 const 44 GameSystemExt = '.xts'; 45 42 46 43 47 implementation … … 51 55 begin 52 56 Result := TGameSystem.Create; 53 Result. Name := Name;57 Result.FileName := Name; 54 58 Add(Result); 55 59 end; … … 60 64 begin 61 65 I := 0; 62 while (I < Count) and ( Items[I].Name <> Name) do Inc(I);66 while (I < Count) and (TGameSystem(Items[I]).GetName <> Name) do Inc(I); 63 67 if I < Count then Result := Items[I] 64 68 else Result := nil; … … 83 87 end; 84 88 89 function TGameSystem.GetName: string; 90 begin 91 Result := ExtractFileNameWithoutExt(ExtractFileName(FileName)); 92 end; 93 85 94 procedure TGameSystem.Assign(Source: TGameSystem); 86 95 begin 87 Name := Source.Name;96 FileName := Source.FileName; 88 97 UnitsMoveImmediately := Source.UnitsMoveImmediately; 89 98 MaxPlayerCount := Source.MaxPlayerCount; … … 96 105 NewNode: TDOMNode; 97 106 begin 98 Name := ReadString(Node, 'Name', '');99 107 UnitsSplitMerge := ReadBoolean(Node, 'UnitsSplitMerge', False); 100 108 EmptyCellsNeutral := ReadBoolean(Node, 'EmptyCellsNeutral', False); … … 110 118 NewNode: TDOMNode; 111 119 begin 112 WriteString(Node, 'Name', Name);113 120 WriteBoolean(Node, 'UnitsSplitMerge', UnitsSplitMerge); 114 121 WriteBoolean(Node, 'EmptyCellsNeutral', EmptyCellsNeutral); … … 129 136 Clear; 130 137 with Doc do try 131 if Doc.DocumentElement.NodeName <> 'Xtactics Rules' then138 if Doc.DocumentElement.NodeName <> 'XtacticsGameSystem' then 132 139 raise Exception.Create(SWrongFileFormat); 133 140 RootNode := Doc.DocumentElement; … … 146 153 Doc := TXMLDocument.Create; 147 154 with Doc do try 148 RootNode := CreateElement('Xtactics Rules');155 RootNode := CreateElement('XtacticsGameSystem'); 149 156 AppendChild(RootNode); 150 157 SaveToNode(RootNode); … … 160 167 begin 161 168 with Config do begin 162 Self.Name := string(GetValue(DOMString(Path + '/Name'), DOMString('')));163 169 UnitsSplitMerge := GetValue(DOMString(Path + '/UnitsSplitMerge'), True); 164 170 EmptyCellsNeutral := GetValue(DOMString(Path + '/EmptyCellsNeutral'), False); … … 170 176 begin 171 177 with Config do begin 172 SetValue(DOMString(Path + '/Name'), DOMString(Self.Name));173 178 SetValue(DOMString(Path + '/UnitsSplitMerge'), UnitsSplitMerge); 174 179 SetValue(DOMString(Path + '/EmptyCellsNeutral'), EmptyCellsNeutral);
Note:
See TracChangeset
for help on using the changeset viewer.