Esempio n. 1
0
    /// SE再生(要事前登録)
    public bool PlaySE(SEList key, int channel = -1)
    {
        if (tableSE.ContainsKey((int)key) == false)
        {
            // 対応するキーがない場合は再生不可
            Debug.Log("PlaySE key:" + key + " has not loaded...");
            return(false);
        }

        // リソースの取得
        SEData se = tableSE[(int)key];

        if (0 <= channel && channel < SE_CHANNEL)
        {
            // チャンネル指定
            var source = GetAudioSource(AudioType.SE, channel);
            source.clip = se.Clip;
            source.Play();
        }
        else
        {
            // チャンネル指定なし
            var source = GetAudioSource(AudioType.SE);
            source.PlayOneShot(se.Clip);  // 重複ありで再生
        }

        return(true);
    }
Esempio n. 2
0
    public void LoadSE(SEList key, string resName)
    {
        if (tableSE.ContainsKey((int)key))
        {
            // 登録済みだったら削除(上書きする)
            tableSE.Remove((int)key);
        }
        tableSE.Add((int)key, new SEData(resName));

        return;
    }
 // SEのResource取得
 public string GetSEResource(SEList key)
 {
     if (seResources.Length > (int)key)
     {
         return(seResources[(int)key]);
     }
     else
     {
         Debug.Log("SE list key is out of range... Max:" + seResources.Length + ", Selected:" + key);
         return(null);
     }
 }
Esempio n. 4
0
        // SEリソース取得
        public string GetSoundResource(SEList key)
        {
            string retStr = universalData.GetSEResource(key);

            Debug.Log("Get SoundResource Key:" + key + ", Resource:" + retStr);

            if (loadOK)
            {
                return(retStr);
            }
            else
            {
                Debug.Log("DataLibrarian Load Data NG -> cannot get SoundResource...");
                return(null);
            }
        }
Esempio n. 5
0
        private void GetSEFileList()
        {
            string SEPath = "SE";

            string[] SeFiles = Directory.GetFiles(SEPath, "*.mp3");

            for (int i = 0; i < SeFiles.Length; i++)
            {
                SeFiles[i] = Path.GetFileName(SeFiles[i]);
            }

            FileStream Fstream = null;

            Fstream = new FileStream(SEPath + "/" + "SEList.txt", FileMode.OpenOrCreate);
            Fstream.Close();
            Fstream = new FileStream(SEPath + "/" + "SEList.txt", FileMode.Truncate);  //清空txt文件
            Fstream.Close();
            Fstream = new FileStream(SEPath + "/" + "SEList.txt", FileMode.OpenOrCreate);
            StreamWriter FileWrite = new StreamWriter(Fstream);

            try
            {
                if (Fstream != null)
                {
                    string temp;
                    Fstream.Position = 0;
                    for (int i = 0; i < SeFiles.Length; i++)
                    {
                        Add_SE(SeFiles[i].ToString());
                        temp = SeFiles[i].ToString().Remove(SeFiles[i].ToString().LastIndexOf("."));
                        FileWrite.WriteLine(temp);
                        FileWrite.Flush();
                    }
                }
                SEList.Reverse();
            }
            catch (Exception ex)
            {
                Push_A_message_to_Room("Error:" + ex.Message + "\n");
            }


            Fstream.Close();
        }
Esempio n. 6
0
        private void Add_SE(string SEFileName)
        {
            SE NewSE = new SE(SEFileName);

            SEList.Add(NewSE);
        }