コード例 #1
0
        public CostumeViewer(Costume costume, Anchor anchor, float x, float y) :
            base(anchor, x, y, false)
        {
            var left = new InvisiblePanel(Anchor.CenterLeft, SLOT_VIEWER_WIDTH, 1f);

            for (ItemPurpose i = ItemPurpose.Head; i <= ItemPurpose.Boots; i++)
            {
                left.AddChild(new SlotViewer(costume.Clothes[i], Anchor.AutoCenter, 1f, SLOT_VIEWER_HEIGHT));
                left.AddChild(new VerticalSpace(BERTICAL_SPACE_SIZE));
            }
            AddChild(left);

            var right = new InvisiblePanel(Anchor.CenterRight, SLOT_VIEWER_WIDTH, 1f);

            for (ItemPurpose i = ItemPurpose.Amulet; i <= ItemPurpose.Ring; i++)
            {
                right.AddChild(new SlotViewer(costume.Clothes[i], Anchor.AutoCenter, 1f, SLOT_VIEWER_HEIGHT));
                right.AddChild(new VerticalSpace(BERTICAL_SPACE_SIZE));
            }
            right.AddChild(new SlotViewer(costume.SecondRing, Anchor.AutoCenter, 1f, SLOT_VIEWER_HEIGHT));
            right.AddChild(new VerticalSpace(BERTICAL_SPACE_SIZE));
            right.AddChild(new SlotViewer(costume.Clothes[ItemPurpose.Shield], Anchor.AutoCenter, 1f, SLOT_VIEWER_HEIGHT));
            right.AddChild(new VerticalSpace(BERTICAL_SPACE_SIZE));
            AddChild(right);
            AddChild(new SlotViewer(costume.Clothes[ItemPurpose.Weapon], Anchor.BottomCenter, SLOT_VIEWER_WIDTH, SLOT_VIEWER_HEIGHT));
        }
コード例 #2
0
        public BagViewer(Bag bag, Anchor anchor, float x, float y) :
            base(anchor, x, y)
        {
            _bag = bag;

            _filtersBar            = new FiltersBar(Anchor.AutoCenter, 1, 0.1f);
            _filtersBar.OnChanged += ResetPacks;
            AddChild(_filtersBar);

            _packsPanel = new InvisiblePanel(Anchor.AutoCenter, 1, 0.9f, true);
            AddChild(_packsPanel);

            _bag.OnChanged += ResetPacks;

            DragAndDrop.OnDrop += DropItem;

            ResetPacks();
        }