コード例 #1
0
ファイル: CSaveGame.cs プロジェクト: TrollShin/MarTruck
    public bool LoadSoundInfo()
    {
        string SoundInfoFilePath = GetFilePath(ESaveFileName.SoundSettingSaveData);

        if (!CheckFilePath(SoundInfoFilePath))
        {
            return(false);
        }

        string file = File.ReadAllText(SoundInfoFilePath);

        float[] values = new float[2];

        string[] tmp = file.Split(',');

        for (int i = 0; i < tmp.Length; i++)
        {
            values[i] = float.Parse(tmp[i]);
        }

        CSoundManager.GetInstance().BackgroundVolume = values[0];
        CSoundManager.GetInstance().EffectVolume     = values[1];

        return(true);
    }
コード例 #2
0
    protected override void InitOption()
    {
        SliderOption.minValue = 0;
        SliderOption.maxValue = 100;
        float value = CSoundManager.GetInstance().BackgroundVolume * 100;

        SliderOption.value = value;
        DisplayText.text   = value.ToString();
    }
コード例 #3
0
ファイル: CSaveGame.cs プロジェクト: TrollShin/MarTruck
    public void Save()
    {
        StrBuilder.Clear();

        //ESaveFileName 순으로 초기화
        string[] json = new string[4];

        json[0] = JsonUtility.ToJson(CGameInputManager.GetInstance());

        StrBuilder.Append(CSoundManager.GetInstance().BackgroundVolume.ToString());
        StrBuilder.Append(",");
        StrBuilder.Append(CSoundManager.GetInstance().EffectVolume.ToString());

        json[1] = StrBuilder.ToString();
        json[2] = JsonUtility.ToJson(CUserInfo.GetInstance());
        json[3] = JsonUtility.ToJson(CUserInfo.GetInstance().QuestLst);

        for (int i = 0; i < json.Length; i++)
        {
            ESaveFileName FileName = (ESaveFileName)i;
            Debug.Log(json[i]);
            File.WriteAllText(GetFilePath(FileName), json[i]);
        }
    }
コード例 #4
0
 protected override void SetOption(float value)
 {
     CSoundManager.GetInstance().BackgroundVolume = value / 100f;
     DisplayText.text = value.ToString();
 }
コード例 #5
0
ファイル: MCar.cs プロジェクト: TrollShin/MarTruck
 private void EngineSound()
 {
     audioSource.pitch = (GetComponent <Rigidbody>().velocity.magnitude * 3.6f / CarInfo.MaxSpeed + 1) * CSoundManager.GetInstance().EffectVolume;
 }