GetAllBankPaths() 공개 정적인 메소드

public static GetAllBankPaths ( ) : string>.IDictionary
리턴 string>.IDictionary
    public static void Update(bool forceUpdate = false)
    {
        //Gather all GeneratedSoundBanks folder from the project
        var allPaths          = AkUtilities.GetAllBankPaths();
        var bNeedRefresh      = false;
        var projectPath       = AkWwiseEditorSettings.WwiseProjectAbsolutePath;
        var baseSoundBankPath = AkBasePathGetter.GetFullSoundBankPathEditor();

        AkWwiseInitializationSettings.UpdatePlatforms();

        //Go through all BasePlatforms
        foreach (var pairPF in AkUtilities.PlatformMapping)
        {
            //Go through all custom platforms related to that base platform and check if any of the bank files were updated.
            var bParse    = forceUpdate;
            var fullPaths = new System.Collections.Generic.List <string>();
            foreach (var customPF in pairPF.Value)
            {
                string bankPath;
                if (!allPaths.TryGetValue(customPF, out bankPath))
                {
                    continue;
                }

                var pluginFile = "";
                try
                {
                    pluginFile = System.IO.Path.Combine(projectPath, System.IO.Path.Combine(bankPath, "PluginInfo.xml"));
                    pluginFile = pluginFile.Replace('/', System.IO.Path.DirectorySeparatorChar);
                    if (!System.IO.File.Exists(pluginFile))
                    {
                        //Try in StreamingAssets too.
                        pluginFile = System.IO.Path.Combine(System.IO.Path.Combine(baseSoundBankPath, customPF), "PluginInfo.xml");
                        if (!System.IO.File.Exists(pluginFile))
                        {
                            continue;
                        }
                    }

                    fullPaths.Add(pluginFile);

                    var t        = System.IO.File.GetLastWriteTime(pluginFile);
                    var lastTime = System.DateTime.MinValue;
                    s_LastParsed.TryGetValue(customPF, out lastTime);
                    if (lastTime < t)
                    {
                        bParse = true;
                        s_LastParsed[customPF] = t;
                    }
                }
                catch (System.Exception ex)
                {
                    UnityEngine.Debug.LogError("WwiseUnity: " + pluginFile + " could not be parsed. " + ex.Message);
                }
            }

            if (bParse)
            {
                var platform = pairPF.Key;

                var newDlls = ParsePluginsXML(platform, fullPaths);
                System.Collections.Generic.HashSet <AkPluginInfo> oldDlls = null;

                //Remap base Wwise platforms to Unity platform folders names
#if !UNITY_2018_3_OR_NEWER
                if (platform.Contains("Vita"))
                {
                    platform = "Vita";
                }
#endif
                //else other platforms already have the right name

                s_PerPlatformPlugins.TryGetValue(platform, out oldDlls);
                s_PerPlatformPlugins[platform] = newDlls;

                //Check if there was any change.
                if (!bNeedRefresh && oldDlls != null)
                {
                    if (oldDlls.Count == newDlls.Count)
                    {
                        oldDlls.IntersectWith(newDlls);
                    }

                    bNeedRefresh |= oldDlls.Count != newDlls.Count;
                }
                else
                {
                    bNeedRefresh |= newDlls.Count > 0;
                }
            }
        }

        if (bNeedRefresh)
        {
            ActivatePluginsForEditor();
        }

        var currentConfig = GetCurrentConfig();
        CheckMenuItems(currentConfig);
    }
예제 #2
0
    public static void Update(bool forceUpdate = false)
    {
        //Gather all GeneratedSoundBanks folder from the project
        IDictionary <string, string> allPaths = AkUtilities.GetAllBankPaths();
        bool   bNeedRefresh = false;
        string projectPath  = System.IO.Path.GetDirectoryName(AkUtilities.GetFullPath(Application.dataPath, WwiseSettings.LoadSettings().WwiseProjectPath));

        var pfMap = AkUtilities.GetPlatformMapping();

        //Go through all BasePlatforms
        foreach (var pairPF in pfMap)
        {
            //Go through all custom platforms related to that base platform and check if any of the bank files were updated.
            bool          bParse    = forceUpdate;
            List <string> fullPaths = new List <string>();
            foreach (string customPF in pairPF.Value)
            {
                string bankPath;
                if (!allPaths.TryGetValue(customPF, out bankPath))
                {
                    continue;
                }

                string pluginFile = "";
                try
                {
                    pluginFile = System.IO.Path.Combine(projectPath, System.IO.Path.Combine(bankPath, "PluginInfo.xml"));
                    pluginFile = pluginFile.Replace('/', System.IO.Path.DirectorySeparatorChar);
                    if (!System.IO.File.Exists(pluginFile))
                    {
                        //Try in StreamingAssets too.
                        pluginFile = System.IO.Path.Combine(System.IO.Path.Combine(AkBasePathGetter.GetFullSoundBankPath(), customPF), "PluginInfo.xml");
                        if (!System.IO.File.Exists(pluginFile))
                        {
                            continue;
                        }
                    }
                    fullPaths.Add(pluginFile);

                    var t        = System.IO.File.GetLastWriteTime(pluginFile);
                    var lastTime = DateTime.MinValue;
                    s_LastParsed.TryGetValue(customPF, out lastTime);
                    if (lastTime < t)
                    {
                        bParse = true;
                        s_LastParsed[customPF] = t;
                    }
                }
                catch (Exception ex)
                {
                    Debug.LogError("Wwise: " + pluginFile + " could not be parsed. " + ex.Message);
                }
            }

            if (bParse)
            {
                string platform = pairPF.Key;

                HashSet <string> newDlls = ParsePluginsXML(platform, fullPaths);
                HashSet <string> oldDlls = null;

                //Remap base Wwise platforms to Unity platform folders names
                if (platform.Contains("Vita"))
                {
                    platform = "Vita";
                }
                //else other platforms already have the right name

                s_PerPlatformPlugins.TryGetValue(platform, out oldDlls);
                s_PerPlatformPlugins[platform] = newDlls;

                //Check if there was any change.
                if (!bNeedRefresh && oldDlls != null)
                {
                    if (oldDlls.Count == newDlls.Count)
                    {
                        oldDlls.IntersectWith(newDlls);
                    }

                    bNeedRefresh |= oldDlls.Count != newDlls.Count;
                }
                else
                {
                    bNeedRefresh |= newDlls.Count > 0;
                }
            }
        }

        if (bNeedRefresh)
        {
            ActivatePluginsForEditor();
        }

        string currentConfig = GetCurrentConfig();

        CheckMenuItems(currentConfig);
    }