Exemplo n.º 1
0
        private void DrawCreateSettlementButton()
        {
            Text.Font   = GameFont.Small;
            Text.Anchor = TextAnchor.MiddleCenter;
            int buttonLength = 130;

            if (Widgets.ButtonText(new Rect((InitialSize.x - 32 - buttonLength) / 2f, 535, buttonLength, 32), "Settle".Translate() + ": (" + settlementCreationCost + ")")) //add inital cost
            {
                if (!CanCreateSettlementHere())
                {
                    return;
                }

                PaymentUtil.paySilver(settlementCreationCost);

                //create settle event
                FCEvent evt = FCEventMaker.MakeEvent(FCEventDefOf.settleNewColony);
                evt.location        = currentTileSelected;
                evt.planetName      = Find.World.info.name;
                evt.timeTillTrigger = Find.TickManager.TicksGame + timeToTravel;
                evt.source          = faction.capitalLocation;
                faction.addEvent(evt);

                faction.settlementCaravansList.Add(evt.location.ToString());
                Messages.Message("CaravanSentToLocation".Translate() + " " + (evt.timeTillTrigger - Find.TickManager.TicksGame).ToTimeString() + "!", MessageTypeDefOf.PositiveEvent);

                DoPostEventCreationTraitThings();
            }
        }
Exemplo n.º 2
0
        public override void DoWindowContents(Rect inRect)
        {
            //grab before anchor/font
            GameFont   fontBefore   = Text.Font;
            TextAnchor anchorBefore = Text.Anchor;



            //Settlement Tax Collection Header
            Text.Anchor = TextAnchor.MiddleCenter;
            Text.Font   = GameFont.Small;

            Widgets.Label(label_Title, "SendSilverToColony".Translate());
            Widgets.Label(label_Upper, TranslatorFormattedStringExtensions.Translate("SendingXSilver", selectedSilver));


            selectedSilver = (int)Widgets.HorizontalSlider(slider, selectedSilver, 0, silverCount, roundTo: 1);

            Widgets.Label(label_Lower, TranslatorFormattedStringExtensions.Translate(stringEffect, returnValue(selectedSilver)));

            if (Widgets.ButtonText(button_Confirm, "FCConfirm".Translate()))
            {
                PaymentUtil.paySilver(selectedSilver);
                this.useValue(selectedSilver);
                this.Close();
            }

            //reset anchor/font
            Text.Font   = fontBefore;
            Text.Anchor = anchorBefore;
        }
        /// <summary>
        /// Attempts to create an upgrading <c>FCEvent</c> for a <c>SettlementFC</c>.
        /// </summary>
        /// <returns>A message describing if the process was successful or not, including a reason in case it was not</returns>
        private Message UpgradeSettlement()
        {
            //failure reasons
            if (settlement.IsBeingUpgraded)
            {
                return(new Message("AlreadyUpgradeSettlement".Translate(), MessageTypeDefOf.RejectInput));
            }
            if (settlement.isUnderAttack)
            {
                return(new Message("SettlementUnderAttack".Translate(), MessageTypeDefOf.RejectInput));
            }
            if (PaymentUtil.getSilver() < settlementUpgradeCost)
            {
                return(new Message("NotEnoughSilverUpgrade".Translate(), MessageTypeDefOf.RejectInput));
            }

            //on success
            PaymentUtil.paySilver(settlementUpgradeCost);
            FCEvent tmp = new FCEvent(true)
            {
                def             = FCEventDefOf.upgradeSettlement,
                location        = settlement.mapLocation,
                planetName      = settlement.planetName,
                timeTillTrigger = Find.TickManager.TicksGame + (settlement.settlementLevel + 1) * 60000 * (factionfc.hasPolicy(FCPolicyDefOf.isolationist) ? 1 : 2)
            };

            Find.World.GetComponent <FactionFC>().addEvent(tmp);

            //Close this window and update the SettlementWindowFc
            Find.WindowStack.TryRemove(this);
            Find.WindowStack.WindowOfType <SettlementWindowFc>().windowUpdateFc();

            return(new Message("StartUpgradeSettlement".Translate(), MessageTypeDefOf.NeutralEvent));
        }
Exemplo n.º 4
0
        public override void DoWindowContents(Rect inRect)
        {
            //grab before anchor/font
            GameFont   fontBefore   = Text.Font;
            TextAnchor anchorBefore = Text.Anchor;



            //Settlement Tax Collection Header
            Text.Anchor = TextAnchor.MiddleLeft;
            Text.Font   = GameFont.Medium;
            Widgets.DrawMenuSection(new Rect(0, 0, 544, 150));
            Widgets.Label(new Rect(10, 0, 500, 60), header);
            Widgets.DrawLineHorizontal(0, 155, 544);



            Text.Anchor = TextAnchor.UpperLeft;
            Text.Font   = GameFont.Tiny;
            Widgets.Label(new Rect(20, 60, 470, 90), desc);


            Text.Anchor = TextAnchor.MiddleLeft;
            Text.Font   = GameFont.Tiny;



            for (int i = 0; i < options.Count(); i++)
            {
                if (Widgets.ButtonTextSubtle(new Rect(xoffset, yoffset + (i * (height + yspacing)), length, height), ""))
                {
                    if (PaymentUtil.getSilver() >= options[i].silverCost)
                    {
                        PaymentUtil.paySilver(options[i].silverCost);

                        FCEventMaker.calculateSuccess(options[i], parentEvent);
                        //Log.Message(options[i].label);


                        Find.WindowStack.TryRemove(this);
                    }
                    else
                    {
                        Messages.Message("You do not have enough silver on the map to pay for that option", MessageTypeDefOf.RejectInput);
                    }
                }

                //label
                Widgets.Label(new Rect(xoffset + 5, yoffset + 5 + (i * (height + yspacing)), length - 10, height - 10), options[i].label);
            }
            //Widgets.DrawBox(new Rect(xoffset, yoffset - yspacing, length, height - yspacing * 2));

            //reset anchor/font
            Text.Font   = fontBefore;
            Text.Anchor = anchorBefore;
        }
Exemplo n.º 5
0
        public override void DoWindowContents(Rect inRect)
        {
            //grab before anchor/font
            GameFont   fontBefore   = Text.Font;
            TextAnchor anchorBefore = Text.Anchor;



            //Settlement Tax Collection Header
            Text.Anchor = TextAnchor.MiddleLeft;
            Text.Font   = GameFont.Medium;
            Widgets.Label(new Rect(2, 0, 300, 60), "EnactPolicy".Translate());



            //settlement buttons

            Text.Anchor = TextAnchor.MiddleCenter;
            Text.Font   = GameFont.Tiny;

            //0 tithe total string
            //1 source - -1
            //2 due/delivery date
            //3 Silver (- || +)
            //4 tithe

            List <String> headerList = new List <String>()
            {
                "Name".Translate(), "Cost".Translate(), "Effect".Translate(), "Enact".Translate()
            };

            for (int i = 0; i < 3; i++)              //-2 to exclude location and ID
            {
                if (i == 0)
                {
                    Widgets.Label(new Rect(xoffset + 2 + i * xspacing, yoffset - yspacing, xspacing + headerSpacing, yspacing), headerList[i]);
                }
                else
                {
                    Widgets.Label(new Rect(xoffset + headerSpacing + 2 + i * xspacing, yoffset - yspacing, xspacing, yspacing), headerList[i]);
                }
            }

            for (int i = 0; i < list.Count(); i++)             //browse through policy list
            {
                if (i * yspacing + scroll >= 0 && i * yspacing + scroll <= height)
                {
                    if (i % 2 == 0)
                    {
                        Widgets.DrawHighlight(new Rect(xoffset, yoffset + i * yspacing + scroll, length, yspacing));
                    }
                    for (int k = 0; k < 4; k++)                                                                                                                      //Browse through thing information
                    {
                        if (k == 0)                                                                                                                                  //name of policy
                        {
                            Widgets.Label(new Rect(xoffset + 2 + k * xspacing, yoffset + i * yspacing + scroll, xspacing + headerSpacing, yspacing), list[i].label); //timedue is date made
                        }
                        else
                        if (k == 1)                         //Cost of policy
                        {
                            Widgets.Label(new Rect(xoffset + headerSpacing + 2 + k * xspacing, yoffset + i * yspacing + scroll, xspacing, yspacing), list[i].cost.ToString());
                        }
                        else
                        if (k == 2)                         // Desc/Effect of policy
                        {
                            if (Widgets.ButtonText(new Rect(xoffset + headerSpacing + 2 + k * xspacing, yoffset + i * yspacing + scroll, xspacing, yspacing), "Info".Translate()))
                            {
                                Find.WindowStack.Add(new descWindowFC(list[i].desc, list[i].label));
                            }
                        }
                        else
                        if (k == 3)                         //Build button
                        {
                            if (list[i].defName == def.defName && list[i].defName != "Empty")
                            {
                                Widgets.Label(new Rect(xoffset + headerSpacing + 2 + k * xspacing, yoffset + i * yspacing + scroll, xspacing, yspacing), "Enacted".Translate());
                                if (Widgets.ButtonText(new Rect(xoffset + headerSpacing + 2 + (k + 1) * xspacing, yoffset + i * yspacing + scroll, xspacing, yspacing), "Repeal".Translate()))
                                {
                                    settlement.repealPolicy(policySlot);
                                    Find.WindowStack.TryRemove(this);
                                    Find.WindowStack.WindowOfType <settlementWindowFC>().WindowUpdateFC();
                                }
                            }
                            else
                            {
                                if (Widgets.ButtonText(new Rect(xoffset + headerSpacing + 2 + k * xspacing, yoffset + i * yspacing + scroll, xspacing, yspacing), "Enact".Translate()))
                                {
                                    if (settlement.validEnactPolicy(list[i], i))
                                    {
                                        FCEvent tmp = new FCEvent(true);
                                        tmp.def             = FCEventDefOf.enactSettlementPolicy;
                                        tmp.source          = settlement.mapLocation;
                                        tmp.policy          = list[i];
                                        tmp.policySlot      = policySlot;
                                        tmp.timeTillTrigger = Find.TickManager.TicksGame + list[i].enactDuration;
                                        //Log.Message(list[i].enactDuration.ToString());
                                        //Log.Message(tmp.timeTillTrigger.ToString());
                                        Find.World.GetComponent <FactionFC>().addEvent(tmp);
                                        PaymentUtil.paySilver(Convert.ToInt32(list[i].cost));
                                        settlement.repealPolicy(policySlot);
                                        settlement.policies[policySlot] = PolicyFCDefOf.Enacting;
                                        Messages.Message(list[i].label + " " + "WillBeEnactedIn".Translate() + " " + GenDate.ToStringTicksToDays(tmp.timeTillTrigger - Find.TickManager.TicksGame), MessageTypeDefOf.PositiveEvent);
                                        Find.WindowStack.TryRemove(this);
                                        Find.WindowStack.WindowOfType <settlementWindowFC>().WindowUpdateFC();
                                    }
                                }
                            }
                        }
                        else                         //Catch all
                        {
                            Widgets.Label(new Rect(xoffset + headerSpacing + 2 + k * xspacing, yoffset + i * yspacing + scroll, xspacing, yspacing), "REPORT THIS listpolicyfc");
                        }
                    }
                }
            }

            Widgets.DrawBox(new Rect(xoffset, yoffset - yspacing, length, height + yspacing * 2));

            //reset anchor/font
            Text.Font   = fontBefore;
            Text.Anchor = anchorBefore;

            if (Event.current.type == EventType.ScrollWheel)
            {
                scrollWindow(Event.current.delta.y);
            }
        }
Exemplo n.º 6
0
        public override void DoWindowContents(Rect inRect)
        {
            //grab before anchor/font
            GameFont   fontBefore   = Text.Font;
            TextAnchor anchorBefore = Text.Anchor;



            //Settlement Tax Collection Header
            Text.Anchor = TextAnchor.MiddleLeft;
            Text.Font   = GameFont.Medium;
            Widgets.Label(new Rect(2, 0, 300, 60), header);



            //settlement buttons

            Text.Anchor = TextAnchor.UpperLeft;
            Text.Font   = GameFont.Tiny;

            //0 tithe total string
            //1 source - -1
            //2 due/delivery date
            //3 Silver (- || +)
            //4 tithe

            if (settlement.settlementLevel < LoadedModManager.GetMod <FactionColoniesMod>().GetSettings <FactionColonies>().settlementMaxLevel)           //if settlement is not max level
            {
                if (Widgets.ButtonText(new Rect(xoffset + ((335 - 150) / 2), height + 10, 150, 40), "UpgradeSettlement".Translate() + ": " + settlementUpgradeCost))
                {                                                                                                                                       //if upgrade button clicked
                    //if max level
                    if (settlement.settlementLevel < LoadedModManager.GetMod <FactionColoniesMod>().GetSettings <FactionColonies>().settlementMaxLevel) //if below max level
                    {
                        if (PaymentUtil.getSilver() > settlementUpgradeCost)                                                                            //if have enough monies to pay
                        {
                            foreach (FCEvent evt in Find.World.GetComponent <FactionFC>().events)
                            {
                                if (evt.def == FCEventDefOf.upgradeSettlement && evt.location == settlement.mapLocation)
                                {                                 //if already existing event
                                    Messages.Message("AlreadyUpgradeSettlement".Translate(), MessageTypeDefOf.RejectInput);
                                    return;
                                }
                            }
                            PaymentUtil.paySilver(settlementUpgradeCost);
                            //settlement.upgradeSettlement();
                            FCEvent tmp = new FCEvent(true);
                            tmp.def             = FCEventDefOf.upgradeSettlement;
                            tmp.location        = settlement.mapLocation;
                            tmp.timeTillTrigger = Find.TickManager.TicksGame + (settlement.settlementLevel + 1) * 60000 * 2;
                            //Log.Message(list[i].enactDuration.ToString());
                            //Log.Message(tmp.timeTillTrigger.ToString());
                            Find.World.GetComponent <FactionFC>().addEvent(tmp);
                            Find.WindowStack.TryRemove(this);
                            Find.WindowStack.WindowOfType <settlementWindowFC>().WindowUpdateFC();
                            Messages.Message("StartUpgradeSettlement".Translate(), MessageTypeDefOf.NeutralEvent);
                        }
                        else
                        {                         //if don't have enough monies
                            Messages.Message("NotEnoughSilverUpgrade".Translate(), MessageTypeDefOf.RejectInput);
                        }
                    }
                    else
                    {
                        Messages.Message(settlement.name + " " + "AlreadyMaxLevel".Translate() + "!", MessageTypeDefOf.RejectInput);
                    }
                }
            }
            else               //if settlement is max level
            {
                desc = "CannotBeUpgradedPastMax".Translate() + ": " + LoadedModManager.GetMod <FactionColoniesMod>().GetSettings <FactionColonies>().settlementMaxLevel;
            }

            Widgets.Label(new Rect(xoffset + 2, yoffset - yspacing + 2, length - 4, height - 4 + yspacing * 2), desc);
            Widgets.DrawBox(new Rect(xoffset, yoffset - yspacing, length, height - yspacing * 2));



            //reset anchor/font
            Text.Font   = fontBefore;
            Text.Anchor = anchorBefore;
        }
Exemplo n.º 7
0
        //Drawing
        public override void DoWindowContents(Rect inRect)
        {
            FactionFC faction = Find.World.GetComponent <FactionFC>();

            faction.roadBuilder.displayPaths();

            if (Find.WorldSelector.selectedTile != -1 && Find.WorldSelector.selectedTile != currentTileSelected)
            {
                currentTileSelected = Find.WorldSelector.selectedTile;
                //Log.Message("Current: " + currentTileSelected + ", Selected: " + Find.WorldSelector.selectedTile);
                currentBiomeSelected = DefDatabase <BiomeResourceDef> .GetNamed(Find.WorldGrid.tiles[currentTileSelected].biome.ToString(), false);

                //default biome
                if (currentBiomeSelected == default(BiomeResourceDef))
                {
                    //Log Modded Biome
                    currentBiomeSelected = BiomeResourceDefOf.defaultBiome;
                }
                currentHillinessSelected = DefDatabase <BiomeResourceDef> .GetNamed(Find.WorldGrid.tiles[currentTileSelected].hilliness.ToString());

                if (currentBiomeSelected.canSettle == true && currentHillinessSelected.canSettle == true && currentTileSelected != 1)
                {
                    timeToTravel = FactionColonies.ReturnTicksToArrive(Find.World.GetComponent <FactionFC>().capitalLocation, currentTileSelected);
                }
                else
                {
                    timeToTravel = 0;
                }
            }


            //grab before anchor/font
            GameFont   fontBefore   = Text.Font;
            TextAnchor anchorBefore = Text.Anchor;


            int silverToCreateSettlement = (int)(traitUtilsFC.cycleTraits(new double(), "createSettlementMultiplier", Find.World.GetComponent <FactionFC>().traits, "multiply") * (FactionColonies.silverToCreateSettlement + (500 * (Find.World.GetComponent <FactionFC>().settlements.Count() + Find.World.GetComponent <FactionFC>().settlementCaravansList.Count())) + (traitUtilsFC.cycleTraits(new double(), "createSettlementBaseCost", Find.World.GetComponent <FactionFC>().traits, "add"))));



            //Draw Label
            Text.Font   = GameFont.Medium;
            Text.Anchor = TextAnchor.MiddleCenter;
            Widgets.Label(new Rect(0, 0, 268, 40), "SettleANewColony".Translate());

            //hori line
            Widgets.DrawLineHorizontal(0, 40, 300);


            //Upper menu
            Widgets.DrawMenuSection(new Rect(5, 45, 258, 220));

            DrawLabelBox(10, 50, 100, 100, "TravelTime".Translate(), GenDate.ToStringTicksToDays(timeToTravel));
            DrawLabelBox(153, 50, 100, 100, "InitialCost".Translate(), silverToCreateSettlement + " " + "Silver".Translate());


            //Lower Menu label
            Text.Font   = GameFont.Medium;
            Text.Anchor = TextAnchor.MiddleCenter;
            Widgets.Label(new Rect(0, 270, 268, 40), "BaseProductionStats".Translate());


            //Lower menu
            Widgets.DrawMenuSection(new Rect(5, 310, 258, 220));


            //Draw production
            Text.Font   = GameFont.Small;
            Text.Anchor = TextAnchor.MiddleCenter;

            //Production headers
            Widgets.Label(new Rect(40, 310, 60, 25), "Base".Translate());
            Widgets.Label(new Rect(110, 310, 60, 25), "Modifier".Translate());
            Widgets.Label(new Rect(180, 310, 60, 25), "Final".Translate());

            if (currentTileSelected != -1)
            {
                for (int i = 0; i < Find.World.GetComponent <FactionFC>().returnNumberResource(); i++)
                {
                    int height = 15;
                    if (Widgets.ButtonImage(new Rect(20, 335 + i * (5 + height), height, height), faction.returnResourceByInt(i).getIcon()))
                    {
                        Find.WindowStack.Add(new descWindowFC("SettlementProductionOf".Translate() + ": " + faction.returnResourceByInt(i).label, char.ToUpper(faction.returnResourceByInt(i).label[0]) + faction.returnResourceByInt(i).label.Substring(1)));
                    }
                    Widgets.Label(new Rect(40, 335 + i * (5 + height), 60, height + 2), (currentBiomeSelected.BaseProductionAdditive[i] + currentHillinessSelected.BaseProductionAdditive[i]).ToString());
                    Widgets.Label(new Rect(110, 335 + i * (5 + height), 60, height + 2), (currentBiomeSelected.BaseProductionMultiplicative[i] * currentHillinessSelected.BaseProductionMultiplicative[i]).ToString());
                    Widgets.Label(new Rect(180, 335 + i * (5 + height), 60, height + 2), ((currentBiomeSelected.BaseProductionAdditive[i] + currentHillinessSelected.BaseProductionAdditive[i]) * (currentBiomeSelected.BaseProductionMultiplicative[i] * currentHillinessSelected.BaseProductionMultiplicative[i])).ToString());
                }
            }



            //Settle button
            Text.Font   = GameFont.Small;
            Text.Anchor = TextAnchor.MiddleCenter;
            int buttonLength = 130;

            if (Widgets.ButtonText(new Rect((InitialSize.x - 32 - buttonLength) / 2f, 535, buttonLength, 32), "Settle".Translate() + ": (" + silverToCreateSettlement + ")")) //add inital cost
            {                                                                                                                                                                 //if click button to settle
                if (PaymentUtil.getSilver() >= silverToCreateSettlement)                                                                                                      //if have enough monies to make new settlement
                {
                    StringBuilder reason = new StringBuilder();
                    if (!TileFinder.IsValidTileForNewSettlement(currentTileSelected, reason) || currentTileSelected == -1 || Find.World.GetComponent <FactionFC>().checkSettlementCaravansList(currentTileSelected.ToString()))
                    {
                        //Alert Error to User
                        Messages.Message(reason.ToString() ?? "CaravanOnWay".Translate() + "!", MessageTypeDefOf.NegativeEvent);
                    }
                    else
                    {   //Else if valid tile
                        PaymentUtil.paySilver(silverToCreateSettlement);
                        //if PROCESS MONEY HERE

                        //create settle event
                        FCEvent tmp = FCEventMaker.MakeEvent(FCEventDefOf.settleNewColony);
                        tmp.location        = currentTileSelected;
                        tmp.planetName      = Find.World.info.name;
                        tmp.timeTillTrigger = Find.TickManager.TicksGame + timeToTravel;
                        tmp.source          = Find.World.GetComponent <FactionFC>().capitalLocation;
                        Find.World.GetComponent <FactionFC>().addEvent(tmp);

                        Find.World.GetComponent <FactionFC>().settlementCaravansList.Add(tmp.location.ToString());
                        Messages.Message("CaravanSentToLocation".Translate() + " " + GenDate.ToStringTicksToDays((tmp.timeTillTrigger - Find.TickManager.TicksGame)) + "!", MessageTypeDefOf.PositiveEvent);
                        // when event activate FactionColonies.createPlayerColonySettlement(currentTileSelected);
                    }
                }
                else
                {  //if don't have enough monies to make settlement
                    Messages.Message("NotEnoughSilverToSettle".Translate() + "!", MessageTypeDefOf.NeutralEvent);
                }
            }



            //reset anchor/font
            Text.Font   = fontBefore;
            Text.Anchor = anchorBefore;
        }
Exemplo n.º 8
0
        public override void DoWindowContents(Rect inRect)
        {
            //grab before anchor/font
            GameFont   fontBefore   = Text.Font;
            TextAnchor anchorBefore = Text.Anchor;

            //Buildings
            for (int i = 0; i < buildingList.Count; i++)
            {
                BuildingFCDef building = buildingList[i];
                newBuildingWindow = new Rect(BaseBuildingWindow.x, BaseBuildingWindow.y + (i * (rowHeight)) + scroll, BaseBuildingWindow.width, BaseBuildingWindow.height);
                newBuildingIcon   = new Rect(BaseBuildingIcon.x, BaseBuildingIcon.y + (i * (rowHeight)) + scroll, BaseBuildingIcon.width, BaseBuildingIcon.height);
                newBuildingLabel  = new Rect(BaseBuildingLabel.x, BaseBuildingLabel.y + (i * (rowHeight)) + scroll, BaseBuildingLabel.width, BaseBuildingLabel.height);
                newBuildingDesc   = new Rect(BaseBuildingDesc.x, BaseBuildingDesc.y + (i * (rowHeight)) + scroll, BaseBuildingDesc.width, BaseBuildingDesc.height);

                if (Widgets.ButtonInvisible(newBuildingWindow))
                {
                    //If click on building
                    List <FloatMenuOption> list = new List <FloatMenuOption>();

                    if (building == buildingDef)
                    {
                        //if the same building
                        list.Add(new FloatMenuOption("Destroy".Translate(), delegate
                        {
                            settlement.deconstructBuilding(buildingSlot);
                            Find.WindowStack.TryRemove(this);
                            Find.WindowStack.WindowOfType <SettlementWindowFc>().windowUpdateFc();
                        }));
                    }
                    else
                    {
                        //if not the same building
                        list.Add(new FloatMenuOption("Build".Translate(), delegate
                        {
                            if (!settlement.validConstructBuilding(building, buildingSlot, settlement))
                            {
                                return;
                            }
                            FCEvent tmpEvt = new FCEvent(true)
                            {
                                def          = FCEventDefOf.constructBuilding,
                                source       = settlement.mapLocation,
                                planetName   = settlement.planetName,
                                building     = building,
                                buildingSlot = buildingSlot
                            };


                            int triggerTime = building.constructionDuration;
                            if (factionfc.hasPolicy(FCPolicyDefOf.isolationist))
                            {
                                triggerTime /= 2;
                            }

                            tmpEvt.timeTillTrigger = Find.TickManager.TicksGame + triggerTime;
                            Find.World.GetComponent <FactionFC>().addEvent(tmpEvt);

                            PaymentUtil.paySilver(Convert.ToInt32(building.cost));
                            settlement.deconstructBuilding(buildingSlot);
                            Messages.Message(building.label + " " + "WillBeConstructedIn".Translate() + " " + (tmpEvt.timeTillTrigger - Find.TickManager.TicksGame).ToTimeString(), MessageTypeDefOf.PositiveEvent);
                            settlement.buildings[buildingSlot] = BuildingFCDefOf.Construction;
                            Find.WindowStack.TryRemove(this);
                            Find.WindowStack.WindowOfType <SettlementWindowFc>().windowUpdateFc();
                        }));
                    }



                    FloatMenu menu = new FloatMenu(list);
                    Find.WindowStack.Add(menu);
                }


                Widgets.DrawMenuSection(newBuildingWindow);
                Widgets.DrawMenuSection(newBuildingIcon);
                Widgets.DrawLightHighlight(newBuildingIcon);
                Widgets.ButtonImage(newBuildingIcon, building.Icon);

                Text.Font = GameFont.Small;
                Widgets.ButtonTextSubtle(newBuildingLabel, "");
                Widgets.Label(newBuildingLabel, "  " + building.LabelCap + " - " + "Cost".Translate() + ": " + building.cost);

                Text.Font = GameFont.Tiny;
                Widgets.Label(newBuildingDesc, building.desc);
            }


            //Top Window
            Widgets.DrawMenuSection(TopWindow);
            Widgets.DrawHighlight(TopWindow);
            Widgets.DrawMenuSection(TopIcon);
            Widgets.DrawLightHighlight(TopIcon);

            Widgets.DrawBox(new Rect(0, 0, 400, 500));
            Widgets.ButtonImage(TopIcon, buildingDef.Icon);

            Widgets.ButtonTextSubtle(TopName, "");
            Text.Font   = GameFont.Medium;
            Text.Anchor = TextAnchor.UpperLeft;
            Widgets.Label(new Rect(TopName.x + 5, TopName.y, TopName.width, TopName.height), buildingDef.LabelCap);

            Widgets.DrawMenuSection(new Rect(TopDescription.x - 5, TopDescription.y - 5, TopDescription.width, TopDescription.height));
            Text.Font = GameFont.Small;
            Widgets.Label(TopDescription, buildingDef.desc);

            Widgets.DrawLineHorizontal(0, TopWindow.y + TopWindow.height, 400);

            //reset anchor/font
            Text.Font   = fontBefore;
            Text.Anchor = anchorBefore;

            if (Event.current.type == EventType.ScrollWheel)
            {
                scrollWindow(Event.current.delta.y);
            }
        }