mirror of
https://github.com/Melledy/Nebula.git
synced 2026-09-20 01:29:54 +02:00
Improve Boss Blitz UI
This commit is contained in:
@@ -27,7 +27,7 @@ public class ScoreBossManager extends PlayerManager {
|
||||
return GameData.getScoreBossControlDataTable().get(this.getControlId());
|
||||
}
|
||||
|
||||
public ScoreBossRankEntry getRanking() {
|
||||
public ScoreBossRankEntry getRankEntry() {
|
||||
if (this.ranking == null && !this.checkedDatabase) {
|
||||
this.ranking = Nebula.getGameDatabase().getObjectByUid(ScoreBossRankEntry.class, this.getPlayerUid());
|
||||
this.checkedDatabase = true;
|
||||
@@ -57,7 +57,7 @@ public class ScoreBossManager extends PlayerManager {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean settle(int stars, int score) {
|
||||
public boolean settle(int stars, int score, int skillScore) {
|
||||
// Get level
|
||||
var control = getControlData();
|
||||
if (control == null || !control.getLevelGroup().contains(this.getLevelId())) {
|
||||
@@ -71,7 +71,7 @@ public class ScoreBossManager extends PlayerManager {
|
||||
}
|
||||
|
||||
// Get ranking from database
|
||||
this.getRanking();
|
||||
this.getRankEntry();
|
||||
|
||||
// Create ranking if its not in the database
|
||||
if (this.ranking == null) {
|
||||
@@ -79,7 +79,7 @@ public class ScoreBossManager extends PlayerManager {
|
||||
}
|
||||
|
||||
// Settle
|
||||
this.ranking.settle(this.getPlayer(), build, getControlId(), getLevelId(), stars, score);
|
||||
this.ranking.settle(this.getPlayer(), build, getControlId(), getLevelId(), stars, score, skillScore);
|
||||
|
||||
// Save ranking
|
||||
this.ranking.save();
|
||||
|
||||
@@ -33,6 +33,8 @@ public class ScoreBossRankEntry implements GameDatabaseObject {
|
||||
private int titleSuffix;
|
||||
private int[] honor;
|
||||
private int score;
|
||||
@SuppressWarnings("unused")
|
||||
private int stars;
|
||||
|
||||
private int controlId;
|
||||
private Map<Integer, ScoreBossTeamEntry> teams;
|
||||
@@ -51,6 +53,17 @@ public class ScoreBossRankEntry implements GameDatabaseObject {
|
||||
this.teams = new HashMap<>();
|
||||
}
|
||||
|
||||
// TODO replace later
|
||||
public int getStars() {
|
||||
int stars = 0;
|
||||
|
||||
for (var team : this.getTeams().values()) {
|
||||
stars += team.getStars();
|
||||
}
|
||||
|
||||
return stars;
|
||||
}
|
||||
|
||||
public void update(Player player) {
|
||||
this.name = player.getName();
|
||||
this.level = player.getLevel();
|
||||
@@ -60,28 +73,38 @@ public class ScoreBossRankEntry implements GameDatabaseObject {
|
||||
this.honor = player.getHonor();
|
||||
}
|
||||
|
||||
public void settle(Player player, StarTowerBuild build, int controlId, int level, int stars, int score) {
|
||||
public void settle(Player player, StarTowerBuild build, int controlId, int level, int stars, int score, int skillScore) {
|
||||
// Update player data
|
||||
this.update(player);
|
||||
|
||||
// Reset score entry if control id doesn't match
|
||||
if (this.controlId != controlId) {
|
||||
this.controlId = controlId;
|
||||
this.getTeams().clear();
|
||||
this.reset();
|
||||
}
|
||||
|
||||
// Set team entry
|
||||
var team = new ScoreBossTeamEntry(player, build, stars, score);
|
||||
var team = new ScoreBossTeamEntry(player, build, stars, score, skillScore);
|
||||
|
||||
// Put in team map
|
||||
this.getTeams().put(level, team);
|
||||
|
||||
// Calculate score
|
||||
// Calculate score/stars
|
||||
this.score = 0;
|
||||
this.stars = 0;
|
||||
|
||||
for (var t : this.getTeams().values()) {
|
||||
this.score += t.getLevelScore();
|
||||
this.stars += t.getStars();
|
||||
}
|
||||
}
|
||||
|
||||
private void reset() {
|
||||
this.score = 0;
|
||||
this.stars = 0;
|
||||
this.getTeams().clear();
|
||||
}
|
||||
|
||||
// Proto
|
||||
|
||||
public ScoreBossRankData toProto() {
|
||||
@@ -115,6 +138,7 @@ public class ScoreBossRankEntry implements GameDatabaseObject {
|
||||
private int buildScore;
|
||||
private int stars;
|
||||
private int levelScore;
|
||||
private int skillScore;
|
||||
private List<ScoreBossCharEntry> characters;
|
||||
|
||||
@Deprecated // Morphia only
|
||||
@@ -122,11 +146,12 @@ public class ScoreBossRankEntry implements GameDatabaseObject {
|
||||
|
||||
}
|
||||
|
||||
public ScoreBossTeamEntry(Player player, StarTowerBuild build, int stars, int score) {
|
||||
public ScoreBossTeamEntry(Player player, StarTowerBuild build, int stars, int score, int skillScore) {
|
||||
this.buildId = build.getUid();
|
||||
this.buildScore = build.getScore();
|
||||
this.stars = stars;
|
||||
this.levelScore = score;
|
||||
this.skillScore = skillScore;
|
||||
this.characters = new ArrayList<>();
|
||||
|
||||
for (var charId : build.getCharIds()) {
|
||||
|
||||
Reference in New Issue
Block a user