@Kroll.method public void setAchievementScore( final String achievement, final Float percentage, final Float value, final boolean showNotification) { final BAchievementListener listener = new BAchievementListener() { @Override public void onComplete(List<PlayerAchievement> a) { KrollDict data = new KrollDict(); data.put("PlayerAchievement", a); fireEvent("onPlayerAchievement", data); } @Override public void onAchievementUnlocked(List<PlayerAchievement> a) { KrollDict data = new KrollDict(); data.put("PlayerAchievement", a); fireEvent("onPlayerAchievementUnlocked", data); } @Override public void onBeintooError(Exception e) { fireEvent("onError", new KrollDict()); } }; Beintoo.currentContext = _tiContext.getAndroidContext(); Beintoo.setAchievementScore( _tiContext.getAndroidContext(), achievement, percentage, value, listener); }
@Kroll.method public void submitScoreWithVgoodCheck( final int lastScore, final int threshold, final String codeID) { final BSubmitScoreListener slistener = new BSubmitScoreListener() { @Override public void onComplete() { fireEvent("onSubmitComplete", new KrollDict()); } @Override public void onBeintooError(Exception e) { fireEvent("onError", new KrollDict()); } }; final BGetVgoodListener glistener = new BGetVgoodListener() { @Override public void onComplete(VgoodChooseOne v) { KrollDict data = new KrollDict(); data.put("Vgood", v); fireEvent("onVgood", data); } @Override public void isOverQuota() { fireEvent("onVgoodOverquota", new KrollDict()); } @Override public void nothingToDispatch() { fireEvent("onVgoodNothingToDispatch", new KrollDict()); } @Override public void onError() { fireEvent("onError", new KrollDict()); } }; Beintoo.currentContext = _tiContext.getAndroidContext(); SubmitScoreManager ssm = new SubmitScoreManager(); ssm.submitScoreWithVgoodCheck( _tiContext.getAndroidContext(), lastScore, threshold, codeID, false, null, Beintoo.VGOOD_NOTIFICATION_ALERT, slistener, glistener); }
@Kroll.method public void submitScore( final int lastScore, final String codeID, final boolean showNotification) { final BSubmitScoreListener listener = new BSubmitScoreListener() { @Override public void onComplete() { fireEvent("onSubmitComplete", new KrollDict()); } @Override public void onBeintooError(Exception e) { fireEvent("onError", new KrollDict()); } }; Beintoo.currentContext = _tiContext.getAndroidContext(); SubmitScoreManager ssm = new SubmitScoreManager(); ssm.submitScore( _tiContext.getAndroidContext(), lastScore, null, true, Gravity.BOTTOM, listener); }
/** CORE METHODS */ @Kroll.method public void playerLogin() { final BPlayerLoginListener listener = new BPlayerLoginListener() { @Override public void onComplete(Player p) { KrollDict data = new KrollDict(); data.put("player", p); fireEvent("onLogin", data); } @Override public void onError() { fireEvent("onError", new KrollDict()); } }; Beintoo.currentContext = _tiContext.getAndroidContext(); PlayerManager pm = new PlayerManager(TiContext.getCurrentTiContext().getActivity().getApplicationContext()); pm.playerLogin(_tiContext.getAndroidContext(), listener); }
@Kroll.method public void getPlayerScore(final String codeID) { BScoreListener listener = new BScoreListener() { @Override public void onComplete(PlayerScore p) { KrollDict data = new KrollDict(); data.put("PlayerScore", p); fireEvent("onPlayerScore", data); } @Override public void onBeintooError(Exception e) { fireEvent("onError", new KrollDict()); } }; Beintoo.currentContext = _tiContext.getAndroidContext(); Beintoo.getPlayerScoreAsync(_tiContext.getAndroidContext(), codeID, listener); }
@Kroll.method public void GetVgood(final String codeID, final boolean isMultiple) { BGetVgoodListener listener = new BGetVgoodListener() { @Override public void onComplete(VgoodChooseOne v) { KrollDict data = new KrollDict(); data.put("Vgood", v); fireEvent("onVgood", data); } @Override public void isOverQuota() { fireEvent("onVgoodOverquota", new KrollDict()); } @Override public void nothingToDispatch() { fireEvent("onVgoodNothingToDispatch", new KrollDict()); } @Override public void onError() { fireEvent("onError", new KrollDict()); } }; Beintoo.currentContext = _tiContext.getAndroidContext(); Beintoo.GetVgood( _tiContext.getAndroidContext(), codeID, isMultiple, null, Beintoo.VGOOD_NOTIFICATION_ALERT, listener); }
@Kroll.method public void beintooStart(boolean goToDashboard) { Beintoo.currentContext = _tiContext.getAndroidContext(); Beintoo.BeintooStart(_tiContext.getAndroidContext(), goToDashboard); }
@Kroll.method public void logout() { Beintoo.currentContext = _tiContext.getAndroidContext(); Beintoo.logout(_tiContext.getAndroidContext()); }
@Kroll.method public boolean isLogged() { Beintoo.currentContext = _tiContext.getAndroidContext(); return Beintoo.isLogged(_tiContext.getAndroidContext()); }