예제 #1
0
        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;
        }
예제 #2
0
        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();
            }
        }
예제 #3
0
파일: UIElement.cs 프로젝트: StWol/Last-Man
 public void SetParent( UIElement parent )
 {
     this.parent = parent;
 }
예제 #4
0
파일: UIPanel.cs 프로젝트: StWol/Last-Man
 public void Remove( UIElement element )
 {
     children.Remove( element );
 }
예제 #5
0
파일: UIPanel.cs 프로젝트: StWol/Last-Man
 public void Add( UIElement element )
 {
     element.SetParent( this );
     children.Add( element );
 }
예제 #6
0
        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 );
            }
        }
예제 #7
0
 public void OnMouseUp( UIElement element )
 {
     throw new NotImplementedException();
 }
예제 #8
0
 void UIActionListener.OnMouseUp(UIElement element)
 {
     // leer
 }
예제 #9
0
 // ***************************************************************************
 // 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");
 }
예제 #10
0
 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);
     }
 }
예제 #11
0
        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);
            }
        }
예제 #12
0
        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);

            //}
        }
예제 #13
0
        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 );
            }
        }
예제 #14
0
 public void OnMouseUp(UIElement element)
 {
     // leer
 }
예제 #15
0
 public void OnMouseDown(UIElement element)
 {
     NameIsActive = !NameIsActive;
 }
예제 #16
0
파일: UIList.cs 프로젝트: StWol/Last-Man
        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;
            }
        }