//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());
        }
        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);
        }
Beispiel #3
0
        private void btnBuyAsSubsidiary_Click(object sender, RoutedEventArgs e)
        {
            AirlinesMVVM airline = this.SelectedAirline;

            double buyingPrice = airline.Airline.getValue() * 100000 * 1.10;

            WPFMessageBoxResult result = WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2113"), string.Format(Translator.GetInstance().GetString("MessageBox", "2113", "message"), airline.Airline.Profile.Name, buyingPrice), WPFMessageBoxButtons.YesNo);

            if (result == WPFMessageBoxResult.Yes)
            {
                List <AirlineLogo> oldLogos = airline.Airline.Profile.Logos;
                string             oldColor = airline.Airline.Profile.Color;

                //creates independent airlines for each subsidiary
                while (airline.Airline.Subsidiaries.Count > 0)
                {
                    SubsidiaryAirline subAirline = airline.Airline.Subsidiaries[0];

                    subAirline.Airline = null;

                    airline.Airline.removeSubsidiaryAirline(subAirline);
                }

                if (airline.Airline.License > GameObject.GetInstance().HumanAirline.License)
                {
                    GameObject.GetInstance().HumanAirline.License = airline.Airline.License;
                }

                SubsidiaryAirline sAirline = new SubsidiaryAirline(GameObject.GetInstance().HumanAirline, airline.Airline.Profile, airline.Airline.Mentality, airline.Airline.MarketFocus, airline.Airline.License, airline.Airline.AirlineRouteFocus);

                AirlineHelpers.SwitchAirline(airline.Airline, sAirline);

                GameObject.GetInstance().HumanAirline.addSubsidiaryAirline(sAirline);

                AirlineHelpers.AddAirlineInvoice(GameObject.GetInstance().HumanAirline, GameObject.GetInstance().GameTime, Invoice.InvoiceType.Airline_Expenses, -buyingPrice);

                Airlines.RemoveAirline(airline.Airline);
                Airlines.AddAirline(sAirline);

                sAirline.Profile.Logos = oldLogos;
                sAirline.Profile.Color = oldColor;

                foreach (AirlinePolicy policy in airline.Airline.Policies)
                {
                    sAirline.addAirlinePolicy(policy);
                }

                sAirline.Money      = airline.Airline.Money;
                sAirline.StartMoney = airline.Airline.Money;

                sAirline.Fees = new AirlineFees();

                PageNavigator.NavigateTo(new PageAirline(GameObject.GetInstance().HumanAirline));
            }
        }
Beispiel #4
0
        private void btnBuyAirline_Click(object sender, RoutedEventArgs e)
        {
            AirlinesMVVM airline = this.SelectedAirline;

            double buyingPrice = airline.Airline.getValue() * 100000 * 1.10;

            WPFMessageBoxResult result = WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2113"), string.Format(Translator.GetInstance().GetString("MessageBox", "2113", "message"), airline.Airline.Profile.Name, buyingPrice), WPFMessageBoxButtons.YesNo);

            if (result == WPFMessageBoxResult.Yes)
            {
                result = WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2114"), string.Format(Translator.GetInstance().GetString("MessageBox", "2114", "message"), airline.Airline.Profile.Name, buyingPrice), WPFMessageBoxButtons.YesNo);

                if (result == WPFMessageBoxResult.Yes)
                {
                    while (airline.Airline.Subsidiaries.Count > 0)
                    {
                        SubsidiaryAirline subAirline = airline.Airline.Subsidiaries[0];
                        subAirline.Profile.CEO = GameObject.GetInstance().HumanAirline.Profile.CEO;

                        subAirline.Airline = GameObject.GetInstance().HumanAirline;
                        airline.Airline.removeSubsidiaryAirline(subAirline);
                        GameObject.GetInstance().HumanAirline.addSubsidiaryAirline(subAirline);
                    }
                }
                else
                {
                    while (airline.Airline.Subsidiaries.Count > 0)
                    {
                        SubsidiaryAirline subAirline = airline.Airline.Subsidiaries[0];

                        subAirline.Airline = null;

                        airline.Airline.removeSubsidiaryAirline(subAirline);
                    }
                }
                if (airline.Airline.License > GameObject.GetInstance().HumanAirline.License)
                {
                    GameObject.GetInstance().HumanAirline.License = airline.Airline.License;
                }

                AirlineHelpers.SwitchAirline(airline.Airline, GameObject.GetInstance().HumanAirline);

                AirlineHelpers.AddAirlineInvoice(GameObject.GetInstance().HumanAirline, GameObject.GetInstance().GameTime, Invoice.InvoiceType.Airline_Expenses, -buyingPrice);

                Airlines.RemoveAirline(airline.Airline);

                PageNavigator.NavigateTo(new PageAirline(GameObject.GetInstance().HumanAirline));
            }
        }