Beispiel #1
0
        protected override void OnScreenLoaded()
        {
            this.InitButtons();
            UXTexture   element = base.GetElement <UXTexture>("SquadImage");
            FactionType faction = Service.CurrentPlayer.Faction;

            if (faction != FactionType.Empire)
            {
                if (faction == FactionType.Rebel)
                {
                    element.LoadTexture("SquadIntro_r");
                }
            }
            else
            {
                element.LoadTexture("SquadIntro_e");
            }
            UXLabel element2 = base.GetElement <UXLabel>("LabelTitle");

            element2.Text = this.lang.Get("SQUAD_JOIN_OR_CREATE", new object[0]);
            UXLabel element3 = base.GetElement <UXLabel>("LabelSquadIntro");

            element3.Text = this.lang.Get("SQUAD_INTRO", new object[0]);
            UXLabel element4 = base.GetElement <UXLabel>("LabelCreateSquad");

            element4.Text = this.lang.Get("CREATE_SQUAD", new object[0]);
            UXLabel element5 = base.GetElement <UXLabel>("LabelJoinSquad");

            element5.Text = this.lang.Get("JOIN_A_SQUAD", new object[0]);
        }
Beispiel #2
0
 protected override void OnScreenLoaded()
 {
     base.OnScreenLoaded();
     base.GetElement <UXElement>("InputFieldRequestMessage").Visible    = !this.isWarRequest;
     base.GetElement <UXElement>("InputFieldRequestMessageWar").Visible = this.isWarRequest;
     this.requestNowCostLabel    = base.GetElement <UXLabel>("FinishCostLabel");
     this.requestLabel.Text      = this.lang.Get("REQUEST_TROOPS", new object[0]);
     this.requestPerksLabel.Text = this.requestLabel.Text;
     this.requestLabel.Visible   = true;
     this.troopsPanel.Visible    = true;
     this.troopsLabel.Visible    = true;
     this.troopsLabel.Text       = this.lang.Get("SQUAD_DONATED_TO_USER", new object[0]);
     if (this.isWarRequest)
     {
         this.input = base.GetElement <UXInput>("LabelInputNameSquadWar");
         UIInput uIInputComponent = this.input.GetUIInputComponent();
         UIInput arg_108_0        = uIInputComponent;
         if (SquadTroopRequestScreen.< > f__mg$cache0 == null)
         {
             SquadTroopRequestScreen.< > f__mg$cache0 = new UIInput.OnValidate(LangUtils.OnValidateWNewLines);
         }
         arg_108_0.onValidate = SquadTroopRequestScreen.< > f__mg$cache0;
         UXTexture element = base.GetElement <UXTexture>("TextureWarRequest");
         element.LoadTexture("squadwars_playerdetails_bg");
         Service.EventManager.RegisterObserver(this, EventId.CurrentPlayerMemberDataUpdated);
     }
     this.input.InitText(this.defaultRequestText);
     this.InitTroopGrid();
     this.UpdateRequestState();
 }
        protected override void OnScreenLoaded()
        {
            base.InitAnimator();
            Lang      lang     = Service.Get <Lang>();
            UXLabel   element  = base.GetElement <UXLabel>("LabelTitlePrimarySquadWarEndCeleb");
            UXLabel   element2 = base.GetElement <UXLabel>("LabelTitleSecondarySquadWarEndCeleb");
            UXLabel   element3 = base.GetElement <UXLabel>("LabelRewardSquadWarEndCeleb");
            UXLabel   element4 = base.GetElement <UXLabel>("LabelCollectSquadWarEndCeleb");
            UXTexture element5 = base.GetElement <UXTexture>("TextureFactionIconSquadWarEndCeleb");

            element.Text = lang.Get("WAR_END_RESULTS_TITLE", new object[0]);
            element5.LoadTexture((this.playerFaction == FactionType.Empire) ? "squadwars_end_celeb_empire" : "squadwars_end_celeb_rebel");
            string id = "sfx_stinger_war_end_draw";

            if (this.squadWarResult == 1)
            {
                id            = ((this.playerFaction == FactionType.Empire) ? "sfx_stinger_war_end_win_empire" : "sfx_stinger_war_end_win_rebel");
                element2.Text = lang.Get((this.playerFaction == FactionType.Empire) ? "WAR_END_RESULTS_EMPIRE_WIN" : "WAR_END_RESULTS_REBELS_WIN", new object[]
                {
                    this.playerSquadName
                });
                element3.Visible = false;
                element4.Text    = lang.Get("WAR_END_RESULTS_WIN_CTA", new object[0]);
                this.ResetAllTriggers();
                this.animator.SetTrigger((this.playerFaction == FactionType.Empire) ? "ShowWinEmpire" : "ShowWinRebel");
            }
            else if (this.squadWarResult == -1)
            {
                id            = "sfx_stinger_war_end_loss";
                element2.Text = lang.Get((this.playerFaction == FactionType.Empire) ? "WAR_END_RESULTS_EMPIRE_LOSS" : "WAR_END_RESULTS_REBELS_LOSS", new object[0]);
                element3.Text = lang.Get("WAR_END_RESULTS_LOSS_REWARD", new object[0]);
                element4.Text = lang.Get("WAR_END_RESULTS_LOSS_CTA", new object[0]);
                this.ResetAllTriggers();
                this.animator.SetTrigger("ShowLoss");
            }
            else if (this.squadWarResult == 0)
            {
                element2.Text = lang.Get("WAR_END_RESULTS_DRAW", new object[0]);
                element3.Text = lang.Get("WAR_END_RESULTS_DRAW_REWARD", new object[0]);
                element4.Text = lang.Get("WAR_END_RESULTS_DRAW_CTA", new object[0]);
                base.GetElement <UXTexture>("TextureDrawIconEmpireSquadWarEndCeleb").LoadTexture("squadwars_end_celeb_empire");
                base.GetElement <UXTexture>("TextureDrawIconRebelSquadWarEndCeleb").LoadTexture("squadwars_end_celeb_rebel");
                this.ResetAllTriggers();
                if (this.sameFaction)
                {
                    this.animator.SetTrigger("ShowDrawSF");
                }
                else
                {
                    this.animator.SetTrigger("ShowDraw");
                }
            }
            Service.Get <AudioManager>().PlayAudio(id);
            UXButton element6 = base.GetElement <UXButton>("BtnCollectSquadWarEndCeleb");

            element6.OnClicked       = new UXButtonClickedDelegate(this.OnCollectButtonClicked);
            base.CurrentBackDelegate = new UXButtonClickedDelegate(this.OnCollectButtonClicked);
            base.CurrentBackButton   = element6;
        }
Beispiel #4
0
        private void SetupCategory(string labelName, string stringUid, string textureName, string textureUid, int[] epList)
        {
            object[] args = Array.ConvertAll <int, object>(epList, (int item) => item);
            base.GetElement <UXLabel>(labelName).Text = this.lang.Get(stringUid, args);
            TextureVO optional = Service.StaticDataController.GetOptional <TextureVO>(textureUid);
            UXTexture element  = base.GetElement <UXTexture>(textureName);

            element.LoadTexture(optional.AssetName);
        }
Beispiel #5
0
        private void SetupTargetedOfferElements()
        {
            IDataController dataController = Service.Get <IDataController>();

            this.characterSprite1 = base.GetElement <UXSprite>("SpriteCharacter1");
            this.characterSprite2 = base.GetElement <UXSprite>("SpriteCharacter2");
            TextureVO optional = dataController.GetOptional <TextureVO>("gui_textures_promotional");

            if (optional != null)
            {
                UXTexture element = base.GetElement <UXTexture>("TexturePromoArt");
                element.LoadTexture(optional.AssetName);
            }
            optional = dataController.GetOptional <TextureVO>("targeted_bundle_entry");
            if (optional != null)
            {
                UXTexture element2 = base.GetElement <UXTexture>("TextureEnvironmentEntry");
                element2.LoadTexture(optional.AssetName);
            }
            optional = dataController.GetOptional <TextureVO>("targeted_bundle_treads");
            if (optional != null)
            {
                UXTexture element3 = base.GetElement <UXTexture>("TextureEnvironmentRight");
                element3.LoadTexture(optional.AssetName);
            }
            optional = dataController.GetOptional <TextureVO>("targeted_bundle_treads");
            if (optional != null)
            {
                UXTexture element4 = base.GetElement <UXTexture>("TextureEnvironmentLeft");
                element4.LoadTexture(optional.AssetName);
            }
            optional = dataController.GetOptional <TextureVO>("targeted_bundle_dust");
            if (optional != null)
            {
                UXTexture element5 = base.GetElement <UXTexture>("TextureEnvironmentDustRight");
                element5.LoadTexture(optional.AssetName);
                element5 = base.GetElement <UXTexture>("TextureEnvironmentDustLeft");
                element5.LoadTexture(optional.AssetName);
            }
            UXUtils.SetupAnimatedCharacter(this.characterSprite1, this.CurrentOffer.Character1Image, ref this.charGeometry1);
            UXUtils.SetupAnimatedCharacter(this.characterSprite2, this.CurrentOffer.Character2Image, ref this.charGeometry2);
        }
Beispiel #6
0
        private void HideStickerVisuals(StoreTab tab)
        {
            string    text            = string.Format("Texture{0}Icon", tab.ToString());
            string    name            = string.Format("Widget{0}Special", tab.ToString());
            string    text2           = string.Format("SpriteBannerGradient{0}Special", tab.ToString());
            string    text3           = string.Format("SpriteBanner{0}Special", tab.ToString());
            string    text4           = string.Format("LabelSee{0}Deals", tab.ToString());
            string    text5           = string.Format("SpriteSee{0}DealsStroke", tab.ToString());
            string    text6           = string.Format("SpriteSee{0}DealsIcon", tab.ToString());
            string    text7           = string.Format("SpriteBkgStrokeTab{0}", tab.ToString());
            string    text8           = string.Format("SpriteBkgDetailRightTab{0}", tab.ToString());
            string    text9           = string.Format("SpriteBkgDetailLeftTab{0}", tab.ToString());
            string    text10          = string.Format("SpriteBkgInnerGlowTab{0}", tab.ToString());
            UXTexture optionalElement = this.parentStoreScreen.GetOptionalElement <UXTexture>(text);

            if (optionalElement != null && this.orginalTextureNames.ContainsKey(text))
            {
                optionalElement.LoadTexture(this.orginalTextureNames[text]);
            }
            UXElement optionalElement2 = this.parentStoreScreen.GetOptionalElement <UXElement>(name);

            if (optionalElement2 != null)
            {
                optionalElement2.Visible = false;
            }
            UXSprite optionalElement3 = this.parentStoreScreen.GetOptionalElement <UXSprite>(text2);

            this.RestoreOriginalSpriteColor(text2, optionalElement3);
            UXSprite optionalElement4 = this.parentStoreScreen.GetOptionalElement <UXSprite>(text3);

            this.RestoreOriginalSpriteColor(text3, optionalElement4);
            UXLabel optionalElement5 = this.parentStoreScreen.GetOptionalElement <UXLabel>(text4);

            this.RestoreOriginalLabelColor(text4, optionalElement5);
            UXSprite optionalElement6 = this.parentStoreScreen.GetOptionalElement <UXSprite>(text5);

            this.RestoreOriginalSpriteColor(text5, optionalElement6);
            UXSprite optionalElement7 = this.parentStoreScreen.GetOptionalElement <UXSprite>(text6);

            this.RestoreOriginalSpriteColor(text6, optionalElement7);
            UXSprite optionalElement8 = this.parentStoreScreen.GetOptionalElement <UXSprite>(text7);

            this.RestoreOriginalSpriteColor(text7, optionalElement8);
            UXSprite optionalElement9 = this.parentStoreScreen.GetOptionalElement <UXSprite>(text8);

            this.RestoreOriginalSpriteColor(text8, optionalElement9);
            UXSprite optionalElement10 = this.parentStoreScreen.GetOptionalElement <UXSprite>(text9);

            this.RestoreOriginalSpriteColor(text9, optionalElement10);
            UXSprite optionalElement11 = this.parentStoreScreen.GetOptionalElement <UXSprite>(text10);

            this.RestoreOriginalSpriteColor(text10, optionalElement11);
        }
Beispiel #7
0
        private void InitPlanetUI()
        {
            UXLabel   element  = base.GetElement <UXLabel>("LabelPlanetNameCrate");
            UXTexture element2 = base.GetElement <UXTexture>("TexturePlanetBgCrateInfo");

            if (this.planetVO != null)
            {
                element.Text = LangUtils.GetPlanetDisplayName(this.planetVO.Uid);
                element2.LoadTexture(this.planetVO.LeaderboardTileTexture);
                return;
            }
            element.Visible  = false;
            element2.Visible = false;
        }
Beispiel #8
0
 private void LoadTexture(UXTexture texture, string textureID)
 {
     if (!string.IsNullOrEmpty(textureID))
     {
         texture.Visible = true;
         TextureVO optional = Service.StaticDataController.GetOptional <TextureVO>(textureID);
         if (optional != null)
         {
             texture.LoadTexture(optional.AssetName);
         }
     }
     else
     {
         texture.MainTexture = null;
         texture.Visible     = false;
     }
 }
Beispiel #9
0
        protected void InitPlanetSlots()
        {
            this.selectPlanetGrid = base.GetElement <UXGrid>("SelectPlanetGrid");
            UXElement element = base.GetElement <UXElement>("SelectPlanetTemplate");

            element.Visible = true;
            this.selectPlanetGrid.SetTemplateItem("SelectPlanetCard");
            element.Visible = false;
            this.unlockablePlanetList.Clear();
            CurrentPlayer currentPlayer = Service.CurrentPlayer;

            foreach (PlanetVO current in Service.StaticDataController.GetAll <PlanetVO>())
            {
                if (current.PlayerFacing && !currentPlayer.UnlockedPlanets.Contains(current.Uid) && currentPlayer.Map.Planet.Uid != current.Uid)
                {
                    UXCheckbox uXCheckbox = (UXCheckbox)this.selectPlanetGrid.CloneTemplateItem(current.Uid);
                    UXLabel    subElement = this.selectPlanetGrid.GetSubElement <UXLabel>(current.Uid, "LabelSelectPlanetName");
                    if (!this.reqMet && !this.tutorialMode)
                    {
                        uXCheckbox.RadioGroup = 0;
                        uXCheckbox.SetSelectable(false);
                        uXCheckbox.Selected = false;
                    }
                    uXCheckbox.OnSelected = new UXCheckboxSelectedDelegate(this.PlanetSelected);
                    UXTexture subElement2 = this.selectPlanetGrid.GetSubElement <UXTexture>(current.Uid, "SpriteSelectPlanetImagePlanet");
                    subElement2.LoadTexture("PlanetEnvIcon-" + current.Abbreviation);
                    subElement.Text       = LangUtils.GetPlanetDisplayName(current);
                    uXCheckbox.Tag        = current;
                    uXCheckbox.RadioGroup = 0;
                    uXCheckbox.DelayedSelect(false);
                    this.selectPlanetGrid.AddItem(uXCheckbox, current.Order);
                    this.unlockablePlanetList.Add(uXCheckbox);
                }
            }
            if (this.unlockablePlanetList.Count == 0)
            {
                base.GetElement <UXElement>("ButtonPrimary").Visible = false;
                base.GetElement <UXElement>("BtnInstantBuy").Visible = false;
                this.buttonTutorialConfirm.Visible = false;
            }
            this.selectPlanetGrid.RepositionItems();
            this.selectPlanetGrid.IsScrollable = true;
            this.selectPlanetGrid.ScrollToItem(0);
        }
        private void AddPlanetButton(PlanetVO planet, bool createdForTournament, bool setSelected)
        {
            string     uid        = planet.Uid;
            UXCheckbox uXCheckbox = (UXCheckbox)this.planetGrid.CloneTemplateItem(uid);

            uXCheckbox.OnSelected = new UXCheckboxSelectedDelegate(this.NewPlanetOptionClicked);
            uXCheckbox.Tag        = planet;
            uXCheckbox.Selected   = setSelected;
            UXLabel subElement = this.planetGrid.GetSubElement <UXLabel>(uid, "LabelBtnPlanet");

            subElement.Text = LangUtils.GetPlanetDisplayName(planet);
            UXSprite subElement2 = this.planetGrid.GetSubElement <UXSprite>(uid, "SpriteBtnPlanetSymbol");

            subElement2.Visible = false;
            UXTexture subElement3 = this.planetGrid.GetSubElement <UXTexture>(uid, "TextureBtnPlanetSymbol");

            subElement3.LoadTexture(planet.LeaderboardButtonTexture);
            this.planetGrid.AddItem(uXCheckbox, planet.Order);
        }
        protected void PopulateGrid(string[] rawSplit, string gridName, string itemName, string itemTextureName, string itemTitleName, string itemBodyName)
        {
            UXGrid element = this.parent.GetElement <UXGrid>(gridName);

            element.SetTemplateItem(itemName);
            int i   = 1;
            int num = rawSplit.Length;

            while (i < num)
            {
                string    itemUid = i.ToString();
                UXElement item    = element.CloneTemplateItem(itemUid);
                element.AddItem(item, i - 1);
                string[] array = rawSplit[i].Split(new char[]
                {
                    ','
                });
                UXTexture subElement = element.GetSubElement <UXTexture>(itemUid, itemTextureName);
                TextureVO optional   = Service.Get <IDataController>().GetOptional <TextureVO>(array[0]);
                if (optional == null)
                {
                    Service.Get <StaRTSLogger>().WarnFormat("Cannot find texture with uid {0}", new object[]
                    {
                        array[0]
                    });
                }
                else
                {
                    subElement.LoadTexture(optional.AssetName);
                }
                Lang lang = Service.Get <Lang>();
                element.GetSubElement <UXLabel>(itemUid, itemTitleName).Text = lang.Get(array[1], new object[0]);
                element.GetSubElement <UXLabel>(itemUid, itemBodyName).Text  = lang.Get(array[2], new object[0]);
                i++;
            }
            element.RepositionItems();
        }
Beispiel #12
0
        public void SetPerkImage(UXTexture perkImage, PerkVO perkVO)
        {
            FactionType faction = Service.CurrentPlayer.Faction;
            string      text    = string.Empty;

            if (faction == FactionType.Empire)
            {
                text = perkVO.TextureIdEmpire;
            }
            else
            {
                text = perkVO.TextureIdRebel;
            }
            if (!string.IsNullOrEmpty(text))
            {
                StaticDataController staticDataController = Service.StaticDataController;
                TextureVO            optional             = staticDataController.GetOptional <TextureVO>(text);
                if (optional != null && perkImage.Tag != optional)
                {
                    perkImage.LoadTexture(optional.AssetName);
                    perkImage.Tag = optional;
                }
            }
        }
Beispiel #13
0
        private void InitUnlockedPlanets()
        {
            this.planetGrid = base.GetElement <UXGrid>("TopUnlockItemsGrid");
            this.planetGrid.SetTemplateItem("TopUnlockItemsTemplate");
            CurrentPlayer        currentPlayer        = Service.CurrentPlayer;
            PlanetVO             planet               = currentPlayer.Map.Planet;
            StaticDataController staticDataController = Service.StaticDataController;
            int i     = 0;
            int count = currentPlayer.UnlockedPlanets.Count;

            while (i < count)
            {
                string    uid        = currentPlayer.UnlockedPlanets[i];
                PlanetVO  planetVO   = staticDataController.Get <PlanetVO>(uid);
                UXElement item       = this.planetGrid.CloneTemplateItem(planetVO.Uid);
                UXLabel   subElement = this.planetGrid.GetSubElement <UXLabel>(planetVO.Uid, "LabelTopUnlockItemsCurrent");
                if (planetVO.Uid != planet.Uid)
                {
                    subElement.Visible = false;
                }
                else
                {
                    subElement.Text = Service.Lang.Get("s_Current", new object[0]);
                }
                UXTexture subElement2 = this.planetGrid.GetSubElement <UXTexture>(planetVO.Uid, "TextureTopUnlockItemsImage");
                subElement2.LoadTexture("PlanetEnvIcon-" + planetVO.Abbreviation);
                UXSprite subElement3 = this.planetGrid.GetSubElement <UXSprite>(planetVO.Uid, "SpriteTopUnlockItemsLock");
                subElement3.Visible = false;
                UXLabel subElement4 = this.planetGrid.GetSubElement <UXLabel>(planetVO.Uid, "LabelTopUnlockItemsLock");
                subElement4.Visible = false;
                UXLabel subElement5 = this.planetGrid.GetSubElement <UXLabel>(planetVO.Uid, "LabelTopUnlockItemsName");
                subElement5.Text = LangUtils.GetPlanetDisplayName(planetVO);
                this.planetGrid.AddItem(item, i);
                UXButton subElement6 = this.planetGrid.GetSubElement <UXButton>(planetVO.Uid, "TopUnlockItemsCard");
                subElement6.Enabled = false;
                subElement6.VisuallyEnableButton();
                i++;
            }
            if (this.nextBuildingInfo != null)
            {
                for (int j = this.nextBuildingInfo.Lvl; j <= this.maxBuildingInfo.Lvl; j++)
                {
                    string    itemUid     = "NavCenter" + j + "Required";
                    UXElement item2       = this.planetGrid.CloneTemplateItem(itemUid);
                    UXLabel   subElement5 = this.planetGrid.GetSubElement <UXLabel>(itemUid, "LabelTopUnlockItemsName");
                    subElement5.Visible = false;
                    UXLabel subElement = this.planetGrid.GetSubElement <UXLabel>(itemUid, "LabelTopUnlockItemsCurrent");
                    subElement.Visible = false;
                    string text = this.lang.Get("PLANETS_GNC_UPGRADE_REQUIRED", new object[]
                    {
                        j
                    });
                    UXLabel subElement4 = this.planetGrid.GetSubElement <UXLabel>(itemUid, "LabelTopUnlockItemsLock");
                    subElement4.Text = text;
                    this.planetGrid.AddItem(item2, j);
                }
            }
            this.planetGrid.RepositionItems();
            this.planetGrid.IsScrollable = true;
            this.planetGrid.ScrollToItem(0);
        }
Beispiel #14
0
        protected override void OnScreenLoaded()
        {
            SquadController squadController = Service.SquadController;
            bool            flag            = squadController.StateManager.GetCurrentSquad() != null;
            SquadRole       role            = squadController.StateManager.Role;
            bool            flag2           = role == SquadRole.Owner || role == SquadRole.Officer;
            int             highestLevelHQ  = Service.BuildingLookupController.GetHighestLevelHQ();

            this.InitButtons();
            UXLabel element = base.GetElement <UXLabel>("LabelTitle");

            element.Text = this.lang.Get("WAR_START_TITLE", new object[0]);
            string id;
            string id2;

            if (!flag)
            {
                id  = "WAR_START_DESCRIPTION_NOSQUAD";
                id2 = "WAR_START_BUTTON_TEXT_NOSQUAD";
            }
            else if (flag2)
            {
                if (highestLevelHQ >= GameConstants.WAR_PARTICIPANT_MIN_LEVEL)
                {
                    id  = "WAR_START_DESCRIPTION_OFFICER";
                    id2 = "WAR_START_BUTTON_TEXT";
                }
                else
                {
                    id  = "WAR_START_DESCRIPTION_OFFICER_INELIGIBLE";
                    id2 = "WAR_START_BUTTON_TEXT_NONOFFICER";
                }
            }
            else
            {
                this.LogMemberAttemptingWarStart();
                id  = "WAR_START_DESCRIPTION_NONOFFICER";
                id2 = "WAR_START_BUTTON_TEXT_NONOFFICER";
            }
            UXLabel element2 = base.GetElement <UXLabel>("LabelSquadWar");

            element2.Text = this.lang.Get(id, new object[]
            {
                highestLevelHQ
            });
            TextureVO optional = Service.StaticDataController.GetOptional <TextureVO>("gui_textures_squadwar_start");

            if (optional != null)
            {
                UXTexture element3 = base.GetElement <UXTexture>("SpriteNextImage");
                element3.LoadTexture(optional.AssetName);
            }
            UXLabel element4 = base.GetElement <UXLabel>("LabelBtnNext");

            element4.Text = this.lang.Get(id2, new object[0]);
            UXButton element5 = base.GetElement <UXButton>("BtnNext");

            element5.OnClicked = new UXButtonClickedDelegate(this.OnNextButtonClicked);
            UXButton element6 = base.GetElement <UXButton>("BtnInfo");

            element6.OnClicked = new UXButtonClickedDelegate(squadController.WarManager.ShowInfoScreen);
        }
Beispiel #15
0
        public void InitCampaignDetailScreen()
        {
            UXLabel element = this.screen.GetElement <UXLabel>("LabelCampaignDescription");

            element.Text = LangUtils.GetCampaignDescription(this.selectedCampaign);
            this.campaignDescriptionGroup         = this.screen.GetElement <UXElement>("ContainerChapterDescription");
            this.campaignDescriptionGroup.Visible = false;
            UXButton element2 = this.screen.GetElement <UXButton>("BtnChapterInfo");

            element2.OnClicked = new UXButtonClickedDelegate(this.OnCampaignInfoButtonClicked);
            UXLabel element3 = this.screen.GetElement <UXLabel>("LabelCampaigns");

            element3.Text = base.LangController.Get("s_ViewAllChapters", new object[0]);
            UXLabel element4 = this.screen.GetElement <UXLabel>("LabelDetailsTitle");

            element4.Text                 = LangUtils.GetCampaignTitle(this.selectedCampaign);
            this.missionCountdown         = this.screen.GetElement <UXLabel>("Countdown");
            this.missionCountdown.Visible = false;
            UXButton element5 = this.screen.GetElement <UXButton>("BtnViewCampaignRewards");

            element5.Visible                     = false;
            this.campaignDetailsTimeLeft         = this.screen.GetElement <UXElement>("CampaignDetailsTimeLeft");
            this.campaignDetailsTimeLeft.Visible = false;
            int     totalCampaignStarsEarned = base.Player.CampaignProgress.GetTotalCampaignStarsEarned(this.selectedCampaign);
            UXLabel element6 = this.screen.GetElement <UXLabel>("LabelStarsCountDetails");

            element6.Text = base.LangController.Get("LABEL_CAMPAIGN_STARS", new object[]
            {
                totalCampaignStarsEarned,
                this.selectedCampaign.TotalMasteryStars
            });
            UXSprite    element7   = this.screen.GetElement <UXSprite>("SpriteMasteryReward");
            RewardType  rewardType = RewardType.Invalid;
            IGeometryVO config;

            base.RManager.GetFirstRewardAssetName(this.selectedCampaign.Reward, ref rewardType, out config);
            RewardUtils.SetRewardIcon(element7, config, AnimationPreference.NoAnimation);
            int     totalCampaignMissionsCompleted = base.Player.CampaignProgress.GetTotalCampaignMissionsCompleted(this.selectedCampaign);
            UXLabel element8 = this.screen.GetElement <UXLabel>("LabelObjectivesCount");

            element8.Text = base.LangController.Get("LABEL_CAMPAIGN_DETAIL_MISSIONS", new object[]
            {
                totalCampaignMissionsCompleted,
                this.selectedCampaign.TotalMissions
            });
            UXLabel element9 = this.screen.GetElement <UXLabel>("LabelUnlocksDetails");

            if (totalCampaignMissionsCompleted > 0 && totalCampaignMissionsCompleted == this.selectedCampaign.TotalMissions)
            {
                element9.Text = base.RManager.GetRewardString(this.selectedCampaign.Reward);
                if (totalCampaignStarsEarned == this.selectedCampaign.TotalMasteryStars)
                {
                    element9.TextColor = PlanetDetailsMissionViewModule.COMPLETION_COLOR;
                }
            }
            else
            {
                element9.Text = base.RManager.GetRewardString(this.selectedCampaign.Reward);
            }
            UXTexture element10 = this.screen.GetElement <UXTexture>("SpriteCampaignImageLarge");

            element10.LoadTexture(this.selectedCampaign.Uid);
            this.screen.GetElement <UXElement>("MasteryProgress").Visible = true;
            this.screen.GetElement <UXElement>("MasteryReward").Visible   = true;
            this.allChaptersButton.Visible = true;
            this.InitMissionGrid();
        }
Beispiel #16
0
        public DevNotesHolonetTab(HolonetScreen screen, HolonetControllerType holonetControllerType) : base(screen, holonetControllerType)
        {
            base.InitializeTab("NotesTab", "hn_devnotes_tab");
            this.notesTable = screen.GetElement <UXTable>("NotesTable");
            this.notesTable.SetTemplateItem("NotesItem");
            List <DevNoteEntryVO> devNotes = Service.HolonetController.DevNotesController.DevNotes;
            int i     = 0;
            int count = devNotes.Count;

            while (i < count)
            {
                DevNoteEntryVO devNoteEntryVO = devNotes[i];
                UXElement      item           = this.notesTable.CloneTemplateItem(devNoteEntryVO.Uid);
                this.notesTable.GetSubElement <UXLabel>(devNoteEntryVO.Uid, "NotesItemLabelTitle").Text = this.lang.Get(devNoteEntryVO.TitleText, new object[0]);
                UXButton subElement  = this.notesTable.GetSubElement <UXButton>(devNoteEntryVO.Uid, "NotesItemBtnAction");
                UXLabel  subElement2 = this.notesTable.GetSubElement <UXLabel>(devNoteEntryVO.Uid, "NotesItemBtnActionLabel");
                base.PrepareButton(devNoteEntryVO, 1, subElement, subElement2);
                this.notesTable.GetSubElement <UXButton>(devNoteEntryVO.Uid, "NotesBackCollider").OnClicked = new UXButtonClickedDelegate(this.ClickedLink);
                UXTexture           subElement3         = this.notesTable.GetSubElement <UXTexture>(devNoteEntryVO.Uid, "NotesThumbTexture");
                UXSprite            subElement4         = this.notesTable.GetSubElement <UXSprite>(devNoteEntryVO.Uid, "SpriteNotesThumbnailFrame");
                string              text                = this.lang.Get(devNoteEntryVO.BodyText, new object[0]);
                List <string>       list                = new List <string>();
                List <UXTexture>    list2               = new List <UXTexture>();
                MiscElementsManager miscElementsManager = Service.UXController.MiscElementsManager;
                if (text.Contains("src="))
                {
                    string[] separator = new string[]
                    {
                        "[img]"
                    };
                    string[] array = text.Split(separator, StringSplitOptions.None);
                    int      j     = 0;
                    int      num   = array.Length;
                    while (j < num)
                    {
                        list.Add(array[j]);
                        j++;
                    }
                    this.notesTable.GetSubElement <UXLabel>(devNoteEntryVO.Uid, "NotesItemLabelBody").Text = string.Empty;
                }
                else
                {
                    this.notesTable.GetSubElement <UXLabel>(devNoteEntryVO.Uid, "NotesItemLabelBody").Text = text;
                }
                int k      = 0;
                int count2 = list.Count;
                while (k < count2)
                {
                    if (list[k].Contains("src="))
                    {
                        UXTexture uXTexture = miscElementsManager.CloneUXTexture(subElement3, "newImage #" + k, subElement3.Root.transform.parent.gameObject);
                        string[]  array2    = list[k].Split(new char[]
                        {
                            '='
                        });
                        string assetName = array2[1];
                        uXTexture.Visible = true;
                        uXTexture.LoadTexture(assetName);
                        list2.Add(uXTexture);
                        string oldValue = "[img]" + list[k] + "[img]";
                        text = text.Replace(oldValue, "IMAGE_TOKEN");
                    }
                    k++;
                }
                if (text.Contains("IMAGE_TOKEN"))
                {
                    string[] separator2 = new string[]
                    {
                        "IMAGE_TOKEN"
                    };
                    string[] array3 = text.Split(separator2, StringSplitOptions.None);
                    int      l      = 0;
                    int      num2   = array3.Length;
                    while (l < num2)
                    {
                        UXLabel uXLabel = miscElementsManager.CloneUXLabel(this.notesTable.GetSubElement <UXLabel>(devNoteEntryVO.Uid, "NotesItemLabelBody"), "thisLabel #" + l, subElement3.Root.transform.parent.gameObject);
                        uXLabel.LocalPosition = new Vector2(this.notesTable.GetSubElement <UXLabel>(devNoteEntryVO.Uid, "NotesItemLabelBody").LocalPosition.x, this.notesTable.GetSubElement <UXLabel>(devNoteEntryVO.Uid, "NotesItemLabelBody").LocalPosition.y);
                        uXLabel.Text          = array3[l];
                        if (list2.Count > 0)
                        {
                            list2[0].LocalPosition = new Vector2(uXLabel.LocalPosition.x - 115f * uXLabel.UXCamera.Camera.transform.localScale.x, uXLabel.LocalPosition.y - uXLabel.Height);
                            list2.Remove(list2[0]);
                        }
                        UXButton uXButton = miscElementsManager.CloneUXButton(this.notesTable.GetSubElement <UXButton>(devNoteEntryVO.Uid, "NotesBackCollider"), "thisButton #" + l, subElement3.Root.transform.parent.gameObject);
                        uXButton.LocalPosition = uXLabel.LocalPosition;
                        uXButton.GetUIWidget.SetAnchor(uXLabel.GetUIWidget.transform);
                        uXButton.OnClicked = new UXButtonClickedDelegate(this.ClickedLink);
                        this.notesTable.GetSubElement <UXLabel>(devNoteEntryVO.Uid, "NotesItemLabelBody").LocalPosition = new Vector2(this.notesTable.GetSubElement <UXLabel>(devNoteEntryVO.Uid, "NotesItemLabelBody").LocalPosition.x, this.notesTable.GetSubElement <UXLabel>(devNoteEntryVO.Uid, "NotesItemLabelBody").LocalPosition.y - uXLabel.Height);
                        this.newLabels.Add(uXLabel);
                        l++;
                    }
                }
                else
                {
                    this.newLabels.Add(this.notesTable.GetSubElement <UXLabel>(devNoteEntryVO.Uid, "NotesItemLabelBody"));
                }
                if (!string.IsNullOrEmpty(devNoteEntryVO.Image))
                {
                    subElement3.Visible = true;
                    subElement4.Visible = true;
                    subElement3.LoadTexture(devNoteEntryVO.Image);
                }
                else
                {
                    subElement3.Visible = false;
                    subElement4.Visible = false;
                }
                this.notesTable.AddItem(item, this.notesTable.Count);
                i++;
            }
        }
Beispiel #17
0
        private UXElement CreateInventoryGridItem(string id, PrizeType prizeType, string title, string description, int count, IGeometryVO vo, int quality)
        {
            PrizeInventoryItemTag prizeInventoryItemTag = new PrizeInventoryItemTag();
            UXElement             uXElement             = this.itemGrid.CloneTemplateItem(id);

            prizeInventoryItemTag.TileElement = uXElement;
            prizeInventoryItemTag.PrizeID     = id;
            prizeInventoryItemTag.PrizeType   = prizeType;
            uXElement.Tag = prizeInventoryItemTag;
            this.SetupGridItemQuality(id, quality);
            prizeInventoryItemTag.MainElement = this.itemGrid.GetSubElement <UXElement>(id, "ItemInfo");
            UXLabel subElement = this.itemGrid.GetSubElement <UXLabel>(id, "LabelName");

            subElement.Text = title;
            UXButton subElement2 = this.itemGrid.GetSubElement <UXButton>(id, "BtnItemInfo");

            prizeInventoryItemTag.InfoLabel = this.itemGrid.GetSubElement <UXLabel>(id, "LabelItemInfo");
            if (!string.IsNullOrEmpty(description) && prizeType != PrizeType.None)
            {
                prizeInventoryItemTag.InfoLabel.Text = description;
                subElement2.Visible   = true;
                subElement2.OnClicked = new UXButtonClickedDelegate(this.OnInfoButtonClicked);
                subElement2.Tag       = prizeInventoryItemTag;
            }
            else
            {
                subElement2.Visible = false;
            }
            prizeInventoryItemTag.CountLabel = this.itemGrid.GetSubElement <UXLabel>(id, "LabelItemCount");
            UXSprite subElement3 = this.itemGrid.GetSubElement <UXSprite>(id, "SpriteItemImage");

            if (prizeType == PrizeType.None)
            {
                RewardUtils.SetCrateIcon(subElement3, (CrateVO)vo, AnimState.Idle);
            }
            else if (prizeType == PrizeType.Crate)
            {
                RewardUtils.SetCrateIcon(subElement3, (CrateVO)vo, AnimState.Closed);
            }
            else
            {
                RewardUtils.SetRewardIcon(subElement3, vo, AnimationPreference.NoAnimation);
            }
            prizeInventoryItemTag.IconAssetName = vo.IconAssetName;
            UXButton subElement4 = this.itemGrid.GetSubElement <UXButton>(id, "InventoryCard");

            subElement4.OnClicked = new UXButtonClickedDelegate(this.OnTileClicked);
            subElement4.Tag       = prizeInventoryItemTag;
            this.itemGrid.GetSubElement <UXElement>(id, "CountAndBuildTime").Visible = true;
            this.itemGrid.GetSubElement <UXElement>(id, "ContainerJewelNew").Visible = false;
            UXLabel subElement5 = this.itemGrid.GetSubElement <UXLabel>(id, "LabelItemExpiration");
            UXLabel subElement6 = this.itemGrid.GetSubElement <UXLabel>(id, "LabelCurrencyAmount");

            subElement6.Visible = false;
            if (prizeType == PrizeType.None)
            {
                prizeInventoryItemTag.CountLabel.Visible = false;
                subElement5.Visible = false;
                subElement6.Text    = description;
                subElement6.Visible = true;
            }
            else if (prizeType == PrizeType.Crate)
            {
                prizeInventoryItemTag.CountLabel.Visible = false;
                CrateData crateData = this.cp.Prizes.Crates.Available[id];
                subElement5.Visible = true;
                UXUtils.SetCrateExpirationTimerLabel(crateData, subElement5, this.lang);
                if (!string.IsNullOrEmpty(crateData.PlanetId))
                {
                    PlanetVO  planetVO    = Service.StaticDataController.Get <PlanetVO>(crateData.PlanetId);
                    UXTexture subElement7 = this.itemGrid.GetSubElement <UXTexture>(id, "TexturePlanet");
                    subElement7.LoadTexture(planetVO.LeaderboardTileTexture);
                }
                if (this.crateTabLastViewedTime < crateData.ReceivedTimeStamp)
                {
                    this.itemGrid.GetSubElement <UXElement>(id, "ContainerJewelNew").Visible = true;
                    this.itemGrid.GetSubElement <UXLabel>(id, "LabelMessageCountNew").Text   = this.lang.Get("CRATE_INVENTORY_CRATE_NEW_BADGE", new object[0]);
                }
                subElement4.Tag = prizeInventoryItemTag;
            }
            else
            {
                prizeInventoryItemTag.CountLabel.Text    = string.Format("x{0}", count);
                prizeInventoryItemTag.CountLabel.Visible = true;
                subElement5.Visible = false;
            }
            this.itemGrid.GetSubElement <UXLabel>(id, "LabelItemInfo").Visible        = false;
            this.itemGrid.GetSubElement <UXLabel>(id, "LabelItemRequirement").Visible = false;
            this.itemGrid.GetSubElement <UXSprite>(id, "SpriteItemTimeIcon").Visible  = false;
            this.itemGrid.GetSubElement <UXLabel>(id, "LabelBuildTime").Visible       = false;
            uXElement.Tag = prizeInventoryItemTag;
            return(uXElement);
        }
Beispiel #18
0
        private void AddBattleLogItem(BattleEntry entry)
        {
            CurrentPlayer     currentPlayer = Service.CurrentPlayer;
            bool              flag          = currentPlayer.PlayerId == entry.AttackerID;
            BattleParticipant battleParticipant;
            BattleParticipant battleParticipant2;

            if (flag)
            {
                battleParticipant  = entry.Attacker;
                battleParticipant2 = entry.Defender;
            }
            else
            {
                battleParticipant  = entry.Defender;
                battleParticipant2 = entry.Attacker;
            }
            string      playerName  = battleParticipant2.PlayerName;
            string      guildName   = battleParticipant2.GuildName;
            FactionType factionType = battleParticipant2.PlayerFaction;

            if (factionType == FactionType.Invalid)
            {
                factionType = GameUtils.GetOppositeFaction(currentPlayer.Faction);
            }
            int       num   = GameUtils.CalcuateMedals(battleParticipant.AttackRating, battleParticipant.DefenseRating);
            int       num2  = GameUtils.CalcuateMedals(battleParticipant.AttackRating + battleParticipant.AttackRatingDelta, battleParticipant.DefenseRating + battleParticipant.DefenseRatingDelta);
            int       value = num2 - num;
            int       tournamentRatingDelta = battleParticipant.TournamentRatingDelta;
            bool      flag2          = GameUtils.IsBattleVersionSupported(entry.CmsVersion, entry.BattleVersion);
            bool      flag3          = Service.SquadController.StateManager.GetCurrentSquad() != null;
            bool      visible        = flag2;
            bool      visible2       = !flag && entry.IsPvP() && !entry.Revenged && entry.PlanetId == currentPlayer.PlanetId;
            bool      visible3       = flag2 && flag3;
            uint      time           = ServerTime.Time;
            int       totalSeconds   = (int)(time - entry.EndBattleServerTime);
            int       count          = this.itemGrid.Count;
            string    text           = string.Format("{0}{1}", "BattleLogItem", count);
            UXElement item           = this.itemGrid.CloneTemplateItem(text);
            bool      won            = entry.Won;
            Color     winResultColor = UXUtils.GetWinResultColor(won);
            UXButton  subElement     = this.itemGrid.GetSubElement <UXButton>(text, "BtnReplay");

            subElement.Tag       = entry;
            subElement.OnClicked = new UXButtonClickedDelegate(this.OnReplayButtonClicked);
            subElement.Visible   = visible;
            UXButton subElement2 = this.itemGrid.GetSubElement <UXButton>(text, "BtnRevenge");

            subElement2.Tag       = entry;
            subElement2.OnClicked = new UXButtonClickedDelegate(this.OnRevengeButtonClicked);
            subElement2.Visible   = visible2;
            if (this.revengeButtons == null)
            {
                this.revengeButtons = new List <UXButton>();
            }
            this.revengeButtons.Add(subElement2);
            UXButton subElement3 = this.itemGrid.GetSubElement <UXButton>(text, "BtnShare");

            subElement3.Tag       = entry;
            subElement3.OnClicked = new UXButtonClickedDelegate(this.OnShareButtonClicked);
            subElement3.Visible   = visible3;
            UXLabel subElement4 = this.itemGrid.GetSubElement <UXLabel>(text, "LabelBtnShare");

            subElement4.Text = this.lang.Get("s_Share", new object[0]);
            UXLabel subElement5 = this.itemGrid.GetSubElement <UXLabel>(text, "LabelBtnReplay");

            subElement5.Text = this.lang.Get("BUTTON_REPLAY", new object[0]);
            UXLabel subElement6 = this.itemGrid.GetSubElement <UXLabel>(text, "LabelBtnRevenge");

            subElement6.Text = this.lang.Get("s_Revenge", new object[0]);
            bool    flag4       = this.curTab == BattleLogTab.Attack;
            int     value2      = (!flag4) ? entry.LootCreditsDeducted : entry.LootCreditsEarned;
            int     value3      = (!flag4) ? entry.LootMaterialsDeducted : entry.LootMaterialsEarned;
            int     value4      = (!flag4) ? entry.LootContrabandDeducted : entry.LootContrabandEarned;
            UXLabel subElement7 = this.itemGrid.GetSubElement <UXLabel>(text, "LabelCredits");

            subElement7.Text = this.lang.ThousandsSeparated(value2);
            UXLabel subElement8 = this.itemGrid.GetSubElement <UXLabel>(text, "LabelMaterials");

            subElement8.Text = this.lang.ThousandsSeparated(value3);
            UXElement subElement9 = this.itemGrid.GetSubElement <UXElement>(text, "Contraband");

            if (currentPlayer.IsContrabandUnlocked)
            {
                subElement9.Visible = true;
                UXLabel subElement10 = this.itemGrid.GetSubElement <UXLabel>(text, "LabelContraband");
                subElement10.Text = this.lang.ThousandsSeparated(value4);
            }
            else
            {
                subElement9.Visible = false;
            }
            UXLabel subElement11 = this.itemGrid.GetSubElement <UXLabel>(text, "LabelBasePoints");

            subElement11.Text      = this.lang.ThousandsSeparated(value);
            subElement11.TextColor = winResultColor;
            UXLabel subElement12 = this.itemGrid.GetSubElement <UXLabel>(text, "LabelDamage");

            subElement12.Text = this.lang.Get("DAMAGE_PERCENT", new object[]
            {
                entry.DamagePercent
            });
            UXLabel subElement13 = this.itemGrid.GetSubElement <UXLabel>(text, "LabelResult");

            subElement13.Text      = this.lang.Get((!won) ? "YOU_LOST" : "YOU_WON", new object[0]);
            subElement13.TextColor = winResultColor;
            UXLabel subElement14 = this.itemGrid.GetSubElement <UXLabel>(text, "LabelTimeStamp");

            subElement14.Text = this.lang.Get("TIME_AGO", new object[]
            {
                GameUtils.GetTimeLabelFromSeconds(totalSeconds)
            });
            UXLabel subElement15 = this.itemGrid.GetSubElement <UXLabel>(text, "LabelPlayerName");

            subElement15.Text = playerName;
            UXLabel subElement16 = this.itemGrid.GetSubElement <UXLabel>(text, "LabelFactionName");

            subElement16.Text = guildName;
            UXSprite subElement17 = this.itemGrid.GetSubElement <UXSprite>(text, "SpriteFaction");

            subElement17.SpriteName = "Faction" + factionType.ToString();
            if (!string.IsNullOrEmpty(entry.PlanetId))
            {
                PlanetVO  planetVO     = this.sdc.Get <PlanetVO>(entry.PlanetId);
                UXTexture subElement18 = this.itemGrid.GetSubElement <UXTexture>(text, "TexturePlanetBg");
                subElement18.LoadTexture(planetVO.LeaderboardTileTexture);
            }
            UXGrid    subElement19 = this.itemGrid.GetSubElement <UXGrid>(text, "TroopsExpendedGrid");
            UXElement subElement20 = this.itemGrid.GetSubElement <UXElement>(text, "TroopsExpendedTemplate");

            subElement19.SetTemplateItem(subElement20.Root.name);
            this.AddExpendedItems(entry, text, subElement19);
            subElement19.RepositionItems();
            bool      flag5        = tournamentRatingDelta != 0;
            UXElement subElement21 = this.itemGrid.GetSubElement <UXElement>(text, "TournamentRating");

            subElement21.Visible = flag5;
            if (!string.IsNullOrEmpty(entry.PlanetId))
            {
                string tournamentPointIconName = GameUtils.GetTournamentPointIconName(entry.PlanetId);
                if (flag5 && !string.IsNullOrEmpty(tournamentPointIconName))
                {
                    UXSprite subElement22 = this.itemGrid.GetSubElement <UXSprite>(text, "SpriteTournamentRating");
                    subElement22.SpriteName = tournamentPointIconName;
                    UXLabel subElement23 = this.itemGrid.GetSubElement <UXLabel>(text, "LabelTournamentRating");
                    subElement23.Text      = tournamentRatingDelta.ToString();
                    subElement23.TextColor = winResultColor;
                }
            }
            this.itemGrid.AddItem(item, count);
        }
Beispiel #19
0
        private void UpdateElements()
        {
            StaticDataController     staticDataController     = Service.StaticDataController;
            TargetedBundleController targetedBundleController = Service.TargetedBundleController;

            this.currentOffer = targetedBundleController.CurrentTargetedOffer;
            if (this.currentOffer != null)
            {
                UXLabel element = base.GetElement <UXLabel>("LabelTitle");
                element.Text = this.lang.Get(this.currentOffer.Title, new object[0]);
                UXLabel element2 = base.GetElement <UXLabel>("LabelDescription");
                element2.Text = this.lang.Get(this.currentOffer.Description, new object[0]);
                TextureVO optional = staticDataController.GetOptional <TextureVO>("gui_textures_promotional");
                if (optional != null)
                {
                    UXTexture element3 = base.GetElement <UXTexture>("TexturePromoArt");
                    element3.LoadTexture(optional.AssetName);
                }
                optional = staticDataController.GetOptional <TextureVO>("targeted_bundle_entry");
                if (optional != null)
                {
                    UXTexture element4 = base.GetElement <UXTexture>("TextureEnvironmentEntry");
                    element4.LoadTexture(optional.AssetName);
                }
                optional = staticDataController.GetOptional <TextureVO>("targeted_bundle_treads");
                if (optional != null)
                {
                    UXTexture element5 = base.GetElement <UXTexture>("TextureEnvironmentRight");
                    element5.LoadTexture(optional.AssetName);
                }
                optional = staticDataController.GetOptional <TextureVO>("targeted_bundle_treads");
                if (optional != null)
                {
                    UXTexture element6 = base.GetElement <UXTexture>("TextureEnvironmentLeft");
                    element6.LoadTexture(optional.AssetName);
                }
                optional = staticDataController.GetOptional <TextureVO>("targeted_bundle_dust");
                if (optional != null)
                {
                    UXTexture element7 = base.GetElement <UXTexture>("TextureEnvironmentDustRight");
                    element7.LoadTexture(optional.AssetName);
                    element7 = base.GetElement <UXTexture>("TextureEnvironmentDustLeft");
                    element7.LoadTexture(optional.AssetName);
                }
                int i     = 0;
                int count = this.currentOffer.RewardUIDs.Count;
                while (i < count)
                {
                    RewardVO rewardVO = staticDataController.Get <RewardVO>(this.currentOffer.RewardUIDs[i]);
                    if (!RewardUtils.SetupTargetedOfferCrateRewardDisplay(rewardVO, this.itemLabels[i], this.itemSprites[i]))
                    {
                        List <RewardComponentTag> rewardComponents = RewardUtils.GetRewardComponents(rewardVO);
                        int j      = 0;
                        int count2 = rewardComponents.Count;
                        while (j < count2)
                        {
                            RewardComponentTag rewardComponentTag = rewardComponents[j];
                            this.itemLabels[i].Text = this.lang.Get("AMOUNT_AND_NAME", new object[]
                            {
                                rewardComponentTag.RewardName,
                                rewardComponentTag.Quantity
                            });
                            RewardUtils.SetRewardIcon(this.itemSprites[i], rewardComponentTag.RewardGeometryConfig, AnimationPreference.AnimationAlways);
                            j++;
                        }
                    }
                    i++;
                }
                if (targetedBundleController.IsCurrencyCostOffer(this.currentOffer))
                {
                    this.SetupCurrencyCostOffer(this.currentOffer);
                }
                else
                {
                    this.SetupIAPLinkedOffer(this.currentOffer);
                }
                UXUtils.SetupAnimatedCharacter(this.characterSprite1, this.currentOffer.Character1Image, ref this.charGeometry1);
                UXUtils.SetupAnimatedCharacter(this.characterSprite2, this.currentOffer.Character2Image, ref this.charGeometry2);
                uint serverTime = Service.ServerAPI.ServerTime;
                this.timeRemaining   = (int)(targetedBundleController.OfferExpiresAt - serverTime);
                this.timerLabel.Text = this.lang.Get("expires_in", new object[]
                {
                    GameUtils.GetTimeLabelFromSeconds(this.timeRemaining)
                });
                this.valueLabel.Text = this.lang.Get("PERCENTAGE", new object[]
                {
                    this.currentOffer.Discount.ToString()
                });
                this.value2Label.Text = this.lang.Get("TARGETED_BUNDLE_DISCOUNT", new object[]
                {
                    this.currentOffer.Discount.ToString()
                });
            }
            else
            {
                Service.Logger.Error("No current offer available for targeted bundle screen");
            }
        }
Beispiel #20
0
        private void SetupStickerVisuals(StoreTab tab, StickerVO vo)
        {
            string      text            = string.Format("Texture{0}Icon", tab.ToString());
            string      name            = string.Format("Widget{0}Special", tab.ToString());
            string      text2           = string.Format("SpriteBannerGradient{0}Special", tab.ToString());
            string      text3           = string.Format("SpriteBanner{0}Special", tab.ToString());
            string      text4           = string.Format("LabelSee{0}Deals", tab.ToString());
            string      text5           = string.Format("SpriteSee{0}DealsStroke", tab.ToString());
            string      text6           = string.Format("SpriteSee{0}DealsIcon", tab.ToString());
            string      text7           = string.Format("SpriteBkgStrokeTab{0}", tab.ToString());
            string      text8           = string.Format("SpriteBkgDetailRightTab{0}", tab.ToString());
            string      text9           = string.Format("SpriteBkgDetailLeftTab{0}", tab.ToString());
            string      text10          = string.Format("SpriteBkgInnerGlowTab{0}", tab.ToString());
            UXTexture   optionalElement = this.parentStoreScreen.GetOptionalElement <UXTexture>(text);
            FactionType faction         = Service.CurrentPlayer.Faction;

            if (optionalElement != null)
            {
                string text11 = string.Empty;
                if (faction == FactionType.Rebel)
                {
                    text11 = vo.TextureOverrideAssetNameRebel;
                }
                else
                {
                    text11 = vo.TextureOverrideAssetNameEmpire;
                }
                if (!string.IsNullOrEmpty(text11))
                {
                    string assetName = optionalElement.AssetName;
                    this.orginalTextureNames.Add(text, assetName);
                    optionalElement.LoadTexture(text11);
                }
            }
            UXElement optionalElement2 = this.parentStoreScreen.GetOptionalElement <UXElement>(name);

            if (optionalElement2 != null)
            {
                optionalElement2.Visible = true;
            }
            UXSprite optionalElement3 = this.parentStoreScreen.GetOptionalElement <UXSprite>(text2);

            if (optionalElement3 != null && !string.IsNullOrEmpty(vo.GradientColor))
            {
                this.AddOriginalUIColor(text2, optionalElement3.Color);
                optionalElement3.Color = FXUtils.ConvertHexStringToColorObject(vo.GradientColor);
            }
            if (string.IsNullOrEmpty(vo.MainColor))
            {
                return;
            }
            Color    color            = FXUtils.ConvertHexStringToColorObject(vo.MainColor);
            UXSprite optionalElement4 = this.parentStoreScreen.GetOptionalElement <UXSprite>(text3);

            if (optionalElement4 != null)
            {
                this.AddOriginalUIColor(text3, optionalElement4.Color);
                optionalElement4.Color = color;
            }
            UXLabel optionalElement5 = this.parentStoreScreen.GetOptionalElement <UXLabel>(text4);

            if (optionalElement5 != null)
            {
                this.AddOriginalUIColor(text4, optionalElement5.TextColor);
                optionalElement5.TextColor = color;
            }
            UXSprite optionalElement6 = this.parentStoreScreen.GetOptionalElement <UXSprite>(text5);

            if (optionalElement6 != null)
            {
                this.AddOriginalUIColor(text5, optionalElement6.Color);
                optionalElement6.Color = color;
            }
            UXSprite optionalElement7 = this.parentStoreScreen.GetOptionalElement <UXSprite>(text6);

            if (optionalElement7 != null)
            {
                this.AddOriginalUIColor(text6, optionalElement7.Color);
                optionalElement7.Color = color;
            }
            UXSprite optionalElement8 = this.parentStoreScreen.GetOptionalElement <UXSprite>(text7);

            if (optionalElement8 != null)
            {
                this.AddOriginalUIColor(text7, optionalElement8.Color);
                optionalElement8.Color = color;
            }
            Color    color2           = new Color(color.r, color.g, color.b, 0.5f);
            UXSprite optionalElement9 = this.parentStoreScreen.GetOptionalElement <UXSprite>(text8);

            if (optionalElement9 != null)
            {
                this.AddOriginalUIColor(text8, optionalElement9.Color);
                optionalElement9.Color = color2;
            }
            UXSprite optionalElement10 = this.parentStoreScreen.GetOptionalElement <UXSprite>(text9);

            if (optionalElement10 != null)
            {
                this.AddOriginalUIColor(text9, optionalElement10.Color);
                optionalElement10.Color = color2;
            }
            UXSprite optionalElement11 = this.parentStoreScreen.GetOptionalElement <UXSprite>(text10);

            if (optionalElement11 != null)
            {
                this.AddOriginalUIColor(text10, optionalElement11.Color);
                optionalElement11.Color = new Color(color.r, color.g, color.b, 0.4f);
            }
        }
Beispiel #21
0
 public void InitCampaignGrid()
 {
     this.screen.CurrentBackButton    = this.backButtonChapter;
     this.screen.CurrentBackDelegate  = new UXButtonClickedDelegate(this.OnBackButtonClicked);
     this.campaignSelectGroup.Visible = true;
     if (this.campaignGroupInitialized)
     {
         return;
     }
     this.campaignGroupInitialized = true;
     this.campaignGrid             = this.screen.GetElement <UXGrid>("CampaignGrid");
     this.campaignGrid.SetTemplateItem("CampaignTemplate");
     foreach (CampaignVO current in base.Sdc.GetAll <CampaignVO>())
     {
         if (!current.Timed && current.Faction == base.Player.Faction)
         {
             string    uid       = current.Uid;
             UXElement uXElement = this.campaignGrid.CloneTemplateItem(uid);
             uXElement.Tag = current;
             int     totalCampaignStarsEarned = base.Player.CampaignProgress.GetTotalCampaignStarsEarned(current);
             int     totalMasteryStars        = current.TotalMasteryStars;
             UXLabel subElement = this.campaignGrid.GetSubElement <UXLabel>(uid, "LabelCampaignName");
             subElement.Text = LangUtils.GetCampaignTitle(current);
             UXLabel subElement2 = this.campaignGrid.GetSubElement <UXLabel>(uid, "LabelChapterDescription");
             subElement2.Text = LangUtils.GetCampaignDescription(current);
             UXLabel subElement3 = this.campaignGrid.GetSubElement <UXLabel>(uid, "LabelStarsCount");
             subElement3.Text = base.LangController.Get("LABEL_CAMPAIGN_STARS", new object[]
             {
                 totalCampaignStarsEarned,
                 totalMasteryStars
             });
             UXButton subElement4 = this.campaignGrid.GetSubElement <UXButton>(uid, "ButtonCampaignCard");
             subElement4.Tag       = current;
             subElement4.OnClicked = new UXButtonClickedDelegate(this.OnCampaignItemButtonClicked);
             UXTexture subElement5 = this.campaignGrid.GetSubElement <UXTexture>(uid, "SpriteCampaignImage");
             subElement5.LoadTexture(current.Uid);
             if (!base.Player.CampaignProgress.HasCampaign(current))
             {
                 subElement4.Enabled = false;
             }
             UXSprite subElement6 = this.campaignGrid.GetSubElement <UXSprite>(uid, "SpriteIcoChapterLocked");
             subElement6.Visible = !subElement4.Enabled;
             UXLabel subElement7 = this.campaignGrid.GetSubElement <UXLabel>(uid, "LabelChapterNumberSelect");
             this.campaignGrid.GetSubElement <UXLabel>(uid, "LabelChapterReward").Text = base.LangController.Get("s_Rewards", new object[0]);
             subElement7.Text = base.LangController.Get("CHAPTER_NUMBER", new object[]
             {
                 current.UnlockOrder
             });
             UXLabel     subElement8  = this.campaignGrid.GetSubElement <UXLabel>(uid, "LabelObjectivesCount");
             UXLabel     subElement9  = this.campaignGrid.GetSubElement <UXLabel>(uid, "LabelCampaignComplete");
             UXSprite    subElement10 = this.campaignGrid.GetSubElement <UXSprite>(uid, "SpriteIconCheck");
             UXLabel     subElement11 = this.campaignGrid.GetSubElement <UXLabel>(uid, "LabelUnlocks");
             UXSprite    subElement12 = this.campaignGrid.GetSubElement <UXSprite>(uid, "SpriteChapterRewardItem");
             UXLabel     subElement13 = this.campaignGrid.GetSubElement <UXLabel>(uid, "LabelChapterRewarded");
             int         totalCampaignMissionsCompleted = base.Player.CampaignProgress.GetTotalCampaignMissionsCompleted(current);
             int         totalMissions = current.TotalMissions;
             IGeometryVO config        = null;
             RewardType  rewardType    = RewardType.Invalid;
             base.RManager.GetFirstRewardAssetName(current.Reward, ref rewardType, out config);
             RewardUtils.SetRewardIcon(subElement12, config, AnimationPreference.NoAnimation);
             if (totalCampaignMissionsCompleted > 0 && totalCampaignMissionsCompleted == totalMissions)
             {
                 subElement8.Visible = false;
                 subElement9.Text    = base.LangController.Get("LABEL_CAMPAIGN_COMPLETE", new object[0]);
                 subElement11.Text   = base.RManager.GetRewardString(current.Reward);
                 bool flag = totalCampaignStarsEarned >= totalMasteryStars;
                 subElement13.Visible = flag;
                 subElement12.Visible = !flag;
                 subElement11.Visible = !flag;
             }
             else
             {
                 subElement9.Visible  = false;
                 subElement10.Visible = false;
                 subElement8.Text     = base.LangController.Get("LABEL_CAMPAIGN_MISSIONS", new object[]
                 {
                     totalCampaignMissionsCompleted,
                     totalMissions
                 });
                 subElement11.Text = base.RManager.GetRewardString(current.Reward);
             }
             UXSlider subElement14 = this.campaignGrid.GetSubElement <UXSlider>(uid, "ChapterPbar");
             subElement14.Value = ((totalMissions != 0) ? ((float)totalCampaignMissionsCompleted / (float)totalMissions) : 0f);
             this.campaignGrid.AddItem(uXElement, current.UnlockOrder);
         }
     }
     this.campaignGrid.RepositionItems();
 }