/// <summary>
 /// Constructor.
 /// </summary>
 public GetPlayerScreen()
 {
     TransitionOnTime = TimeSpan.FromSeconds(0.5);
     TransitionOffTime = TimeSpan.FromSeconds(0.5);
     _controls = new List<Control>();
     _fm = new FileManager();
     _list = new HighscoreList();
 }
Exemple #2
0
 public List(Texture2D texture, Vector2 position, string text)
     : base(position)
 {
     base.Text = text;
     _texture = texture;
     _fm = new FileManager();
     _list = _fm.LoadHighscoreList();
     _bounds = new Rectangle((int)position.X, (int)position.Y, texture.Width, texture.Height);
 }
        public ShopModules(Texture2D texture, Texture2D texture_buy_off, Texture2D texture_buy_on, SpriteFont font, SpriteFont hintFont, Vector2 position, string text, Pilot pilot)
            : base(position)
        {
            base.Text = text;
            base.Font = font;
            _texture = texture;
            _texture_buy_off = texture_buy_off;
            _texture_buy_on = texture_buy_on;
            _fm = new FileManager();
            _pilot = pilot;
            _bounds = new Rectangle((int)position.X, (int)position.Y, texture.Width, texture.Height);
            _controls = new List<Control>();

            int count = 0;
            foreach (Module module in _pilot.GetModuleListOfShip())
            {
                Module currentModule = _pilot.GetModuleListOfShip()[count];
                ModuleControl _moduleControl = new ModuleControl(
                    _texture_buy_off,
                    _texture_buy_on,
                    new Vector2(base.Position.X + 20, 160 + 140 * count),
                    currentModule);
                _moduleControl.Font = Font;
                _moduleControl.BuyClicked += (sender, args) =>
                {
                    Int32 price = currentModule.Price;
                    if (_pilot.Money >= price && currentModule.size < 3)
                    {
                        _pilot.UpgradeModuleOfShip(currentModule.kind);
                        _pilot.Money -= price;
                    }
                };
                _moduleControl.HintFont = hintFont;
                _controls.Add(_moduleControl);
                count++;
            }
        }