Esempio n. 1
0
 private void OnSquadDetailsUpdated(Squad squad, bool success)
 {
     ProcessingScreen.Hide();
     if (this.IsClosedOrClosing())
     {
         return;
     }
     if (success)
     {
         if (squad != null)
         {
             string detailsString;
             bool   showRequestButton = SquadUtils.CanCurrentPlayerJoinSquad(Service.CurrentPlayer, Service.SquadController.StateManager.GetCurrentSquad(), squad, Service.Lang, out detailsString);
             this.DisplaySquadInfoView(squad, showRequestButton, detailsString);
         }
         else
         {
             success = false;
         }
     }
     else
     {
         string message = this.lang.Get("GENERIC_SQUAD_INFO_ISSUE", new object[0]);
         AlertScreen.ShowModal(false, null, message, null, null);
     }
 }
Esempio n. 2
0
        private void InitFullView()
        {
            Lang   lang = Service.Lang;
            string text;

            if (!SquadUtils.CanCurrentPlayerJoinSquad(Service.CurrentPlayer, Service.SquadController.StateManager.GetCurrentSquad(), this.squad, lang, out text))
            {
                this.primaryButton.VisuallyDisableButton();
            }
            else if (this.squad.InviteType == 0 && Service.SquadController.StateManager.SquadJoinRequestsPending.Contains(this.squad.SquadID))
            {
                this.primaryButton.Enabled = false;
            }
            this.primaryButton.OnClicked = new UXButtonClickedDelegate(this.OnJoinClicked);
            this.joinModule = new SquadJoinActionModule(this.squad, this.screen, this.primaryButton);
            this.secondaryButton.OnClicked = new UXButtonClickedDelegate(this.screen.ViewSquadInfoClicked);
            this.secondaryButton.Tag       = this.squad.SquadID;
            this.secondaryButton.Visible   = true;
            this.secondaryButtonLabel.Text = lang.Get("context_Info", new object[0]);
            if (this.squad.InviteType == 1)
            {
                this.primaryButtonLabel.Text = lang.Get("JOIN", new object[0]);
                this.typeLabel.Text          = lang.Get("SQUAD_OPEN_TO_ALL", new object[0]);
            }
            else
            {
                this.primaryButtonLabel.Text = lang.Get("APPLY", new object[0]);
                this.typeLabel.Text          = lang.Get("SQUAD_INVITE_ONLY", new object[0]);
            }
            this.playerFactionSprite.Visible = false;
            this.memberNumberLabel.Text      = lang.Get("SQUAD_MEMBERS", new object[0]) + " " + lang.Get("FRACTION", new object[]
            {
                this.squad.MemberCount,
                this.squad.MemberMax
            });
            this.activeMemberNumberLabel.Text = lang.Get("SQUAD_ACTIVE_MEMBERS", new object[0]) + " " + lang.Get("FRACTION", new object[]
            {
                this.squad.ActiveMemberCount,
                this.squad.MemberMax
            });
            this.squadLevelGroup.Visible = true;
            this.squadLevelLabel.Text    = this.squad.Level.ToString();
            this.friendTexture.Visible   = false;
            this.planetLabel.Visible     = false;
            this.planetBgTexture.Visible = false;
            Squad currentSquad = Service.SquadController.StateManager.GetCurrentSquad();

            base.ToggleHighlight(currentSquad != null && currentSquad.SquadID == this.squad.SquadID);
        }
Esempio n. 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);
            }
        }