using System.Collections.Generic; using UnityEngine; namespace DarkTonic.MasterAudio.EditorScripts { // ReSharper disable once CheckNamespace // ReSharper disable once InconsistentNaming public class MAGOSetting { private const string IgnoredComponentNames = ";Transform;AudioSource;SoundGroupVariationUpdater;"; private List _componentSettings; public MAGOSetting(GameObject gameObj) { GameObj = gameObj; CreateComponentSettings(); } public GameObject GameObj { get; set; } public List ComponentSettings { get { return _componentSettings; } } public void CreateComponentSettings() { _componentSettings = new List(); var components = GameObj.GetComponents(typeof(Component)); foreach (var c in components) { var setting = new MAComponentPatch(c); if (c == null) { continue; } if (IgnoredComponentNames.Contains(";" + setting.ComponentName + ";")) { continue; } _componentSettings.Add(setting); } } public void StoreAllSelectedSettings() { _componentSettings.ForEach(setting => setting.StoreSettings()); } public List RestoreAllSelectedSettings() { var listOfChangedComponents = new List(); foreach (var setting in _componentSettings) { var resultChangedComponent = setting.RestoreSettings(); if (resultChangedComponent != null) { listOfChangedComponents.Add(resultChangedComponent); } } return listOfChangedComponents; } } }