コード例 #1
0
    //-------------------------------------------------------------------------
    public CSoundMgr()
    {
        mObjAudio = new GameObject("Audio Object");

        if (!PlayerPrefs.HasKey("Music"))
        {
            PlayerPrefs.SetFloat("Music", 0.5f);
        }
        if (!PlayerPrefs.HasKey("Sounds"))
        {
            PlayerPrefs.SetFloat("Sounds", 0.5f);
        }

        mListAudioFree.Clear();
        for (int i = 0; i < 8; i++)
        {
            AudioSource obj_audio = mObjAudio.AddComponent <AudioSource>();
            Debug.Log("CSoundMgr调用");
            mListAudioFree.Add(obj_audio);
            mQueAudioFree.Enqueue(obj_audio);
        }

        {
            CSoundLayerBackground s = new CSoundLayerBackground(this);
            mMapSoundLayer[s.getLayerId()] = s;
        }

        {
            CSoundLayerIgnore s = new CSoundLayerIgnore(this);
            mMapSoundLayer[s.getLayerId()] = s;
        }

        {
            CSoundLayerReplace s = new CSoundLayerReplace(this);
            mMapSoundLayer[s.getLayerId()] = s;
        }

        {
            CSoundLayerNormal s = new CSoundLayerNormal(this);
            mMapSoundLayer[s.getLayerId()] = s;
        }
    }
コード例 #2
0
ファイル: SoundMgr.cs プロジェクト: yinlei/Fishing
    //-------------------------------------------------------------------------
    public CSoundMgr()
    {
        mObjAudio = new GameObject("Audio Object");

        if (!PlayerPrefs.HasKey("Music"))
        {
            PlayerPrefs.SetFloat("Music", 0.5f);
        }
        if (!PlayerPrefs.HasKey("Sounds"))
        {
            PlayerPrefs.SetFloat("Sounds", 0.5f);
        }

        mListAudioFree.Clear();
        for (int i = 0; i < 8; i++)
        {
            AudioSource obj_audio = mObjAudio.AddComponent<AudioSource>();
            Debug.Log("CSoundMgr调用");
            mListAudioFree.Add(obj_audio);
            mQueAudioFree.Enqueue(obj_audio);
        }

        {
            CSoundLayerBackground s = new CSoundLayerBackground(this);
            mMapSoundLayer[s.getLayerId()] = s;
        }

        {
            CSoundLayerIgnore s = new CSoundLayerIgnore(this);
            mMapSoundLayer[s.getLayerId()] = s;
        }

        {
            CSoundLayerReplace s = new CSoundLayerReplace(this);
            mMapSoundLayer[s.getLayerId()] = s;
        }

        {
            CSoundLayerNormal s = new CSoundLayerNormal(this);
            mMapSoundLayer[s.getLayerId()] = s;
        }
    }