コード例 #1
0
ファイル: Airline.cs プロジェクト: rhgtvcx/tap-desktop
        public Airline(AirlineProfile profile, AirlineMentality mentality, AirlineFocus marketFocus, AirlineLicense license, Route.RouteType routeFocus)
        {
            this.Scores = new AirlineScores();
            this.Airports = new List<Airport>();
            this.Fleet = new List<FleetAirliner>();
            this._Routes = new List<Route>();
            this.FutureAirlines = new List<FutureSubsidiaryAirline>();
            this.Subsidiaries = new List<SubsidiaryAirline>();
            this.Advertisements = new Dictionary<AdvertisementType.AirlineAdvertisementType, AdvertisementType>();
            this.Statistics = new GeneralStatistics();
            this.Facilities = new List<AirlineFacility>();
            this.Invoices = new Invoices();
            this.Budget = new AirlineBudget();
            this.BudgetHistory = new Dictionary<DateTime, AirlineBudget>();
            this.TestBudget = new Dictionary<DateTime, AirlineBudget>();
            this.Profile = profile;
            this.AirlineRouteFocus = routeFocus;
            this.Loans = new List<Loan>();
            this.Reputation = 50;
            this.Alliances = new List<Alliance>();
            this.Mentality = mentality;
            this.MarketFocus = marketFocus;
            this.License = license;
            this.FlightCodes = new List<string>();
            this.Policies = new List<AirlinePolicy>();
            this.EventLog = new List<RandomEvent>();
            this.Ratings = new AirlineRatings();
            this.OverallScore = this.CountedScores = 0;
            this.GameScores = new Dictionary<DateTime, int>();
            this.InsuranceClaims = new List<InsuranceClaim>();
            this.InsurancePolicies = new List<AirlineInsurance>();
            for (int i = 1; i < 10000; i++)
                this.FlightCodes.Add(string.Format("{0}{1:0000}",this.Profile.IATACode, i));

            createStandardAdvertisement();

            this.Pilots = new List<Pilot>();
            this.FlightSchools = new List<FlightSchool>();
            this.Budget = new AirlineBudget();
        }
コード例 #2
0
        private void 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);

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

            AirlineProfile 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;

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

            Airlines.AddAirline(airline);

            WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2405"), Translator.GetInstance().GetString("MessageBox", "2405", "message"), WPFMessageBoxButtons.Ok);
        }
コード例 #3
0
        //creates the airline
        private void createAirline()
        {
            Airline tAirline = Airlines.GetAirline(txtIATA.Text.Trim().ToUpper());

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

            string name = txtAirlineName.Text.Trim();
            string iata = txtIATA.Text.Trim().ToUpper();
            Country country = (Country)cbCountry.SelectedItem;
            string color = ((PropertyInfo)cbColor.SelectedItem).Name;

            AirlineProfile profile = new AirlineProfile(name, iata, color,"Unknown",false,1950,2199);
            profile.Countries = new List<Country>() { country };
            profile.Country = country;
            profile.addLogo(new AirlineLogo(logoPath));

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

            Airlines.AddAirline(airline);

            PageNavigator.NavigateTo(new PageNewGame());
        }
コード例 #4
0
ファイル: AirlineHelpers.cs プロジェクト: tehknox/tap-desktop
        //creates a subsidiary airline for an airline
        public static SubsidiaryAirline CreateSubsidiaryAirline(Airline airline, double money, string name, string iata, Airline.AirlineMentality mentality, Airline.AirlineFocus market, Route.RouteType routefocus, Airport homebase)
        {
            AirlineProfile profile = new AirlineProfile(name, iata, airline.Profile.Color, airline.Profile.CEO, true, GameObject.GetInstance().GameTime.Year, 2199);
            profile.Country = homebase.Profile.Country;

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

            AddSubsidiaryAirline(airline, sAirline, money, homebase);

            return sAirline;
        }
コード例 #5
0
        private void btnCreateSubsidiary_Click(object sender, RoutedEventArgs e)
        {
            string iata = txtIATA.Text.ToUpper().Trim();
            string name = txtAirlineName.Text.Trim();
            Airport airport = (Airport)cbAirport.SelectedItem;
            string color = ((PropertyInfo)cbColor.SelectedItem).Name;
            Route.RouteType focus = rbPassengerType.IsChecked.Value ? Route.RouteType.Passenger : Route.RouteType.Cargo;

            string pattern = @"^[A-Za-z0-9]+$";
            Regex regex = new Regex(pattern);

            if (name.Length > 0 && iata.Length == 2 && regex.IsMatch(iata) && !Airlines.GetAllAirlines().Exists(a=>a.Profile.IATACode == iata))
            {

                WPFMessageBoxResult result = WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2402"), Translator.GetInstance().GetString("MessageBox", "2402", "message"), WPFMessageBoxButtons.YesNo);

                if (result == WPFMessageBoxResult.Yes)
                {
                    AirlineProfile profile = new AirlineProfile(name, iata, color, GameObject.GetInstance().MainAirline.Profile.CEO, false, GameObject.GetInstance().GameTime.Year, 2199);

                    profile.Logos.Clear();
                    profile.addLogo(new AirlineLogo(logoPath));
                    profile.Country = GameObject.GetInstance().MainAirline.Profile.Country;

                    SubsidiaryAirline subAirline = new SubsidiaryAirline(GameObject.GetInstance().MainAirline, profile, Model.AirlineModel.Airline.AirlineMentality.Safe, Model.AirlineModel.Airline.AirlineFocus.Local, Model.AirlineModel.Airline.AirlineLicense.Domestic, focus);
                    subAirline.addAirport(airport);
                     subAirline.Money = slMoney.Value;

                    this.Airline.addSubsidiaryAirline(subAirline);

                }

            }
            else
                WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2404"), Translator.GetInstance().GetString("MessageBox", "2404", "message"), WPFMessageBoxButtons.Ok);
        }
コード例 #6
0
        private void btnOk_Click(object sender, RoutedEventArgs e)
        {
            Airport airport = (Airport)cbAirport.SelectedItem;
            string color = ((PropertyInfo)cbColor.SelectedItem).Name;

            AirlineProfile profile = new AirlineProfile(txtAirlineName.Text.Trim(),txtIATA.Text.ToUpper().Trim(),color,GameObject.GetInstance().MainAirline.Profile.CEO,false,GameObject.GetInstance().GameTime.Year,2199);
            profile.addLogo(new AirlineLogo(logoPath));
            profile.Country = GameObject.GetInstance().MainAirline.Profile.Country;

            SubsidiaryAirline subAirline = new SubsidiaryAirline(GameObject.GetInstance().MainAirline,profile,Airline.AirlineMentality.Safe,Airline.AirlineFocus.Local,Airline.AirlineLicense.Domestic,airlineType);
            subAirline.addAirport(airport);
            subAirline.Money = slMoney.Value;

            this.Selected = subAirline;
            this.Close();
        }