Example #1
0
 public void Setup(InputSettingsSave save)
 {
     Save = save;
 }
Example #2
0
        private void Start()
        {
            // Disable feedback text
            FeedbackText.SetText(string.Empty);
            FeedbackText.transform.parent.gameObject.SetActive(false);

            //Creates an empty settings file to load. This is because it will return null reference exceptions if it's not done first.
            DisplaySave = new DisplaySettingsSave();
            SoundSave   = new SoundSettingsSave();
            ControlSave = new ControlSettingsSave();
            InputSave   = new InputSettingsSave();

            // Setup buttons
            ButtonDisplay.interactable = false; // Set the display to be interactable by default

            ButtonDisplay.onClick.AddListener(delegate
            {
                PanelDisplay.SetActive(true);
                PanelSound.SetActive(false);
                PanelControls.SetActive(false);

                ButtonDisplay.interactable  = false;
                ButtonSound.interactable    = true;
                ButtonControls.interactable = true;
            });

            ButtonSound.onClick.AddListener(delegate
            {
                PanelDisplay.SetActive(false);
                PanelSound.SetActive(true);
                PanelControls.SetActive(false);

                ButtonDisplay.interactable  = true;
                ButtonSound.interactable    = false;
                ButtonControls.interactable = true;
            });

            ButtonControls.onClick.AddListener(delegate
            {
                PanelDisplay.SetActive(false);
                PanelSound.SetActive(false);
                PanelControls.SetActive(true);

                ButtonDisplay.interactable  = true;
                ButtonSound.interactable    = true;
                ButtonControls.interactable = false;
            });

            // Get components
            DisplaySettings = PanelDisplay.GetComponent <DisplaySettings>();
            SoundSettings   = PanelSound.GetComponent <SoundSettings>();
            ControlSettings = PanelControls.GetComponent <ControlSettings>();
            InputSettings   = PanelControls.GetComponent <InputSettings>();

            // Set the default screen
            PanelDisplay.SetActive(true);
            PanelSound.SetActive(false);
            PanelControls.SetActive(false);

            // Setup Options
            LoadSettings();
        }