| | 1 | | using DCL.SettingsCommon.SettingsControllers.BaseControllers; |
| | 2 | |
|
| | 3 | | /// <summary> |
| | 4 | | /// Data Store that contains accessors to all the loaded settings controllers. |
| | 5 | | /// </summary> |
| | 6 | | public class SettingsPanelDataStore |
| | 7 | | { |
| 1 | 8 | | private static SettingsPanelDataStore instance = new SettingsPanelDataStore(); |
| 34 | 9 | | public static SettingsPanelDataStore i { get => instance; } |
| 0 | 10 | | public static void Clear() => instance = new SettingsPanelDataStore(); |
| | 11 | |
|
| | 12 | | /// <summary> |
| | 13 | | /// Access to all the settings control controllers. |
| | 14 | | /// </summary> |
| 1 | 15 | | public readonly Controls controls = new Controls(); |
| | 16 | |
|
| | 17 | | public class Controls |
| | 18 | | { |
| 1 | 19 | | public readonly BaseCollection<SettingsControlController> controlControllers = new BaseCollection<SettingsContro |
| | 20 | |
|
| | 21 | | public bool TryGetController<T>(out T controlController) where T : SettingsControlController |
| | 22 | | { |
| 0 | 23 | | bool found = false; |
| 0 | 24 | | controlController = null; |
| | 25 | |
|
| 0 | 26 | | foreach (SettingsControlController controller in controlControllers.Get()) |
| | 27 | | { |
| 0 | 28 | | if (controller is T) |
| | 29 | | { |
| 0 | 30 | | controlController = (T)controller; |
| 0 | 31 | | return true; |
| | 32 | | } |
| | 33 | | } |
| | 34 | |
|
| 0 | 35 | | return found; |
| 0 | 36 | | } |
| | 37 | | } |
| | 38 | | } |