public override void DoWindowContents(Rect inRect) { //create a 2 by 1 table ASTable table = new ASTable(inRect, 2, 1, 4, 0); Rect selectable = table.GetRectangle(0, 0); //seperate bottom part for cancel button Rect cancelrect = selectable.BottomPartPixels(30f); selectable.height -= 30f; CompBox.DrawListBox(selectable); if (Widgets.ButtonText(cancelrect, "Close".Translate())) { Close(); } //if something is selected, get comp, create label; if (CompBox.GetSelectedIndex != -1) { TradeRequestComp tc = CompBox.GetSelected; Widgets.Label(table.GetRectangle(1, 0), "RWAutoSell.NotifySummary".Translate(tc.parent.Faction.Name, tc.requestCount + "x " + tc.requestThingDef.LabelCap, tc.rewards.ContentsString) //"From: " + Environment.NewLine + tc.parent.Faction.Name + Environment.NewLine + Environment.NewLine + //"Request: " + Environment.NewLine + tc.requestCount + "x " + tc.requestThingDef.LabelCap + Environment.NewLine + Environment.NewLine + //"Reward: " + Environment.NewLine + tc.rewards.ContentsString ); //create rule, add rule to comp, notify Maintab needs a refresh, close dialog if (Widgets.ButtonText(table.GetRectangle(1, 0).BottomPartPixels(30f), "Create")) { ANRule newrule = new ANRule(CompBox.GetSelected); map.GetComponent <ANMapComp>().Add(newrule); ASLibMod.GuiRefresh = true; Close(); } } }
/// <summary> /// draw your rule options here. the first 30 points are reserved for Rule Description, leaving around 60 points height to play with /// </summary> /// <param name="inrect"></param> public override void DrawProperties(Rect inrect) { base.DrawProperties(inrect); Rect tablerect = new Rect(inrect.x, inrect.y + 30f, inrect.width, 30f); // here I use an ASTable object to segment each option into its own cell without having to control the width manually, // use a reference to RWASWidgets from RWAutoSeller if you wish to use it ASTable table = new ASTable(tablerect, 5, 1, 5, 5, true); ASWidgets.AlignedTextBox <int>(table.GetRectangle(0, 0), "RWAutoSell.Quantity".Translate(), ref Quant_, ref QCache, 0, int.MaxValue); if (Widgets.RadioButtonLabeled(table.GetRectangle(1, 0), "RWAutoSell.NotifyUnder".Translate(), NotifyUnder_)) { NotifyUnder_ = true; } if (Widgets.RadioButtonLabeled(table.GetRectangle(2, 0), "RWAutoSell.NotifyOver".Translate(), !NotifyUnder_)) { NotifyUnder_ = false; } }