protected virtual void DisplayItem(Option <IEquipment> item) { _buttonListeners.Clear(); foreach (var button in ButtonContainer.GetChildren().OfType <Button>()) { button.QueueFree(); } match(from i in item from c in PlayerControl.Character select(item: i, character: c), v => { InfoPanel.Visible = true; ItemStand.Visible = true; ItemStand.Mesh = v.item.Meshes.First().Mesh; TitleLabel.Text = v.item.DisplayName; TypeLabel.Iter(label => label.Text = v.item.EquipmentType.DisplayName(Node)); DescriptionLabel.Iter(label => label.Text = v.item.Description.IfNone(string.Empty)); ViewControl.Reset(); var context = new InteractionContext(v.character, v.item); var actions = v.character.Actions.Values .OfType <Interaction>() .Where(a => a.Active && a.Valid && a.AllowedFor(context)); foreach (var action in actions) { var button = (Button)ActionButton.Instance(); button.Text = action.DisplayName; ButtonContainer.AddChild(button); var listener = button.OnPress().Subscribe(_ => OnButtonPress(action.Key), this); _buttonListeners.Add(listener); } }, () => { InfoPanel.Visible = false; ItemStand.Visible = false; ItemStand.Mesh = null; } ); }