public void ResetToDefaultValues() { CallToInteractConfig.SetAllValuesToDefault(); CallToInteractConfig.SaveConfig(); SettingsConfig.SetAllValuesToDefault(); SettingsConfig.SaveConfig(); LoadConfigValuesIntoFields(); ValidateCursorColourPresets(); SaveValuesToConfig(); }
protected override void SaveValuesToConfig() { var config = SettingsConfig.Config; config.CursorDotSizeM = TryParseNewStringToFloat(ref config.CursorDotSizeM, cursorDotSize.text, true); config.CursorRingMaxScale = TryParseNewStringToFloat(ref config.CursorRingMaxScale, cursorMaxRingScale.text); config.CursorMaxRingScaleAtDistanceM = TryParseNewStringToFloat(ref config.CursorMaxRingScaleAtDistanceM, cursorMaxRingScaleAtDistance.text, true); config.CursorRingColor = TryParseHexColour(ref config.CursorRingColor, cursorRingColor.text); config.CursorRingOpacity = cursorRingOpacity.value; config.CursorDotFillColor = TryParseHexColour(ref config.CursorDotFillColor, cursorDotFillColor.text); config.CursorDotFillOpacity = cursorDotFillOpacity.value; config.CursorDotBorderColor = TryParseHexColour(ref config.CursorDotBorderColor, cursorDotBorderColor.text); config.CursorDotBorderOpacity = cursorDotBorderOpacity.value; config.UseScrollingOrDragging = scrollingOrDraggingTog.isOn; config.ShowSetupScreenOnStartup = setupOnStartup.isOn; config.SendHoverEvents = sendHoverEventsTog.isOn; config.DeadzoneRadius = cursorDeadzoneSlider.value; config.CursorVerticalOffset = TryParseNewStringToFloat(ref config.CursorVerticalOffset, cursorVerticalOffset.text, true); config.HoverCursorStartTimeS = HoverCursorStartTimeSlider.value; config.HoverCursorCompleteTimeS = HoverCursorCompleteTimeSlider.value; if (interactionTypeTogglePush.isOn) { config.InteractionSelection = InteractionSelection.Push; } else if (interactionTypeTogglePoke.isOn) { config.InteractionSelection = InteractionSelection.Poke; } else if (interactionTypeTogglePinch.isOn) { config.InteractionSelection = InteractionSelection.Grab; } else { config.InteractionSelection = InteractionSelection.Hover; } if (cursorColorPresetToggleLight.isOn) { config.CursorColorPreset = CursorColourPreset.light; } else if (cursorColorPresetToggleDark.isOn) { config.CursorColorPreset = CursorColourPreset.dark; } else if (cursorColorPresetToggleLightContrast.isOn) { config.CursorColorPreset = CursorColourPreset.white_Contrast; } else if (cursorColorPresetToggleDarkContrast.isOn) { config.CursorColorPreset = CursorColourPreset.black_Contrast; } else { config.CursorColorPreset = CursorColourPreset.custom; customCursorDotFillColour = config.CursorDotFillColor; customCursorDotBorderColour = config.CursorDotBorderColor; customCursorRingColour = config.CursorRingColor; customCursorDotFillOpacity = config.CursorDotFillOpacity; customCursorDotBorderOpacity = config.CursorDotBorderOpacity; customCursorRingOpacity = config.CursorRingOpacity; } var CTIconfig = CallToInteractConfig.Config; CTIconfig.Enabled = CTIEnableTog.isOn; CTIconfig.ShowTimeAfterNoHandPresent = TryParseNewStringToFloat(ref CTIconfig.ShowTimeAfterNoHandPresent, CTIShowTimer.text); CTIconfig.HideTimeAfterHandPresent = TryParseNewStringToFloat(ref CTIconfig.HideTimeAfterHandPresent, CTIHideTimer.text); if (CTIEndOnPresentTog.isOn) { CTIconfig.hideType = HideRequirement.PRESENT; } else if (CTIEndOnInteractionTog.isOn) { CTIconfig.hideType = HideRequirement.INTERACTION; } if (CTIFileDropdown.options.Count != 0) { CTIconfig.CurrentFileName = CTIFileDropdown.options[CTIFileDropdown.value].text; } SettingsConfig.UpdateConfig(config); CallToInteractConfig.UpdateConfig(CTIconfig); RestartSaveConfigTimer(); DisplayCursorPreview(); DisplayIntractionPreview(); }