Exemple #1
0
        public MainForm(IGameLogicInteractable game)
        {
            InitializeComponent();
            this.game = game;
            game.FlightProgressChanged += Game_FlightProgressChanged;
            game.GameOver += Game_GameOver;
            contracts      = game.GetContracts();
            contracts.CollectionChanged += Contracts_CollectionChanged;
            flights = game.GetFlightsInfo();
            flights.CollectionChanged += Flights_CollectionChanged;
            cities = game.GetCitiesInfo();
            planes = game.GetPlanes();
            planes.CollectionChanged += Planes_CollectionChanged;

            lblDateValue.Text    = game.GetCurrentDateTime().ToLongDateString();
            lblBalanceValue.Text = "$ " + game.GetSavings().ToString();
            lblTimeValue.Text    = game.GetCurrentDateTime().TimeOfDay.ToString("hh\\:mm");
            lblFuelValue.Text    = "$ " + game.GetFuelPrice().ToString();

            game.SavingsChanged   += Game_SavingsChanged;
            game.DateChanged      += Game_DateChanged;
            game.FuelPriceChanged += Game_FuelPriceChanged;

            btnUpOne.FlatAppearance.BorderSize   = 0;
            btnUpTwo.FlatAppearance.BorderSize   = 0;
            btnUpThree.FlatAppearance.BorderSize = 0;

            InitLayoutControls();
            StartupLayoutInit();
            FillPlanes(PlaneDataType.TransferPlane, userAiroportPlanes);
            FillContracts();
            FillBoard();
            FillPlanes(PlaneDataType.SellPlane, userMarketPlanesSell);
            FillPlanesMarket(userMarketPlanesBuy);
        }
        public ContractForm(IGameLogicInteractable game, Contract contract, uint flightID)
        {
            InitializeComponent();
            this.game     = game;
            this.flightID = flightID;
            cities        = game.GetCitiesInfo().Values.ToList();
            this.contract = contract;

            BackColor = MainForm.MostlyBackColor;
            btnAddFlight.BackColor = MainForm.MostlyBackColor;
            btnCancel.BackColor    = MainForm.MostlyBackColor;

            planesForContract = new UserScroll();
            planesForContract.SetLocation(20, 40);
            planesForContract.Text = "Ваши самолеты";
            FillPlanes(PlaneDataType.SelectPlane, planesForContract);
            this.Controls.Add(planesForContract);
        }