示例#1
0
 private void SearchClicked(UXButton btn)
 {
     ProcessingScreen.Show();
     this.PrepareForNextSearch();
     this.searchBtnOverlay.Enabled = false;
     Service.LeaderboardController.SearchSquadsByName(this.searchInput.Text, new LeaderboardController.OnUpdateData(this.OnSquadsSearched));
 }
示例#2
0
        public void PurchaseCooldownSkip(string perkId)
        {
            StaticDataController staticDataController = Service.StaticDataController;
            string            perkGroup          = staticDataController.Get <PerkVO>(perkId).PerkGroup;
            ActivatedPerkData playerPerkForGroup = this.GetPlayerPerkForGroup(perkGroup);

            if (this.IsPerkInCooldown(playerPerkForGroup))
            {
                Dictionary <string, uint> playerPerkGroupCooldowns = this.GetPlayerPerkGroupCooldowns();
                uint seconds  = playerPerkGroupCooldowns[perkGroup] - ServerTime.Time;
                int  crystals = GameUtils.SecondsToCrystalsForPerk((int)seconds);
                if (!GameUtils.SpendCrystals(crystals))
                {
                    return;
                }
                ProcessingScreen.Show();
                PlayerPerkSkipCooldownRequest request = new PlayerPerkSkipCooldownRequest(playerPerkForGroup.PerkId);
                PlayerPerkSkipCooldownCommand command = new PlayerPerkSkipCooldownCommand(request);
                Service.ServerAPI.Sync(command);
            }
            else
            {
                Service.Logger.WarnFormat("Perk {0} is no longer in cooldown, skipping purchase", new object[]
                {
                    playerPerkForGroup.PerkId
                });
            }
        }
示例#3
0
        public override void ShowView()
        {
            EventManager eventManager = Service.EventManager;

            this.viewContainer.Visible = true;
            eventManager.SendEvent(EventId.SquadSelect, null);
            eventManager.SendEvent(EventId.UISquadScreenTabShown, "warlog");
            SquadController    squadController      = Service.SquadController;
            SquadMemberWarData currentMemberWarData = squadController.WarManager.GetCurrentMemberWarData();
            uint serverTime = Service.ServerAPI.ServerTime;

            if (SquadUtils.DoesRewardWithoutWarHistoryExist(squadController, currentMemberWarData, serverTime))
            {
                ProcessingScreen.Show();
                EventManager eventManager2 = Service.EventManager;
                eventManager2.RegisterObserver(this, EventId.SquadUpdateCompleted);
                squadController.UpdateCurrentSquad();
            }
            else
            {
                this.RefreshView();
            }
            this.tabButton.Selected = true;
            Service.ViewTimeEngine.RegisterFrameTimeObserver(this);
        }
示例#4
0
 protected void LoadFriends()
 {
     this.ResetGrid();
     ProcessingScreen.Show();
     Service.ISocialDataController.FriendsDetailsCB = new OnFBFriendsDelegate(this.OnFriendsListLoaded);
     Service.ISocialDataController.UpdateFriends();
     UXUtils.SetSpriteTopAnchorPoint(this.scrollUp, -4);
 }
示例#5
0
        private void OnRejectClicked(UXButton button)
        {
            SquadMsg message = SquadMsgUtils.CreateRejectSquadInviteMessage(this.invite.SquadId, new SquadController.ActionCallback(this.OnRejectSquadInviteComplete), null);

            Service.SquadController.TakeAction(message);
            Service.EventManager.SendEvent(EventId.SquadNext, null);
            ProcessingScreen.Show();
        }
示例#6
0
        public virtual void ViewSquadInfoClicked(UXButton button)
        {
            string squadId = (string)button.Tag;

            this.squadInfoView.ToggleInfoVisibility(false);
            ProcessingScreen.Show();
            Service.LeaderboardController.UpdateSquadDetails(squadId, new LeaderboardController.OnUpdateSquadData(this.OnSquadDetailsUpdated));
            this.CheckBackButton();
            Service.EventManager.SendEvent(EventId.SquadNext, null);
        }
示例#7
0
 private void OnRewardSuccess(ClaimMobileConnectorAdsRewardResponse response, object cookie)
 {
     if (response.CrateDataTO != null)
     {
         ProcessingScreen.Show();
         Service.EventManager.SendEvent(EventId.OpeningEpisodeTaskCrate, null);
         CrateData     crateDataTO          = response.CrateDataTO;
         List <string> resolvedSupplyIdList = GameUtils.GetResolvedSupplyIdList(crateDataTO);
         Service.InventoryCrateRewardController.GrantInventoryCrateReward(resolvedSupplyIdList, crateDataTO);
     }
 }
 private void OnLeaveAndJoinSquad(object result, object cookie)
 {
     if (result != null)
     {
         ProcessingScreen.Show();
         SquadMsg message = SquadMsgUtils.CreateLeaveSquadMessage(new SquadController.ActionCallback(this.OnLeaveComplete), null);
         Service.Get <SquadController>().TakeAction(message);
         return;
     }
     this.button.Enabled = true;
 }
示例#9
0
 public void SetupChatDisplay()
 {
     if (!this.ChatDisplaySetup)
     {
         this.ChatDisplaySetup = true;
         ProcessingScreen.Show();
         this.numExistingMsgsProcessed = 0;
         this.existingMsgsProcessed    = new HashSet <SquadMsg>();
         this.SetupChatDisplayFrameDelayed();
     }
 }
示例#10
0
        public void ReplayBattle(string battleId, BattleParticipant defender, string sharerPlayerId)
        {
            ProcessingScreen.Show();
            ReplayMapDataLoader replayMapDataLoader = Service.Get <ReplayMapDataLoader>();

            replayMapDataLoader.Initialize(defender, sharerPlayerId);
            GetReplayCommand getReplayCommand = new GetReplayCommand(Service.Get <CurrentPlayer>().PlayerId, battleId, defender.PlayerId);

            getReplayCommand.AddSuccessCallback(new AbstractCommand <GetReplayRequest, GetReplayResponse> .OnSuccessCallback(replayMapDataLoader.OnReplayLoaded));
            getReplayCommand.AddFailureCallback(new AbstractCommand <GetReplayRequest, GetReplayResponse> .OnFailureCallback(replayMapDataLoader.OnReplayLoadFailed));
            Service.Get <ServerAPI>().Sync(getReplayCommand);
            Service.Get <BattlePlaybackController>().LogReplayViewed(battleId, defender.PlayerId, sharerPlayerId);
        }
示例#11
0
        private void OnAlertDemoteMemberResult(object result, object cookie)
        {
            if (result == null)
            {
                return;
            }
            SquadMember     squadMember     = cookie as SquadMember;
            SquadMsg        message         = SquadMsgUtils.CreateDemoteMemberMessage(squadMember.MemberID, new SquadController.ActionCallback(this.OnMemberChangeComplete), squadMember);
            SquadController squadController = Service.SquadController;

            squadController.TakeAction(message);
            ProcessingScreen.Show();
        }
示例#12
0
 public void Login(OnAllDataFetchedDelegate callback)
 {
     if (this.HaveAllData)
     {
         callback();
         return;
     }
     this.allDataFetchedCallbacks.Add(callback);
     ProcessingScreen.Show();
     FacebookManager.OnFacebookLoggedIn    = new FacebookLoggedInDelegate(this.OnFacebookLogin);
     FacebookManager.OnFacebookLogInFailed = new FacebookLogInFailedDelegate(this.OnFacebookLoginFailed);
     FacebookManager.Login();
     Service.BILoggingController.TrackAuthorization("allow", "f");
 }
示例#13
0
        public void ShowRewardedVideoAd()
        {
            if (!this.IsMobileConnectorAdAvailable())
            {
                Service.Logger.Warn("Not Available Yet");
                return;
            }
            ProcessingScreen.Show();
            this.HandleBackgrounding();
            string videoAdUnitId = this.GetVideoAdUnitId();

            this.BILogEvent("video_ad", "start", videoAdUnitId);
            MCAdsBinding.ShowRewardedVideo(videoAdUnitId);
        }
示例#14
0
 public void SetupChatDisplay()
 {
     if (!this.ChatDisplaySetup)
     {
         this.ChatDisplaySetup = true;
         if (Service.Get <SquadController>().MsgManager.GetExistingMessages().Count > 0)
         {
             ProcessingScreen.Show();
             this.numExistingMsgsProcessed = 0;
             this.existingMsgsProcessed    = new HashSet <SquadMsg>();
             this.SetupChatDisplayFrameDelayed();
         }
     }
 }
示例#15
0
        public void JoinSquad(string biSource)
        {
            if (this.squad == null)
            {
                return;
            }
            Lang lang = Service.Lang;

            this.biSource = biSource;
            Squad squad = Service.CurrentPlayer.Squad;

            if (!this.button.VisuallyDisabled)
            {
                this.button.Enabled = false;
                Service.EventManager.SendEvent(EventId.SquadNext, null);
                if (this.squad.InviteType == 1)
                {
                    if (squad == null)
                    {
                        ProcessingScreen.Show();
                        this.ActualJoinSquad();
                    }
                    else if (!SquadUtils.CanLeaveSquad())
                    {
                        string message = Service.Lang.Get("IN_WAR_CANT_LEAVE_SQUAD", new object[0]);
                        AlertScreen.ShowModal(false, null, message, null, null, true);
                    }
                    else
                    {
                        YesNoScreen.ShowModal(lang.Get("ALERT", new object[0]), lang.Get("JOIN_LEAVE_SQUAD_ALERT", new object[]
                        {
                            squad.SquadName,
                            this.squad.SquadName
                        }), false, lang.Get("JOIN_CTA", new object[0]), lang.Get("ACCOUNT_CONFLICT_CONFIRM_CANCEL", new object[0]), new OnScreenModalResult(this.OnLeaveAndJoinSquad), this.squad);
                        Service.EventManager.SendEvent(EventId.UISquadLeaveConfirmation, squad.SquadID + "|join|" + this.squad.SquadID);
                    }
                }
                else
                {
                    Service.ScreenController.AddScreen(new SquadJoinRequestScreen(this.squad, new SquadController.ActionCallback(this.OnApplyToSquadComplete), this.button));
                }
            }
            else
            {
                string msg;
                SquadUtils.CanCurrentPlayerJoinSquad(Service.CurrentPlayer, Service.SquadController.StateManager.GetCurrentSquad(), this.squad, Service.Lang, out msg);
                this.ShowInfoText(msg);
            }
        }
示例#16
0
        public void VisitNeighbor(string neighborId)
        {
            if (this.processing)
            {
                return;
            }
            this.processing = true;
            ProcessingScreen.Show();
            VisitNeighborRequest request = new VisitNeighborRequest(neighborId);
            VisitNeighborCommand visitNeighborCommand = new VisitNeighborCommand(request);

            visitNeighborCommand.AddSuccessCallback(new AbstractCommand <VisitNeighborRequest, VisitNeighborResponse> .OnSuccessCallback(this.OnVisitNeighborSuccess));
            visitNeighborCommand.AddFailureCallback(new AbstractCommand <VisitNeighborRequest, VisitNeighborResponse> .OnFailureCallback(this.OnVisitNeighborFailure));
            Service.Get <ServerAPI>().Sync(visitNeighborCommand);
        }
示例#17
0
 private void LoadSquads()
 {
     if (!Service.Get <LeaderboardController>().ShouldRefreshData(PlayerListType.Squads, null))
     {
         if (this.gridLoadHelper.IsAddedItems || this.gridLoadHelper.IsBusyAddingItems)
         {
             base.ResetGrid();
         }
         this.AddItemsToLeaderboardGrid();
         return;
     }
     base.ResetGrid();
     ProcessingScreen.Show();
     Service.Get <LeaderboardController>().UpdateTopSquads(new LeaderboardController.OnUpdateData(this.OnGetLBSquads));
 }
示例#18
0
        private void LoadSquadInvites()
        {
            base.ResetGrid();
            List <SquadInvite> squadInvites = Service.SquadController.StateManager.SquadInvites;

            if (squadInvites != null && this.squadIdsRequiringDetails.Count == 0)
            {
                base.AddItemsToGrid <SquadInvite>(squadInvites, true, false);
            }
            else
            {
                ProcessingScreen.Show();
            }
            UXUtils.SetSpriteTopAnchorPoint(this.scrollUp, -4);
        }
        public void BuyTargetedOfferWithCurrency()
        {
            if (this.CurrentTargetedOffer == null)
            {
                Service.Get <StaRTSLogger>().Warn("No offer available to purchase.");
                return;
            }
            GameUtils.SpendCurrency(this.CurrentTargetedOffer.Cost, true);
            this.GrantTargetedBundleRewards(this.CurrentTargetedOffer);
            ProcessingScreen.Show();
            BuyTargetedOfferRequest request = new BuyTargetedOfferRequest(this.CurrentTargetedOffer.Uid);
            BuyTargetedOfferCommand buyTargetedOfferCommand = new BuyTargetedOfferCommand(request);

            buyTargetedOfferCommand.AddSuccessCallback(new AbstractCommand <BuyTargetedOfferRequest, BuyTargetedOfferResponse> .OnSuccessCallback(this.OnBuySuccess));
            Service.Get <ServerAPI>().Sync(buyTargetedOfferCommand);
        }
示例#20
0
        private void OnDonateConfirm(UXButton button)
        {
            SquadMsg message;

            if (this.isWarRequest)
            {
                message = SquadMsgUtils.CreateWarDonateMessage(this.recipientId, this.troopsToDonate, this.GetNumberOfTroopsDonated(), this.requestId, new SquadController.ActionCallback(this.OnDonationComplete), null);
            }
            else
            {
                message = SquadMsgUtils.CreateDonateMessage(this.recipientId, this.troopsToDonate, this.GetNumberOfTroopsDonated(), this.requestId, new SquadController.ActionCallback(this.OnDonationComplete), null);
            }
            SquadController squadController = Service.Get <SquadController>();

            squadController.TakeAction(message);
            ProcessingScreen.Show();
        }
示例#21
0
 public void Login(OnAllDataFetchedDelegate callback)
 {
     if (this.HaveAllData)
     {
         callback();
         return;
     }
     if (this.IsLoggedIn)
     {
         return;
     }
     this.allDataFetchedCallbacks.Add(callback);
     ProcessingScreen.Show();
     Service.Get <Engine>().ForceGarbageCollection(null);
     FacebookManager.OnFacebookLoggedIn    = new FacebookDelegate(this.OnFacebookLogin);
     FacebookManager.OnFacebookLogInFailed = new FacebookDelegate(this.OnFacebookLoginFailed);
     FacebookManager.Instance.Login();
     Service.Get <BILoggingController>().TrackAuthorization("allow", "f");
 }
示例#22
0
        private void LoadLeaders()
        {
            PlanetVO selectedPlanet = this.planetSelectionDropDown.GetSelectedPlanet();
            string   planetId       = (selectedPlanet == null) ? null : selectedPlanet.Uid;

            ProcessingScreen.Show();
            if (!Service.Get <LeaderboardController>().ShouldRefreshData(PlayerListType.Leaders, planetId))
            {
                if (this.gridLoadHelper.IsAddedItems || this.gridLoadHelper.IsBusyAddingItems)
                {
                    base.ResetGrid();
                }
                LeaderboardList <PlayerLBEntity> leaderboardList = this.GetLeaderboardList();
                base.OnPlayersListLoaded((leaderboardList != null) ? leaderboardList.List : null, new Action(this.PopulatePlayersOnGrid));
                return;
            }
            base.ResetGrid();
            Service.Get <LeaderboardController>().UpdateLeaders(selectedPlanet, new LeaderboardController.OnUpdateData(this.OnGetLBPlayers));
        }
示例#23
0
        private void OnInviteToSquadClicked(UXButton button)
        {
            this.secondaryButton.Enabled = false;
            string fbFriendId    = null;
            string fbAccessToken = null;
            Dictionary <string, SocialFriendData> playerIdToFriendData = Service.ISocialDataController.PlayerIdToFriendData;
            SocialFriendData socialFriendData = null;

            if (playerIdToFriendData != null && playerIdToFriendData.TryGetValue(this.player.PlayerID, out socialFriendData))
            {
                fbFriendId    = socialFriendData.Id;
                fbAccessToken = AccessToken.CurrentAccessToken.TokenString;
            }
            SquadMsg message = SquadMsgUtils.CreateSendInviteMessage(this.player.PlayerID, fbFriendId, fbAccessToken, new SquadController.ActionCallback(this.OnInviteToSquadComplete), null);

            Service.SquadController.TakeAction(message);
            Service.EventManager.SendEvent(EventId.SquadNext, null);
            ProcessingScreen.Show();
        }
示例#24
0
        public void LoadTournamentLeaders()
        {
            PlanetVO selectedPlanet = this.planetSelectionDropDown.GetSelectedPlanet();
            string   text           = (selectedPlanet == null) ? null : selectedPlanet.Uid;

            if (string.IsNullOrEmpty(text))
            {
                return;
            }
            if (!Service.Get <LeaderboardController>().ShouldRefreshData(PlayerListType.TournamentLeaders, text))
            {
                if (this.gridLoadHelper.IsAddedItems || this.gridLoadHelper.IsBusyAddingItems)
                {
                    base.ResetGrid();
                }
                this.AddItemsToLeaderboardGrid();
                return;
            }
            base.ResetGrid();
            ProcessingScreen.Show();
            Service.Get <LeaderboardController>().UpdateTournamentLeaders(selectedPlanet, new LeaderboardController.OnUpdateData(this.OnGetLBTournament));
        }