示例#1
0
        public override void FillTab()
        {
            var selected = Find.Selector.SingleSelectedThing as ThingWithComps;

            if (Drawer == null)
            {
                if (Colorable == null)
                {
                    Log.Warning("selected thing has no CompPauldronDrawer for ITab_ToggleLivelry");
                }
                labelKey = "AdeptusMechanicus.Customize";
            }
            else
            {
                labelKey = Drawer.Props.labelKey;  //"UM_TabToggleDef";//.Translate();
            }
            var rect = new Rect(17f, 17f, ITab_ToggleLivelry.CardSize().x, ITab_ToggleLivelry.CardSize().y);

            var ts    = Text.CalcSize(selected.def.LabelCap).x;
            var y     = rect.y;
            var rect2 = new Rect(rect.width / 2 - ts + SpacingOffset, y, rect.width, HeaderSize);

            y        += rect2.height;
            Text.Font = GameFont.Medium;
            Widgets.Label(rect2, selected.def.LabelCap);

            if (Colorable != null)
            {
                Rect r = Colorable == null?rect.ContractedBy(4) : rect.TopPart(0.25f).ContractedBy(4);

                this.DrawCard(r, selected, Colorable);
            }

            if (Drawer != null)
            {
                Rect r = Colorable == null?rect.ContractedBy(4) : rect.BottomPart(0.75f).ContractedBy(4);

                this.DrawCard(r, selected, Drawer);
            }
        }
示例#2
0
 public ITab_ToggleLivelry()
 {
     size = ITab_ToggleLivelry.CardSize() + new Vector2(17f, 17f) * 2f;
 }