private void Open(GameObject obj, IEnumerable <IContextMenuOption> options, Vector2 position) { if (!HasActiveWindow(obj)) { GameObject menuObj = WindowManager.OpenWindow(MenuPrefab); if (menuObj) { HighlighterCollection highlighter = HighlighterCollection.Create(obj.transform.root.gameObject, Highlighter); highlighter.Highlight(); highlighter.Tint(Color.green); menuObj.transform.position = position; ContextMenu menu = menuObj.GetComponent <ContextMenu>(); menu.Open(options); menu.StickTo(obj.transform); AddActiveWindow(obj, menu); menu.OnClosed += () => { RemoveActiveWindow(obj); highlighter.EndHighlight(); }; } } }
private void OnHoverChanged(Collider2D cur, Collider2D prev) { if (_highlighters != null) { _highlighters.EndHighlight(); } if (cur != null) { _highlighters = HighlighterCollection.Create(cur.transform.root.gameObject, Highlighter); _highlighters.Highlight(); _highlighters.Tint(Color.green); } }