-1
Scene2D를 사용하여 libGDX 프로젝트의 리더 보드 용 사용자 인터페이스를 작성하려고합니다. 내 벤치 마크는 Google Play 게임/게임 센터 리더 보드와 유사합니다. 슬라이드 다운을 사용하여 새로 고침 기능이있는 기존 화면에 오버레이처럼 표시됩니다.libGDX Scene2D의 UI 측면에서 Game center/Play 게임 유형 리더 보드를 구축하는 가장 좋은 방법은 무엇입니까?
이미 렌더링 된 Scene2D 요소에서 데이터를 업데이트하는 방법에 대한 아이디어가 없습니다. 이것은 리더 보드를 만드는 방법입니다. 아래 함수는 버튼 누름에서 호출됩니다. 이제 새로 고침 할 때 렌더링 된 리더 보드 테이블의 데이터를 업데이트하는 방법은 무엇입니까? 리더 보드 유형을 글로벌에서 소셜 또는 모든 시간에서 지난 주로 변경하려고 할 때도 동일한 도전 과제가 있습니다.
public Table getLeaderboard(com.myapp.models.Leaderboard[] leaderboards){
Constants.printLog(TAG,"getLeaderboard function");
//To check layout. Comment later
Pixmap pm1 = new Pixmap(1, 1, Pixmap.Format.RGB565);
pm1.setColor(Color.LIGHT_GRAY);
pm1.fill();
// Defining Tables
final Table rootTable = new Table(); // Root table
rootTable.setFillParent(true);
Table navigationTable = new Table(); //Table to done/back button
Table scoresTable = new Table(); //Table to to show scores
// Strings to be used
String doneString = "done";
TextButton doneButton = new TextButton(getString(doneString),skin,"default");
navigationTable.add(doneButton);
for(int i=0; i<leaderboards.length; i++){
scoresTable.add(renderScoreRow(leaderboards[i].getName(),leaderboards[i].getHighscore())).expandX().fillX();
scoresTable.row();
}
ScrollPane scoreScrollPane = new ScrollPane(scoresTable);
rootTable.add(navigationTable).expandX().right().row();
rootTable.add(scoreScrollPane).expandY().expandX().fillX();
doneButton.addListener(new InputListener() {
@Override
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
rootTable.setVisible(false);
rootTable.remove();
return true;
}
});
// navigationTable.setDebug(true);
// scoresTable.setDebug(true);
rootTable.setBackground(new TextureRegionDrawable(new TextureRegion(new Texture(pm1))));
return rootTable;
}