/// <summary> /// Closes this dropdown menu. /// </summary> public void CloseMenu() { if (!Active || IsAnimating) { return; } listContainer.TotalItems = 0; context = null; hideAni.PlayFromStart(); }
/// <summary> /// Sets up the dropdown menu for specified context and makes the menu visible. /// </summary> public void OpenMenu(DropdownContext context) { if (Active || IsAnimating) { return; } this.context = context; // Clamp menu height so it doesn't go over half of screen height. holder.Height = Mathf.Min(ItemSize.y * context.Datas.Count, GetMaxHolderHeight()); listContainer.TotalItems = context.Datas.Count; showAni.PlayFromStart(); }