Exemple #1
0
        private void InternalOnLeaveSquadClicked(object cookie)
        {
            Service.EventManager.SendEvent(EventId.SquadEdited, null);
            SquadController    squadController      = Service.SquadController;
            SquadMemberWarData currentMemberWarData = squadController.WarManager.GetCurrentMemberWarData();
            uint serverTime = Service.ServerAPI.ServerTime;
            int  unclaimedSquadWarRewardsCount = SquadUtils.GetUnclaimedSquadWarRewardsCount(currentMemberWarData, serverTime);

            if (!SquadUtils.CanLeaveSquad())
            {
                string message = Service.Lang.Get("IN_WAR_CANT_LEAVE_SQUAD", new object[0]);
                AlertScreen.ShowModal(false, null, message, null, null, true);
                this.screen.ShowSquadSlideButton();
            }
            else if (unclaimedSquadWarRewardsCount > 0)
            {
                YesNoScreen.ShowModal(this.lang.Get("LEAVING_SQUAD_ALERT_WITH_REWARDS_TITLE", new object[0]), this.lang.Get("LEAVING_SQUAD_ALERT_WITH_REWARDS", new object[]
                {
                    unclaimedSquadWarRewardsCount
                }), false, this.lang.Get("LEAVING_SQUAD_CONFIRM", new object[0]), this.lang.Get("ACCOUNT_CONFLICT_CONFIRM_CANCEL", new object[0]), new OnScreenModalResult(this.OnAlertLeaveResult), null);
            }
            else
            {
                YesNoScreen.ShowModal(this.lang.Get("LEAVING_SQUAD_ALERT_TITLE", new object[0]), this.lang.Get("LEAVING_SQUAD_ALERT", new object[0]), false, this.lang.Get("LEAVING_SQUAD_CONFIRM", new object[0]), this.lang.Get("ACCOUNT_CONFLICT_CONFIRM_CANCEL", new object[0]), new OnScreenModalResult(this.OnAlertLeaveResult), null);
            }
        }
Exemple #2
0
 private void OnCreateSquadClicked(UXButton button)
 {
     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
     {
         Service.ScreenController.AddScreen(new SquadCreateScreen(true));
     }
     this.screen.Close(null);
 }
Exemple #3
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);
            }
        }
        private void UpdateSquadRank()
        {
            SquadController squadController = Service.Get <SquadController>();
            Squad           currentSquad    = squadController.StateManager.GetCurrentSquad();

            if (currentSquad == null)
            {
                return;
            }
            this.squadRankLabel.Text        = this.lang.ThousandsSeparated(currentSquad.Rank);
            this.squadHighestRankLabel.Text = this.lang.ThousandsSeparated(currentSquad.HighestRank);
            if (SquadUtils.CanLeaveSquad())
            {
                this.leaveButton.VisuallyEnableButton();
                return;
            }
            this.leaveButton.VisuallyDisableButton();
        }