コード例 #1
0
ファイル: ItemMenu.cs プロジェクト: ma9851/SDV-Mods
        /*********
        ** Public methods
        *********/
        public ItemMenu(List <Item> inventory, BehaviorOnItemSelect behaviorOnItemSelectFunction, BehaviorOnItemSelect behaviorOnItemGrab = null)
            : base(null, true, true)
        {
            this.BehaviorFunction   = behaviorOnItemSelectFunction;
            this.BehaviorOnItemGrab = behaviorOnItemGrab;

            this.Title     = new ClickableComponent(new Rectangle(this.xPositionOnScreen + (width / 2), this.yPositionOnScreen - Game1.tileSize * 2, Game1.tileSize * 4, Game1.tileSize), "CJB Endless Inventory");
            this.UpArrow   = new ClickableTextureComponent("up-arrow", new Rectangle(this.xPositionOnScreen + width - Game1.tileSize / 2, this.yPositionOnScreen - Game1.tileSize, 11 * Game1.pixelZoom, 12 * Game1.pixelZoom), "", "", Game1.mouseCursors, new Rectangle(421, 459, 11, 12), Game1.pixelZoom);
            this.DownArrow = new ClickableTextureComponent("down-arrow", new Rectangle(this.xPositionOnScreen + width - Game1.tileSize / 2, this.yPositionOnScreen + height / 2 - Game1.tileSize * 2, 11 * Game1.pixelZoom, 12 * Game1.pixelZoom), "", "", Game1.mouseCursors, new Rectangle(421, 472, 11, 12), Game1.pixelZoom);

            this.AllowRightClick = true;
            this.Inventory.ShowGrayedOutSlots = false;

            this.ItemsToGrabMenu = new ItemInventoryMenu(this.xPositionOnScreen + Game1.tileSize / 2, this.yPositionOnScreen, false, inventory, null, 99999, 99999 / 12);
        }
コード例 #2
0
        public ItemMenu(List <Item> inventory, ItemMenu.behaviorOnItemSelect behaviorOnItemSelectFunction, ItemMenu.behaviorOnItemSelect behaviorOnItemGrab = null)
            : base(null, true, true, 0, 0)
        {
            //this.inventoryItems = inventory;
            //base.movePosition(0, Game1.viewport.Height - (this.yPositionOnScreen + this.height + IClickableMenu.spaceToClearTopBorder));

            this.behaviorFunction   = new behaviorOnItemSelect(behaviorOnItemSelectFunction);
            this.behaviorOnItemGrab = new behaviorOnItemSelect(behaviorOnItemGrab);

            title          = new ClickableComponent(new Rectangle(this.xPositionOnScreen + (width / 2), this.yPositionOnScreen - Game1.tileSize * 2, Game1.tileSize * 4, Game1.tileSize), "CJB Endless Inventory");
            this.upArrow   = new ClickableTextureComponent("", new Rectangle(this.xPositionOnScreen + width - Game1.tileSize / 2, this.yPositionOnScreen - Game1.tileSize, 11 * Game1.pixelZoom, 12 * Game1.pixelZoom), "", "", Game1.mouseCursors, new Rectangle(421, 459, 11, 12), (float)Game1.pixelZoom);
            this.downArrow = new ClickableTextureComponent("", new Rectangle(this.xPositionOnScreen + width - Game1.tileSize / 2, this.yPositionOnScreen + height / 2 - Game1.tileSize * 2, 11 * Game1.pixelZoom, 12 * Game1.pixelZoom), "", "", Game1.mouseCursors, new Rectangle(421, 472, 11, 12), (float)Game1.pixelZoom);


            this.allowRightClick = true;
            this.inventory.showGrayedOutSlots = false;

            this.ItemsToGrabMenu = new ItemInventoryMenu(this.xPositionOnScreen + Game1.tileSize / 2, this.yPositionOnScreen, false, inventory, null, 99999, 99999 / 12, 0, 0, true);
        }
コード例 #3
0
        public ItemMenuWithInventory(InventoryMenu.highlightThisItem highlighterMethod = null, bool okButton = false, bool trashCan = false, int inventoryXOffset = 0, int inventoryYOffset = 0)
            : base(Game1.viewport.Width / 2 - (800 + IClickableMenu.borderWidth * 2) / 2, Game1.viewport.Height / 2 - (600 + IClickableMenu.borderWidth * 2) / 2, 800 + IClickableMenu.borderWidth * 2, 600 + IClickableMenu.borderWidth * 2, false)
        {
            if (this.yPositionOnScreen < IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder)
            {
                this.yPositionOnScreen = IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder;
            }
            if (this.xPositionOnScreen < 0)
            {
                this.xPositionOnScreen = 0;
            }
            int yPosition = this.yPositionOnScreen + IClickableMenu.spaceToClearTopBorder + IClickableMenu.borderWidth + Game1.tileSize * 3 - Game1.tileSize / 4 + inventoryYOffset;

            this.inventory = new ItemInventoryMenu(this.xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + IClickableMenu.borderWidth / 2 + inventoryXOffset, yPosition, false, (List <Item>)null, highlighterMethod, -1, 3, 0, 0, true);
            if (okButton)
            {
                this.okButton = new ClickableTextureComponent("", new Rectangle(this.xPositionOnScreen + this.width + 4, this.yPositionOnScreen + this.height - Game1.tileSize * 3 - IClickableMenu.borderWidth, Game1.tileSize, Game1.tileSize), "", "", Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 46, -1, -1), 1f);
            }
            if (!trashCan)
            {
                return;
            }
            this.trashCan = new ClickableTextureComponent("", new Rectangle(this.xPositionOnScreen + this.width + 4, this.yPositionOnScreen + this.height - Game1.tileSize * 3 - Game1.tileSize / 2 - IClickableMenu.borderWidth - 104, Game1.tileSize, 104), "", "", Game1.mouseCursors, new Rectangle(669, 261, 16, 26), (float)Game1.pixelZoom);
        }
コード例 #4
0
        public override void gameWindowSizeChanged(Rectangle oldBounds, Rectangle newBounds)
        {
            base.gameWindowSizeChanged(oldBounds, newBounds);
            if (this.yPositionOnScreen < IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder)
            {
                this.yPositionOnScreen = IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder;
            }
            if (this.xPositionOnScreen < 0)
            {
                this.xPositionOnScreen = 0;
            }
            int yPosition = this.yPositionOnScreen + IClickableMenu.spaceToClearTopBorder + IClickableMenu.borderWidth + Game1.tileSize * 3 - Game1.tileSize / 4;

            this.inventory = new ItemInventoryMenu(this.xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + IClickableMenu.borderWidth / 2, yPosition, false, (List <Item>)null, this.inventory.highlightMethod, -1, 3, 0, 0, true);
            if (this.okButton != null)
            {
                this.okButton = new ClickableTextureComponent("", new Rectangle(this.xPositionOnScreen + this.width + 4, this.yPositionOnScreen + this.height - Game1.tileSize * 3 - IClickableMenu.borderWidth, Game1.tileSize, Game1.tileSize), "", "", Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 46, -1, -1), 1f);
            }
            if (this.trashCan == null)
            {
                return;
            }
            this.trashCan = new ClickableTextureComponent("", new Rectangle(this.xPositionOnScreen + this.width + 4, this.yPositionOnScreen + this.height - Game1.tileSize * 3 - Game1.tileSize / 2 - IClickableMenu.borderWidth - 104, Game1.tileSize, 104), "", "", Game1.mouseCursors, new Rectangle(669, 261, 16, 26), (float)Game1.pixelZoom);
        }