pub const MAX_LEADERBOARD_DETAILS: usize = 64;
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum LeaderboardSort {
Ascending,
Descending,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum LeaderboardDisplay {
Numeric,
TimeSeconds,
TimeMilliseconds,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum UploadMethod {
KeepBest,
ForceUpdate,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum ScoreRange {
Global {
first: u32,
last: u32,
},
AroundUser {
before: u32,
after: u32,
},
Friends,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct LeaderboardEntry {
pub rank: i32,
pub steam_id: u64,
pub score: i32,
pub details: Vec<i32>,
}
pub trait LeaderboardBackend {
fn find_leaderboard(&self, op: u64, name: &str, create: Option<(LeaderboardSort, LeaderboardDisplay)>) -> bool;
fn upload_score(&self, op: u64, board: u64, method: UploadMethod, score: i32, details: &[i32]) -> bool;
fn download_scores(&self, op: u64, board: u64, range: ScoreRange) -> bool;
fn leaderboard_sort(&self, board: u64) -> Option<LeaderboardSort>;
fn leaderboard_display(&self, board: u64) -> Option<LeaderboardDisplay>;
fn leaderboard_entry_count(&self, board: u64) -> i32;
}