コード例 #1
0
        protected void UpdateDps(int sliderIndex)
        {
            BuildingUpgradeCatalog buildingUpgradeCatalog = Service.Get <BuildingUpgradeCatalog>();
            IDataController        dataController         = Service.Get <IDataController>();
            BuildingTypeVO         maxLevel     = buildingUpgradeCatalog.GetMaxLevel(this.buildingInfo.UpgradeGroup);
            TurretTypeVO           turretTypeVO = dataController.Get <TurretTypeVO>(maxLevel.TurretUid);

            if (turretTypeVO.ProjectileType.IsBeam)
            {
                int beamDamage  = turretTypeVO.ProjectileType.BeamDamage;
                int beamDamage2 = this.turretInfo.ProjectileType.BeamDamage;
                this.sliders[1].DescLabel.Text = this.lang.Get("BEAM_DAMAGE", new object[]
                {
                    beamDamage2
                });
                this.sliders[sliderIndex].CurrentLabel.Text   = string.Empty;
                this.sliders[sliderIndex].CurrentSlider.Value = ((beamDamage == 0) ? 0f : ((float)beamDamage2 / (float)beamDamage));
                if (this.useUpgradeGroup && this.nextBuildingInfo != null)
                {
                    BuildingTypeVO nextLevel   = buildingUpgradeCatalog.GetNextLevel(this.buildingInfo);
                    int            beamDamage3 = dataController.Get <TurretTypeVO>(nextLevel.TurretUid).ProjectileType.BeamDamage;
                    this.sliders[sliderIndex].NextLabel.Text = this.lang.Get("PLUS", new object[]
                    {
                        this.lang.ThousandsSeparated(beamDamage3 - beamDamage2)
                    });
                    this.sliders[sliderIndex].NextSlider.Value = ((beamDamage == 0) ? 0f : ((float)beamDamage3 / (float)beamDamage));
                    return;
                }
            }
            else
            {
                int dPS  = this.turretInfo.DPS;
                int dPS2 = turretTypeVO.DPS;
                this.sliders[1].DescLabel.Text = this.lang.Get("DAMAGE_DPS", new object[]
                {
                    ""
                });
                this.sliders[sliderIndex].CurrentLabel.Text   = this.lang.ThousandsSeparated(dPS);
                this.sliders[sliderIndex].CurrentSlider.Value = ((dPS2 == 0) ? 0f : ((float)dPS / (float)dPS2));
                if (this.useUpgradeGroup && this.nextBuildingInfo != null)
                {
                    BuildingTypeVO nextLevel2 = buildingUpgradeCatalog.GetNextLevel(this.buildingInfo);
                    int            dPS3       = dataController.Get <TurretTypeVO>(nextLevel2.TurretUid).DPS;
                    this.sliders[sliderIndex].NextLabel.Text = this.lang.Get("PLUS", new object[]
                    {
                        this.lang.ThousandsSeparated(dPS3 - dPS)
                    });
                    this.sliders[sliderIndex].NextSlider.Value = ((dPS2 == 0) ? 0f : ((float)dPS3 / (float)dPS2));
                }
            }
        }
コード例 #2
0
        private void UpdateShieldRange(int sliderIndex)
        {
            ShieldController       shieldController       = Service.Get <ShieldController>();
            BuildingUpgradeCatalog buildingUpgradeCatalog = Service.Get <BuildingUpgradeCatalog>();
            BuildingTypeVO         maxLevel = buildingUpgradeCatalog.GetMaxLevel(this.buildingInfo.UpgradeGroup);
            int num  = shieldController.PointsToRange[this.buildingInfo.ShieldRangePoints];
            int num2 = shieldController.PointsToRange[maxLevel.ShieldRangePoints];

            this.sliders[sliderIndex].CurrentSlider.Value = ((num2 == 0) ? 0f : ((float)num / (float)num2));
            if (this.useUpgradeGroup)
            {
                BuildingTypeVO nextLevel = buildingUpgradeCatalog.GetNextLevel(this.buildingInfo);
                int            num3      = shieldController.PointsToRange[nextLevel.ShieldRangePoints];
                this.sliders[sliderIndex].CurrentLabel.Text = this.lang.ThousandsSeparated(num);
                this.sliders[sliderIndex].NextLabel.Text    = this.lang.Get("PLUS", new object[]
                {
                    this.lang.ThousandsSeparated(num3 - num)
                });
                this.sliders[sliderIndex].NextSlider.Value = ((num2 == 0) ? 0f : ((float)num3 / (float)num2));
                return;
            }
            this.sliders[sliderIndex].CurrentLabel.Text = this.lang.Get("FRACTION", new object[]
            {
                this.lang.ThousandsSeparated(num),
                this.lang.ThousandsSeparated(num2)
            });
        }
コード例 #3
0
        private void UpgradeChampionToMatchPlatform(SmartEntity building)
        {
            BuildingTypeVO buildingType = building.BuildingComp.BuildingType;
            TroopTypeVO    troopTypeVO  = this.FindChampionTypeIfPlatform(buildingType);

            if (troopTypeVO == null)
            {
                return;
            }
            BuildingUpgradeCatalog buildingUpgradeCatalog = Service.Get <BuildingUpgradeCatalog>();
            BuildingTypeVO         nextLevel    = buildingUpgradeCatalog.GetNextLevel(buildingType);
            TroopTypeVO            troopTypeVO2 = this.FindChampionTypeIfPlatform(nextLevel);

            if (troopTypeVO2 == null)
            {
                return;
            }
            this.AddChampionToInventoryIfAlive(building, false);
            CurrentPlayer currentPlayer = Service.Get <CurrentPlayer>();

            UnlockedLevelData.UpgradeTroopsOrStarshipsInventory(currentPlayer.Inventory.Champion, false, troopTypeVO2.UpgradeGroup, troopTypeVO2.Uid);
            this.DestroyChampionEntity(troopTypeVO);
            if (Service.Get <GameStateMachine>().CurrentState is HomeState)
            {
                this.CreateChampionEntity(troopTypeVO2, building);
            }
        }
コード例 #4
0
        private void UpdateShieldHealth(int sliderIndex)
        {
            ShieldController       shieldController       = Service.ShieldController;
            BuildingUpgradeCatalog buildingUpgradeCatalog = Service.BuildingUpgradeCatalog;
            BuildingTypeVO         maxLevel = buildingUpgradeCatalog.GetMaxLevel(this.buildingInfo.UpgradeGroup);
            int num  = shieldController.PointsToHealth[this.buildingInfo.ShieldHealthPoints];
            int num2 = shieldController.PointsToHealth[maxLevel.ShieldHealthPoints];

            this.sliders[sliderIndex].CurrentSlider.Value = ((num2 != 0) ? ((float)num / (float)num2) : 0f);
            if (this.useUpgradeGroup)
            {
                BuildingTypeVO nextLevel = buildingUpgradeCatalog.GetNextLevel(this.buildingInfo);
                int            num3      = shieldController.PointsToHealth[nextLevel.ShieldHealthPoints];
                this.sliders[sliderIndex].CurrentLabel.Text = this.lang.ThousandsSeparated(num);
                this.sliders[sliderIndex].NextLabel.Text    = this.lang.Get("PLUS", new object[]
                {
                    this.lang.ThousandsSeparated(num3 - num)
                });
                this.sliders[sliderIndex].NextSlider.Value = ((num2 != 0) ? ((float)num3 / (float)num2) : 0f);
            }
            else
            {
                this.sliders[sliderIndex].CurrentLabel.Text = this.lang.Get("FRACTION", new object[]
                {
                    this.lang.ThousandsSeparated(num),
                    this.lang.ThousandsSeparated(num2)
                });
            }
        }
コード例 #5
0
        protected override void SetSelectedBuilding(SmartEntity newSelectedBuilding)
        {
            base.SetSelectedBuilding(newSelectedBuilding);
            BuildingUpgradeCatalog buildingUpgradeCatalog = Service.BuildingUpgradeCatalog;

            this.nextBuildingInfo = buildingUpgradeCatalog.GetNextLevel(this.buildingInfo);
            this.maxBuildingInfo  = buildingUpgradeCatalog.GetMaxLevel(this.buildingInfo.UpgradeGroup);
            this.reqMet           = Service.UnlockController.IsUnlocked(this.nextBuildingInfo, 1, out this.reqBuildingInfo);
        }
コード例 #6
0
        private void UpdateCapacity(int sliderIndex)
        {
            BuildingUpgradeCatalog buildingUpgradeCatalog = Service.Get <BuildingUpgradeCatalog>();
            int storage  = this.buildingInfo.Storage;
            int storage2 = buildingUpgradeCatalog.GetNextLevel(this.buildingInfo).Storage;
            int storage3 = buildingUpgradeCatalog.GetMaxLevel(this.buildingInfo.UpgradeGroup).Storage;

            this.UpdateSlider(sliderIndex, this.lang.Get("UPGRADE_FIELD_CAPACITY", new object[0]), storage, storage2, storage3);
        }
コード例 #7
0
        public ChampionInfoScreen(SmartEntity platformBuilding, TroopTypeVO championType, bool forUpgrade) : base(new TroopUpgradeTag(championType, true), null, forUpgrade, platformBuilding)
        {
            this.wantsTransition   = true;
            this.shouldCloseParent = false;
            BuildingUpgradeCatalog buildingUpgradeCatalog = Service.BuildingUpgradeCatalog;

            this.nextBuildingInfo = buildingUpgradeCatalog.GetNextLevel(this.buildingInfo);
            this.maxBuildingInfo  = buildingUpgradeCatalog.GetMaxLevel(this.buildingInfo);
            TroopTypeVO nextLevel = Service.TroopUpgradeCatalog.GetNextLevel(this.selectedTroop.Troop as TroopTypeVO);

            this.selectedTroop.ReqMet = Service.UnlockController.CanDeployableBeUpgraded(this.selectedTroop.Troop, nextLevel, out this.selectedTroop.RequirementText, out this.selectedTroop.ShortRequirementText);
        }
コード例 #8
0
        private void UpdateCapacity(int sliderIndex)
        {
            BuildingUpgradeCatalog buildingUpgradeCatalog = Service.BuildingUpgradeCatalog;
            int          storage      = this.buildingInfo.Storage;
            int          storage2     = buildingUpgradeCatalog.GetNextLevel(this.buildingInfo).Storage;
            int          storage3     = buildingUpgradeCatalog.GetMaxLevel(this.buildingInfo.UpgradeGroup).Storage;
            DeliveryType deliveryType = this.deliveryType;
            string       id;

            if (deliveryType != DeliveryType.Vehicle)
            {
                if (deliveryType != DeliveryType.Starship)
                {
                    if (deliveryType != DeliveryType.Mercenary)
                    {
                        id = "UPGRADE_FIELD_CAPACITY";
                    }
                    else
                    {
                        id = "UPGRADE_FIELD_MERCENARY_CAPACITY";
                    }
                }
                else
                {
                    id = "UPGRADE_FIELD_STARSHIP_CAPACITY";
                }
            }
            else
            {
                id = "UPGRADE_FIELD_VEHICLE_CAPACITY";
            }
            SliderControl sliderControl = this.sliders[sliderIndex];

            sliderControl.DescLabel.Text      = this.lang.Get(id, new object[0]);
            sliderControl.CurrentLabel.Text   = this.lang.ThousandsSeparated(storage);
            sliderControl.CurrentSlider.Value = ((storage3 != 0) ? ((float)storage / (float)storage3) : 0f);
            if (storage2 > storage)
            {
                sliderControl.NextLabel.Text = this.lang.Get("PLUS", new object[]
                {
                    this.lang.ThousandsSeparated(storage2 - storage)
                });
                sliderControl.NextSlider.Value = ((storage3 != 0) ? ((float)storage2 / (float)storage3) : 0f);
            }
            else
            {
                sliderControl.NextLabel.Visible  = false;
                sliderControl.NextSlider.Visible = false;
            }
        }
コード例 #9
0
        private void UpdateCapacity(int sliderIndex)
        {
            BuildingUpgradeCatalog buildingUpgradeCatalog = Service.Get <BuildingUpgradeCatalog>();
            int storage  = this.buildingInfo.Storage;
            int storage2 = buildingUpgradeCatalog.GetNextLevel(this.buildingInfo).Storage;
            int storage3 = buildingUpgradeCatalog.GetMaxLevel(this.buildingInfo.UpgradeGroup).Storage;

            this.sliders[sliderIndex].DescLabel.Text    = this.lang.Get("UPGRADE_FIELD_CAPACITY", new object[0]);
            this.sliders[sliderIndex].CurrentLabel.Text = this.lang.ThousandsSeparated(storage);
            this.sliders[sliderIndex].NextLabel.Text    = this.lang.Get("PLUS", new object[]
            {
                this.lang.ThousandsSeparated(storage2 - storage)
            });
            this.sliders[sliderIndex].CurrentSlider.Value = ((storage3 == 0) ? 0f : ((float)storage / (float)storage3));
            this.sliders[sliderIndex].NextSlider.Value    = ((storage3 == 0) ? 0f : ((float)storage2 / (float)storage3));
        }
コード例 #10
0
        public void InitStorage(int sliderIndex, string description)
        {
            BuildingUpgradeCatalog buildingUpgradeCatalog = Service.BuildingUpgradeCatalog;
            int            storage       = this.buildingInfo.Storage;
            BuildingTypeVO nextLevel     = buildingUpgradeCatalog.GetNextLevel(this.buildingInfo);
            int            num           = (nextLevel != null) ? nextLevel.Storage : storage;
            int            storage2      = buildingUpgradeCatalog.GetMaxLevel(this.buildingInfo.UpgradeGroup).Storage;
            SliderControl  sliderControl = this.sliders[sliderIndex];

            sliderControl.DescLabel.Text      = this.lang.Get(description, new object[0]);
            sliderControl.CurrentLabel.Text   = this.lang.ThousandsSeparated(storage);
            sliderControl.CurrentSlider.Value = ((storage2 != 0) ? ((float)storage / (float)storage2) : 0f);
            sliderControl.NextLabel.Text      = this.lang.Get("PLUS", new object[]
            {
                this.lang.ThousandsSeparated(num - storage)
            });
            sliderControl.NextSlider.Value = ((storage2 != 0) ? ((float)num / (float)storage2) : 0f);
        }
コード例 #11
0
        private void UpdateCapacity(int sliderIndex)
        {
            BuildingUpgradeCatalog buildingUpgradeCatalog = Service.Get <BuildingUpgradeCatalog>();
            int storage  = this.buildingInfo.Storage;
            int storage2 = buildingUpgradeCatalog.GetNextLevel(this.buildingInfo).Storage;
            int storage3 = buildingUpgradeCatalog.GetMaxLevel(this.buildingInfo.UpgradeGroup).Storage;

            this.sliders[sliderIndex].DescLabel.Text    = this.lang.Get("STORAGE_CAPACITY", new object[0]);
            this.sliders[sliderIndex].CurrentLabel.Text = this.lang.ThousandsSeparated(storage);
            this.sliders[sliderIndex].NextLabel.Text    = this.lang.Get("PLUS", new object[]
            {
                this.lang.ThousandsSeparated(storage2 - storage)
            });
            this.sliders[sliderIndex].CurrentSlider.Value = ((storage3 == 0) ? 0f : ((float)storage / (float)storage3));
            this.sliders[sliderIndex].NextSlider.Value    = ((storage3 == 0) ? 0f : ((float)storage2 / (float)storage3));
            int   num        = StorageSpreadUtils.CalculateAssumedCurrencyInStorage(this.buildingInfo.Currency, this.selectedBuilding);
            int   storage4   = this.buildingInfo.Storage;
            float meterValue = (storage4 == 0) ? 0f : ((float)num / (float)storage4);

            this.projector.Config.MeterValue = meterValue;
        }
コード例 #12
0
        private void UpdateCapacity(int sliderIndex)
        {
            BuildingUpgradeCatalog buildingUpgradeCatalog = Service.Get <BuildingUpgradeCatalog>();
            int storage  = this.buildingInfo.Storage;
            int storage2 = buildingUpgradeCatalog.GetNextLevel(this.buildingInfo).Storage;
            int storage3 = buildingUpgradeCatalog.GetMaxLevel(this.buildingInfo.UpgradeGroup).Storage;

            this.sliders[sliderIndex].DescLabel.Text    = this.lang.Get("UPGRADE_FIELD_STORAGE", new object[0]);
            this.sliders[sliderIndex].CurrentLabel.Text = this.lang.ThousandsSeparated(storage);
            this.sliders[sliderIndex].NextLabel.Text    = this.lang.Get("PLUS", new object[]
            {
                this.lang.ThousandsSeparated(storage2 - storage)
            });
            this.sliders[sliderIndex].CurrentSlider.Value = ((storage3 == 0) ? 0f : ((float)storage / (float)storage3));
            this.sliders[sliderIndex].NextSlider.Value    = ((storage3 == 0) ? 0f : ((float)storage2 / (float)storage3));
            BuildingComponent buildingComponent = this.selectedBuilding.Get <BuildingComponent>();
            int   accruedCurrency = buildingComponent.BuildingTO.AccruedCurrency;
            int   storage4        = this.buildingInfo.Storage;
            float meterValue      = (storage4 == 0) ? 0f : ((float)accruedCurrency / (float)storage4);

            this.projector.Config.MeterValue = meterValue;
        }
コード例 #13
0
        protected virtual void InitHitpoints(int sliderIndex)
        {
            this.hitpointSliderIndex = sliderIndex;
            this.sliders[sliderIndex].CurrentLabel.Visible  = true;
            this.sliders[sliderIndex].CurrentSlider.Visible = true;
            this.sliders[sliderIndex].DescLabel.Visible     = true;
            this.sliders[sliderIndex].Background.Visible    = true;
            string text;

            if (this.useUpgradeGroup && this.nextBuildingInfo != null)
            {
                text = this.lang.Get("BUILDING_HITPOINTS", new object[0]);
                BuildingUpgradeCatalog buildingUpgradeCatalog = Service.BuildingUpgradeCatalog;
                int health  = this.buildingInfo.Health;
                int health2 = buildingUpgradeCatalog.GetNextLevel(this.buildingInfo).Health;
                int health3 = buildingUpgradeCatalog.GetMaxLevel(this.buildingInfo.UpgradeGroup).Health;
                this.sliders[sliderIndex].CurrentLabel.Text = this.lang.ThousandsSeparated(health);
                this.sliders[sliderIndex].NextLabel.Text    = this.lang.Get("PLUS", new object[]
                {
                    this.lang.ThousandsSeparated(health2 - health)
                });
                this.sliders[sliderIndex].CurrentSlider.Value = ((health3 != 0) ? ((float)health / (float)health3) : 0f);
                this.sliders[sliderIndex].NextSlider.Value    = ((health3 != 0) ? ((float)health2 / (float)health3) : 0f);
            }
            else
            {
                text = this.lang.Get("BUILDING_HITPOINTS", new object[0]);
                this.UpdateHitpoints();
            }
            this.sliders[this.hitpointSliderIndex].DescLabel.Text = text;
            if (!this.observingClockViewTime && Service.PostBattleRepairController.IsEntityInRepair(this.selectedBuilding))
            {
                Service.ViewTimeEngine.RegisterClockTimeObserver(this, 1f);
                this.observingClockViewTime = true;
            }
        }
コード例 #14
0
        protected override void UpdateReputation(int sliderIndex)
        {
            Inventory inventory = Service.Get <CurrentPlayer>().Inventory;

            if (!inventory.HasItem("reputation"))
            {
                this.sliders[sliderIndex].HideAll();
                Service.Get <StaRTSLogger>().WarnFormat("No reputation found in your inventory", new object[0]);
                return;
            }
            BuildingUpgradeCatalog buildingUpgradeCatalog = Service.Get <BuildingUpgradeCatalog>();
            int itemCapacity = inventory.GetItemCapacity("reputation");
            int reputationCapacityForLevel  = GameUtils.GetReputationCapacityForLevel(buildingUpgradeCatalog.GetNextLevel(this.buildingInfo).Lvl);
            int reputationCapacityForLevel2 = GameUtils.GetReputationCapacityForLevel(buildingUpgradeCatalog.GetMaxLevel(this.buildingInfo.UpgradeGroup).Lvl);

            this.UpdateSlider(sliderIndex, this.lang.Get("BUILDING_REPUTATION", new object[0]), itemCapacity, reputationCapacityForLevel, reputationCapacityForLevel2);
        }