Exemple #1
0
 protected override void SetupControls()
 {
     base.GetElement <UXLabel>("TickerDialogSmall").Visible = false;
     this.titleLabel.Text     = this.title;
     this.payButton.Visible   = true;
     this.payButton.OnClicked = new UXButtonClickedDelegate(this.OnPayButtonClicked);
     UXUtils.SetupCostElements(this, "Cost", null, 0, 0, 0, this.crystals, false, null);
     if (this.multiItemSpriteNames != null && this.multiItemLabelTexts != null)
     {
         this.groupMultipleItems.Visible = true;
         this.centerLabel.Visible        = false;
         this.rightLabel.Visible         = false;
         this.multiItemMessageLabel.Text = this.message;
         this.sprite.Visible             = false;
         this.textureImageInset.Enabled  = false;
         if (this.multiItemTable != null && this.multiItemSpriteNames.Count == this.multiItemLabelTexts.Count)
         {
             this.multiItemTable.Clear();
             int i     = 0;
             int count = this.multiItemSpriteNames.Count;
             while (i < count)
             {
                 string    itemUid     = i.ToString();
                 UXElement item        = this.multiItemTable.CloneTemplateItem(itemUid);
                 UXSprite  subElement  = this.multiItemTable.GetSubElement <UXSprite>(itemUid, "SpriteImageAndTextMultiple");
                 UXLabel   subElement2 = this.multiItemTable.GetSubElement <UXLabel>(itemUid, "LabelItemImageAndTextMultiple");
                 UXUtils.SetupGeometryForIcon(subElement, this.multiItemSpriteNames[i]);
                 subElement2.Text = this.multiItemLabelTexts[i];
                 this.multiItemTable.AddItem(item, i);
                 i++;
             }
         }
     }
 }
Exemple #2
0
        public void SetIAPRewardIcon(UXSprite iconSprite, string uid)
        {
            StaticDataController staticDataController = Service.StaticDataController;
            InAppPurchaseTypeVO  inAppPurchaseTypeVO  = staticDataController.Get <InAppPurchaseTypeVO>(uid);
            string rewardUid = string.Empty;

            if (Service.CurrentPlayer.Faction == FactionType.Empire)
            {
                rewardUid = inAppPurchaseTypeVO.RewardEmpire;
            }
            else
            {
                rewardUid = inAppPurchaseTypeVO.RewardRebel;
            }
            if (inAppPurchaseTypeVO.CurrencyType.Equals("hard") || inAppPurchaseTypeVO.CurrencyType.Equals("pack"))
            {
                UXUtils.SetupGeometryForIcon(iconSprite, inAppPurchaseTypeVO.CurrencyIconId);
            }
            else
            {
                RewardType  rewardType = RewardType.Invalid;
                IGeometryVO config;
                Service.RewardManager.GetFirstRewardAssetName(rewardUid, ref rewardType, out config);
                RewardUtils.SetRewardIcon(iconSprite, config, AnimationPreference.NoAnimation);
            }
        }
 protected override void SetupControls()
 {
     base.GetElement <UXLabel>("TickerDialogSmall").Visible = false;
     this.rightLabel.Text                  = DisableProtectionAlertScreen.GetProtectionTimeRemaining();
     this.titleLabel.Text                  = this.lang.Get("ALERT", new object[0]);
     this.primary2Option.Text              = this.lang.Get("YES", new object[0]);
     this.primary2OptionButton.Visible     = true;
     this.primary2OptionButton.Tag         = true;
     this.primary2OptionButton.OnClicked   = new UXButtonClickedDelegate(this.OnYesOrNoButtonClicked);
     this.secondary2Option.Text            = this.lang.Get("NO", new object[0]);
     this.secondary2OptionButton.Visible   = true;
     this.secondary2OptionButton.Tag       = null;
     this.secondary2OptionButton.OnClicked = new UXButtonClickedDelegate(this.OnYesOrNoButtonClicked);
     if (!string.IsNullOrEmpty(this.spriteName))
     {
         UXUtils.SetupGeometryForIcon(this.sprite, this.spriteName);
     }
 }
Exemple #4
0
        protected override void SetupControls()
        {
            base.GetElement <UXLabel>("TickerDialogSmall").Visible = false;
            CurrentPlayer currentPlayer = Service.Get <CurrentPlayer>();

            if (this.forDroids && currentPlayer.CurrentDroidsAmount < currentPlayer.MaxDroidsAmount)
            {
                this.payLeftLabel.Text       = this.lang.Get("FINISH", new object[0]);
                this.payLeftButton.Visible   = true;
                this.payLeftButton.OnClicked = new UXButtonClickedDelegate(this.OnPayButtonClicked);
                UXUtils.SetupCostElements(this, "CostOptionPay1", null, 0, 0, 0, this.crystals, false, null);
                this.payRightLabel.Text       = this.lang.Get("ADD_DROID", new object[0]);
                this.payRightButton.Visible   = true;
                this.payRightButton.OnClicked = new UXButtonClickedDelegate(this.OnAlternatePayButtonClicked);
                int num = GameUtils.DroidCrystalCost(currentPlayer.CurrentDroidsAmount);
                UXUtils.SetupCostElements(this, "CostOptionPay2", null, 0, 0, 0, num, false, null);
                this.centerLabel.Text    = this.message;
                this.centerLabel.Visible = true;
                this.rightLabel.Visible  = false;
            }
            else
            {
                this.payButton.Visible   = true;
                this.payButton.OnClicked = new UXButtonClickedDelegate(this.OnPayButtonClicked);
                UXUtils.SetupCostElements(this, "Cost", null, 0, 0, 0, this.crystals, false, null);
                if (this.forDroids)
                {
                    this.centerLabel.Text    = this.message;
                    this.centerLabel.Visible = true;
                    this.rightLabel.Visible  = false;
                }
                else
                {
                    this.rightLabel.Text     = this.message;
                    this.centerLabel.Visible = false;
                    this.rightLabel.Visible  = true;
                    this.sprite.SpriteName   = this.spriteName;
                    UXUtils.SetupGeometryForIcon(this.sprite, this.spriteName);
                }
            }
            this.titleLabel.Text = this.title;
        }
Exemple #5
0
 protected override void SetupControls()
 {
     if (!this.noContract)
     {
         Service.ViewTimeEngine.RegisterClockTimeObserver(this, 1f);
     }
     if (Service.BuildingController.SelectedBuilding == this.buildingEntity)
     {
         Service.UXController.HUD.ShowContextButtons(null);
     }
     if (this.geometry != null)
     {
         UXUtils.SetupGeometryForIcon(this.sprite, this.geometry);
     }
     this.payButton.Visible = true;
     if (this.buildingEntity != null)
     {
         this.payButton.Tag = this.buildingEntity;
     }
     else if (!string.IsNullOrEmpty(this.perkId))
     {
         this.payButton.Tag = this.perkId;
     }
     else
     {
         this.payButton.Tag = true;
     }
     if (string.IsNullOrEmpty(this.titleOverride))
     {
         this.titleLabel.Text = Service.Lang.Get((!this.noContract) ? "upgrade_title_FinishNow" : "instant_upgrade_confirm_title", new object[0]);
     }
     else
     {
         this.titleLabel.Text = this.titleOverride;
     }
     this.payButton.OnClicked = new UXButtonClickedDelegate(this.OnPayButtonClicked);
     Service.UserInputInhibitor.AddToAllow(this.CloseButton);
     Service.UserInputInhibitor.AddToAllow(this.payButton);
     base.GetElement <UXLabel>("TickerDialogSmall").Visible = false;
 }
Exemple #6
0
        private void AddExpendedItem(UXGrid expendedGrid, string entryItemUid, string troopUid, IUpgradeableVO troop, int count, int unitQuality, BattleEntry battleEntry)
        {
            if (expendedGrid.Count == 8)
            {
                return;
            }
            if (count <= 0)
            {
                return;
            }
            UXElement uXElement = expendedGrid.CloneTemplateItem(troopUid);

            uXElement.Root.name = UXUtils.FormatAppendedName(uXElement.Root.name, entryItemUid);
            UXLabel subElement = expendedGrid.GetSubElement <UXLabel>(troopUid, UXUtils.FormatAppendedName("LabelTroopsExpended", entryItemUid));

            subElement.Text = ((count <= 0) ? string.Empty : this.lang.Get("TROOP_MULTIPLIER", new object[]
            {
                count
            }));
            UXLabel subElement2 = expendedGrid.GetSubElement <UXLabel>(troopUid, UXUtils.FormatAppendedName("LabelTroopLevel", entryItemUid));

            subElement2.Text = LangUtils.GetLevelText(troop.Lvl);
            UXSprite        subElement3     = expendedGrid.GetSubElement <UXSprite>(troopUid, UXUtils.FormatAppendedName("SpriteTroopsImage", entryItemUid));
            ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(troop, subElement3);

            Service.EventManager.SendEvent(EventId.ButtonCreated, new GeometryTag(troop, projectorConfig, battleEntry));
            UXUtils.SetupGeometryForIcon(subElement3, projectorConfig);
            string defaultCardName = UXUtils.FormatAppendedName("TroopsExpendBgDefault", entryItemUid);
            string cardName        = UXUtils.FormatAppendedName("TroopsExpendBgQ{0}", entryItemUid);

            UXUtils.SetCardQuality(this, expendedGrid, troopUid, unitQuality, cardName, defaultCardName);
            FactionDecal.UpdateDeployableDecal(troopUid, entryItemUid, expendedGrid, (IDeployableVO)troop);
            UXButton subElement4 = expendedGrid.GetSubElement <UXButton>(troopUid, UXUtils.FormatAppendedName("TroopsExpendedCard", entryItemUid));

            this.troopTooltipHelper.RegisterButtonTooltip(subElement4, troop, battleEntry);
            expendedGrid.AddItem(uXElement, troop.Order);
        }
Exemple #7
0
        private void Refresh()
        {
            WarBuffVO         warBuffVO   = Service.Get <IDataController>().Get <WarBuffVO>(this.buffBaseData.BuffBaseId);
            SquadWarManager   warManager  = Service.Get <SquadController>().WarManager;
            SquadWarSquadData squadData   = warManager.GetSquadData(this.buffBaseData.OwnerId);
            FactionType       factionType = FactionType.Neutral;
            string            text        = this.buffBaseData.GetDisplayBaseLevel().ToString();

            if (squadData != null)
            {
                factionType = squadData.Faction;
            }
            string uid;
            string text2;

            if (factionType == FactionType.Empire)
            {
                uid   = warBuffVO.MasterEmpireBuildingUid;
                text2 = LangUtils.GetFactionName(factionType);
            }
            else if (factionType == FactionType.Rebel)
            {
                uid   = warBuffVO.MasterRebelBuildingUid;
                text2 = LangUtils.GetFactionName(factionType);
            }
            else
            {
                uid   = warBuffVO.MasterNeutralBuildingUid;
                text2 = this.lang.Get("BUFF_BASE_UNOWNED_FACTION_NAME", new object[0]);
            }
            this.spriteFactionIcon.SpriteName = UXUtils.GetIconNameFromFactionType(factionType);
            this.labelBuffBaseName.Text       = this.lang.Get("WAR_BOARD_BUFF_BASE_TITLE", new object[]
            {
                this.lang.Get(warBuffVO.BuffBaseName, new object[0]),
                LangUtils.GetPlanetDisplayName(warBuffVO.PlanetId)
            });
            this.labelBuffBaseLevel.Text = this.lang.Get("WAR_BOARD_BUFF_BASE_LEVEL", new object[]
            {
                text,
                text2
            });
            this.labelCaptureRequirement.Text = this.lang.Get("WAR_BOARD_BUFF_BASE_CAPTURE_REQUIREMENT", new object[0]);
            this.labelProduces.Text           = this.lang.Get("BUFF_BASE_PRODUCES", new object[0]);
            this.labelBuffDescription.Text    = this.lang.Get(warBuffVO.BuffStringDesc, new object[0]);
            this.labelLocked.Text             = this.lang.Get("PLANET_LOCKED_REQUIREMENT", new object[0]);
            this.labelLocked.Visible          = !Service.Get <CurrentPlayer>().IsPlanetUnlocked(warBuffVO.PlanetId);
            TextureVO       textureVO      = null;
            IDataController dataController = Service.Get <IDataController>();

            if (warBuffVO.PlanetId == GameConstants.TATOOINE_PLANET_UID)
            {
                textureVO = dataController.GetOptional <TextureVO>("squadwars_basedetails_tatooine");
            }
            else if (warBuffVO.PlanetId == GameConstants.YAVIN_PLANET_UID)
            {
                textureVO = dataController.GetOptional <TextureVO>("squadwars_basedetails_yavin");
            }
            else if (warBuffVO.PlanetId == GameConstants.DANDORAN_PLANET_UID)
            {
                textureVO = dataController.GetOptional <TextureVO>("squadwars_basedetails_dandoran");
            }
            else if (warBuffVO.PlanetId == GameConstants.ERKIT_PLANET_UID)
            {
                textureVO = dataController.GetOptional <TextureVO>("squadwars_basedetails_erkit");
            }
            else if (warBuffVO.PlanetId == GameConstants.TFA_PLANET_UID)
            {
                textureVO = dataController.GetOptional <TextureVO>("squadwars_basedetails_tfa");
            }
            else if (warBuffVO.PlanetId == GameConstants.HOTH_PLANET_UID)
            {
                textureVO = dataController.GetOptional <TextureVO>("squadwars_basedetails_hoth");
            }
            if (textureVO != null)
            {
                this.textureBaseDetail.LoadTexture(textureVO.AssetName);
            }
            BuildingTypeVO data = Service.Get <IDataController>().Get <BuildingTypeVO>(uid);

            UXUtils.SetupGeometryForIcon(this.spriteBuffBaseIcon, data);
            this.spriteBuffIcon.SpriteName = warBuffVO.BuffIcon;
            string empty = string.Empty;

            if (warManager.CanScoutBuffBase(this.buffBaseData, ref empty))
            {
                this.btnScout.VisuallyEnableButton();
                this.labelScout.TextColor = this.labelScout.OriginalTextColor;
                return;
            }
            this.btnScout.VisuallyDisableButton();
            this.labelScout.TextColor = UXUtils.COLOR_LABEL_DISABLED;
        }
Exemple #8
0
 protected virtual void SetupControls()
 {
     this.labelTimer.Visible      = false;
     this.primaryButton.Visible   = true;
     this.primaryButton.OnClicked = new UXButtonClickedDelegate(this.OnPrimaryButtonClicked);
     if (Service.UserInputInhibitor != null)
     {
         Service.UserInputInhibitor.AddToAllow(this.primaryButton);
     }
     this.titleLabel.Text = this.title;
     if (this.title == null)
     {
         this.titleLabel.Text = this.lang.Get((!this.IsFatal) ? "ALERT" : "ERROR", new object[0]);
     }
     if (string.IsNullOrEmpty(this.primaryLabelOverride))
     {
         this.primary2Option.Text = this.lang.Get("YES", new object[0]);
         this.primaryLabel.Text   = this.lang.Get((!this.IsFatal) ? "OK" : "RELOAD", new object[0]);
     }
     else
     {
         this.primary2Option.Text = this.primaryLabelOverride;
         this.primaryLabel.Text   = this.primaryLabelOverride;
     }
     if (string.IsNullOrEmpty(this.secondaryLabelOverride))
     {
         this.secondary2Option.Text = this.lang.Get("NO", new object[0]);
     }
     else
     {
         this.secondary2Option.Text = this.secondaryLabelOverride;
     }
     this.textureImage.Enabled = false;
     if (!string.IsNullOrEmpty(this.textureInsetAssetName))
     {
         this.centerLabel.Visible = false;
         this.rightLabel.Visible  = true;
         this.rightLabel.Text     = this.message;
         this.sprite.SpriteName   = "bkgClear";
         this.textureImageInset.LoadTexture(this.textureInsetAssetName);
         this.sprite.Enabled = false;
     }
     else if (this.geometry != null)
     {
         this.centerLabel.Visible       = false;
         this.rightLabel.Visible        = true;
         this.rightLabel.Text           = this.message;
         this.sprite.SpriteName         = "bkgClear";
         this.textureImageInset.Enabled = false;
         UXUtils.SetupGeometryForIcon(this.sprite, this.geometry);
     }
     else if (string.IsNullOrEmpty(this.spriteName))
     {
         this.centerLabel.Visible       = true;
         this.rightLabel.Visible        = false;
         this.centerLabel.Text          = this.message;
         this.textureImageInset.Enabled = false;
     }
     else
     {
         this.centerLabel.Visible       = false;
         this.rightLabel.Visible        = true;
         this.rightLabel.Text           = this.message;
         this.sprite.SpriteName         = "bkgClear";
         this.textureImageInset.Enabled = false;
         UXUtils.SetupGeometryForIcon(this.sprite, this.spriteName);
     }
 }