示例#1
0
        public Airline(
            AirlineProfile profile,
            AirlineMentality mentality,
            AirlineFocus marketFocus,
            AirlineLicense license,
            Route.RouteType routeFocus)
        {
            Scores = new AirlineScores();
            Shares = new List<AirlineShare>();
            Airports = new List<Airport>();
            Fleet = new List<FleetAirliner>();
            Routes = new List<Route>();
            FutureAirlines = new List<FutureSubsidiaryAirline>();
            Subsidiaries = new List<SubsidiaryAirline>();
            Advertisements = new Dictionary<AdvertisementType.AirlineAdvertisementType, AdvertisementType>();
            Codeshares = new List<CodeshareAgreement>();
            Statistics = new GeneralStatistics();
            Facilities = new List<AirlineFacility>();
            Invoices = new Invoices();
            Budget = new AirlineBudget();
            BudgetHistory = new Dictionary<DateTime, AirlineBudget>();
            TestBudget = new Dictionary<DateTime, AirlineBudget>();
            Profile = profile;
            AirlineRouteFocus = routeFocus;
            Loans = new List<Loan>();
            Reputation = 50;
            Alliances = new List<Alliance>();
            Mentality = mentality;
            MarketFocus = marketFocus;
            License = license;
            Policies = new List<AirlinePolicy>();
            EventLog = new List<RandomEvent>();
            Ratings = new AirlineRatings();
            OverallScore = CountedScores = 0;
            GameScores = new Dictionary<DateTime, int>();
            InsuranceClaims = new List<InsuranceClaim>();
            InsurancePolicies = new List<AirlineInsurance>();
            SpecialContracts = new List<SpecialContract>();

            CreateStandardAdvertisement();

            Pilots = new List<Pilot>();
            FlightSchools = new List<FlightSchool>();
            Budget = new AirlineBudget();
        }
        //creates a subsidiary airline for an airline
        public static SubsidiaryAirline CreateSubsidiaryAirline(Airline airline, double money, string name, string iata, Airline.AirlineMentality mentality, AirlineFocus market,
                                                                Route.RouteType routefocus, Airport homebase)
        {
            var profile = new AirlineProfile(name, iata, airline.Profile.Color, airline.Profile.CEO, true, GameObject.GetInstance().GameTime.Year, 2199) {Country = homebase.Profile.Country};

            var sAirline = new SubsidiaryAirline(airline, profile, mentality, market, airline.License, routefocus);

            AddSubsidiaryAirline(airline, sAirline, money, homebase);

            return sAirline;
        }
        private void btnOk_Click(object sender, RoutedEventArgs e)
        {
            string iata = this.txtIATA.Text.ToUpper().Trim();
            string name = this.txtAirlineName.Text.Trim();
            var airport = (Airport)this.cbAirport.SelectedItem;
            string color = ((PropertyInfo)this.cbColor.SelectedItem).Name;
            Route.RouteType focus = this.rbPassengerType.IsChecked.Value
                ? Route.RouteType.Passenger
                : Route.RouteType.Cargo;

            var profile = new AirlineProfile(
                       name,
                       iata,
                       color,
                       GameObject.GetInstance().MainAirline.Profile.CEO,
                       false,
                       GameObject.GetInstance().GameTime.Year,
                       2199);

            profile.Country = airport.Profile.Country; //GameObject.GetInstance().MainAirline.Profile.Country;<

            var subAirline = new SubsidiaryAirline(
                GameObject.GetInstance().MainAirline,
                profile,
                Airline.AirlineMentality.Safe,
                AirlineFocus.Local,
                Airline.AirlineLicense.Domestic,
                focus);

            subAirline.AddAirport(airport);
            subAirline.Profile.Logos.Clear();
            subAirline.Profile.AddLogo(new AirlineLogo(this.logoPath));
            subAirline.Money = this.slMoney.Value;

            this.Selected = subAirline;
            this.Close();
        }
        //saves the airline
        //creates the airline
        private Airline createAirline()
        {
            string name = txtName.Text.Trim();
            string iata = txtIATA.Text.Trim().ToUpper();
            string ceo = txtCEO.Text.Trim();

            Airline tAirline = Airlines.GetAirline(iata);

            if (tAirline != null)
            {
                Airlines.RemoveAirline(tAirline);
            }

            var country = (Country)cbCountry.SelectedItem;
            string color = ((PropertyInfo)cbColor.SelectedItem).Name;

            var profile = new AirlineProfile(name, iata, color, ceo, false, 1950, 2199);
            profile.Countries = new List<Country> { country };
            profile.Country = country;
            profile.AddLogo(new AirlineLogo(logoPath));
            profile.PreferedAirport = cbAirport.SelectedItem != null ? (Airport)cbAirport.SelectedItem : null;

            Route.RouteType focus = rbPassengerType.IsChecked.Value
                ? Route.RouteType.Passenger
                : Route.RouteType.Cargo;

            var airline = new Airline(
                profile,
                Airline.AirlineMentality.Aggressive,
                AirlineFocus.Local,
                Airline.AirlineLicense.Domestic,
                focus);

            Airlines.AddAirline(airline);

            WPFMessageBox.Show(
                Translator.GetInstance().GetString("MessageBox", "2405"),
                Translator.GetInstance().GetString("MessageBox", "2405", "message"),
                WPFMessageBoxButtons.Ok);

            return airline;
        }