private void UpdateContext() { GUI_OmniRange = RTUtil.FormatSI(Omni, "m"); GUI_DishRange = RTUtil.FormatSI(Dish, "m"); GUI_EnergyReq = RTUtil.FormatConsumption(Consumption); Events["EventTarget"].guiName = RTUtil.TargetName(Target); }
public void Draw() { if (Satellite == null) { return; } GUILayout.BeginHorizontal(); { GUILayout.TextField(Satellite.Name.Truncate(25), GUILayout.ExpandWidth(true)); RTUtil.Button(Localizer.Format("#RT_NetworkFB_NameButton"), () =>//"Name" { var vessel = RTUtil.GetVesselById(Satellite.Guid); if (vessel) { vessel.RenameVessel(); } }, GUILayout.ExpandWidth(false), GUILayout.Height(24)); } GUILayout.EndHorizontal(); mScrollPosition = GUILayout.BeginScrollView(mScrollPosition, GUILayout.ExpandHeight(true)); { Color pushColor = GUI.contentColor; TextAnchor pushAlign = GUI.skin.button.alignment; GUI.skin.button.alignment = TextAnchor.MiddleLeft; foreach (var a in Satellite.Antennas.Where(a => a.CanTarget)) { GUI.contentColor = (a.Powered) ? XKCDColors.ElectricLime : XKCDColors.Scarlet; String text = a.Name.Truncate(25) + Environment.NewLine + Localizer.Format("#RT_NetworkFB_Target") + RTUtil.TargetName(a.Target).Truncate(18);//"Target: " RTUtil.StateButton(text, Antenna, a, s => { Antenna = (s > 0) ? a : null; }); } GUI.skin.button.alignment = pushAlign; GUI.contentColor = pushColor; } GUILayout.EndScrollView(); }