/// <summary> /// Performs initial setup /// </summary> /// <param name="parentTransform">Parent transform</param> /// <param name="targetPrefabInfo">Currently selected target prefab</param> internal override void Setup(Transform parentTransform, PrefabInfo targetPrefabInfo) { try { // Perform basic panel setup. base.Setup(parentTransform, targetPrefabInfo); Logging.Message("commencing InfoPanel setup"); // Replace all button. replaceAllButton = AddIconButton(this, MidControlX + replaceButton.width, ReplaceY, BigIconSize, ReplaceAllTooltipKey, ReplaceAllAtlas); replaceAllButton.eventClicked += ReplaceAll; // Probability. UIPanel probabilityPanel = Sliderpanel(this, MidControlX, ProbabilityY, SliderHeight); probabilitySlider = AddBOBSlider(probabilityPanel, 0f, "BOB_PNL_PRB", 0, 100, 1); probabilitySlider.TrueValue = 100f; probabilitySlider.LimitToVisible = true; // Angle. UIPanel anglePanel = Sliderpanel(this, MidControlX, AngleY, SliderHeight); angleSlider = AddBOBSlider(anglePanel, 0f, "BOB_PNL_ANG", -180, 180, 1); Logging.Message("Creating offset panel"); // Offset panel. UIPanel offsetPanel = Sliderpanel(this, MidControlX, OffsetPanelY, OffsetPanelHeight); UILabel offsetLabel = UIControls.AddLabel(offsetPanel, 0f, OffsetLabelY, Translations.Translate("BOB_PNL_OFF")); offsetLabel.textAlignment = UIHorizontalAlignment.Center; while (offsetLabel.width > MidControlWidth) { offsetLabel.textScale -= 0.05f; offsetLabel.PerformLayout(); } offsetLabel.relativePosition = new Vector2((offsetPanel.width - offsetLabel.width) / 2f, OffsetLabelY); // Offset sliders. xSlider = AddBOBSlider(offsetPanel, XOffsetY, "BOB_PNL_XOF", -8f, 8f, 0.01f); ySlider = AddBOBSlider(offsetPanel, YOffsetY, "BOB_PNL_YOF", -8f, 8f, 0.01f); zSlider = AddBOBSlider(offsetPanel, ZOffsetY, "BOB_PNL_ZOF", -8f, 8f, 0.01f); // Set initial button states. UpdateButtonStates(); // Normal/random toggle. randomCheck = UIControls.LabelledCheckBox((UIComponent)(object)this, hideVanilla.relativePosition.x, hideVanilla.relativePosition.y + hideVanilla.height + (Margin / 2f), Translations.Translate("BOB_PNL_RSW"), 12f, 0.7f); randomCheck.eventCheckChanged += RandomCheckChanged; // Random settings button. UIButton randomButton = UIControls.EvenSmallerButton(this, RightX - 200f, TitleHeight + Margin + 20f, Translations.Translate("BOB_PNL_RST")); randomButton.eventClicked += (control, clickEvent) => BOBRandomPanel.Create(); Logging.Message("InfoPanel setup completed"); } catch (Exception e) { Logging.LogException(e, "exception setting up InfoPanel"); } }
/// <summary> /// Performs initial setup /// </summary> /// <param name="parentTransform">Parent transform</param> /// <param name="targetPrefabInfo">Currently selected target prefab</param> internal override void Setup(Transform parentTransform, PrefabInfo targetPrefabInfo) { // Set target reference. currentNet = targetPrefabInfo as NetInfo; // Base setup. base.Setup(parentTransform, targetPrefabInfo); // Add pack button. UIButton packButton = UIControls.EvenSmallerButton(this, RightX - 200f, TitleHeight + (Margin / 2f), Translations.Translate("BOB_PNL_PKB")); packButton.eventClicked += (component, clickEvent) => PackPanelManager.Create(); // Populate target list and select target item. TargetList(); // Apply Harmony rendering patches. Patcher.PatchNetworkOverlays(true); }