Class TScoreList

Unit

Declaration

type TScoreList<T:TScore,constructor> = class(TObjectList<T>)

Description

Generic list of scores registered for a game (use TScoreList if you don't need the genericity)

Hierarchy

Overview

Methods

Public constructor Create(EditorName, GameName: string; ScoreFileName: string = 'score.dat'); overload; virtual;
Public procedure Save;
Public procedure SaveToFile(AFileName: string);
Public procedure Load;
Public procedure LoadFromFile(AFileName: string);
Public function GetScoreFileName: string;
Public function Add(APseudo: string; APoints: cardinal; ASaveList: boolean = true) : boolean; overload;
Public function Add(APseudo: string; APoints: cardinal; ALevel: cardinal; ASaveList: boolean = true): boolean; overload;
Public function GetOldScoreFileName(EditorName: string = ''; GameName: string = ''): string;
Public procedure SortByPseudoAsc;
Public procedure SortByPseudoDesc;
Public procedure SortByPointsAsc(WithLevel: boolean = true);
Public procedure SortByPointsDesc(WithLevel: boolean = true);

Description

Methods

Public constructor Create(EditorName, GameName: string; ScoreFileName: string = 'score.dat'); overload; virtual;

Scores list constructor

Public procedure Save;

Save the list of scores in the default file (GetScoreFileName)

Public procedure SaveToFile(AFileName: string);

Save the list of scores in AFileName (and create the path if needed and possible)

Public procedure Load;

Load the list of scores from the default file (GetScoreFileName)

Public procedure LoadFromFile(AFileName: string);

Load the list of scores from FileName (if it exists)

Public function GetScoreFileName: string;

Return default file name for the file list storrage

Public function Add(APseudo: string; APoints: cardinal; ASaveList: boolean = true) : boolean; overload;

Add a new score to the list

Public function Add(APseudo: string; APoints: cardinal; ALevel: cardinal; ASaveList: boolean = true): boolean; overload;

Add a new score to the list

Public function GetOldScoreFileName(EditorName: string = ''; GameName: string = ''): string;

Return old default file name (from u_scores.pas) for compatibility reasons

Public procedure SortByPseudoAsc;

Sort the scores list by pseudo in alphabetical order (and level+score if same pseudo is present more than once time)

Public procedure SortByPseudoDesc;

Sort the scores list by pseudo in inverse alphabetical order (and level+score if same pseudo is present more than once time)

Public procedure SortByPointsAsc(WithLevel: boolean = true);

Sort the scores list by level / points / pseudo (bottom from top)

Public procedure SortByPointsDesc(WithLevel: boolean = true);

Sort the scores list by level / points / pseudo (top from bottom)

Delphi Game Engine (c) 2021-2025 Patrick PREMARTIN - Powered by PasDoc
Generated by PasDoc 0.16.0.