예제 #1
0
    public void applyVideoSettings()
    {
        FileController.Config temp = loadData();

        //Screen Resolution
        Resolution[] resolutions = Screen.resolutions;
        int          i           = 0;

        foreach (Resolution res in resolutions)
        {
            if (i == dropdownScreenResolution.value)
            {
                temp.ScreenResolution = res.width + "x" + res.height;
                break;
            }
            i++;
        }

        //FullscreenMode
        temp.Fullscreen = toggleFullscreenMode.isOn;

        //VSync
        temp.VSync = (int)sliderVSync.value;

        //Anti-aliasing
        switch (dropdownAntiAliasing.value)
        {
        case 0:
            temp.AntiAliasing = 0;
            break;

        case 1:
            temp.AntiAliasing = 2;
            break;

        case 2:
            temp.AntiAliasing = 4;
            break;

        case 3:
            temp.AntiAliasing = 8;
            break;
        }

        //TextureQuality
        temp.TextureQuality = dropdownTextureQuality.value;

        //ShadowDistance
        temp.ShadowDistance = (int)sliderShadowDistance.value;

        //ShadowResolution
        temp.ShadowResolution = dropdownShadowResolution.value;

        applyAllOptions(temp);
        saveData(temp);
    }
예제 #2
0
    public void applyAudioSettings()
    {
        FileController.Config temp = loadData();

        temp.BGM  = (int)sliderBGM.value;
        temp.SE   = (int)sliderSE.value;
        temp.Mute = toggleMute.isOn;

        applyAllOptions(temp);
        saveData(temp);
    }
예제 #3
0
    public void setDefaultValue()
    {
        try
        {
            FileController.Config temp = loadData();

            sliderBGM.value = temp.BGM;
            sliderSE.value  = temp.SE;
            toggleMute.isOn = temp.Mute;
        }
        catch (Exception e)
        {
            Debug.Log("Cannot set default value");
            Debug.Log(e.Message);
        }
    }
예제 #4
0
    void Start()
    {
        bool exist = GetComponent <FileController>().checkExist("config.json");

        if (!exist)
        {
            Debug.Log("There is no config.json");
            GetComponent <FileController>().generateNewData("config.json");
            Debug.Log("Generated config.json");
        }
        FileController.Config temp = GetComponent <VideoSettings>().loadData();
        GetComponent <VideoSettings>().applyAllOptions(temp);
        GetComponent <AudioSettings>().applyAllOptions(temp);

        Credits.text = string.Format("Unity {0}\n Rolling!! {1}", UnityEngine.Application.unityVersion, Application.version);
    }
예제 #5
0
    public void applyAllOptions(FileController.Config temp)
    {
        //ScreenResolution and Fullscreen
        Screen.fullScreen = temp.Fullscreen;
        int Center = temp.ScreenResolution.IndexOf("x");
        int Front  = int.Parse(temp.ScreenResolution.Substring(0, Center));
        int Rear   = int.Parse(temp.ScreenResolution.Substring(Center + 1));

        Screen.SetResolution(Front, Rear, temp.Fullscreen);

        //VSync
        QualitySettings.vSyncCount = temp.VSync;

        //Anti-aliasing
        QualitySettings.antiAliasing = temp.AntiAliasing;

        //Texture Quality
        QualitySettings.masterTextureLimit = temp.TextureQuality;

        //Shadow Distance
        QualitySettings.shadowDistance = temp.ShadowDistance;

        //Shadow Resolution
        switch (temp.ShadowResolution)
        {
        case 0:
            QualitySettings.shadowResolution = ShadowResolution.Low;
            break;

        case 1:
            QualitySettings.shadowResolution = ShadowResolution.Medium;
            break;

        case 2:
            QualitySettings.shadowResolution = ShadowResolution.High;
            break;

        case 3:
            QualitySettings.shadowResolution = ShadowResolution.VeryHigh;
            break;
        }
    }
예제 #6
0
    void Start()
    {
        if (!IsComponent)
        {
            //設定データを表示
            displayPulldownData();

            //他のCanvasを非表示
            canvasAudioSettings.SetActive(false);

            //Configデータから読み取り
            if (!(GetComponent <FileController>().checkExist("config.json")))
            {
                Debug.Log("There is no config.json");
                GetComponent <FileController>().generateNewData("config.json");
                Debug.Log("Generated config.json");
            }
            Data = loadData();

            setDefaultValue();
        }
    }
예제 #7
0
 public void applyAllOptions(FileController.Config temp)
 {
     if (!temp.Mute)
     {
         GainBGM = (float)(20f * Math.Log(temp.BGM * 0.01f, 10));
         GainSE  = (float)(20f * Math.Log(temp.SE * 0.01f, 10));
         if (temp.BGM == 0)
         {
             GainBGM = -80;
         }
         if (temp.SE == 0)
         {
             GainSE = -80;
         }
         AudioMixer.SetFloat("BGMVolume", GainBGM);
         AudioMixer.SetFloat("SEVolume", GainSE);
     }
     else
     {
         AudioMixer.SetFloat("BGMVolume", -80);
         AudioMixer.SetFloat("SEVolume", -80);
     }
 }
예제 #8
0
 public bool saveData(FileController.Config data)
 {
     return(GetComponent <FileController>().saveData("config.json", data));
 }
예제 #9
0
    public void setDefaultValue()
    {
        try
        {
            FileController.Config temp = loadData();

            //Screen Resolution
            Resolution[] resolutions = Screen.resolutions;
            int          i           = 0;
            foreach (Resolution res in resolutions)
            {
                if ((res.width + "x" + res.height) == temp.ScreenResolution)
                {
                    dropdownScreenResolution.value = i;
                    break;
                }
                i++;
            }

            //VSync
            sliderVSync.value = temp.VSync;

            //Fullscreen Mode
            toggleFullscreenMode.isOn = temp.Fullscreen;

            // Anti-Aliasing
            switch (temp.AntiAliasing)
            {
            case 0:
                dropdownAntiAliasing.value = 0;
                break;

            case 2:
                dropdownAntiAliasing.value = 1;
                break;

            case 4:
                dropdownAntiAliasing.value = 2;
                break;

            case 8:
                dropdownAntiAliasing.value = 3;
                break;

            default:
                dropdownAntiAliasing.value = 0;
                break;
            }

            // TextureQuality
            dropdownTextureQuality.value = temp.TextureQuality;

            //Shadow Distance
            sliderShadowDistance.value = temp.ShadowDistance;

            //Shadow Resolution
            dropdownShadowResolution.value = temp.ShadowResolution;
        }
        catch (Exception e)
        {
            Debug.Log("Cannot set default value");
            Debug.Log(e.Message);
        }
    }