我想在我的游戏中使用 Scoreloop 成就。我在他们的网站上配置了带有图标的捆绑包,并将捆绑包添加到资产中。当运行 Scorellop EntryActivity 我有成就活动。但是现在我需要设置游戏成就的进度,但我不明白该怎么做。Scoreloop 网站的文档没有为我清除。有人可以提供我的示例代码吗?
问问题
395 次
1 回答
3
public void achieve(final String awardId) {
ScoreloopManagerSingleton.get().loadAchievements(null);
// final String awardId = context.getResources().getString(resId);
// i.e. wait with the unlocking and/or display of achievements until your runnable gets invoked.
ScoreloopManagerSingleton.get().loadAchievements(new Continuation<Boolean>() {
@Override
public void withValue(Boolean arg0, Exception arg1) {
Achievement achivment = ScoreloopManagerSingleton.get().getAchievement(awardId);
if (achivment.getAward().getAchievingValue() - achivment.getValue() == 1) {
ScoreloopManagerSingleton.get().achieveAward(achivment.getAward().getIdentifier(), true, true);
} else {
if (!achivment.isAchieved()) {
achivment.incrementValue();
}
if (achivment.needsSubmit()) {
AchievementController aController = new AchievementController(
new RequestControllerObserver() {
public void requestControllerDidReceiveResponse(RequestController arg0) {
// TODO Auto-generated method stub
}
public void requestControllerDidFail(RequestController arg0, Exception arg1) {
// TODO Auto-generated method stub
}
});
aController.setAchievement(achivment);
aController.submitAchievement();
}
}
}
});
}
于 2013-03-29T13:09:58.503 回答