コード例 #1
0
ファイル: InventoryItem.cs プロジェクト: Gothen111/2DWorld
 public InventoryItem(Rectangle _Bounds, Container _Parent, CreatureObject _InventoryOwner)
     : base(_Bounds)
 {
     this.itemObject = null;
     this.parent = _Parent;
     this.inventoryOwner = _InventoryOwner;
 }
コード例 #2
0
ファイル: MenuManager.cs プロジェクト: Gothen111/2DWorld
 public void setMenu(Container _Menu)
 {
     if(this.activeContainer!=null)
     {
         this.activeContainer.release();
     }
     this.activeContainer = _Menu;
 }
コード例 #3
0
ファイル: InventoryMenu.cs プロジェクト: Gothen111/2DWorld
        public InventoryMenu(CreatureObject _InventoryOwner)
            : base()
        {
            this.inventoryOwner = _InventoryOwner;

            this.Bounds = new Rectangle(475, 0, 700, 1000); // TODO: Größe an Bildschirm anpassen!

            this.AllowMultipleFocus = true;

            this.BackgroundGraphicPath = "Gui/Menu/Inventory/InventoryMenu";

            this.equipmentContainer = new Container(this.Bounds);

            int var_Count = this.inventoryOwner.Body.BodyParts.Count;
            for (int y = 0; y < var_Count; y++)
            {
                Component var_InventoryItemSpace = new Component(new Rectangle(this.Bounds.X, this.Bounds.Y + y * 36, 36, 36));
                var_InventoryItemSpace.BackgroundGraphicPath = "Gui/Menu/Inventory/InventoryItemSpace";
                this.add(var_InventoryItemSpace);
            }

            for (int y = 0; y < var_Count; y++)
            {
                EquipmentField var_EquipmentField = new EquipmentField(this.inventoryOwner, this.inventoryOwner.Body.BodyParts[y].Id, this.inventoryOwner.Body.BodyParts[y].AcceptedItemTypes, new Rectangle(this.Bounds.X, this.Bounds.Y + y * 36, 36, 36));
                this.equipmentContainer.add(var_EquipmentField);
            }

            this.itemContainer = new Container(new Rectangle(this.Bounds.X, this.Bounds.Y + 300, this.Bounds.Width, this.Bounds.Height));

            int var_BackbackSize = this.inventoryOwner.Inventory.MaxItems;

            int var_SizeY = var_BackbackSize / 4 + var_BackbackSize % 4;

            for (int y = 0; y < var_SizeY; y++)
            {
                for (int x = 0; x < 4; x++)
                {
                    int var_ItemId = y * 4 + x;
                    if (var_BackbackSize > 0)
                    {
                        InventoryField var_InventoryField = new InventoryField(this.inventoryOwner, var_ItemId, new Rectangle(this.Bounds.X + 92 + 36 * x, this.Bounds.Y + 306 + y * 36, 36, 36));
                        this.itemContainer.add(var_InventoryField);

                        var_BackbackSize -= 1;
                    }
                }
            }

            this.checkItems();
            this.add(this.equipmentContainer);
            this.add(this.itemContainer);
        }
コード例 #4
0
        public CharacterCreationMenu()
            : base()
        {
            this.Bounds = new Rectangle(0,0,1000,1000); // TODO: Größe an Bildschirm anpassen!
            this.BackgroundGraphicPath = "Gui/Menu/CharacterCreation/Background";

            this.AllowMultipleFocus = true;

            this.plattformComponent = new Component(new Rectangle(290, 200, 230, 70));
            this.plattformComponent.BackgroundGraphicPath = "Gui/Menu/CharacterCreation/Plattform";
            this.add(this.plattformComponent);

            this.createCharacter(Factory.FactoryEnums.GenderEnum.Male);

            /*this.characterComponent = new Component(new Rectangle(350, 100, 96, 128));//new Component(new Rectangle(320, 50, 170, 190));
            this.characterComponent.BackgroundGraphicPath = this.playerObject.Body.MainBody.TexturePath;//"Character/BodyMale";//"Character/Char1_Big";
            int var_SizeX = (int)this.playerObject.Body.MainBody.Size.X;
            int var_SizeY = (int)this.playerObject.Body.MainBody.Size.Y;
            this.characterComponent.SourceRectangle = new Rectangle(var_SizeX, 0, var_SizeX, var_SizeY);
            this.add(this.characterComponent);*/

            this.bodyColorPicker = new Container(new Rectangle(530, 50, 300, 300));
            this.createColors();
            this.add(this.bodyColorPicker);

            this.maleButton = new Button(new Rectangle(0, 50, 60, 60));
            //this.maleButton.Text = "Male";
            this.maleButton.BackgroundGraphicPath = "Gui/Menu/CharacterCreation/MaleSymbol";
            this.maleButton.Scale = 0.5f;
            this.maleButton.Action = this.selectedMale;
            this.add(this.maleButton);

            this.femaleButton = new Button(new Rectangle(60, 50, 60, 60));
            //this.femaleButton.Text = "Female";
            this.femaleButton.BackgroundGraphicPath = "Gui/Menu/CharacterCreation/FemaleSymbol";
            this.femaleButton.Scale = 0.4f;
            this.femaleButton.Action = this.selectedFemale;
            this.add(this.femaleButton);

            this.playerNameTextField = new TextField(new Rectangle(260, 280, 289, 85));
            this.playerNameTextField.Text = "Name";
            this.add(this.playerNameTextField);

            this.createCharacterButton = new Button(new Rectangle(260, 380, 289, 85));
            this.createCharacterButton.Text = "Accept";
            this.add(this.createCharacterButton);
            this.createCharacterButton.Action = acceptCharacter;
        }