コード例 #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();
            }
        }