diff --git a/Assets/extDebug/Scripts/Menu/DMAction.cs b/Assets/extDebug/Scripts/Menu/DMAction.cs index 0acc54d..0cf9705 100644 --- a/Assets/extDebug/Scripts/Menu/DMAction.cs +++ b/Assets/extDebug/Scripts/Menu/DMAction.cs @@ -31,7 +31,7 @@ protected override void OnEvent(EventArgs eventArgs) if (eventArgs.Key == EventKey.Left) { - DM.Back(); + Container.Back(); } else if (eventArgs.Key == EventKey.Right && _action != null) { diff --git a/Assets/extDebug/Scripts/Menu/DMBranch.cs b/Assets/extDebug/Scripts/Menu/DMBranch.cs index 0723bb5..a9e4a99 100644 --- a/Assets/extDebug/Scripts/Menu/DMBranch.cs +++ b/Assets/extDebug/Scripts/Menu/DMBranch.cs @@ -251,8 +251,8 @@ protected override void OnEvent(EventArgs eventArgs) var currentItem = Current; if (currentItem is DMBranch) { - if (DM.IsVisible) - DM.Back(); + if (Container.IsVisible) + Container.Back(); } else { @@ -264,8 +264,8 @@ protected override void OnEvent(EventArgs eventArgs) var currentItem = Current; if (currentItem is DMBranch currentBranch) { - if (DM.IsVisible) - DM.Open(currentBranch); + if (Container.IsVisible) + Container.Open(currentBranch); } else { @@ -286,7 +286,7 @@ protected override void OnEvent(EventArgs eventArgs) } else if (eventArgs.Key == EventKey.Back) { - DM.Back(); + Container.Back(); } } } diff --git a/Assets/extDebug/Scripts/Menu/DMBranchRequest.cs b/Assets/extDebug/Scripts/Menu/DMBranchRequest.cs index c5d73d5..68047e0 100644 --- a/Assets/extDebug/Scripts/Menu/DMBranchRequest.cs +++ b/Assets/extDebug/Scripts/Menu/DMBranchRequest.cs @@ -72,13 +72,19 @@ protected override DMItem BuildItem(DMBranch parent, T @object, string name, int void OnOpenCallback(DMBranch branch) { foreach (var item in _items) + { item.Data = branch.Data; + item.Container = branch.Container; + } } void OnCloseCallback(DMBranch branch) { foreach (var item in _items) + { item.Data = null; + item.Container = null; + } } var branch = DM.Add(parent, name, GetDescription(@object), order); diff --git a/Assets/extDebug/Scripts/Menu/DMContainer.cs b/Assets/extDebug/Scripts/Menu/DMContainer.cs index de5a252..36eb3ab 100644 --- a/Assets/extDebug/Scripts/Menu/DMContainer.cs +++ b/Assets/extDebug/Scripts/Menu/DMContainer.cs @@ -67,6 +67,7 @@ public void Open(DMBranch branch) } _currentBranch = branch; + _currentBranch.Container = this; _currentBranch.SendEvent(EventArgs.OpenBranch); _currentBranch.RequestRepaint(); diff --git a/Assets/extDebug/Scripts/Menu/DMEnum.cs b/Assets/extDebug/Scripts/Menu/DMEnum.cs index e2adbb9..5074deb 100644 --- a/Assets/extDebug/Scripts/Menu/DMEnum.cs +++ b/Assets/extDebug/Scripts/Menu/DMEnum.cs @@ -69,7 +69,7 @@ public DMEnum(DMBranch parent, string path, Func getter, Action setter = n }, i); } - DM.Add(_flagBranch, "Back", _ => DM.Back(), string.Empty, int.MaxValue); + DM.Add(_flagBranch, "Back", a => a.Container.Back(), string.Empty, int.MaxValue); } } } @@ -82,13 +82,13 @@ protected override void OnEvent(EventArgs eventArgs) { if (_flagBranch != null && eventArgs.Tag == EventTag.Input && eventArgs.Key == EventKey.Left) { - if (DM.IsVisible) - DM.Back(); + if (Container.IsVisible) + Container.Back(); } else if (_flagBranch != null && eventArgs.Tag == EventTag.Input && eventArgs.Key == EventKey.Right) { - if (DM.IsVisible) - DM.Open(_flagBranch); + if (Container.IsVisible) + Container.Open(_flagBranch); } else { diff --git a/Assets/extDebug/Scripts/Menu/DMItem.cs b/Assets/extDebug/Scripts/Menu/DMItem.cs index 1f724e7..e22e775 100644 --- a/Assets/extDebug/Scripts/Menu/DMItem.cs +++ b/Assets/extDebug/Scripts/Menu/DMItem.cs @@ -94,16 +94,24 @@ public Color ValueColor public object Data { - get => _data ?? _parent?._data; + get => _data ?? _parent?.Data; set => _data = value; } - #endregion + public DMContainer Container + { + get => _container ?? _parent?.Container; + set => _container = value; + } + #endregion + #region Protected Vars protected readonly DMBranch _parent; + protected DMContainer _container; + protected string _name; protected Color _nameColor = DM.Colors.Name; diff --git a/Assets/extDebug/Scripts/Menu/DMRequest.cs b/Assets/extDebug/Scripts/Menu/DMRequest.cs index 3818d04..3ea2ecc 100644 --- a/Assets/extDebug/Scripts/Menu/DMRequest.cs +++ b/Assets/extDebug/Scripts/Menu/DMRequest.cs @@ -54,6 +54,7 @@ internal override List BuildItems(DMBranch parent) var @object = objects[i]; var @objectItem = BuildItem(parent, @object, GetName(@object), i); @objectItem.Data = @object; + @objectItem.Container = parent.Container; branches.Add(@objectItem); }