public bool isMouseIn( Rectangle rect, UIElement source ) { int xRect = ( rect.X ); int yRect = ( rect.Y ); int w = rect.Width; int h = rect.Height; if ( x > xRect && x < xRect + w && y > yRect && y < yRect + h ) { if ( source.GetType() == typeof( UIToggleButton ) ) { int a= 0; } return true; } return false; }
public void OnMouseDown(UIElement element) { if (element.GetType() == typeof(UIListButton)) { Item item = ((UIListButton) element).Item; if (item.GetType() == typeof (Visier)) { constructionPanel.SetVisier((Visier) item); } else if (item.GetType() == typeof (Antrieb)) { constructionPanel.SetAntrieb((Antrieb) item); } else if (item.GetType() == typeof (Stabilisator)) { constructionPanel.SetStabilisator((Stabilisator) item); } else if (item.GetType() == typeof (Hauptteil)) { constructionPanel.SetHauptteil((Hauptteil) item); } } else if(element.GetType() == typeof(UIButton)) { Visier v = constructionPanel.Visier; Antrieb a = constructionPanel.Antrieb; Stabilisator s = constructionPanel.Stabilisator; Hauptteil h = constructionPanel.Hauptteil; Weapon newWeapon = new Weapon(v, a, s, h, Item.StaticID, 0, constructionPanel.InputText, 0, "", new MapLocation(new Vector2(0,0))); player.RemoveItemFromInventar(v); player.RemoveItemFromInventar(a); player.RemoveItemFromInventar(s); player.RemoveItemFromInventar(h); Item.AllItems.Add(Item.StaticID++, newWeapon); player.AddItemToInventar(newWeapon); filteredConstructorList.RefreshItemList(); player.ReduceLiquid(newWeapon.GetTotalRequeredLiquids()); constructionPanel.ResetPanel(); } }
public void OnMouseDown( UIElement element ) { ////////////////////////////////////////////////////// // ListButtons if ( element.GetType() == typeof( UIListButton ) ) { activeItem = ( ( UIListButton ) element ).Item; if ( activeItem.GetType() == typeof( Powerup ) ) { //aus der Liste in die Shortcuts btnOk.IsEnabled = true; } else { btnOk.IsEnabled = false; } btnCancel.IsEnabled = true; } ////////////////////////////////////////////////////// // OK & Cankel Buttons if ( activeItem != null ) if ( element == btnOk ) { if ( activeItem.GetType() == typeof( Powerup ) ) { //Fressen activeItem player.UsePowerup( ( Powerup ) activeItem ); filteredInventarList.RemoveActiveItem(); player.RemoveItemFromInventar(activeItem); activeItem = null; //Fressen activeItem } } else if ( element == btnCancel ) { Item dropedItem = Item.Get( activeItem.TypeId ); dropedItem.LocationBehavior.Position = player.LocationBehavior.Position; dropedItem.LocationSizing(); if ( dropedItem.GetType() == typeof( Munition ) ) { ( ( Munition ) dropedItem ).Count = player.Inventar[ activeItem.TypeId ]; } Main.MainObject.GameManager.GameState.QuadTreeItems.Add( dropedItem ); filteredInventarList.RemoveActiveItem(); activeItem = player.RemoveItemFromInventar( activeItem ); //filteredInventarList.GenerateFilteredLists( player.Inventar ); } ////////////////////////////////////////////////////// // Shortcut buttons if ( element.GetType() == typeof( UIShortcutButton ) ) { HandleShortcutButtonClick( ( UIShortcutButton ) element ); } }
public void OnMouseDown(UIElement element) { ////////////////////////////////////////////////////// // ToggleButtons if (element.GetType() == typeof (UIToggleButton)) { inventarList.FirsVisibleButtonIndex = 0; } if (element == toggleHauptteil) { inventarList.AddItemList(listHauptteil); } else if (element == toggleStabilisator) { inventarList.AddItemList(listStabilisator); } else if (element == toggleVisier) { inventarList.AddItemList(listVisier); } else if (element == toggleAntrieb) { inventarList.AddItemList(listAntrieb); } }
public void OnMouseDown( UIElement element ) { ////////////////////////////////////////////////////// // ToggleButtons if ( element.GetType() == typeof( UIToggleButton ) ) { inventarList.FirsVisibleButtonIndex = 0; } ResetToggleButtons(); if ( element == toggleAlles ) { inventarList.SetItems( listAlles ); } if ( element == toggleWaffe ) { inventarList.SetItems( listWaffe ); } else if ( element == toggleHauptteil ) { inventarList.SetItems( listHauptteil ); } else if ( element == toggleMunition ) { inventarList.SetItems( listMunition ); } else if ( element == toggleStabilisator ) { inventarList.SetItems( listStabilisator ); } else if ( element == toggleVisier ) { inventarList.SetItems( listVisier ); } else if ( element == toggleAntrieb ) { inventarList.SetItems( listAntrieb ); } else if ( element == togglePowerup ) { inventarList.SetItems( listPowerup ); } }
public void OnMouseDown( UIElement element ) { if ( element == btnPrevious && firsVisibleButtonIndex > 0 ) { firsVisibleButtonIndex--; } if ( element == btnNext ) { if ( ( firsVisibleButtonIndex + MAX_VISIBLE_BUTTON_COUNT ) < buttonList.Count ) { firsVisibleButtonIndex++; } } if ( element.GetType() == typeof( UIListButton ) ) { foreach ( UIListButton i in buttonList ) { i.isActive = false; if ( i == element ) { i.isActive = true; } } if ( activeItemButton != null ) activeItemButton.Color = Color.Gray; activeItemButton = ( UIListButton ) element; activeItemButton.Color = Color.Green; } }