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 SetParent( UIElement parent ) { this.parent = parent; }
public void Remove( UIElement element ) { children.Remove( element ); }
public void Add( UIElement element ) { element.SetParent( this ); children.Add( element ); }
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 OnMouseUp( UIElement element ) { throw new NotImplementedException(); }
void UIActionListener.OnMouseUp(UIElement element) { // leer }
// *************************************************************************** // Listener für die Buttons void UIActionListener.OnMouseDown(UIElement element) { if (element == btnExit) Environment.Exit(0); else if (element == btnStart) startButtonEvent(); else if (element == btnHighscore) { Main.MainObject.Highscoremanager = new HighscoreManager(); Main.MainObject.CurrentManager = Main.MainObject.Highscoremanager; } else if (element == btnCredits) Debug.WriteLine("Credits Button"); }
public void OnMouseUp(UIElement element) { inventarList.FirsVisibleButtonIndex = 0; if (element == toggleHauptteil) { inventarList.RemoveItems(listHauptteil); } else if (element == toggleStabilisator) { inventarList.RemoveItems(listStabilisator); } else if (element == toggleVisier) { inventarList.RemoveItems(listVisier); } else if (element == toggleAntrieb) { inventarList.RemoveItems(listAntrieb); } }
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 OnMouseUp( UIElement element ) { //inventarList.FirsVisibleButtonIndex = 0; //if (element == toggleWaffe) //{ // inventarList.RemoveItems(listWaffe); //} //else if (element == toggleHauptteil) //{ // inventarList.RemoveItems(listHauptteil); //} //else if (element == toggleMunition) //{ // inventarList.RemoveItems(listMunition); //} //else if (element == toggleStabilisator) //{ // inventarList.RemoveItems(listStabilisator); //} //else if (element == toggleVisier) //{ // inventarList.RemoveItems(listVisier); //} //else if (element == toggleAntrieb) //{ // inventarList.RemoveItems(listAntrieb); //} //else if (element == togglePowerup) //{ // inventarList.RemoveItems(listPowerup); //} }
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 OnMouseUp(UIElement element) { // leer }
public void OnMouseDown(UIElement element) { NameIsActive = !NameIsActive; }
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; } }