private void PutOn(Slot slot) { var icon = new IconViewer(slot.Item, Anchor.Center, 1f, 1f); icon.OnMouseEnter += EnableSelecting; icon.OnMouseExit += DisableSelecting; AddChild(icon); }
public PackViewer(Pack pack, Anchor anchor, float x, float y) : base(anchor, x, y) { _pack = pack; _pack.OnCountChange += ResetCount; SetUnselecting(this); CanBeMoused = true; OnMouseEnter += SetSelecting; OnMouseExit += SetUnselecting; OnSecondaryPressed += SecondaryPressed; var icon = new IconViewer(_pack.Item, Anchor.CenterLeft, 0.1f, 1f); icon.OnMouseEnter += SetSelecting; icon.OnMouseExit += SetUnselecting; icon.OnSecondaryPressed += SecondaryPressed; AddChild(icon); AddChild(new CustomText(Anchor.Center, _pack.Item.Name)); _count = new CustomText(Anchor.CenterRight, "x" + _pack.Count); AddChild(_count); InputListeners.Mouse.MouseDragStart += OnMouseDragStart; }