Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposed new beatmap object model #83

Closed
ddevault opened this issue Oct 14, 2016 · 0 comments
Closed

Proposed new beatmap object model #83

ddevault opened this issue Oct 14, 2016 · 0 comments

Comments

@ddevault
Copy link
Contributor

ddevault commented Oct 14, 2016

public class BeatmapSetInfo // db bound
{
    [PrimaryKey]
    public int BeatmapSetID { get; set; }
    [sqlite-net-extensions ormy stuff goes here]
    public BeatmapMetadata Metadata { get; set; }
    public string Hash { get; set; }
    public string Path { get; set; }
}

public class BeatmapInfo // db bound
{
    [PrimaryKey]
    public int BeatmapID { get; set; }
    [ormy stuff]
    public BeatmapMetadata Metadata { get; set; }
    [ormy stuff]
    public BaseDifficulty BaseDifficulty { get; set; }
    [ormy stuff]
    public BeatmapSetInfo BeatmapSet { get; set; }
    public string Version { get; set; }
}

public class BeatmapMetadata // db bound
{
    [PrimaryKey, AutoIncrement]
    public int ID { get; set; }

    public int BeatmapSetID { get; set; }
    public string Title { get; set; }
    public string Artist { get; set; }
    public string AudioFile { get; set; }
    public string BackgroundFile { get; set; }
    // ...
}

public class BaseDifficulty // db bound
{
    // ...
}

public class BeatmapSet
{
    public BeatmapSetInfo Info { get; set; }
    public List<Beatmap> Beatmaps { get; set; }
}

public class Beatmap
{
    public BeatmapInfo Info { get; set; }
    public List<HitObject> HitObjects { get; set; }
    // ...
}

// Usage

// Get list of beatmaps in the db (i.e. SongSelect):
var beatmapSets = BeatmapStorage.Query<BeatmapSetInfo>().Where(...) etc

// Save a beatmap to the db
BeatmapSetInfo info = ...;
BeatmapStorage.Update(info);

// Get a full beatmap object:
BeatmapSetInfo setInfo = BeatmapStorage.GetBeatmapSet(113377);
Beatmap beatmap = BeatmapStorage.GetBeatmap(setInfo.Beatmaps[0]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant