public static void CreateSettingsButton(OptionsMenu optionsMenu) { string toggleText = "OFF"; if (config.activated) { toggleText = "ON"; } optionsMenu.AddHeader(0, "Trippy Menu"); toggleButton = optionsMenu.AddButton (0, toggleText, new Action(() => { if (config.activated) { config.activated = false; playPsychadelia = false; toggleButton.label.text = "OFF"; SaveConfig(); GameplayModifiers.I.mPsychedeliaPhase = 0.00000001f; timer = 0; } else { config.activated = true; playPsychadelia = true; toggleButton.label.text = "ON"; SaveConfig(); } }), null, "Turns Trippy Menu on or off"); speedSlider = optionsMenu.AddSlider ( 0, "Trippy Menu Cycle Speed", "P", new Action <float>((float n) => { config.speed = Mathf.Round((config.speed + n) * 1000.0f) / 1000.0f; UpdateSlider(speedSlider, "Speed : " + config.speed.ToString()); }), null, null, "Changes color cycle speed" ); speedSlider.label.text = "Speed : " + config.speed.ToString(); //MelonModLogger.Log("Buttons created"); menuSpawned = true; }
public static void UpdateSlider(OptionsMenuSlider slider, string text) { if (slider == null) { return; } else { slider.label.text = text; SaveConfig(); } }
public static void AddModPageToModMenu(ModPage modPage) { int buttonCol = 0; foreach (EntryType entryType in modPage.entryType) { switch (entryType) { case EntryType.Header: optionsMenu.AddHeader(0, modPage.headers[0]); modPage.headers.RemoveAt(0); buttonCol = 0; break; case EntryType.Button: ModButton b = modPage.buttons[0]; OptionsMenuButton omb = optionsMenu.AddButton(buttonCol, b.label, new System.Action(() => { b.onSelectedDelegate.Invoke(); }), null, b.helpText); omb.label.text = b.initialButtonText; modPage.buttons.RemoveAt(0); if (buttonCol == 0) { buttonCol = 1; } else { buttonCol = 0; } break; case EntryType.Slider: ModSlider s = modPage.sliders[0]; OptionsMenuSlider oms = optionsMenu.AddSlider(buttonCol, s.label, s.numberFormat, s.onAdjustAction, null); oms.label.text = s.initialSliderText; modPage.sliders.RemoveAt(0); if (buttonCol == 0) { buttonCol = 1; } else { buttonCol = 0; } break; default: break; } } }
public static void AddOptionsButtons(OptionsMenu optionsMenu) { void UpdateSlider(OptionsMenuSlider slider, string text) { if (slider == null) { return; } else { slider.label.text = text; SaveConfig(); } } OptionsMenuSlider MakeSlider(string label, OptionsMenuSlider.AdjustActionDelegate action, string helpText) { OptionsMenuSlider slider = optionsMenu.AddSlider ( 0, label, "P", action, null, null, helpText ); return(slider); } string positionSmoothingLabel = "Position Smoothing"; OptionsMenuSlider.AdjustActionDelegate positionSmoothingAction = new Action <float>((float n) => { positionSmoothing = Mathf.Round((positionSmoothing + (n * 0.001f)) * 1000.0f) / 1000.0f; UpdateSlider(positionSmoothingSlider, positionSmoothingLabel + " : " + positionSmoothing.ToString()); }); positionSmoothingSlider = MakeSlider(positionSmoothingLabel, positionSmoothingAction, "Changes how smooth positioning will be"); positionSmoothingSlider.label.text = positionSmoothingLabel + " : " + positionSmoothing.ToString(); string rotationSmoothingLabel = "Rotation Smoothing"; OptionsMenuSlider.AdjustActionDelegate rotationSmoothingAction = new Action <float>((float n) => { rotationSmoothing = Mathf.Round((rotationSmoothing + (n * 0.001f)) * 1000.0f) / 1000.0f; UpdateSlider(rotationSmoothingSlider, rotationSmoothingLabel + " : " + rotationSmoothing.ToString()); }); rotationSmoothingSlider = MakeSlider(rotationSmoothingLabel, rotationSmoothingAction, "Changes how smooth rotation will be"); rotationSmoothingSlider.label.text = rotationSmoothingLabel + " : " + rotationSmoothing.ToString(); string camOffsetLabel = "Horizontal Offset"; OptionsMenuSlider.AdjustActionDelegate camOffsetAction = new Action <float>((float n) => { camOffset = Mathf.Round((camOffset + (n * 0.1f)) * 10.0f) / 10.0f; UpdateSlider(camOffsetSlider, camOffsetLabel + " : " + camOffset.ToString()); }); camOffsetSlider = MakeSlider(camOffsetLabel, camOffsetAction, "Changes horizontal position"); camOffsetSlider.label.text = camOffsetLabel + " : " + camOffset.ToString(); string camHeightLabel = "Vertical Offset"; OptionsMenuSlider.AdjustActionDelegate camHeightAction = new Action <float>((float n) => { camHeight = Mathf.Round((camHeight + (n * 0.1f)) * 10.0f) / 10.0f; UpdateSlider(camHeightSlider, camHeightLabel + " : " + camHeight.ToString()); }); camHeightSlider = MakeSlider(camHeightLabel, camHeightAction, "Changes vertical position"); camHeightSlider.label.text = camHeightLabel + " : " + camHeight.ToString(); string camDistanceLabel = "Distance"; OptionsMenuSlider.AdjustActionDelegate camDistanceAction = new Action <float>((float n) => { camDistance = Mathf.Round((camDistance + (n * 0.1f)) * 10.0f) / 10.0f; UpdateSlider(camDistanceSlider, camDistanceLabel + " : " + camDistance.ToString()); }); camDistanceSlider = MakeSlider(camDistanceLabel, camDistanceAction, "Changes the distance"); camDistanceSlider.label.text = camDistanceLabel + " : " + camDistance.ToString(); string camRotationLabel = "Rotation"; OptionsMenuSlider.AdjustActionDelegate camRotationAction = new Action <float>((float n) => { camRotation = Mathf.Round((camRotation + (n * 0.1f)) * 10.0f) / 10.0f; UpdateSlider(camRotationSlider, camRotationLabel + " : " + camRotation.ToString()); }); camRotationSlider = MakeSlider(camRotationLabel, camRotationAction, "Changes the rotation"); camRotationSlider.label.text = camRotationLabel + " : " + camRotation.ToString(); optionsMenu.scrollable.AddRow(optionsMenu.AddHeader(0, "Follow Camera <size=5>Must be set to 3rd person static</size>")); optionsMenu.scrollable.AddRow(positionSmoothingSlider.gameObject); optionsMenu.scrollable.AddRow(rotationSmoothingSlider.gameObject); optionsMenu.scrollable.AddRow(camOffsetSlider.gameObject); optionsMenu.scrollable.AddRow(camHeightSlider.gameObject); optionsMenu.scrollable.AddRow(camDistanceSlider.gameObject); optionsMenu.scrollable.AddRow(camRotationSlider.gameObject); if (activated) { spectatorCam.previewCam.gameObject.SetActive(true); spectatorCam.previewCamDisplay.SetActive(true); } }
private static void AddButtons(OptionsMenu optionsMenu) { optionsMenu.AddHeader(0, "Skybox controls"); var RotationSlider = optionsMenu.AddSlider(0, "Skybox Rotation", "P", new Action <float>(x => { ArenaLoaderMod.RotateSkybox(x * 5); }), null); RotationSlider.label.text = "Rotation"; var ExposureSlider = optionsMenu.AddSlider(1, "Skybox Exposure", "P", new Action <float>(x => { ArenaLoaderMod.ChangeExposure(x * 0.05f); }), null); ExposureSlider.label.text = "Brightness"; var ReflectionSlider = optionsMenu.AddSlider(0, "Skybox Reflection", "P", new Action <float>(x => { ArenaLoaderMod.ChangeReflectionStrength(x * 0.05f); }), null); ReflectionSlider.label.text = "Reflection"; optionsMenu.AddTextBlock(0, "These settings will reset when you enter a new arena. A way to save current arena settings will be added in a future update"); optionsMenu.AddHeader(0, "Custom skybox"); OptionsMenuSlider skyboxSlider = optionsMenu.AddSlider(0, "Custom Skybox", null, new Action <float>((amount) => { ArenaLoaderMod.skyboxLoader.Index += (int)amount; }), new Func <float>(() => { return((float)ArenaLoaderMod.skyboxLoader.Index); }), new Action(() => { ArenaLoaderMod.skyboxLoader.Index = 0; }), "Skybox to load", new Func <float, string>((amount) => { if (ArenaLoaderMod.skyboxLoader.skyboxes.Count == 0) { return("Skybox folder is empty"); } Material currentSkybox = ArenaLoaderMod.skyboxLoader.skyboxes[ArenaLoaderMod.skyboxLoader.Index]; if (currentSkybox != null) { return(currentSkybox.name); } else { return("Skybox folder is empty"); } }), optionsMenu.sliderCustomModelPrefab); skyboxSlider.transform.Find("reload").gameObject.SetActive(false); // Disables the reload icon. optionsMenu.AddButton(0, "Apply skybox", new Action(() => { if (ArenaLoaderMod.skyboxLoader.skyboxes.Count == 0) { return; } var newSkybox = ArenaLoaderMod.skyboxLoader.skyboxes[ArenaLoaderMod.skyboxLoader.Index]; if (newSkybox != null) { ArenaLoaderMod.UpdateSkybox(newSkybox); } }), null, "Apply the currently selected skybox"); optionsMenu.AddButton(0, "Reload skybox folder", new Action(() => { ArenaLoaderMod.skyboxLoader.LoadSkyboxes(); }), null, "Deletes the currently loaded skyboxes and reloads the folder.\n<color=red>Only use this for working on skyboxes</color>"); optionsMenu.AddTextBlock(0, "Create your own custom skyboxes from images in Audica\\Mods\\Arenas\\Skyboxes\nTo reset a custom skybox, load a different arena."); }
public static void ShowPage(OptionsMenu optionsMenu, OptionsMenu.Page page) { if (page == OptionsMenu.Page.SpectatorCam && !menuCreated) { /*string toggleText = "OFF"; * * if (config.activated) * { * toggleText = "ON"; * } * * toggleButton = optionsMenu.AddButton * (0, * toggleText, * new Action(() => { * if (config.activated) * { * config.activated = false; * toggleButton.label.text = "OFF"; * SaveConfig(); * } * else * { * config.activated = true; * toggleButton.label.text = "ON"; * SaveConfig(); * } * }), * null, * "Turns the follow camera on or off"); */ positionSmoothingSlider = optionsMenu.AddSlider ( 0, "Position Speed", "P", new Action <float>((float n) => { config.positionSmoothing = Mathf.Round((config.positionSmoothing + (n * 0.001f)) * 1000.0f) / 1000.0f; UpdateSlider(positionSmoothingSlider, "Position Smoothing : " + config.positionSmoothing.ToString()); }), null, null, "Changes how smooth position will be" ); positionSmoothingSlider.label.text = "Position Smoothing : " + config.positionSmoothing.ToString(); rotationSmoothingSlider = optionsMenu.AddSlider ( 0, "Rotation Speed", "P", new Action <float>((float n) => { config.rotationSmoothing = Mathf.Round((config.rotationSmoothing + (n * 0.001f)) * 1000.0f) / 1000.0f; UpdateSlider(rotationSmoothingSlider, "Rotation Smoothing : " + config.rotationSmoothing.ToString()); }), null, null, "Changes how smooth rotation will be" ); rotationSmoothingSlider.label.text = "Rotation Smoothing : " + config.rotationSmoothing.ToString(); camOffsetSlider = optionsMenu.AddSlider ( 0, "Horizontal Offset", "P", new Action <float>((float n) => { config.camOffset = Mathf.Round((config.camOffset + (n * 0.1f)) * 10.0f) / 10.0f; UpdateSlider(camOffsetSlider, "Horizontal Offset : " + config.camOffset.ToString()); }), null, null, "Changes horizontal position" ); camOffsetSlider.label.text = "Horizontal Offset : " + config.camOffset.ToString(); camHeightSlider = optionsMenu.AddSlider ( 0, "Vertical Offset", "P", new Action <float>((float n) => { config.camHeight = Mathf.Round((config.camHeight + (n * 0.1f)) * 10.0f) / 10.0f; UpdateSlider(camHeightSlider, "Vertical Offset : " + config.camHeight.ToString()); }), null, null, "Changes vertical position" ); camHeightSlider.label.text = "Vertical Offset : " + config.camHeight.ToString(); camDistanceSlider = optionsMenu.AddSlider ( 0, "Distance", "P", new Action <float>((float n) => { config.camDistance = Mathf.Round((config.camDistance + (n * 0.1f)) * 10.0f) / 10.0f; UpdateSlider(camDistanceSlider, "Distance : " + config.camDistance.ToString()); }), null, null, "Changes the distance" ); camDistanceSlider.label.text = "Distance : " + config.camDistance.ToString(); camRotationSlider = optionsMenu.AddSlider ( 0, "Tilt", "P", new Action <float>((float n) => { config.camRotation = Mathf.Round((config.camRotation + (n * 0.1f)) * 10.0f) / 10.0f; UpdateSlider(camRotationSlider, "Rotation : " + config.camRotation.ToString()); }), null, null, "Changes the rotation" ); camRotationSlider.label.text = "Rotation : " + config.camRotation.ToString(); optionsMenu.scrollable.AddRow(optionsMenu.AddHeader(0, "Follow Camera <size=5>Must be set to 3rd person static</size>")); //optionsMenu.scrollable.AddRow(toggleButton.gameObject); optionsMenu.scrollable.AddRow(positionSmoothingSlider.gameObject); optionsMenu.scrollable.AddRow(rotationSmoothingSlider.gameObject); optionsMenu.scrollable.AddRow(camOffsetSlider.gameObject); optionsMenu.scrollable.AddRow(camHeightSlider.gameObject); optionsMenu.scrollable.AddRow(camDistanceSlider.gameObject); optionsMenu.scrollable.AddRow(camRotationSlider.gameObject); if (config.activated) { spectatorCam.previewCam.gameObject.SetActive(true); spectatorCam.previewCamDisplay.SetActive(true); } menuCreated = true; } else { menuCreated = false; } }