public static void getHighScore(Action <LeaderboardListResponse> successfullAction, Action <int> failureAction) { LeaderboardsService leaderboardsService = new LeaderboardsService(); ListRequest request = new ListRequest().addOrderBy(Exp.property(LeaderboardEntity.COLUMN_Time), true); leaderboardsService.list(request, successfullAction, failureAction); }
public static void saveOrUpdate(LeaderboardEntity leaderboardEntity) { LeaderboardsService leaderboardsService = new LeaderboardsService(); ListRequest request = new ListRequest() .and(Exp.equalsTo(LeaderboardEntity.COLUMN_DeviceId, leaderboardEntity.DeviceId)); leaderboardsService.list(request, (LeaderboardListResponse leaderboardListResponse) => { if (leaderboardListResponse.TotalCount == 0) { createItem(leaderboardEntity); Debug.Log("create leaderboardEntity"); } else { LeaderboardEntity tmp = leaderboardListResponse.Data[0]; Debug.Log("update leaderboardEntity: " + tmp.Time + " " + leaderboardEntity.Time); if (tmp.Time > leaderboardEntity.Time) { tmp.Time = leaderboardEntity.Time; updateItem(tmp); } } }, (int resultCode) => { Debug.Log("failure: " + resultCode + ""); }); }
public static void updateItem(LeaderboardEntity request) { LeaderboardsService leaderboardsService = new LeaderboardsService(); leaderboardsService.update(request, (InsertUpdateResponse insertUpdateResponse) => { Debug.Log("successful " + "update Ad: " + insertUpdateResponse.Guid); }, (int resultCode) => { Debug.Log("failure " + "update Ad: " + resultCode); }); }
public static void listOfAds(ListRequest request, String message) { request.PageSize = 10; LeaderboardsService leaderboardsService = new LeaderboardsService(); leaderboardsService.list(request, (LeaderboardListResponse leaderboardListResponse) => { Debug.Log("successful " + message + ": " + leaderboardListResponse.TotalCount + " " + leaderboardListResponse.Data[0].Time); }, (int resultCode) => { Debug.Log("failure " + message + ": " + resultCode + ""); }); }