public static GetPlatformMapping ( ) : HashSet |
||
리턴 | HashSet |
public static void Update(bool forceUpdate = false) { //Gather all GeneratedSoundBanks folder from the project var allPaths = AkUtilities.GetAllBankPaths(); var bNeedRefresh = false; var projectPath = System.IO.Path.GetDirectoryName(AkUtilities.GetFullPath(UnityEngine.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. 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(AkBasePathGetter.GetFullSoundBankPath(), 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 <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(); } var currentConfig = GetCurrentConfig(); CheckMenuItems(currentConfig); }
public static void Update() { //Gather all GeneratedSoundBanks folder from the project IDictionary <string, string> allPaths = AkUtilities.GetAllBankPaths(); bool bNeedRefresh = false; string projectPath = Path.GetDirectoryName(AkUtilities.GetFullPath(Application.dataPath, WwiseSettings.LoadSettings().WwiseProjectPath)); IDictionary <string, HashSet <string> > pfMap = AkUtilities.GetPlatformMapping(); //Go through all BasePlatforms foreach (KeyValuePair <string, HashSet <string> > 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 = false; 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 = Path.Combine(projectPath, Path.Combine(bankPath, "PluginInfo.xml")); pluginFile = pluginFile.Replace('/', Path.DirectorySeparatorChar); if (!File.Exists(pluginFile)) { //Try in StreamingAssets too. pluginFile = Path.Combine(Path.Combine(AkBasePathGetter.GetFullSoundBankPath(), customPF), "PluginInfo.xml"); if (!File.Exists(pluginFile)) { continue; } } fullPaths.Add(pluginFile); DateTime t = File.GetLastWriteTime(pluginFile); DateTime lastTime = DateTime.MinValue; s_LastParsed.TryGetValue(customPF, out lastTime); if (lastTime < t) { bParse = true; s_LastParsed[customPF] = t; } } catch (System.Exception ex) { Debug.LogError("Wwise: " + pluginFile + " could not be parsed. " + ex.Message); } } if (bParse) { HashSet <string> newDlls = ParsePluginsXML(fullPaths); HashSet <string> oldDlls = null; string platform = pairPF.Key; //Remap base Wwise platforms to Unity platform folders names if (platform == "WiiUSW") { platform = "WiiU"; } else if (platform.Contains("Vita")) { platform = "Vita"; } //else other platform 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((IEnumerable <string>)newDlls); } bNeedRefresh |= oldDlls.Count != newDlls.Count; } else { bNeedRefresh |= newDlls.Count > 0; } } } if (bNeedRefresh) { RefreshPlugins(); } }