コード例 #1
0
        private string GetBubbleText(SmartEntity building, bool homeState, bool editState, bool isSelected)
        {
            string     result     = null;
            GamePlayer worldOwner = GameUtils.GetWorldOwner();

            if (homeState)
            {
                BuildingTypeVO buildingType = building.BuildingComp.BuildingType;
                BuildingType   type         = buildingType.Type;
                switch (type)
                {
                case BuildingType.HQ:
                {
                    int numInventoryItemsNotViewed = GameUtils.GetNumInventoryItemsNotViewed();
                    if (!Service.CurrentPlayer.CampaignProgress.FueInProgress && numInventoryItemsNotViewed > 0)
                    {
                        result = Service.Lang.Get("HQ_BADGE", new object[0]);
                    }
                    return(result);
                }

                case BuildingType.Barracks:
                case BuildingType.Factory:
                case BuildingType.DefenseResearch:
                    goto IL_2DD;

                case BuildingType.FleetCommand:
                {
                    int totalStorageCapacity = worldOwner.Inventory.SpecialAttack.GetTotalStorageCapacity();
                    int totalStorageAmount   = worldOwner.Inventory.SpecialAttack.GetTotalStorageAmount();
                    if (totalStorageAmount >= totalStorageCapacity)
                    {
                        result = Service.Lang.Get("FULL", new object[0]);
                    }
                    else
                    {
                        result = LangUtils.GetBuildingVerb(buildingType.Type);
                    }
                    return(result);
                }

                case BuildingType.HeroMobilizer:
                {
                    int totalStorageCapacity2 = worldOwner.Inventory.Hero.GetTotalStorageCapacity();
                    int totalStorageAmount2   = worldOwner.Inventory.Hero.GetTotalStorageAmount();
                    if (totalStorageAmount2 >= totalStorageCapacity2)
                    {
                        result = Service.Lang.Get("FULL", new object[0]);
                    }
                    else
                    {
                        result = LangUtils.GetBuildingVerb(buildingType.Type);
                    }
                    return(result);
                }

                case BuildingType.ChampionPlatform:
                case BuildingType.Housing:
                case BuildingType.DroidHut:
                case BuildingType.Wall:
                case BuildingType.Turret:
IL_63:
                    switch (type)
                    {
                    case BuildingType.Cantina:
                    case BuildingType.NavigationCenter:
                        goto IL_2DD;

                    case BuildingType.ScoutTower:
                        return(result);

                    case BuildingType.Armory:
                        if (this.ShouldBadgeArmoryBuilding())
                        {
                            result = Service.Lang.Get("HQ_BADGE", new object[0]);
                        }
                        else if (ArmoryUtils.IsArmoryFull(Service.CurrentPlayer))
                        {
                            result = Service.Lang.Get("ARMORY_TOOLTIP_FULL", new object[0]);
                        }
                        else if (ArmoryUtils.IsArmoryEmpty(Service.CurrentPlayer))
                        {
                            result = Service.Lang.Get("ARMORY_TOOLTIP_EMPTY", new object[0]);
                        }
                        else
                        {
                            result = LangUtils.GetBuildingVerb(buildingType.Type);
                        }
                        return(result);

                    default:
                        return(result);
                    }
                    break;

                case BuildingType.Squad:
                    if (worldOwner.Squad != null)
                    {
                        int donatedTroopStorageUsedByWorldOwner = SquadUtils.GetDonatedTroopStorageUsedByWorldOwner();
                        int storage = buildingType.Storage;
                        if (donatedTroopStorageUsedByWorldOwner >= storage)
                        {
                            result = Service.Lang.Get("FULL", new object[0]);
                        }
                        else
                        {
                            result = Service.Lang.Get("context_RequestTroops", new object[0]);
                        }
                    }
                    else
                    {
                        result = Service.Lang.Get("context_Join", new object[0]);
                    }
                    return(result);

                case BuildingType.Starport:
                    if (!isSelected)
                    {
                        int donatedTroopStorageUsedByWorldOwner;
                        int storage;
                        GameUtils.GetStarportTroopCounts(out donatedTroopStorageUsedByWorldOwner, out storage);
                        if (donatedTroopStorageUsedByWorldOwner >= storage)
                        {
                            result = Service.Lang.Get("FULL", new object[0]);
                        }
                    }
                    return(result);

                case BuildingType.TroopResearch:
                    if (this.ShouldBadgeResearchBuilding())
                    {
                        result = Service.Lang.Get("HQ_BADGE", new object[0]);
                    }
                    else
                    {
                        result = LangUtils.GetBuildingVerb(buildingType.Type);
                    }
                    return(result);
                }
                goto IL_63;
IL_2DD:
                result = LangUtils.GetBuildingVerb(buildingType.Type);
            }
            return(result);
        }