Пример #1
0
        //purchases a terminal for an airline
        public void purchaseTerminal(Airline airline)
        {
            this.Airline = airline;

            double yearlyPayment = AirportHelpers.GetYearlyContractPayment(this.Airport, AirportContract.ContractType.Full, this.Gates.NumberOfGates, 20);

            AirportHelpers.AddAirlineContract(new AirportContract(this.Airline, this.Airport, AirportContract.ContractType.Full, GameObject.GetInstance().GameTime, this.Gates.NumberOfGates, 20, yearlyPayment * 0.75, true));
        }
Пример #2
0
        public void addAirlineContract(AirportContract contract)
        {
            AirportHelpers.AddAirlineContract(contract);

            this.IsHuman           = GameObject.GetInstance().HumanAirline.Airports.Contains(this.Airport);
            this.NumberOfFreeGates = this.Airport.Terminals.NumberOfFreeGates;
            this.NumberOfAirlines  = this.Airport.AirlineContracts.Select(c => c.Airline).Distinct().Count();
            this.NumberOfRoutes    = AirportHelpers.GetAirportRoutes(this.Airport).Count;
        }
Пример #3
0
        //adds an airline contract to the airport
        public void addAirlineContract(AirportContract contract)
        {
            AirportHelpers.AddAirlineContract(contract);

            this.Contracts.Add(new ContractMVVM(contract));

            this.FreeGates = this.Airport.Terminals.NumberOfFreeGates;

            this.CanBuildHub = this.Contracts.Count(c => c.Airline == GameObject.GetInstance().HumanAirline) > 0;

            foreach (AirportTerminalMVVM terminal in Terminals)
            {
                terminal.FreeGates = terminal.Terminal.getFreeGates();
            }

            this.CanMakeCooperation = GameObject.GetInstance().HumanAirline.Airports.Exists(a => a == this.Airport);
        }
Пример #4
0
        private void btnDemandContract_Click(object sender, RoutedEventArgs e)
        {
            DemandMVVM demand = (DemandMVVM)((Button)sender).Tag;

            Airport airport = demand.Destination;

            Boolean hasCheckin = airport.getAirportFacility(GameObject.GetInstance().HumanAirline, AirportFacility.FacilityType.CheckIn).TypeLevel > 0;

            int gates = Math.Min(2, airport.Terminals.NumberOfFreeGates);

            //WPFMessageBoxResult result = WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2222"), string.Format(Translator.GetInstance().GetString("MessageBox", "2222", "message"), gates, airport.Profile.Name), WPFMessageBoxButtons.YesNo);
            object o = PopUpAirportContract.ShowPopUp(airport);

            if (o != null)
            {
                AirportContract.ContractType contractType = (AirportContract.ContractType)o;

                if (!hasCheckin && contractType == AirportContract.ContractType.Full)
                {
                    AirportFacility checkinFacility = AirportFacilities.GetFacilities(AirportFacility.FacilityType.CheckIn).Find(f => f.TypeLevel == 1);

                    airport.addAirportFacility(GameObject.GetInstance().HumanAirline, checkinFacility, GameObject.GetInstance().GameTime);
                    AirlineHelpers.AddAirlineInvoice(GameObject.GetInstance().HumanAirline, GameObject.GetInstance().GameTime, Invoice.InvoiceType.Purchases, -checkinFacility.Price);
                }

                double yearlyPayment = AirportHelpers.GetYearlyContractPayment(airport, contractType, gates, 2);

                AirportContract contract = new AirportContract(GameObject.GetInstance().HumanAirline, airport, contractType, GameObject.GetInstance().GameTime, gates, 2, yearlyPayment, true);

                AirportHelpers.AddAirlineContract(contract);

                for (int i = 0; i < gates; i++)
                {
                    Gate gate = airport.Terminals.getGates().Where(g => g.Airline == null).First();
                    gate.Airline = GameObject.GetInstance().HumanAirline;
                }

                demand.Contracted = true;
            }
        }