mirror of
https://github.com/Zagrios/bs-manager.git
synced 2026-07-03 14:08:25 +02:00
[feature-107] lot of changes but mainly, maps now use a cache and load almost instantly after first load
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
export function isFunction(value: any): value is Function {
|
||||
return !!(value && value.constructor && value.call && value.apply)
|
||||
}
|
||||
|
||||
export function noop() {}
|
||||
|
||||
@@ -143,7 +143,7 @@ export interface BsvMapParitySummary {
|
||||
export type BsvMapCharacteristic = "Standard" | "OneSaber" | "NoArrows" | "90Degree" | "360Degree" | "Lightshow" | "Lawless";
|
||||
export type BsvMapDifficultyType = "Easy" | "Normal" | "Hard" | "Expert" | "ExpertPlus";
|
||||
|
||||
export type MapStyle = "dance" | "swing" | "nightcore" | "folk" | "family" | "ambient" | "funk" | "jazz" | "soul" | "speedcore" | "punk" | "rb" | "holiday" | "vocaloid" | "jrock" | "trance" | "drumbass" | "comedy" | "instrumental" | "hardcore" | "kpop" | "indie" | "techno" | "house" | "game" | "film" | "alt" | "dubstep" | "metal" | "anime" | "hiphop" | "jpop" | "rock" | "pop" | "electronic" | "classical-orchestral";
|
||||
export type MapStyle = "dance" | "swing" | "nightcore" | "folk" | "family" | "ambient" | "funk" | "jazz" | "soul" | "speedcore" | "punk" | "rb" | "holiday" | "vocaloid" | "j-rock" | "trance" | "drumbass" | "comedy" | "instrumental" | "hardcore" | "k-pop" | "indie" | "techno" | "house" | "game" | "film" | "alt" | "dubstep" | "metal" | "anime" | "hiphop" | "j-pop" | "rock" | "pop" | "electronic" | "classical-orchestral";
|
||||
export type MapType = "accuracy" | "balanced" | "challenge" | "dancestyle" | "fitness" | "speed" | "tech";
|
||||
export type MapTag = MapStyle | MapType;
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { BsvMapDetail } from "./beat-saver.model";
|
||||
import { RawMapInfoData } from "./raw-map.model";
|
||||
import { SongDetails } from "./song-details-cache.model";
|
||||
|
||||
export interface BsmLocalMap {
|
||||
hash: string;
|
||||
coverUrl: string;
|
||||
songUrl: string;
|
||||
rawInfo: RawMapInfoData;
|
||||
bsaverInfo?: BsvMapDetail;
|
||||
songDetails?: SongDetails;
|
||||
path: string;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
export { RawMapInfoData, RawMapDifficulty, RawDifficultySet } from "./raw-map.model";
|
||||
export { BsvInstant, BsvMapDetail, BsvMapDetailMetadata, BsvMapDifficulty, BsvMapParitySummary, BsvMapStats, BsvMapTestplay, BsvMapVersion, BsvUserDetail } from "./beat-saver.model";
|
||||
export { SongDetailsCache, SongDetails, Difficulty, MapDetailMetadata, Uploader, SongDetailDiffCharactertistic, SongDiffName } from "./song-details-cache.model";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BsvMapCharacteristic, BsvMapDifficultyType } from "./beat-saver.model";
|
||||
import { SongDetailDiffCharactertistic, SongDiffName } from "./song-details-cache.model";
|
||||
|
||||
export interface RawMapInfoData<T = unknown> {
|
||||
_version: string;
|
||||
@@ -21,12 +21,12 @@ export interface RawMapInfoData<T = unknown> {
|
||||
}
|
||||
|
||||
export interface RawDifficultySet {
|
||||
_beatmapCharacteristicName: BsvMapCharacteristic;
|
||||
_beatmapCharacteristicName: SongDetailDiffCharactertistic;
|
||||
_difficultyBeatmaps: RawMapDifficulty[];
|
||||
}
|
||||
|
||||
export interface RawMapDifficulty {
|
||||
_difficulty: BsvMapDifficultyType;
|
||||
_difficulty: SongDiffName;
|
||||
_difficultyRank: string;
|
||||
_beatmapFilename: string;
|
||||
_noteJumpMovementSpeed: number;
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
|
||||
|
||||
export interface SongDetailsCache {
|
||||
songs: SongDetails[];
|
||||
lastUpdated: number; // int64 in protobuf is represented as number in TypeScript, but consider using BigInt for precise representation
|
||||
total: number; // uint32
|
||||
}
|
||||
|
||||
export interface SongDetails {
|
||||
id: string;
|
||||
hash: string;
|
||||
name: string;
|
||||
metadata: MapDetailMetadata;
|
||||
uploader: Uploader;
|
||||
uploadedAt: number; // int32
|
||||
tags: string[];
|
||||
bpm: number; // float
|
||||
ranked: boolean;
|
||||
qualified: boolean;
|
||||
curated: boolean;
|
||||
rankedBL: boolean;
|
||||
nominatedBL: boolean;
|
||||
qualifiedBL: boolean;
|
||||
upVotes: number; // int32
|
||||
downVotes: number; // int32
|
||||
downloads: number; // int32
|
||||
duration: number; // int32
|
||||
automapper: boolean;
|
||||
difficulties: Difficulty[];
|
||||
}
|
||||
|
||||
export interface Difficulty {
|
||||
difficulty: SongDiffName;
|
||||
characteristic: SongDetailDiffCharactertistic;
|
||||
label: string;
|
||||
stars: number; // float
|
||||
starsBL: number; // float
|
||||
njs: number; // float
|
||||
nps: number; // float
|
||||
offset: number; // float
|
||||
chroma: boolean;
|
||||
cinema: boolean;
|
||||
me: boolean;
|
||||
ne: boolean;
|
||||
bombs: number; // int32
|
||||
notes: number; // int32
|
||||
obstacles: number; // int32
|
||||
}
|
||||
|
||||
export interface Uploader {
|
||||
name: string;
|
||||
id: number; // int32
|
||||
verified: boolean;
|
||||
}
|
||||
|
||||
export interface MapDetailMetadata {
|
||||
bpm: number; // float
|
||||
duration: number; // int32
|
||||
levelAuthorName: string;
|
||||
songAuthorName: string;
|
||||
songName: string;
|
||||
songSubName: string;
|
||||
}
|
||||
|
||||
export enum SongDiffName {
|
||||
Easy = "Easy",
|
||||
Normal = "Normal",
|
||||
Hard = "Hard",
|
||||
Expert = "Expert",
|
||||
ExpertPlus = "ExpertPlus",
|
||||
}
|
||||
|
||||
export enum SongDetailDiffCharactertistic {
|
||||
Standard = "Standard",
|
||||
OneSaber = "OneSaber",
|
||||
NoArrows = "NoArrows",
|
||||
Lawless = "Lawless",
|
||||
Lightshow = "Lightshow",
|
||||
Legacy = "Legacy",
|
||||
_90Degree = "90Degree",
|
||||
_360Degree = "360Degree",
|
||||
}
|
||||
Reference in New Issue
Block a user