Advertisement
NoneApplicableGames

Options Menu

Jul 29th, 2024
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.42 KB | Software | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5.  
  6.  
  7. //This will be a seperate class from MainMenuControl for ease of reading and to avoid any chance of spaghetti code
  8.  
  9. public class OptionsMenu : MonoBehaviour
  10. {
  11.     /// References to other objects in the scene
  12.     public Slider hoverDelaySlider;
  13.     public Slider effectDelaySlider;
  14.     public Toggle showEffectsToggle;
  15.     public Toggle holdToHoverToggle;
  16.     public Toggle holdToDragToggle;
  17.  
  18.    
  19.    
  20.     /// References to class instances we will use in this script
  21.     public Options optionsVaribles;
  22.     public MainMenuControl mainMenuControl;
  23.     public MenuControl menuControl;
  24.  
  25.  
  26.  
  27.     //Each slider/toggle has been seperated into its own function so we can use the editor's inbuilt on value changed wiget
  28.     //This way we dont have to call it every frame
  29.     public void setHoverDelay()
  30.     {
  31.         Options.HoverDelay = hoverDelaySlider.value;
  32.     }
  33.  
  34.     public void setShowEffects()
  35.     {
  36.         Options.ShowEffectsOnHover = showEffectsToggle.isOn;
  37.     }
  38.  
  39.     public void setEffectDisplayDelay()
  40.     {
  41.         Options.EffectDisplayDelay = effectDelaySlider.value;
  42.     }
  43.  
  44.     public void setHoldToHover()
  45.     {
  46.         //Options.HoldToHover = holdToHoverToggle.isOn;
  47.     }
  48.  
  49.     public void setHoldToDrag()
  50.     {
  51.         Options.HoldMouseButtonToDrag = holdToDragToggle.isOn;
  52.     }
  53.  
  54. }
  55.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement