public void OnSettingsUI(UIHelperBase helper) { // create a new group heading UIHelperBase group = helper.AddGroup("Game Day Timer Settings"); // add a check box to show/hide the timings GameDayTimerConfiguration config = Configuration <GameDayTimerConfiguration> .Load(); group.AddCheckbox("Show timings", config.PanelIsVisible, (bool isChecked) => { // save the visibility in the config file GameDayTimerConfiguration.SavePanelIsVisible(isChecked); // if there is a panel, show or hide it if (Panel != null) { Panel.isVisible = isChecked; } }); // add a button to reset the panel position group.AddButton("Reset Position", () => { // save the default position in the config file GameDayTimerConfiguration.SavePanelPosition(GameDayTimerPanel.DefaultPanelPositionX, GameDayTimerPanel.DefaultPanelPositionY); // if there is a panel, move it to the default position if (Panel != null) { Panel.MovePanelToPosition(GameDayTimerPanel.DefaultPanelPositionX, GameDayTimerPanel.DefaultPanelPositionY); } }); }
private void GameDayTimerPanel_eventMouseUp(UIComponent component, UIMouseEventParameter eventParam) { // if dragging, then drag is done, save final panel position if (Dragging) { GameDayTimerConfiguration.SavePanelPosition(relativePosition.x, relativePosition.y); } // reset dragging flags MouseDown = false; Dragging = false; }