Пример #1
0
        public override void Update(GameTime gameTime)
        {
            if (Visible)
            {
                if (GeneralManager.Singleton.CheckLMB())
                {
                    if (new Rectangle(0, 0, (int)(Renderer.Width * 0.057), (int)(Renderer.Height * 0.14)).Contains((int)GeneralManager.Singleton.MousePos.X, (int)GeneralManager.Singleton.MousePos.Y))
                    {
                        this.Visible = false;
                        GeneralManager.Singleton.CurrentLevel.Show();
                        GeneralManager.SoundManager.PlaySound("beep");
                    }

                    foreach (Slot S in GeneralManager.Singleton.CurrentPlayer.Ship.Hull.Slots)
                    {
                        if (new Rectangle((int)S.Position.X - 15 + Renderer.Width / 2 - GeneralManager.Singleton.CurrentPlayer.Ship.Hull.SizeX / 2, (int)S.Position.Y - 15 + Renderer.Height / 2 - GeneralManager.Singleton.CurrentPlayer.Ship.Hull.SizeY / 2, 30, 30).Contains((int)GeneralManager.Singleton.MousePos.X, (int)GeneralManager.Singleton.MousePos.Y))
                        {
                            if (Selected != null)
                            {

                                GeneralManager.SoundManager.PlaySound("beep");

                                if (S.Component != null)
                                {
                                    GeneralManager.Singleton.CurrentPlayer.ComponentsInventory.Add(S.Component);
                                }

                                S.Component = Selected;
                                GeneralManager.Singleton.CurrentPlayer.ComponentsInventory.Remove(Selected);
                                Selected = null;

                            }
                            else
                            {
                                GeneralManager.Singleton.CurrentPlayer.ComponentsInventory.Add(S.Component);
                                S.Component = null;
                            }
                        }
                    }
                }

                if (Rects[0].Contains((int)GeneralManager.Singleton.MousePos.X, (int)GeneralManager.Singleton.MousePos.Y) && GeneralManager.Singleton.CheckLMB())
                {
                    if (Rewind > 0)
                    {
                        Rewind--;
                    }
                    GeneralManager.SoundManager.PlaySound("beep");
                }
                for(int i =1; i <17; i++)
                {
                    if (Rects[i].Contains((int)GeneralManager.Singleton.MousePos.X, (int)GeneralManager.Singleton.MousePos.Y) && GeneralManager.Singleton.CheckLMB())
                    {
                        Selected = GeneralManager.Singleton.CurrentPlayer.ComponentsInventory[i - 1 + Rewind];
                    }

                }
                if (Rects[17].Contains((int)GeneralManager.Singleton.MousePos.X, (int)GeneralManager.Singleton.MousePos.Y) && GeneralManager.Singleton.CheckLMB())
                {
                    if (GeneralManager.Singleton.CurrentPlayer.ComponentsInventory.Count - 16 - Rewind >0)
                    {
                        Rewind++;
                    }
                    GeneralManager.SoundManager.PlaySound("beep");
                }
            }
            base.Update(gameTime);
        }
Пример #2
0
 public SellOption(Component Item, int Price)
 {
     this.Item = Item;
     this.Price = Price;
 }