Skip to content

Commit

Permalink
Music Select : show trophy (Course Mode)
Browse files Browse the repository at this point in the history
  • Loading branch information
exch-bms2 committed Jun 9, 2016
1 parent fa34d05 commit 5810c45
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 18 deletions.
43 changes: 31 additions & 12 deletions src/bms/player/beatoraja/select/Bar.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import bms.player.lunaticrave2.FolderData;
import bms.player.lunaticrave2.SongData;
import bms.player.beatoraja.*;
import bms.table.Course;

public abstract class Bar {

Expand Down Expand Up @@ -170,17 +171,14 @@ class GradeBar extends SelectableBar {
private SongData[] songs;
private String name;

private int[] constraint = new int[0];

private IRScoreData score;
private TableData.CourseData course;
private IRScoreData mscore;
private IRScoreData rscore;

public GradeBar(String name, SongData[] songs, int[] constraint) {
public GradeBar(String name, SongData[] songs, TableData.CourseData course) {
this.songs = songs;
this.name = name;
if(constraint != null) {
this.constraint = constraint;
}
this.course = course;
}

public SongData[] getSongDatas() {
Expand All @@ -202,11 +200,11 @@ public boolean existsAllSongs() {
}

public IRScoreData getMirrorScore() {
return score;
return mscore;
}

public void setMirrorScore(IRScoreData score) {
this.score = score;
this.mscore = score;
}

public IRScoreData getRandomScore() {
Expand All @@ -218,11 +216,32 @@ public void setRandomScore(IRScoreData score) {
}

public int[] getConstraint() {
return constraint;
if(course.getConstraint() != null) {
return course.getConstraint();
}
return new int[0];
}

public void setConstraint(int[] constraint) {
this.constraint = constraint;
public TableData.TrophyData[] getAllTrophy() {
return course.getTrophy();
}
public TableData.TrophyData getTrophy() {
for(TableData.TrophyData trophy : course.getTrophy()) {
if(qualified(this.getScore(), trophy)) {
return trophy;
}
if(qualified(mscore, trophy)) {
return trophy;
}
if(qualified(rscore, trophy)) {
return trophy;
}
}
return null;
}

private boolean qualified(IRScoreData score, TableData.TrophyData trophy) {
return score != null && score.getNotes() != 0 && trophy.getMissrate() >= score.getMinbp() * 100.0 / score.getNotes()
&& trophy.getScorerate() <= score.getExscore() * 100.0 / (score.getNotes() * 2);
}
}
29 changes: 23 additions & 6 deletions src/bms/player/beatoraja/select/MusicSelector.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@
*/
public class MusicSelector extends MainState {

// TODO フォルダのクリアランプ/スコア状況内訳
// TODO バナー、テキスト表示
// TODO 詳細オプション(BGA ON/OFF、JUDGE TIMING、JUDGE DETAIL等
// TODO 譜面情報表示

private MainController main;

Expand Down Expand Up @@ -155,7 +154,7 @@ public MusicSelector(MainController main, Config config) {
}
}

l.add(new GradeBar(course.getName(), songlist.toArray(new SongData[0]), course.getConstraint()));
l.add(new GradeBar(course.getName(), songlist.toArray(new SongData[0]), course));
}
tables.add(new TableBar(td.getName(), levels.toArray(new TableLevelBar[0]), l
.toArray(new GradeBar[0])));
Expand Down Expand Up @@ -456,6 +455,20 @@ public void render() {
}
}
}
// trophy
TableData.TrophyData trophy = gb.getTrophy();
if(trophy != null) {
shape.begin(ShapeType.Filled);
shape.setColor(Color.valueOf("222200"));
shape.rect(x - 72, y, 30, barh - 6);
shape.setColor(Color.CYAN);
shape.rect(x - 76, y + 4, 30, barh - 6);
shape.end();
sprite.begin();
titlefont.setColor(Color.BLACK);
titlefont.draw(sprite, trophy.getName(), x - 72, y + barh - 8);
sprite.end();
}
} else {
if (sd.getScore() != null && sd.getScore().getClear() != 0
&& skin.getLamp()[sd.getScore().getClear()] != null) {
Expand Down Expand Up @@ -489,13 +502,13 @@ public void render() {
if (ln) {
shape.begin(ShapeType.Filled);
shape.setColor(Color.valueOf("222200"));
shape.rect(x - 36, y - 4, 30, barh - 6);
shape.rect(x - 36, y, 30, barh - 6);
shape.setColor(Color.YELLOW);
shape.rect(x - 40, y, 30, barh - 6);
shape.rect(x - 40, y + 4, 30, barh - 6);
shape.end();
sprite.begin();
titlefont.setColor(Color.BLACK);
titlefont.draw(sprite, "LN", x - 36, y + barh - 12);
titlefont.draw(sprite, "LN", x - 36, y + barh - 8);
sprite.end();
}
}
Expand Down Expand Up @@ -1134,6 +1147,10 @@ private boolean updateBar(Bar bar) {
str.append(sd.getTitle());
}
}

for (TableData.TrophyData tr : ((GradeBar) song).getAllTrophy()) {
str.append(tr.getName());
}
}
}

Expand Down

0 comments on commit 5810c45

Please sign in to comment.