Esempio n. 1
0
    new void Awake()
    {
        base.Awake();
        // dependencies
        audioController        = FindObjectOfType <V_AudioController>();
        crosshairRectTransform = currentCrosshair.rectTransform;
        crosshairOriginalSize  = new Vector2(crosshairRectTransform.rect.width, crosshairRectTransform.rect.height);
        // checking if dependencies are null to throw err
        if (audioController == null)
        {
            UIController.ThrowError("V_Settings: Awake: ome of the dependencies is null", UIController.CloseError);
        }
        // Settings main buttons
        UIController.IfClick_GoTo(videoBtn, () => UIController.Enable_DisableUI(videoPanel, controlsPanel, audioPanel, picPanel));
        UIController.IfClick_GoTo(controlsBtn, () => UIController.Enable_DisableUI(controlsPanel, videoPanel, audioPanel, picPanel));
        UIController.IfClick_GoTo(audioBtn, () => UIController.Enable_DisableUI(audioPanel, videoPanel, controlsPanel, picPanel));
        UIController.IfClick_GoTo(picBtn, () => UIController.Enable_DisableUI(picPanel, videoPanel, controlsPanel, audioPanel));

        UIController.IfClick_GoTo(applyBtn, SaveSettings);
        UIController.IfClick_GoTo(cancelBtn, CancelSettings);
        UIController.IfClick_GoTo(defaultBtn, RestoreSettings);

        // video settings buttons
        UIController.IfClick_GoTo(expressGraphicBtn, () => { isAdvancedGraphicsEnabled = false; UIController.Enable_DisableUI(expressGraphicPanel, advancedGraphicPanel); });
        UIController.IfClick_GoTo(advancedGraphicBtn, () => { isAdvancedGraphicsEnabled = true; UIController.Enable_DisableUI(advancedGraphicPanel, expressGraphicPanel); });

        UIController.IfClick_GoTo(expressHighBtn, () => expressType = ExpressGraphicsTypes.HIGH);      // for fantastic QualitySettings
        UIController.IfClick_GoTo(expressMedBtn, () => expressType  = ExpressGraphicsTypes.MED);       // for medium and good
        UIController.IfClick_GoTo(expressLowBtn, () => expressType  = ExpressGraphicsTypes.LOW);       // for low QualitySettings

        // controlsBtns
        UIController.IfClick_GoTo(mouseBtn, () => UIController.Enable_DisableUI(mousePanel, keyboardPanel));
        UIController.IfClick_GoTo(keyboardBtn, () => UIController.Enable_DisableUI(keyboardPanel, mousePanel));

        // other settings
        UIController.OnSliderChangesValue(crosshairSizeSlider, (value) => ChangeCrosshairSize(value));
    }
Esempio n. 2
0
    public void LoadSettings()
    {
        // video
        try
        {
            isAdvancedGraphicsEnabled = PlayerPrefs.GetInt("advancedGraphic") == 0 ? false : true;
            if (isAdvancedGraphicsEnabled)
            {
                UIController.Enable_DisableUI(advancedGraphicPanel, expressGraphicPanel);
            }
            else
            {
                UIController.Enable_DisableUI(expressGraphicPanel, advancedGraphicPanel);
            }

            expressType = (ExpressGraphicsTypes)PlayerPrefs.GetInt("beginnerGraphics", 0);

            resolutionDropDown.value = PlayerPrefs.GetInt("resolution", 0);
            vSyncDropDown.value      = PlayerPrefs.GetInt("vsync", 0);
            fulScreenToggle.isOn     = (PlayerPrefs.GetInt("fulscreen") == 0) ? false : true;
            StartCoroutine(UIController.FillSlider(GammaSlider, PlayerPrefs.GetFloat("gamma")));
            textureDropDown.value      = PlayerPrefs.GetInt("texture", 0);
            antiAliasingDropDown.value = PlayerPrefs.GetInt("antialiasing", 0);
            weatherToggle.isOn         = (PlayerPrefs.GetInt("weatherfx")) == 0 ? false : true;
            bloodSpatterToggle.isOn    = (PlayerPrefs.GetInt("bloodspatterfx") == 0 ? false : true);
        }
        catch (System.Exception err)
        {
            UIController.ThrowError("no data to load or " + err.Message, UIController.CloseError);
        }

        // control settings
        try
        {
            // mouse settings
            StartCoroutine(UIController.FillSlider(mouseSensitivitySlider, PlayerPrefs.GetFloat("mouseSensitivity", 0)));
            StartCoroutine(UIController.FillSlider(zoomSensitivitySlider, PlayerPrefs.GetFloat("zoomSensitivity", 0)));
            invertToggle.isOn             = PlayerPrefs.GetInt("invecrosshairRectTransform") == 1 ? true : false;
            invertMouseButtonsToggle.isOn = PlayerPrefs.GetInt("invecrosshairRectTransformMouseButtons") == 1 ? true : false;
            // keyboard settings

            rightInput.text  = PlayerPrefs.GetString("right");
            crouchInput.text = PlayerPrefs.GetString("crouch");
            zoomInput.text   = PlayerPrefs.GetString("zoom");
            jumpInput.text   = PlayerPrefs.GetString("jump");
            pickupInput.text = PlayerPrefs.GetString("pickup");
        }
        catch (System.Exception)
        {
            throw;
        }

        // audioSettings
        try
        {
            StartCoroutine(UIController.FillSlider(themeVolSlider, PlayerPrefs.GetFloat("themeVol", 0)));
            StartCoroutine(UIController.FillSlider(fxVolSlider, PlayerPrefs.GetFloat("fxVol", 0)));
            StartCoroutine(UIController.FillSlider(voiceVolSlider, PlayerPrefs.GetFloat("voiceVol", 0)));
        }
        catch (System.Exception err)
        {
            UIController.ThrowError(err.Message, UIController.CloseError);
        }

        // other Settings
        try
        {
            StartCoroutine(UIController.FillSlider(crosshairSizeSlider, PlayerPrefs.GetFloat("crosshairSize")));
            helpToggle.isOn           = PlayerPrefs.GetInt("help") == 1 ? true : false;
            tooltipToggle.isOn        = PlayerPrefs.GetInt("tooltip") == 1 ? true : false;
            friendReqToggle.isOn      = PlayerPrefs.GetInt("friendReq") == 1 ? true : false;
            clanReqToggle.isOn        = PlayerPrefs.GetInt("clanReq") == 1 ? true : false;
            roomInvitationToggle.isOn = PlayerPrefs.GetInt("roomInviteReq") == 1 ? true : false;
        }
        catch (System.Exception)
        {
            throw;
        }
        finally
        {
            ApplySettings();
        }
    }