Exemple #1
0
        public void UpdateTournamentLeaders(PlanetVO planetVO, LeaderboardController.OnUpdateData callback)
        {
            if (planetVO == null)
            {
                Service.Logger.Error("Tournament leaderboard requested without setting planetVO");
                return;
            }
            PlayerLeaderboardRequest         request         = new PlayerLeaderboardRequest(planetVO.Uid, Service.CurrentPlayer.PlayerId);
            LeaderboardList <PlayerLBEntity> leaderboardList = null;
            LeaderboardList <PlayerLBEntity> value           = null;

            this.GetPlayerLists(PlayerListType.TournamentLeaders, planetVO.Uid, out leaderboardList, out value);
            Dictionary <string, object> dictionary = new Dictionary <string, object>();

            dictionary["callback"]   = callback;
            dictionary["list"]       = leaderboardList;
            dictionary["listnearby"] = value;
            GetTournamentLeaderboardPlayersCommand getTournamentLeaderboardPlayersCommand = new GetTournamentLeaderboardPlayersCommand(request);

            getTournamentLeaderboardPlayersCommand.Context = dictionary;
            getTournamentLeaderboardPlayersCommand.AddSuccessCallback(new AbstractCommand <PlayerLeaderboardRequest, LeaderboardResponse> .OnSuccessCallback(this.OnLeadersUpdated));
            getTournamentLeaderboardPlayersCommand.AddFailureCallback(new AbstractCommand <PlayerLeaderboardRequest, LeaderboardResponse> .OnFailureCallback(this.OnLeadersUpdateFailure));
            Service.ServerAPI.Sync(getTournamentLeaderboardPlayersCommand);
            leaderboardList.LastRefreshTime = Service.ServerAPI.ServerTime;
        }
Exemple #2
0
 private void FireCallbackFromCookie(object cookie, bool success)
 {
     LeaderboardController.OnUpdateData onUpdateData = (LeaderboardController.OnUpdateData)cookie;
     if (onUpdateData != null)
     {
         onUpdateData(success);
     }
 }
Exemple #3
0
        public void UpdateFeaturedSquads(LeaderboardController.OnUpdateData callback)
        {
            GetFeaturedSquadsCommand getFeaturedSquadsCommand = new GetFeaturedSquadsCommand(new PlayerIdRequest
            {
                PlayerId = Service.CurrentPlayer.PlayerId
            });

            getFeaturedSquadsCommand.AddSuccessCallback(new AbstractCommand <PlayerIdRequest, FeaturedSquadsResponse> .OnSuccessCallback(this.OnGetFeaturedSquadsSuccess));
            getFeaturedSquadsCommand.AddFailureCallback(new AbstractCommand <PlayerIdRequest, FeaturedSquadsResponse> .OnFailureCallback(this.OnUpdateFailure));
            getFeaturedSquadsCommand.Context = callback;
            Service.ServerAPI.Sync(getFeaturedSquadsCommand);
            this.FeaturedSquads.LastRefreshTime = Service.ServerAPI.ServerTime;
        }
Exemple #4
0
        public void UpdateFriends(string friendIds, LeaderboardController.OnUpdateData callback)
        {
            GetLeaderboardFriendsCommand getLeaderboardFriendsCommand = new GetLeaderboardFriendsCommand(new FriendLBIDRequest
            {
                PlayerId  = Service.CurrentPlayer.PlayerId,
                FriendIDs = friendIds
            });

            getLeaderboardFriendsCommand.AddSuccessCallback(new AbstractCommand <FriendLBIDRequest, LeaderboardResponse> .OnSuccessCallback(this.OnFriendsUpdated));
            getLeaderboardFriendsCommand.AddFailureCallback(new AbstractCommand <FriendLBIDRequest, LeaderboardResponse> .OnFailureCallback(this.OnUpdateFailure));
            getLeaderboardFriendsCommand.Context = callback;
            Service.ServerAPI.Sync(getLeaderboardFriendsCommand);
            this.Friends.LastRefreshTime = Service.ServerAPI.ServerTime;
        }
Exemple #5
0
        public void SearchSquadsByName(string searchStr, LeaderboardController.OnUpdateData callback)
        {
            SearchSquadsByNameCommand searchSquadsByNameCommand = new SearchSquadsByNameCommand(new SearchSquadsByNameRequest
            {
                PlayerId   = Service.CurrentPlayer.PlayerId,
                SearchTerm = searchStr
            });

            searchSquadsByNameCommand.AddSuccessCallback(new AbstractCommand <SearchSquadsByNameRequest, FeaturedSquadsResponse> .OnSuccessCallback(this.OnGetSearchedSquadsSuccess));
            searchSquadsByNameCommand.AddFailureCallback(new AbstractCommand <SearchSquadsByNameRequest, FeaturedSquadsResponse> .OnFailureCallback(this.OnUpdateFailure));
            searchSquadsByNameCommand.Context = callback;
            Service.ServerAPI.Sync(searchSquadsByNameCommand);
            this.SearchedSquads.LastRefreshTime = Service.ServerAPI.ServerTime;
        }
Exemple #6
0
        public void UpdateLeaders(PlanetVO planetVO, LeaderboardController.OnUpdateData callback)
        {
            LeaderboardList <PlayerLBEntity> leaderboardList = null;
            LeaderboardList <PlayerLBEntity> value           = null;
            string planetId = (planetVO != null) ? planetVO.Uid : null;

            this.GetPlayerLists(PlayerListType.Leaders, planetId, out leaderboardList, out value);
            PlayerLeaderboardRequest     request = new PlayerLeaderboardRequest(planetId, Service.Get <CurrentPlayer>().PlayerId);
            GetLeaderboardPlayersCommand getLeaderboardPlayersCommand = new GetLeaderboardPlayersCommand(request);
            Dictionary <string, object>  dictionary = new Dictionary <string, object>();

            dictionary["callback"]               = callback;
            dictionary["list"]                   = leaderboardList;
            dictionary["listnearby"]             = value;
            getLeaderboardPlayersCommand.Context = dictionary;
            getLeaderboardPlayersCommand.AddSuccessCallback(new AbstractCommand <PlayerLeaderboardRequest, LeaderboardResponse> .OnSuccessCallback(this.OnLeadersUpdated));
            getLeaderboardPlayersCommand.AddFailureCallback(new AbstractCommand <PlayerLeaderboardRequest, LeaderboardResponse> .OnFailureCallback(this.OnLeadersUpdateFailure));
            Service.Get <ServerAPI>().Sync(getLeaderboardPlayersCommand);
            leaderboardList.LastRefreshTime = Service.Get <ServerAPI>().ServerTime;
        }