unit ant_profile;

//
//  Profile works pretty much the same as ant_config. The difference is that
//  the config determines how the application starts and works, while the
//  profile determines user progress and in-game choices.
//

{$MODE FPC}
{$MODESWITCH DEFAULTPARAMETERS}
{$MODESWITCH OUT}
{$MODESWITCH RESULT}

interface

uses
  DEng;

type
TProfile = object
private
  FFirstRun: Boolean;
  FBestTime: UInt64;

public
  procedure Init;
  procedure Done;

  function Load: Boolean;
  // Usually should be called once after application start. Rewrites all
  // previously loaded data. The constructor Init does not load any data
  // automatically.

  function Save: Boolean;
  // After every sequence of write calls (which are basically the methods
  // started with Set*) the Save method should be called.  Otherwise changes
  // will be lost.

  function GetFirstRun: Boolean;
  procedure SetFirstRun(Value: Boolean);
  // The FirstRun is a flag for checking if the game was run for the first
  // time. It can be used for example for showing tutorial.

  function GetBestTime: UInt64;
  procedure SetBestTime(Value: UInt64);
  // The BestTime is the time in milliseconds of the longest game session.
  // BestTime=0 means no game sessions yet.
end;

implementation

procedure TProfile.Init;
begin
  FFirstRun := True;
  FBestTime := 0;
end;

procedure TProfile.Done;
begin
end;

function TProfile.Load: Boolean;
begin
  FFirstRun := True;
  FBestTime := 0;
  Exit(True);
end;

function TProfile.Save: Boolean;
begin
  Exit(True);
end;

function TProfile.GetFirstRun: Boolean;
begin
  Exit(FFirstRun);
end;

procedure TProfile.SetFirstRun(Value: Boolean);
begin
  FFirstRun := Value;
end;

function TProfile.GetBestTime: UInt64;
begin
  Exit(FBestTime);
end;

procedure TProfile.SetBestTime(Value: UInt64);
begin
  FBestTime := Value;
end;

end.
