Ejemplo n.º 1
0
        private UXElement CreateUXElementFromGridItem(object itemObject, object cookie, int position)
        {
            GridDataCookie             gridDataCookie             = (GridDataCookie)cookie;
            SocialTabs                 selectedTab                = gridDataCookie.SelectedTab;
            FactionToggle              selectedFaction            = gridDataCookie.SelectedFaction;
            string                     selectedPlanet             = gridDataCookie.SelectedPlanet;
            AbstractLeaderboardRowView abstractLeaderboardRowView = null;

            if (itemObject is PlayerLBEntity)
            {
                abstractLeaderboardRowView = this.AddPlayerRow((PlayerLBEntity)itemObject, selectedTab, selectedFaction, selectedPlanet, position);
            }
            else if (itemObject is Squad)
            {
                abstractLeaderboardRowView = this.AddSquadRow((Squad)itemObject, selectedTab, selectedFaction, position);
            }
            else if (itemObject is SquadInvite)
            {
                abstractLeaderboardRowView = this.AddSquadInviteRow((SquadInvite)itemObject, selectedTab, selectedFaction, position);
            }
            UXElement result = null;

            if (abstractLeaderboardRowView != null)
            {
                result = abstractLeaderboardRowView.GetItem();
                this.rowViews.Add(abstractLeaderboardRowView);
            }
            return(result);
        }
Ejemplo n.º 2
0
 public GridDataCookie(SocialTabs socialTab, FactionToggle factionToggle, string selectedPlanet)
 {
     this = default(GridDataCookie);
     this.SelectedFaction = factionToggle;
     this.SelectedTab     = socialTab;
     this.SelectedPlanet  = selectedPlanet;
 }
        public void Init(FactionToggle factionToggle)
        {
            this.filterOptions      = this.uxFactory.GetElement <UXElement>("FilterOptions");
            this.filterBtn          = this.uxFactory.GetElement <UXButton>("BtnFilter");
            this.filterBtnLabel     = this.uxFactory.GetElement <UXLabel>("LabelBtnFilter");
            this.filterSprite       = this.uxFactory.GetElement <UXSprite>("SpriteBtnFilterSymbol");
            this.empireBtn          = this.uxFactory.GetElement <UXCheckbox>("BtnEmpire");
            this.empireBtnLabel     = this.uxFactory.GetElement <UXLabel>("LabelBtnEmpire");
            this.empireBtn.Selected = false;
            this.rebelBtn           = this.uxFactory.GetElement <UXCheckbox>("BtnRebel");
            this.rebelBtnLabel      = this.uxFactory.GetElement <UXLabel>("LabelBtnRebel");
            this.rebelBtn.Selected  = false;
            this.bothBtn            = this.uxFactory.GetElement <UXCheckbox>("BtnBoth");
            this.bothBtnLabel       = this.uxFactory.GetElement <UXLabel>("LabelBtnBoth");
            this.bothBtn.Selected   = true;
            Lang lang = Service.Get <Lang>();

            this.empireBtnLabel.Text  = lang.Get("s_Empire", new object[0]);
            this.rebelBtnLabel.Text   = lang.Get("s_Rebel", new object[0]);
            this.bothBtnLabel.Text    = lang.Get("s_Both", new object[0]);
            this.filterBtn.OnClicked  = new UXButtonClickedDelegate(this.FilterButtonClicked);
            this.empireBtn.OnSelected = new UXCheckboxSelectedDelegate(this.EmpireTabClicked);
            this.rebelBtn.OnSelected  = new UXCheckboxSelectedDelegate(this.RebelTabClicked);
            this.bothBtn.OnSelected   = new UXCheckboxSelectedDelegate(this.BothTabClicked);
            this.SelectFaction(factionToggle, false);
        }
        private void SelectFaction(FactionToggle faction, bool doCallBack)
        {
            this.selectedFaction = faction;
            UXLabel  uXLabel;
            UXSprite element;

            switch (faction)
            {
            case FactionToggle.Empire:
                uXLabel = this.empireBtnLabel;
                element = this.uxFactory.GetElement <UXSprite>("SpriteBtnEmpireSymbol");
                goto IL_67;

            case FactionToggle.Rebel:
                uXLabel = this.rebelBtnLabel;
                element = this.uxFactory.GetElement <UXSprite>("SpriteBtnRebelSymbol");
                goto IL_67;
            }
            uXLabel = this.bothBtnLabel;
            element = this.uxFactory.GetElement <UXSprite>("SpriteBtnBothSymbol");
IL_67:
            this.filterBtnLabel.Text     = uXLabel.Text;
            this.filterSprite.SpriteName = element.SpriteName;
            this.filterSprite.Color      = element.Color;
            this.ShowHideFilterOptions(false);
            if (doCallBack && this.FactionSelectCallBack != null)
            {
                this.FactionSelectCallBack.Invoke(faction);
            }
        }
Ejemplo n.º 5
0
 protected void FactionChanged(FactionToggle faction)
 {
     if (!this.Visible)
     {
         return;
     }
     Service.Get <EventManager>().SendEvent(EventId.SquadSelect, null);
     this.ReloadCurrentTab();
     this.LogLeaderboardFactionUpdate();
 }
Ejemplo n.º 6
0
 public AbstractLeaderboardRowView(AbstractLeaderboardScreen screen, UXGrid grid, UXElement templateItem, SocialTabs tab, FactionToggle faction, int position, bool initAllElements)
 {
     this.screen       = screen;
     this.grid         = grid;
     this.templateItem = templateItem;
     this.tab          = tab;
     this.faction      = faction;
     this.position     = position;
     this.CreateItem();
     if (initAllElements)
     {
         this.InitElements();
     }
 }
Ejemplo n.º 7
0
        private AbstractLeaderboardRowView AddSquadRow(Squad squad, SocialTabs tab, FactionToggle faction, int position)
        {
            if (squad == null)
            {
                return(null);
            }
            if (!this.IsFactionToggleValidFactionType(faction, squad.Faction) || position >= 51)
            {
                return(null);
            }
            Squad currentSquad = Service.SquadController.StateManager.GetCurrentSquad();

            if (currentSquad != null && currentSquad.SquadID == squad.SquadID)
            {
                this.currentPlayerTileIndex = position;
            }
            return(new LeaderboardRowSquadView(this, this.gridLoadHelper.GetGrid(), this.itemTemplate, tab, faction, position, squad));
        }
Ejemplo n.º 8
0
        public bool EnableFindMeButton()
        {
            bool flag = Service.Get <SquadController>().StateManager.GetCurrentSquad() != null;

            if (!this.top50Button.Enabled && this.curTab == SocialTabs.Squads && !flag)
            {
                return(false);
            }
            string selectedPlanetId = this.GetSelectedPlanetId();

            if (!this.top50Button.Enabled && selectedPlanetId != null && selectedPlanetId != Service.Get <CurrentPlayer>().PlanetId&& this.curTab == SocialTabs.Leaders)
            {
                return(false);
            }
            FactionToggle selectedFaction = this.GetSelectedFaction();
            FactionType   faction         = Service.Get <CurrentPlayer>().Faction;

            return(!this.top50Button.Enabled && (selectedFaction == FactionToggle.All || (faction == FactionType.Empire && selectedFaction == FactionToggle.Empire) || (faction == FactionType.Rebel && selectedFaction == FactionToggle.Rebel)));
        }
Ejemplo n.º 9
0
 public LeaderboardRowSquadInviteView(AbstractLeaderboardScreen screen, UXGrid grid, UXElement templateItem, SocialTabs tab, FactionToggle faction, int position, SquadInvite invite, Squad squad) : base(screen, grid, templateItem, tab, faction, position, squad)
 {
     this.invite = invite;
     base.InitBaseView();
     this.InitFullView();
 }
Ejemplo n.º 10
0
 private bool IsFactionToggleValidFactionType(FactionToggle selectedFaction, FactionType faction)
 {
     return(selectedFaction == FactionToggle.All || (faction == FactionType.Empire && selectedFaction == FactionToggle.Empire) || (faction == FactionType.Rebel && selectedFaction == FactionToggle.Rebel));
 }
Ejemplo n.º 11
0
        private AbstractLeaderboardRowView AddSquadInviteRow(SquadInvite invite, SocialTabs tab, FactionToggle faction, int position)
        {
            if (invite == null || string.IsNullOrEmpty(invite.SquadId))
            {
                return(null);
            }
            Squad orCreateSquad = Service.LeaderboardController.GetOrCreateSquad(invite.SquadId);

            if (!this.IsFactionToggleValidFactionType(faction, orCreateSquad.Faction) || position >= 51)
            {
                return(null);
            }
            return(new LeaderboardRowSquadInviteView(this, this.gridLoadHelper.GetGrid(), this.itemTemplate, tab, faction, position, invite, orCreateSquad));
        }
Ejemplo n.º 12
0
 private AbstractLeaderboardRowView AddPlayerRow(PlayerLBEntity player, SocialTabs tab, FactionToggle faction, string planetUid, int position)
 {
     if (player == null || string.IsNullOrEmpty(player.PlayerName))
     {
         return(null);
     }
     if (!this.IsFactionToggleValidFactionType(faction, player.Faction) || position >= 51)
     {
         return(null);
     }
     if (player.PlayerID == Service.CurrentPlayer.PlayerId)
     {
         this.currentPlayerTileIndex = position;
     }
     return(new LeaderboardRowPlayerView(this, this.gridLoadHelper.GetGrid(), this.itemTemplate, tab, faction, position, player, planetUid));
 }
Ejemplo n.º 13
0
 public LeaderboardRowPlayerView(AbstractLeaderboardScreen screen, UXGrid grid, UXElement templateItem, SocialTabs tab, FactionToggle faction, int position, PlayerLBEntity player, string planetUid) : base(screen, grid, templateItem, tab, faction, position, true)
 {
     this.player    = player;
     this.planetUid = planetUid;
     this.InitView();
 }
 public void SelectFaction(FactionToggle faction)
 {
     this.SelectFaction(faction, true);
 }