using System; using System.Collections.Generic; using UnityEngine; namespace UnityEditor.AddressableAssets.Build.AnalyzeRules { /// /// Represents the data acquired after analyzing Addressable assets. /// [Obsolete("This has been made obsolete and is no longer functional. Analyze result data is handled internally.")] public class AnalyzeResultData : ScriptableObject, ISerializationCallbackReceiver { /// /// Retrieves serialized data after a domain reload. /// public void OnAfterDeserialize() { //Do nothing } /// /// Converts our data to a serialized structure before a domain reload. /// public void OnBeforeSerialize() { //Do nothing } } /// /// Represents the data acquired after analyzing Addressable assets. /// [Serializable] public class AddressablesAnalyzeResultData : ISerializationCallbackReceiver { [Serializable] private class RuleToResults { [SerializeField] public string RuleName; [SerializeField] public List Results; public RuleToResults(string ruleName, List results) { RuleName = ruleName; Results = results; } } [SerializeField] private List m_RuleToResults = new List(); internal Dictionary> Data = new Dictionary>(); /// /// Retrieves serialized data after a domain reload. /// public void OnAfterDeserialize() { for (int i = 0; i < m_RuleToResults.Count; i++) Data.Add(m_RuleToResults[i].RuleName, m_RuleToResults[i].Results); } /// /// Converts our data to a serialized structure before a domain reload. /// public void OnBeforeSerialize() { m_RuleToResults.Clear(); foreach (var key in Data.Keys) m_RuleToResults.Add(new RuleToResults(key, Data[key])); } internal void Clear(AnalyzeRule rule) { Clear(rule.ruleName); } internal void Clear(string ruleName) { if (Data.ContainsKey(ruleName)) Data[ruleName].Clear(); } } }