Changeset 19 for trunk/UCore.pas


Ignore:
Timestamp:
Oct 5, 2019, 1:00:29 PM (5 years ago)
Author:
chronos
Message:
  • Added: Remember board state between application restarts.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UCore.pas

    r17 r19  
    115115    CurrentContext := ApplicationInfo1.GetRegistryContext;
    116116
    117     Game.TopScore := ReadIntegerWithDefault('TopScore', 0);
    118     Game.Board.Size := Point(ReadIntegerWithDefault('SizeX', 4), ReadIntegerWithDefault('SizeY', 4));
    119     Game.AnimationDuration := ReadIntegerWithDefault('AnimationDuration', 30);
    120117    if ValueExists('LanguageCode') then
    121118      Translator1.Language := Translator1.Languages.SearchByCode(ReadStringWithDefault('LanguageCode', ''))
     
    124121    Free;
    125122  end;
     123  Game.LoadFromRegistry(ApplicationInfo1.GetRegistryContext);
    126124end;
    127125
     
    132130    CurrentContext := ApplicationInfo1.GetRegistryContext;
    133131
    134     WriteInteger('TopScore', Game.TopScore);
    135     WriteInteger('SizeX', Game.Board.Size.X);
    136     WriteInteger('SizeY', Game.Board.Size.Y);
    137     WriteInteger('AnimationDuration', Game.AnimationDuration);
    138132    if Assigned(Translator1.Language) and (Translator1.Language.Code <> '') then
    139133      WriteString('LanguageCode', Translator1.Language.Code)
     
    142136    Free;
    143137  end;
     138  Game.SaveToRegistry(ApplicationInfo1.GetRegistryContext);
    144139end;
    145140
Note: See TracChangeset for help on using the changeset viewer.