//ParticleComponent particleComponent; public GameSurface() : base() { this.Bounds = new Rectangle(0, (int)(Setting.Setting.resolutionY * 0.7), Setting.Setting.resolutionX, (int)(Setting.Setting.resolutionY * 0.3)); this.AllowMultipleFocus = true; this.healthComponent = new Healthbar(new Rectangle((int)(this.Bounds.X + this.Bounds.Width * 0.106), (int)(this.Bounds.Y + this.Bounds.Height * 0.18), 187, 188)); this.healthComponent.BackgroundGraphicPath = "Gui/Menu/GameSurface/Health"; this.add(this.healthComponent); this.manaComponent = new Component(new Rectangle((int)(this.Bounds.X + this.Bounds.Width * 0.662), (int)(this.Bounds.Y + this.Bounds.Height * 0.18), 187, 188)); this.manaComponent.BackgroundGraphicPath = "Gui/Menu/GameSurface/Mana"; this.add(this.manaComponent); this.interfaceComponent = new Component(new Rectangle((int)(this.Bounds.X + this.Bounds.Width * 0.1), (int)(this.Bounds.Y + this.Bounds.Height * 0.15), 767, 201)); this.interfaceComponent.BackgroundGraphicPath = "Gui/Menu/GameSurface/Interface"; this.add(this.interfaceComponent); this.inventoryButton = new Button(new Rectangle((int)(this.Bounds.X + this.Bounds.Width * 0.5), (int)(this.Bounds.Y + this.Bounds.Height * 0.3), 25, 25)); this.inventoryButton.BackgroundGraphicPath = "Gui/Menu/Inventory/InventoryButton"; this.inventoryButton.Action = inventoryButton_Click; this.inventoryButton.IsTextEditAble = false; this.add(this.inventoryButton); this.inventoryMenu = new InventoryMenu(Configuration.Configuration.networkManager.client.PlayerObject); this.inventoryMenu.setIsActive(false); this.add(this.inventoryMenu); }
public virtual void add(Component _Component) { if (this.strategy != null && !this.strategy.checkComponent(_Component)) { Logger.Logger.LogInfo("Strategy " + this.strategy.ToString() + " verhindert das Hinzufügen von " + _Component.ToString()); return; } this.components.Add(_Component); }
public LoadingMenu() : 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.loadingComponent = new Component(new Rectangle(200, 100, 289, 85)); this.add(this.loadingComponent); }
//TODO: Lässt sich bestimmt per Strategie machen ;) public void addAtTop(Component _Component) { _Component.Bounds = new Rectangle(this.Bounds.X, this.Bounds.Y, _Component.Bounds.Width, _Component.Bounds.Height); foreach (Component var_Component in this.Components) { var_Component.Bounds = new Rectangle(var_Component.Bounds.X, var_Component.Bounds.Y + _Component.Bounds.Height, var_Component.Bounds.Width, var_Component.Bounds.Height); } this.add(_Component); }
public override bool componentIsDropedIn(Component _Component) { base.componentIsDropedIn(_Component); if (_Component is InventoryItem) { //Iteriere durch alle inventory menus in surface oä.... this.inventoryMenu.InventoryOwner.Inventory.dropItem(this.inventoryMenu.InventoryOwner, ((InventoryItem)_Component).ItemObject); ((InventoryItem)_Component).ItemObject.PositionInInventory = -1; return true; } return false; }
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); }
public override bool componentIsDropedIn(Component _Component) { base.componentIsDropedIn(_Component); if(_Component is InventoryItem) { if (this.item == null || this.Components.Contains(this.item)) { //this.setItem(((InventoryItem)_Component).ItemObject); this.itemDropedIn(((InventoryItem)_Component).ItemObject); return true; } } return false; }
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; }
public void addAtBottom(Component _Component) { float var_PositionY = this.Bounds.Y; foreach (Component var_Component in this.Components) { if (var_Component.Bounds.Y + var_Component.Bounds.Height >= var_PositionY) { var_PositionY = var_Component.Bounds.Y + var_Component.Bounds.Height; } } _Component.Bounds = new Rectangle(this.Bounds.X, (int)var_PositionY, _Component.Bounds.Width, _Component.Bounds.Height); this.add(_Component); }
public override bool componentIsDropedIn(Component _Component) { base.componentIsDropedIn(_Component); if(_Component is InventoryItem) { //TODO: Überürufe welcher typ :D ob wawffe oder ücstung usw if (this.item == null || this.Components.Contains(this.item)) { if (this.acceptedItemTypes.Contains(((InventoryItem)_Component).ItemObject.ItemEnum)) { this.itemDropedIn(((InventoryItem)_Component).ItemObject); return true; } } } return false; }
public override void onClick(UserInterface.MouseEnum.MouseEnum mouseButton, Vector2 _MousePosition) { base.onClick(mouseButton, _MousePosition); if (this.lastSelected != null) { this.lastSelected.IsSelected = false; this.lastSelected = null; } //TODO: Texture / Background anpassen! foreach (Component var_Component in this.Components) { // VLL auch mit isPressed ;) da mouse event öfters als einmal abegefeuert wird usw... if (_MousePosition.X >= var_Component.Bounds.Left && _MousePosition.X <= var_Component.Bounds.Right && _MousePosition.Y >= var_Component.Bounds.Top && _MousePosition.Y <= var_Component.Bounds.Bottom) { this.lastSelected = var_Component; } } if (this.lastSelected != null) this.lastSelected.IsSelected = true; }
public virtual bool componentIsDropedIn(Component _Component) { return true; }
public virtual void remove(Component _Component) { if(this.components.Contains(_Component)) this.components.Remove(_Component); }
private void createColors() { /*int y = 0; for (int x = 0; x < 10; x++) { for (; y < 5; y++) { Component var_ColorComponent = new Component(new Rectangle(this.bodyColorPicker.Bounds.X + x * 16 + (y%2)*8, this.bodyColorPicker.Bounds.Y + y * 13, 16, 17)); var_ColorComponent.BackgroundGraphicPath = "Gui/Menu/CharacterCreation/ColorField"; var_ColorComponent.ComponentColor = new Color(y * 25, x * 25, x * 25); this.bodyColorPicker.add(var_ColorComponent); } for (; y >=5 && y < 10; y++) { Component var_ColorComponent = new Component(new Rectangle(this.bodyColorPicker.Bounds.X + x * 16 + (y % 2) * 8, this.bodyColorPicker.Bounds.Y + y * 13, 16, 17)); var_ColorComponent.BackgroundGraphicPath = "Gui/Menu/CharacterCreation/ColorField"; var_ColorComponent.ComponentColor = new Color(255 - y * 10, 255 - x * 25, x * 25); this.bodyColorPicker.add(var_ColorComponent); } y = 0; }*/ for (int y = 0; y < 10; y++) { for (int x = 0; x < y; x++) { Component var_ColorComponent = new Component(new Rectangle(this.bodyColorPicker.Bounds.X + x * 16 + (y % 2) * 8, this.bodyColorPicker.Bounds.Y + y * 13, 16, 17)); var_ColorComponent.BackgroundGraphicPath = "Gui/Menu/CharacterCreation/ColorField"; var_ColorComponent.ComponentColor = new Color(255 - (y * 25 + x * 25) / 2, y * 25 - x * 25, (y * 25 + x * 25) / 2); //var_ColorComponent.ComponentColor = new Color((125-x*12, y * 25 - x * 25, (y * 25 + x * 25) / 2); //Console.Write(var_ColorComponent.ComponentColor.B + " | "); this.bodyColorPicker.add(var_ColorComponent); } Console.WriteLine(); } }