コード例 #1
0
ファイル: TestInventory.cs プロジェクト: henon/manic_digger
        public override void OnLoad(EventArgs e)
        {
            window.Mouse.ButtonDown += new EventHandler<OpenTK.Input.MouseButtonEventArgs>(Mouse_ButtonDown);
            the3d.d_Config3d = new Config3d();
            the3d.d_GetFile = getfile;
            the3d.d_Terrain = new TerrainTextures();
            the3d.d_TextRenderer = new TextRenderer();
            the3d.d_ViewportSize = viewportsize;

            var dataItems = new GameDataItems();
            var inventory = new Inventory();
            var server = new InventoryServer();
            var inventoryUtil = new InventoryUtil();
            hud = new HudInventory();
            hud.dataItems = dataItems;
            hud.inventory = inventory;
            hud.inventoryUtil = inventoryUtil;
            hud.controller = server;
            hud.viewport_size = viewportsize;
            hud.mouse_current = this;
            hud.the3d = the3d;
            hud.getfile = getfile;
            hud.ActiveMaterial = new ActiveMaterialDummy();
            hud.viewport3d = new Viewport3dSelectedBlockDummy();
            server.d_Items = dataItems;
            server.d_Inventory = inventory;
            server.d_InventoryUtil = inventoryUtil;
            server.d_DropItem = new DropItemDummy();
            inventoryUtil.d_Inventory = inventory;
            inventoryUtil.d_Items = dataItems;

            for (int i = 0; i < 10; i++)
            {
                inventory.Items.Add(new ProtoPoint(i * 1, 0), new Item() { ItemClass = ItemClass.Block, BlockId = i });
                inventory.Items.Add(new ProtoPoint(i * 1, 6), new Item() { ItemClass = ItemClass.Block, BlockId = i });
            }
            inventory.RightHand[0] = new Item() { ItemClass = ItemClass.Weapon, ItemId = "inventory_weapon_hand_axe.png" };
            inventory.Boots = new Item() { ItemClass = ItemClass.Boots, ItemId = "inventory_boots_shoes.png" };
            inventory.Gauntlet = new Item() { ItemClass = ItemClass.Gauntlet, ItemId = "inventory_gauntlet_gloves.png" };
            inventory.Helmet = new Item() { ItemClass = ItemClass.Helmet, ItemId = "inventory_helmet_zischagge.png" };
            inventory.MainArmor = new Item() { ItemClass = ItemClass.MainArmor, ItemId = "inventory_armor_plate_mail.png" };
            inventory.LeftHand[0] = new Item() { ItemClass = ItemClass.Shield, ItemId = "inventory_shield_small_shield.png" };
            inventory.Items.Add(new ProtoPoint(0, 1), new Item() { ItemClass = ItemClass.Weapon, ItemId = "inventory_weapon_shovel.png" });
            inventory.Items.Add(new ProtoPoint(2, 1), new Item() { ItemClass = ItemClass.Weapon, ItemId = "inventory_weapon_knife.png" });
            inventory.Items.Add(new ProtoPoint(3, 1), new Item() { ItemClass = ItemClass.Weapon, ItemId = "inventory_weapon_club.png" });
            inventory.Items.Add(new ProtoPoint(4, 1), new Item() { ItemClass = ItemClass.MainArmor, ItemId = "inventory_armor_plate_mail.png" });
            inventory.Items.Add(new ProtoPoint(6, 1), new Item() { ItemClass = ItemClass.Weapon, ItemId = "inventory_weapon_maul.png" });
            inventory.Items.Add(new ProtoPoint(8, 1), new Item() { ItemClass = ItemClass.Weapon, ItemId = "inventory_sword.png" });
            inventory.Items.Add(new ProtoPoint(9, 1), new Item() { ItemClass = ItemClass.Other, ItemId = "inventory_health_potion.png" });
        }
コード例 #2
0
ファイル: ModManager.cs プロジェクト: MagistrAVSH/manicdigger
 public void CopyFrom(Inventory inventory)
 {
     //this.LeftHand = inventory.LeftHand;
     this.RightHand = inventory.RightHand;
     this.MainArmor = inventory.MainArmor;
     this.Boots = inventory.Boots;
     this.Helmet = inventory.Helmet;
     this.Gauntlet = inventory.Gauntlet;
     this.Items = inventory.Items;
     this.DragDropItem = inventory.DragDropItem;
 }
コード例 #3
0
ファイル: ModManager.cs プロジェクト: MagistrAVSH/manicdigger
 public static Inventory Create()
 {
     Inventory i = new Inventory();
     //i.LeftHand = new Item[10];
     i.RightHand = new Item[10];
     return i;
 }