Example #1
0
    public void PlayCalloutSound(Level lvl, int segmentId, Segment seg)
    {
        string    fileName;
        string    url;
        AudioClip voice;
        string    word = "";

        switch (lvl.monsterInputType)
        {
        case MonsterInputType.Letter:
        case MonsterInputType.SoundLetter:

            if (TryLetter)
            {
                fileName = RTL.Clean(seg.MonsterRequiredLetters [0]);


                if (letters.ContainsKey(fileName))
                {
                    letters.Remove(fileName);
                }

                url   = "Sounds/Voice/Letters/" + fileName;
                voice = Resources.Load(url) as AudioClip;
                if (voice == null)
                {
                    logLetter += "Letter - Sound is missing - '" + /*RTL.Fix*/ (url) + "'" + " Level: " + (lvl.levelId - 1) + " Segment Id: " + (segmentId + 1) + "\n";
//					Debug.Log ("Letter - Sound is missing - '" + url + "'" + " Level: " + (lvl.levelId - 1) + " Segment Id: " + (segmentId + 1));
                }
            }
            break;

        case MonsterInputType.LetterInWord:
            if (TryLetterInWord)
            {
                fileName = ArabicBaseForm.Extract(RTL.Clean(seg.MonsterRequiredLetters [0]));
//				fileName = RTL.Fix(seg.MonsterRequiredLetters [0]);

                if (letters.ContainsKey(fileName))
                {
                    letters.Remove(fileName);
                }

                url   = "Sounds/Voice/Letters/" + fileName;
                voice = Resources.Load(url) as AudioClip;
                if (voice == null)
                {
                    logLetterInWord += "Letter In Word - Sound is missing - '" + /*RTL.Fix*/ (url) + "'" + " Level: " + (lvl.levelId - 1) + " Segment Id: " + (segmentId + 1) + " ( " + url + " )" + "\n";
//					Debug.Log ("Letter In Word - Sound is missing - '" + url + "'" + " Level: " + (lvl.levelId - 1) + " Segment Id: " + (segmentId + 1));
                }
            }
            break;

        case MonsterInputType.Word:
        case MonsterInputType.SoundWord:
            if (TryWord)
            {
                word = "";
                foreach (string letter in seg.MonsterRequiredLetters)
                {
                    word += letter;
                }
                fileName = ArabicBaseForm.Extract(RTL.Clean(word));
                if (words.ContainsKey(fileName))
                {
                    words.Remove(fileName);
                }
                url = "Sounds/Voice/Words/" + fileName;

                voice = Resources.Load(url) as AudioClip;
                if (voice == null)
                {
                    logWord += "Word - Sound is missing - '" + /*RTL.Fix*/ (url) + "'" + " Level: " + (lvl.levelId - 1) + " Segment Id: " + (segmentId + 1) + "\n";
                }
            }
            break;
        }
    }
    public void PlayCalloutSound()
    {
        string    fileName;
        string    url;
        AudioClip voice;
        string    word = "";

        getCanvasGroup.interactable = true;

        switch (GameplayController.Instance.CurrentLevel.monsterInputType)
        {
        case MonsterInputType.Letter:
        case MonsterInputType.SoundLetter:
            url   = "Sounds/Voice/Letters/" + RTL.Clean(GameplayController.Instance.CurrentSegment.MonsterRequiredLetters [0]);
            voice = Resources.Load(url) as AudioClip;
//			var ss = Resources.Load (url);

            if (voice != null)
            {
                AudioController.Instance.PlaySound(voice, 1, monster.Pitch);
            }
            else
            {
                Debug.Log("Sound is missing - '" + url + "'");
            }
            break;

        case MonsterInputType.LetterInWord:
            //			voice = Resources.Load ("Sounds/Voice/Letters/" + Common.Instance.GetIsolatedForm(GameplayController.Instance.CurrentSegment.MonsterRequiredLetters[0])) as AudioClip;
            fileName = ArabicBaseForm.Extract(RTL.Clean(GameplayController.Instance.CurrentSegment.MonsterRequiredLetters [0]));
            url      = "Sounds/Voice/Letters/" + fileName;
            voice    = Resources.Load(url) as AudioClip;
            if (voice != null)
            {
                AudioController.Instance.PlaySound(voice, 1, monster.Pitch);
            }
            else
            {
                Debug.Log("Sound is missing - '" + url + "'");
            }
            break;

        case MonsterInputType.Word:
        case MonsterInputType.SoundWord:
            word = "";
            foreach (string letter in GameplayController.Instance.CurrentSegment.MonsterRequiredLetters)
            {
                word += letter;
            }
            url = "Sounds/Voice/Words/" + ArabicBaseForm.Extract(RTL.Clean(word));

            voice = Resources.Load(url) as AudioClip;
            if (voice != null)
            {
                AudioController.Instance.PlaySound(voice, 1, monster.Pitch);
            }
            else
            {
                Debug.Log("Sound is missing - '" + url + "'");
            }
            break;
        }
    }