Changeset 79 for trunk/UCore.pas
- Timestamp:
- Nov 4, 2014, 8:57:21 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UCore.pas
r77 r79 7 7 uses 8 8 Classes, SysUtils, XMLConf, FileUtil, ActnList, Controls, Dialogs, Forms, 9 UGame, UApplicationInfo, U CoolTranslator;9 UGame, UApplicationInfo, UPersistentForm, UCoolTranslator; 10 10 11 11 type … … 29 29 ImageListSmall: TImageList; 30 30 OpenDialog1: TOpenDialog; 31 PersistentForm: TPersistentForm; 31 32 SaveDialog1: TSaveDialog; 32 33 XMLConfig1: TXMLConfig; … … 51 52 procedure GameNewTurnExecute(Sender: TObject); 52 53 procedure AutoSave; 54 procedure LoadConfig; 55 procedure SaveConfig; 53 56 public 54 57 Game: TGame; … … 143 146 end; 144 147 148 procedure TCore.LoadConfig; 149 begin 150 LastMapFileName := XMLConfig1.GetValue('LastMapFileName', ''); 151 DevelMode := XMLConfig1.GetValue('DevelMode', false); 152 AnimationSpeed := XMLConfig1.GetValue('AnimationSpeed', 50); 153 AutoSaveEnabled := XMLConfig1.GetValue('AutoSave', True); 154 CoolTranslator1.Language := CoolTranslator1.Languages.SearchByCode(XMLConfig1.GetValue('Language', '')); 155 end; 156 157 procedure TCore.SaveConfig; 158 begin 159 XMLConfig1.SetValue('Language', CoolTranslator1.Language.Code); 160 XMLConfig1.SetValue('LastMapFileName', LastMapFileName); 161 XMLConfig1.SetValue('DevelMode', DevelMode); 162 XMLConfig1.SetValue('AnimationSpeed', AnimationSpeed); 163 XMLConfig1.SetValue('AutoSave', AutoSaveEnabled); 164 end; 165 145 166 procedure TCore.UpdateActions; 146 167 begin … … 269 290 begin 270 291 Game.SaveConfig(XMLConfig1, 'Game'); 271 XMLConfig1.SetValue('Language', CoolTranslator1.Language.Code); 272 XMLConfig1.SetValue('LastMapFileName', LastMapFileName); 273 XMLConfig1.SetValue('DevelMode', DevelMode); 274 XMLConfig1.SetValue('AnimationSpeed', AnimationSpeed); 275 XMLConfig1.SetValue('AutoSave', AutoSaveEnabled); 292 SaveConfig; 276 293 FreeAndNil(Game); 277 294 end; … … 282 299 begin 283 300 FInitialized := True; 284 LastMapFileName := XMLConfig1.GetValue('LastMapFileName', ''); 285 DevelMode := XMLConfig1.GetValue('DevelMode', false); 286 AnimationSpeed := XMLConfig1.GetValue('AnimationSpeed', 50); 287 AutoSaveEnabled := XMLConfig1.GetValue('AutoSave', True); 288 CoolTranslator1.Language := CoolTranslator1.Languages.SearchByCode(XMLConfig1.GetValue('Language', '')); 301 LoadConfig; 289 302 for I := 0 to Game.Players.Count - 1 do 290 303 TPlayer(Game.Players[I]).View.DestRect := Rect(0, 0, FormMain.PaintBox1.Width,
Note:
See TracChangeset
for help on using the changeset viewer.