Beispiel #1
0
    public void DoSomeThing()
    {
        SoundBean sb = soundBeanList[index];

        if (audioManageText.Contains("/" + sb.simpleName + "\""))
        {
            use.Add(sb);
        }
        else if (!string.IsNullOrEmpty(renderList.Find(x => x.Contains(sb.simpleName + ".wav\""))))
        {
            use.Add(sb);
        }
        else if (!string.IsNullOrEmpty(ingameSoundEnumList.Find(x => x.Equals(sb.simpleName))))
        {
            use.Add(sb);
        }
        else if (!string.IsNullOrEmpty(configList.Find(x => x.Contains(sb.simpleName + "\""))) || !string.IsNullOrEmpty(configList.Find(x => x.Contains(sb.simpleName + "<"))))
        {
            use.Add(sb);
        }
        else
        {
            noUse.Add(sb);
        }
    }
Beispiel #2
0
    private List <string> configList;          //配置
    public UISoundProcess(string type, string sourcePath)
        : base(type)
    {
        //x5_mobile/mobile_dancer_resource/Resources/ResourcePublish/CDN/SourceFiles/android/assetbundles/audio/ui_sound_effect/
        //x5_mobile/mobile_dancer/trunk/client/Assets/StreamingAssets/audio/sound_effect/


        //F:\p4_workspace\DGM\x5_mobile\mobile_dancer\trunk\client\Assets\Standard Assets\X5ExtendComponent\InGameSoundEffect.cs  加了一个ui_
        //F:\p4_workspace\DGM\x5_mobile\mobile_dancer\trunk\client\Assets\Scripts\Framework\Global\AudioEffectManager.cs  /ui_kuaimen"
        //F:\p4_workspace\DGM\x5_mobile\mobile_dancer\trunk\client\Assets\Scripts\CoreGame\Render\ModeSpecial\GameRenderClassic.cs  /ingame_classic_miss.wav"
        string ab_sound_effect = sourcePath + @"\android\assetbundles\audio\ui_sound_effect";

        string[] ab_source = Directory.GetFiles(ab_sound_effect, "*", SearchOption.AllDirectories);

        string streaming_sound_effect = Application.dataPath + @"\StreamingAssets\audio\sound_effect";

        string[] streaming_source = Directory.GetFiles(streaming_sound_effect, "*", SearchOption.AllDirectories);

        soundBeanList = new List <SoundBean>();
        for (int i = 0; i < ab_source.Length + streaming_source.Length; i++)
        {
            string item = i >= ab_source.Length ? streaming_source[i - ab_source.Length] : ab_source[i];

            string simpleName = System.IO.Path.GetFileName(item).Split('.')[0];
            simpleName = simpleName.ToLower();
            SoundBean sb = soundBeanList.Find(x => x.simpleName.Equals(simpleName));
            if (sb != null)
            {
            }
            else
            {
                sb = new SoundBean();
                soundBeanList.Add(sb);
                sb.simpleName = simpleName;
            }
            sb.AddFullName(item);
        }

        string audioEffectManager = Application.dataPath + @"\Scripts\Framework\Global\AudioEffectManager.cs";

        audioManageText = File.ReadAllText(audioEffectManager).ToLower();
        string[] render = new string[] {
            Application.dataPath + @"\Scripts\CoreGame\Render\ModeSpecial\GameRenderClassic.cs",
            Application.dataPath + @"\Scripts\CoreGame\Render\GameRender.cs",
            Application.dataPath + @"\Scripts\CoreGame\Render\ModeSpecial\GameRenderPinball.cs",
            Application.dataPath + @"\Scripts\CoreGame\Render\ModeSpecial\ModeJoyParty\GameRenderJoyParty.cs",
            Application.dataPath + @"\Scripts\CoreGame\Render\ModeSpecial\ModeTeamArena\GameRenderTeamArena.cs",
            Application.dataPath + @"\Scripts\CoreGame\Render\ModeSpecial\ModeTryst\GameRenderTryst.cs"
        };
        renderList = new List <string>();
        for (int i = 0; i < render.Length; i++)
        {
            renderList.Add(File.ReadAllText(render[i]).ToLower());
        }
        ingameSoundEnumList = new List <string>();
        foreach (int myCode in Enum.GetValues(typeof(InGameSoundEffect)))
        {
            string strName  = Enum.GetName(typeof(InGameSoundEffect), myCode); //获取名称
            string strVaule = strName.ToLower();                               //获取值
            ingameSoundEnumList.Add(strVaule.StartsWith("ui_") ? strVaule : "ui_" + strVaule);
        }
        configList = new List <string>();
        string[] configs = new string[] {
            sourcePath + @"\crossplatform\config\shared\community\community_npc_list.xml",
            sourcePath + @"\crossplatform\config\shared\guide\guide.xml",
            sourcePath + @"\crossplatform\config\shared\pop_tip.xml",
        };
        for (int i = 0; i < configs.Length; i++)
        {
            configList.Add(File.ReadAllText(configs[i]).ToLower());
        }



        max    = soundBeanList.Count;
        Do     = DoSomeThing;
        Name   = GetCurrentProcessName;
        Finish = OnFinish;
    }