/// <summary> /// Constructor /// </summary> /// <param name="uiHost">The instance of the main UI class to link to </param> public UIElectricalView(DynamicBatteryStorageUI uiHost) : base(uiHost) { if (HighLogic.LoadedSceneIsEditor) { solarManager = new UISolarPanelManager(uiHost, this); } if (HighLogic.LoadedSceneIsFlight) { dbsManager = new UIDBSManager(uiHost, this); } foreach (KeyValuePair <string, List <ModuleDataHandler> > entry in producerCats) { // Currently always generated with Show = false producerCategoryUIItems.Add(entry.Key, new UIExpandableItem(entry.Key, entry.Value, dataHost, false, (col_width - 10f), powerFlowUnits)); } foreach (KeyValuePair <string, List <ModuleDataHandler> > entry in consumerCats) { // Currently always generated with Show = false consumerCategoryUIItems.Add(entry.Key, new UIExpandableItem(entry.Key, entry.Value, dataHost, false, (col_width - 10f), powerFlowUnits)); } if (Settings.DebugUIMode) { Utils.Log("[UI]: [ElectricalView]: New instance created"); } }
/// <summary> /// Constructor /// </summary> /// <param name="uiHost">The parent UI</param> /// <param name="view">The parent ElectricalView panel</param> public UIDBSManager(DynamicBatteryStorageUI uiHost, UIElectricalView view) : base(uiHost) { electricalView = view; if (Settings.DebugUIMode) { Utils.Log(String.Format("[UI DBS Manager] Created")); } }
/// <summary> /// Constructor /// </summary> /// <param name="catName">The code name of the category</param> /// <param name="catHandlers">The list of handlers for the categorym</param> /// <param name="uiHost">The instance of the main UI class</param> /// <param name="expandedState">Whether the widget should start extended or not</param> public UIExpandableItem(string catName, List <ModuleDataHandler> catHandlers, DynamicBatteryStorageUI uiHost, bool expandedState, float width, string uiUnit) : base(uiHost) { uiUnits = uiUnit; host = uiHost; expanded = expandedState; categoryName = String.Format("{0}", Settings.HandlerCategoryData[catName].title); colWidth = width; RefreshHandlers(catHandlers); if (Settings.DebugUIMode) { Utils.Log(String.Format("[UI]: [UIExpandableItem]: building UI element for category {0}", catName)); } }
public UIThermalView(DynamicBatteryStorageUI uiHost) : base(uiHost) { foreach (KeyValuePair <string, List <ModuleDataHandler> > entry in producerCats) { // Currently always generated with Show = false producerCategoryUIItems.Add(entry.Key, new UIExpandableItem(entry.Key, entry.Value, dataHost, false, (col_width - 10f), heatFlowUnits)); } foreach (KeyValuePair <string, List <ModuleDataHandler> > entry in consumerCats) { // Currently always generated with Show = false consumerCategoryUIItems.Add(entry.Key, new UIExpandableItem(entry.Key, entry.Value, dataHost, false, (col_width - 10f), heatFlowUnits)); } if (Settings.DebugUIMode) { Utils.Log("[UI]: [ThermalView]: New instance created"); } }
/// <summary> /// Constructor /// </summary> /// <param name="uiHost">The instance of the main UI class to link to </param> public UIView(DynamicBatteryStorageUI uiHost) : base(uiHost) { dataHost = uiHost; col_width = (uiHost.WindowPosition.width - 20f) / 2f; // Build all of the base data and UI components producerCategoryUIItems = new Dictionary <string, UIExpandableItem>(); consumerCategoryUIItems = new Dictionary <string, UIExpandableItem>(); consumerCats = new Dictionary <string, List <ModuleDataHandler> >(); producerCats = new Dictionary <string, List <ModuleDataHandler> >(); categoryNames = Settings.HandlerCategories; foreach (KeyValuePair <string, HandlerCategory> categoryEntry in Settings.HandlerCategoryData) { consumerCats.Add(categoryEntry.Key, new List <ModuleDataHandler>()); producerCats.Add(categoryEntry.Key, new List <ModuleDataHandler>()); } }
/// <summary> /// Constructor /// </summary> /// <param name="uiHost">The parent UI</param> /// <param name="view">The parent ElectricalView panel</param> public UISolarPanelManager(DynamicBatteryStorageUI uiHost, UIElectricalView view) : base(uiHost) { electricalView = view; sunBody = FlightGlobals.Bodies[0]; homeBody = FlightGlobals.GetHomeBody(); selectedBodyIndex = homeBody.flightGlobalsIndex; SelectBody(homeBody); refSunOrbitAlt = FlightGlobals.getAltitudeAtPos(homeBody.getPositionAtUT(0d), sunBody) / 1000000d; if (Settings.DebugUIMode) { Utils.Log(String.Format("[UI Solar Manager] Set home body to {0} (alt {1}), sun body to {2}", homeBody.name, FormatUtils.ToSI(refSunOrbitAlt, "F2"), sunBody.name)); } if (Settings.DebugUIMode) { Utils.Log(String.Format("[UI Solar Manager] Created")); } }