//TODO may need to add code that enabels a scroll bar should we ever need a station with that many WorkTypeDef(s). may also depend on resulution / UI Scale. protected override void FillTab() { Listing_Standard list = new Listing_Standard(); Rect inRect = new Rect(0f, 0f, this.size.x, this.size.y).ContractedBy(10f); list.Begin(inRect); list.Gap(); var rect = new Rect(); rect = list.GetRect(30f); Rect rect3 = rect; rect3.y -= 17; Widgets.Label(rect3, "ITab_DroneStation_HeaderLabel".Translate()); //Add Lable Explayning the pannel Widgets.Label(rect, "ITab_DroneStation_InfoLabel".Translate()); rect = list.GetRect(30f); Widgets.DrawLineHorizontal(rect.x, rect.y, itabwidth); foreach (WorkTypeDef def in droneInterface.GetWorkSettings.Keys.ToList()) { droneInterface.GetWorkSettings[def] = CheckboxHelper(rect, list, droneInterface.GetWorkSettings[def], def); } //Add The Sleep Times Overview //If There are Sleep Times configured if (droneInterface.GetSleepTimeList[0] != "") { rect = list.GetRect(30f); Widgets.DrawLineHorizontal(rect.x, rect.y, itabwidth); CommonGUIFunctions.Label(rect, "ITab_DroneStation_Sleeptimes".Translate(), richTextStyle); AddSleepDisplay(rect, list); } //Add the fule display if existing if (droneInterface.compRefuelable != null) { rect = list.GetRect(30f); Widgets.DrawLineHorizontal(rect.x, rect.y, itabwidth); CommonGUIFunctions.Label(rect, "ITab_DroneStation_SetTargetFuel".Translate(), richTextStyle); rect = list.GetRect(30f); list.Gap(); droneInterface.compRefuelable.TargetFuelLevel = Widgets.HorizontalSlider(rect, droneInterface.compRefuelable.TargetFuelLevel, 0, droneInterface.compRefuelable.Props.fuelCapacity, true, "SetTargetFuelLevel".Translate(droneInterface.compRefuelable.TargetFuelLevel), "0", droneInterface.compRefuelable.Props.fuelCapacity.ToString(), 1); } list.End(); }
private void AddSleepDisplay(Rect rect, Listing_Standard list) { rect = list.GetRect(30f); // droneInterface.GetSleepTimeList string txt = ""; for (int i = 0; i < 24; i++) { if (droneInterface.GetSleepTimeList.Contains(i.ToString())) { txt += "<color=red><b>" + i.ToString() + "</b></color> "; } else { txt += i.ToString() + " "; } } CommonGUIFunctions.Label(rect, txt, richTextStyle); }
public Listing_Standard ITab_Settings_AppendContent(Listing_Standard list, Rect parrent_rect) { var rect = new Rect(); rect = list.GetRect(30f); Rect rect3 = rect; rect3.y -= 17; Widgets.Label(rect3, "ITab_DroneStation_HeaderLabel".Translate()); //Add Lable Explayning the pannel Widgets.Label(rect, "ITab_DroneStation_InfoLabel".Translate()); rect = list.GetRect(30f); Widgets.DrawLineHorizontal(rect.x, rect.y, 400); foreach (WorkTypeDef def in droneStation.GetWorkSettings.Keys.ToList()) { droneStation.GetWorkSettings[def] = CheckboxHelper(rect, list, droneStation.GetWorkSettings[def], def); } //Add The Sleep Times Overview //If There are Sleep Times configured if (droneStation.GetSleepTimeList[0] != "") { rect = list.GetRect(30f); Widgets.DrawLineHorizontal(rect.x, rect.y, 400); CommonGUIFunctions.Label(rect, "ITab_DroneStation_Sleeptimes".Translate(), richTextStyle); rect = list.GetRect(30f); // droneInterface.GetSleepTimeList string txt = ""; for (int i = 0; i < 24; i++) { if (droneStation.GetSleepTimeList.Contains(i.ToString())) { txt += "<color=red><b>" + i.ToString() + "</b></color> "; } else { txt += i.ToString() + " "; } } CommonGUIFunctions.Label(rect, txt, richTextStyle); } //Add the fule display if existing if (droneStation.compRefuelable != null) { rect = list.GetRect(30f); Widgets.DrawLineHorizontal(rect.x, rect.y, 400); CommonGUIFunctions.Label(rect, "ITab_DroneStation_SetTargetFuel".Translate(), richTextStyle); rect = list.GetRect(30f); list.Gap(); droneStation.compRefuelable.TargetFuelLevel = Widgets.HorizontalSlider(rect, droneStation.compRefuelable.TargetFuelLevel, 0, droneStation.compRefuelable.Props.fuelCapacity, true, "SetTargetFuelLevel".Translate(droneStation.compRefuelable.TargetFuelLevel), "0", droneStation.compRefuelable.Props.fuelCapacity.ToString(), 1); } return(list); }