示例#1
0
        public async Task <ItemStrings> GetStringListsOfItemDictionary(SortedDictionary <string, object> dictionary)
        {
            ItemStrings itemStringLists = new ItemStrings();

            foreach (var item in dictionary)
            {
                string itemKey = item.Key;
                if (itemKey == "name" || itemKey == "created" || itemKey == "edited" || itemKey == "url" || itemKey == "title" || itemKey == "vehicle_class")
                {
                    continue;
                }
                itemKey = char.ToUpper(itemKey[0]) + itemKey.Substring(1).Replace("_", " ");
                itemStringLists.PropertyNames.Add(itemKey);

                if (item.Value == null)
                {
                    itemStringLists.PropertyValues.Add("unknown");
                }
                else if (item.Value.GetType() == typeof(List <string>))
                {
                    List <string> stringList = new List <string>();

                    foreach (var listItem in (List <string>)item.Value)
                    {
                        string category = listItem.Substring(21).TrimEnd('/', '1', '2', '3', '4', '5', '6', '7', '8', '9');
                        category = char.ToUpper(category[0]) + category.Substring(1);
                        switch (category)
                        {
                        case ("Planets"):
                            Planet planetResult = await GetSingleByUrl <Planet>(listItem);

                            stringList.Add(planetResult.name);
                            break;

                        case ("People"):
                            People peopleResult = await GetSingleByUrl <People>(listItem);

                            stringList.Add(peopleResult.name);
                            break;

                        case ("Films"):
                            Film filmResult = await GetSingleByUrl <Film>(listItem);

                            await Task.Delay(100);

                            stringList.Add(filmResult.title);
                            break;

                        case ("Species"):
                            Specie speciesResult = await GetSingleByUrl <Specie>(listItem);

                            stringList.Add(speciesResult.name);
                            break;

                        case ("Starships"):
                            Starship starshipResult = await GetSingleByUrl <Starship>(listItem);

                            stringList.Add(starshipResult.name);
                            break;

                        case ("Vehicles"):
                            Vehicle vehicleResult = await GetSingleByUrl <Vehicle>(listItem);

                            stringList.Add(vehicleResult.name);
                            break;
                        }
                    }
                    string listToString = string.Join(", ", stringList);

                    if (stringList.Count == 0)
                    {
                        listToString = "unknown";
                    }

                    itemStringLists.PropertyValues.Add(listToString);
                }
                else if (item.Value.ToString().StartsWith("https://swapi.co/api/"))
                {
                    string category = item.Value.ToString().Substring(21).TrimEnd('/', '1', '2', '3', '4', '5', '6', '7', '8', '9');
                    category = char.ToUpper(category[0]) + category.Substring(1);
                    switch (category)
                    {
                    case ("Planets"):
                        Planet planetResult = await GetSingleByUrl <Planet>(item.Value.ToString());

                        itemStringLists.PropertyValues.Add(planetResult.name);
                        break;

                    case ("People"):
                        People peopleResult = await GetSingleByUrl <People>(item.Value.ToString());

                        itemStringLists.PropertyValues.Add(peopleResult.name);
                        break;

                    case ("Films"):
                        Film filmResult = await GetSingleByUrl <Film>(item.Value.ToString());

                        itemStringLists.PropertyValues.Add(filmResult.title);
                        break;

                    case ("Species"):
                        Specie speciesResult = await GetSingleByUrl <Specie>(item.Value.ToString());

                        itemStringLists.PropertyValues.Add(speciesResult.name);
                        break;

                    case ("Starships"):
                        Starship starshipResult = await GetSingleByUrl <Starship>(item.Value.ToString());

                        itemStringLists.PropertyValues.Add(starshipResult.name);
                        break;

                    case ("Vehicles"):
                        Vehicle vehicleResult = await GetSingleByUrl <Vehicle>(item.Value.ToString());

                        itemStringLists.PropertyValues.Add(vehicleResult.name);
                        break;
                    }
                }
                else
                {
                    itemStringLists.PropertyValues.Add(item.Value.ToString());
                }
            }

            return(itemStringLists);
        }
示例#2
0
 public Voyage(Starship starship)
 {
     Starship = starship;
 }
 public bool SizeTooBig(Task <List <Parking> > parkings, int index, Starship ship)
 {
     return(ship.Length > parkings.Result[index].MaxLength);
 }
示例#4
0
        private ResupplyResponse CalculateResupplyStops(Starship starship, decimal distance)
        {
            var response = new ResupplyResponse
            {
                StarshipName = starship.Name,
                StarshipUrl  = starship.Url
            };


            if (!int.TryParse(starship.Mglt, out int starshipSpeed) ||
                string.IsNullOrWhiteSpace(starship.Consumables) ||
                starship.Consumables.Contains("unknown"))
            {
                response.TotalStopsRequired = "unknown";
                return(response);
            }

            var      dateFrom = DateTime.Now.Date;
            DateTime dateTo;
            var      timeLabel = starship.Consumables.Split(" ")[1].Replace("s", "");

            int.TryParse(starship.Consumables.Split(" ")[0], out int timeValue);

            var performance = 0.0;

            switch (timeLabel)
            {
            case "year":
                dateTo      = dateFrom.AddYears(timeValue);
                performance = dateTo.Subtract(dateFrom).TotalHours;
                break;

            case "month":
                dateTo      = dateFrom.AddMonths(timeValue);
                performance = dateTo.Subtract(dateFrom).TotalHours;
                break;

            case "week":
                dateTo      = dateFrom.AddDays(timeValue * 7);
                performance = dateTo.Subtract(dateFrom).TotalHours;
                break;

            case "day":
                dateTo      = dateFrom.AddDays(timeValue);
                performance = dateTo.Subtract(dateFrom).TotalHours;
                break;

            case "hour":
                performance = timeValue;
                break;

            default:
                break;
            }

            var totalHoursNeeded = distance / starshipSpeed;

            //if(totalHoursNeeded > (decimal)performance)
            //{
            var totalResupplysNeeded = totalHoursNeeded / (decimal)performance;

            response.TotalStopsRequired = (totalResupplysNeeded > 0 ? Math.Round(totalResupplysNeeded) : 0).ToString();

            //    return response;
            //}


            //response.TotalStopsRequired = "0";

            return(response);
        }
        public IActionResult StarshipSearch(int Id)
        {
            Starship s = SP.GetStarship("starships", Id);

            return(View(s));
        }
示例#6
0
        public WeaponUpgrades(Starship starship)
        {
            if (starship == null)
            {
                throw new ArgumentException("Cannot make weapon ugprades with a null ship");
            }
            this.Starship       = starship;
            this.Weapons        = new List <Weapon>();
            this.Ranges         = new List <TextBox>();
            this.Ballistics     = new List <TextBox>();
            this.Matrices       = new List <CheckBox>();
            this.WeaponRowCount = 0;
            InitializeComponent();
            AllCheck.IsChecked = (Starship.TargettingMatrix == Quality.Common);
            Label    label;
            TextBox  textbox;
            CheckBox checkbox;
            int      count = 0;

            foreach (Tuple <WeaponSlot, Weapon> WeaponPackage in Starship.WeaponList)
            {
                if (WeaponPackage.Item2 != null)
                {
                    int      index = count; //initialise ints for each time around or lambdas will all use final count value of 3 and be out of bounds
                    ComboBox combobox;      //declare memory inside loop for same reason as above
                    Weapons.Add(WeaponPackage.Item2);
                    label         = new Label();
                    label.Content = WeaponPackage.Item1.ToString();
                    Grid.SetRow(label, WeaponRowCount);
                    Grid.SetColumn(label, 0);
                    WeaponGrid.Children.Add(label);
                    textbox            = new TextBox();
                    textbox.Text       = WeaponPackage.Item2.QualityName;
                    textbox.IsReadOnly = true;
                    Grid.SetRow(textbox, WeaponRowCount);
                    Grid.SetColumn(textbox, 1);
                    WeaponGrid.Children.Add(textbox);
                    textbox               = new TextBox();
                    textbox.IsReadOnly    = true;
                    textbox.TextAlignment = TextAlignment.Center;
                    Ranges.Add(textbox);
                    Grid.SetRow(textbox, WeaponRowCount);
                    Grid.SetColumn(textbox, 2);
                    WeaponGrid.Children.Add(textbox);
                    textbox               = new TextBox();
                    textbox.IsReadOnly    = true;
                    textbox.TextAlignment = TextAlignment.Center;
                    Ballistics.Add(textbox);
                    Grid.SetRow(textbox, WeaponRowCount);
                    Grid.SetColumn(textbox, 3);
                    WeaponGrid.Children.Add(textbox);
                    combobox              = new ComboBox();
                    combobox.ItemsSource  = Qualities;
                    combobox.SelectedItem = WeaponPackage.Item2.TurboWeapon;
                    if (WeaponPackage.Item2.Type != WeaponType.Macrobattery)
                    {
                        combobox.IsEnabled = false;
                        combobox.ToolTip   = "Only Macrobatteries may have turbo-weapon batteries";
                        ToolTipService.SetShowOnDisabled(combobox, true);
                    }
                    combobox.SelectionChanged += ((s, e) => QualityChanged(combobox, index));
                    Grid.SetRow(combobox, WeaponRowCount);
                    Grid.SetColumn(combobox, 4);
                    WeaponGrid.Children.Add(combobox);
                    checkbox                     = new CheckBox();
                    checkbox.IsChecked           = (Starship.TargettingMatrix == Quality.Common || WeaponPackage.Item2.TargettingMatrix == Quality.Poor);
                    checkbox.Click              += ((s, e) => SetMatrixIndex(index));
                    checkbox.ToolTip             = "Poor Quality";
                    checkbox.VerticalAlignment   = System.Windows.VerticalAlignment.Center;
                    checkbox.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;
                    checkbox.Margin              = new Thickness(17, 0, 0, 0);
                    Matrices.Add(checkbox);
                    Grid.SetRow(checkbox, WeaponRowCount++);
                    Grid.SetColumn(checkbox, 5);
                    WeaponGrid.Children.Add(checkbox);
                    UpdateWeapon(count++);
                }
            }
        }
示例#7
0
 /// <summary>
 /// Calculates the maximum duration in hours that a Starship can provide consumables for th entire crew.
 /// </summary>
 /// <param name="ship">An instance of a Starship.</param>
 /// <returns>
 /// A double representing the number of hours.
 /// </returns>
 protected abstract double?CalculateConsumableDuration(Starship ship);
示例#8
0
 public static Complication ShipHistory(Starship starship)
 {
     return(new Complication(starship, false));
 }
示例#9
0
 private Complication(Starship starship, bool MorH)
 {
     if (starship == null)
     {
         throw new ArgumentNullException("Cannot create a complication for a null starship");
     }
     this.Starship         = starship;
     this.MachineOrHistory = MorH;
     InitializeComponent();
     if (MachineOrHistory)
     {
         TitleName.Content = "Machine Spirit Complication";
         Name1.Text        = ((Machine)1).Name();
         Effect1.Text      = ((Machine)1).Description();
         Name2.Text        = ((Machine)2).Name();
         Effect2.Text      = ((Machine)2).Description();
         Name3.Text        = ((Machine)3).Name();
         Effect3.Text      = ((Machine)3).Description();
         Name4.Text        = ((Machine)4).Name();
         Effect4.Text      = ((Machine)4).Description();
         Name5.Text        = ((Machine)5).Name();
         Effect5.Text      = ((Machine)5).Description();
         Name6.Text        = ((Machine)6).Name();
         Effect6.Text      = ((Machine)6).Description();
         Name7.Text        = ((Machine)7).Name();
         Effect7.Text      = ((Machine)7).Description();
         Name8.Text        = ((Machine)8).Name();
         Effect8.Text      = ((Machine)8).Description();
         Name9.Text        = ((Machine)9).Name();
         Effect9.Text      = ((Machine)9).Description();
         Name10.Text       = ((Machine)10).Name();
         Effect10.Text     = ((Machine)10).Description();
         Custom.Content    = "Custom Machine Spirit";
         if (!String.IsNullOrWhiteSpace(Starship.GMMachineSpirit))
         {
             String[] parts = Starship.GMMachineSpirit.Split(new char[] { ':' }, 2);
             CustomName.Text   = parts[0].Trim();
             CustomEffect.Text = parts[1].Trim();
         }
     }
     else
     {
         TitleName.Content = "Ship History Complication";
         Name1.Text        = ((History)1).Name();
         Effect1.Text      = ((History)1).Description();
         Name2.Text        = ((History)2).Name();
         Effect2.Text      = ((History)2).Description();
         Name3.Text        = ((History)3).Name();
         Effect3.Text      = ((History)3).Description();
         Name4.Text        = ((History)4).Name();
         Effect4.Text      = ((History)4).Description();
         Name5.Text        = ((History)5).Name();
         Effect5.Text      = ((History)5).Description();
         Name6.Text        = ((History)6).Name();
         Effect6.Text      = ((History)6).Description();
         Name7.Text        = ((History)7).Name();
         Effect7.Text      = ((History)7).Description();
         Name8.Text        = ((History)8).Name();
         Effect8.Text      = ((History)8).Description();
         Name9.Text        = ((History)9).Name();
         Effect9.Text      = ((History)9).Description();
         Name10.Text       = ((History)10).Name();
         Effect10.Text     = ((History)10).Description();
         Custom.Content    = "Custom Ship History";
         if (!String.IsNullOrWhiteSpace(Starship.GMShipHistory))
         {
             String[] parts = Starship.GMShipHistory.Split(new char[] { ':' }, 2);
             CustomName.Text   = parts[0].Trim();
             CustomEffect.Text = parts[1].Trim();
         }
     }
 }
示例#10
0
        public void CreateStarshipConstructor2()
        {
            var ship = new Starship("TestName", 12.5M);

            Assert.IsNotNull(ship);
        }
示例#11
0
 public static Complication MachineSpirit(Starship starship)
 {
     return(new Complication(starship, true));
 }
示例#12
0
        public void CreateStarshipConstructor1()
        {
            var ship = new Starship();

            Assert.IsNotNull(ship);
        }
        public IActionResult Config()
        {
            ViewBag.CommandLineConfig = $"CommandLineValue1: {_config.GetValue<string>("CommandLineKey1")}, "
                                        + $"CommandLineValue2: {_config.GetValue<string>("CommandLineKey2")}, "
                                        + $"CommandLineValue3: {_config.GetValue<string>("CommandLineKey3")}";

            ViewBag.ConnectionString = $"Connection: {_config.GetConnectionString("MvcMovieContext")}";
            var providerName = _config.GetValue <string>("ConnectionStrings:MvcMovieContext_ProviderName");

            if (!string.IsNullOrEmpty(providerName))
            {
                ViewBag.ConnectionString += $", Provider: {providerName}";
            }

            ViewBag.INIConfig = $"section0:key0 = {_config.GetValue<string>("section0:key0")}, " +
                                $"section0:key1 = { _config.GetValue<string>("section0:key1")}, " +
                                $"section1:subsection:key = { _config.GetValue<string>("section1:subsection:key")}, " +
                                $"section2:subsection0:key = { _config.GetValue<string>("section2:subsection0:key")}, " +
                                $"section2:subsection1:key = { _config.GetValue<string>("section2:subsection1:key")}";

            ViewBag.JsonConfig = $"jsonoption1 = {_config.GetValue<string>("jsonoption1")}, " +
                                 $"jsonoption2:suboption1 = {_config.GetValue<string>("jsonoption2:suboption1")}, " +
                                 $"jsonoption2:suboption2 = {_config.GetValue<string>("jsonoption2:suboption2")}";

            ViewBag.XmlConfig = $"section0:key0 = {_config.GetValue<string>("section0:key0")}, " +
                                $"section0:key1 = {_config.GetValue<string>("section0:key1")}, " +
                                $"section1:key0 = {_config.GetValue<string>("section1:key0")}, " +
                                $"section1:key1 = {_config.GetValue<string>("section1:key1")}, " +
                                $"section:section0:name = {_config.GetValue<string>("section:section0:name")}, " +
                                $"section:section0:key:key0:name = {_config.GetValue<string>("section:section0:key:key0:name")}, " +
                                $"section:section0:key:key0 = {_config.GetValue<string>("section:section0:key:key0")}, " +
                                $"section:section0:key:key1:name = {_config.GetValue<string>("section:section0:key:key1:name")}, " +
                                $"section:section0:key:key1 = {_config.GetValue<string>("section:section0:key:key1")}";

            ViewBag.KeyPerFileConfig = $"Logging:LogLevel:System = {_config.GetValue<string>("Logging:LogLevel:System")}";

            ViewBag.InMemoryConfig = $"MemoryCollectionKey1 = {_config.GetValue<string>("MemoryCollectionKey1")}, " +
                                     $"MemoryCollectionKey2 = {_config.GetValue<string>("MemoryCollectionKey2")}";


            var starship = new Starship();

            _config.GetSection("starship").Bind(starship);
            ViewBag.StarshipConfig = $"Starship name: {starship.Name}, registry: {starship.Registry}, class: {starship.Class}, length: {starship.Length}, commisioned: {starship.Commissioned}, trademark: {_config.GetValue<string>("trademark")}";

            var tvShow = _config.GetSection("tvshow").Get <TvShow>();

            ViewBag.TvShowConfig = $"TvShow metadata: {tvShow.Metadata.Series}-{tvShow.Metadata.Title}-{tvShow.Metadata.AirDate}-{tvShow.Metadata.Episode}, actors: {tvShow.Actors.Names}, legal: {tvShow.Legal}";

            var arrayExample = _config.GetSection("array").Get <ArrayExample>();

            ViewBag.ArrayConfig = $"Entries: {string.Join(',', arrayExample.Entries)}";

            var jsonArrayExample = _config.GetSection("json_array").Get <JsonArrayExample>();

            ViewBag.JsonArrayConfig = $"Json Array: Key-{jsonArrayExample.Key}, Subsection: {string.Join(',', jsonArrayExample.Subsection)}";

            ViewBag.EFConfiguration = $"quote1: {_config.GetValue<string>("quote1")}, quote2: {_config.GetValue<string>("quote2")}, quote3: {_config.GetValue<string>("quote3")}";

            var configSettings = $"setting1: {_config.GetValue<string>("setting1")}, setting2: {_config.GetValue<string>("setting2")}";

            ViewBag.ConfigSettings = configSettings;

            return(View());
        }
示例#14
0
        static void Main(string[] args)
        {
            bool willExit = false;

            while (!willExit)
            {
                Console.Clear();
                Console.WriteLine("Menu: ");
                Console.WriteLine("1. Add Rocket\n2. List Rockets\n3. Run Simulation");

                ConsoleKeyInfo inputKey = Console.ReadKey(true);

                switch (inputKey.Key)
                {
                case ConsoleKey.D1:
                    Console.Clear();
                    Console.WriteLine("1. Starship, SpaceX\n2.Heavy Falcon, SpaceX");

                    ConsoleKeyInfo shipKey = Console.ReadKey(true);

                    switch (shipKey.Key)
                    {
                    case ConsoleKey.D1:
                        Rocket starShip = new Starship(1335000);
                        break;

                    case ConsoleKey.D2:
                        Rocket falcon = new Falcon((1335000 * 5));
                        break;
                    }
                    break;

                case ConsoleKey.D2:
                    Console.Clear();
                    Console.WriteLine("Simulated Rockets:");
                    StringBuilder sb1 = new StringBuilder();
                    sb1.Append('-', Console.WindowWidth);
                    Console.WriteLine(sb1);
                    foreach (Rocket rocket in rocketList)
                    {
                        Console.WriteLine(rocket.Name);
                    }
                    Console.ReadKey(true);
                    break;

                case ConsoleKey.D3:
                    Console.Clear();
                    Console.WriteLine("Burn Time in sec: ");
                    int           burnTime = int.Parse(Console.ReadLine());
                    StringBuilder sb       = new StringBuilder();
                    sb.Append('-', Console.WindowWidth);
                    Console.WriteLine($"Engine burn period (sec): {burnTime}");
                    Console.WriteLine("Rocket:\t\t\tVelocity (km/s)\t\t\tFuel left (tons)");
                    Console.WriteLine(sb);
                    foreach (var rocket in Program.rocketList)
                    {
                        Console.WriteLine($"{rocket.Name}\t\t{Math.Round(rocket.SimulateMotion(burnTime)/1000,2)}\t\t{rocket.fuelWeight/1000}");
                    }
                    Console.WriteLine("<Press anykey to continue>");
                    Console.ReadKey(true);

                    break;

                case ConsoleKey.D4:
                    willExit = true;
                    break;
                }
            }
        }
示例#15
0
文件: Program.cs 项目: Na-R-84/Rocket
        static void Main(string[] args)
        {
            bool isRunning = true;
            int  i         = 0;

            while (isRunning)
            {
                Clear();
                Console.ForegroundColor
                    = ConsoleColor.Magenta;
                WriteLine(" -- Menu -- ");

                WriteLine("1. Add rocket");
                WriteLine("2. List rocket");
                WriteLine("3. Run simulation");
                WriteLine("4. Run Simulation with graph");
                WriteLine("5. Exit");

                ConsoleKeyInfo pressedKey = ReadKey();

                switch (pressedKey.Key)
                {
                case ConsoleKey.D1:
                    Clear();
                    WriteLine("--Add your Rocket--");
                    WriteLine();
                    WriteLine("[1] Starship, SpaceX\n[2] Falcon Heavy, SpaceX");

                    ConsoleKeyInfo rocketChoice = ReadKey();

                    switch (rocketChoice.Key)
                    {
                    case ConsoleKey.D1:
                        rocketList[i] = new Starship("Falcon 9, SpaceX", 549, 1600);

                        break;

                    case ConsoleKey.D2:
                        rocketList[i] = new FalconHeavy("Falcon Heavy, SpaceX", 1420, 3000);

                        break;
                    }
                    i++;

                    break;

                case ConsoleKey.D2:
                    Clear();

                    int counter = 1;
                    WriteLine("Simulated Rockets");
                    WriteLine("----------------------------------------------------------------------");
                    foreach (Rocket eachRocketShip in rocketList)
                    {
                        if (rocketList[counter - 1] == null)
                        {
                            continue;
                        }
                        WriteLine($"{counter++}. {eachRocketShip.RocketName}");
                    }

                    WriteLine("\n\nPress any key to continue...");
                    ReadLine();

                    break;

                case ConsoleKey.D3:
                    Clear();

                    WriteLine("Engine burn period (sec):");
                    double engineBurn = double.Parse(ReadLine());

                    Clear();
                    WriteLine("Engine burn period (sec):");
                    WriteLine("\n Rocket\t\t\t\t\t Velocity (km/s)\t\t\t Fuel left (tons)");
                    WriteLine("--------------------------------------------------------------------------------------");


                    foreach (var rocket in rocketList)
                    {
                        if (rocket == null)
                        {
                            continue;
                        }

                        WriteLine($"{rocket.RocketName}\t\t\t{Math.Round(rocket.EngineOn(engineBurn), 2)}\t\t\t\t{Math.Round(rocket.FuelLeft(rocket.AmountOfFuel, engineBurn), 1)} ");
                    }

                    ReadLine();
                    break;

                case ConsoleKey.D4:

                    foreach (var rocket in rocketList)
                    {
                        if (rocket == null)
                        {
                            continue;
                        }

                        WriteLine("Engine burn period (sec):");
                        double engineBurn1 = double.Parse(ReadLine());

                        rocket.Graph(rocket.EngineOn(engineBurn1), engineBurn1);
                    }
                    ReadKey();

                    break;

                case ConsoleKey.D5:

                    isRunning = false;
                    break;
                }
            }
        }
示例#16
0
        public SupplementalWindow(Starship starship, Loader loader)
        {
            if (starship == null || starship.Hull == null)
            {
                throw new ArgumentNullException("Cannot choose supplementals without a hull");
            }
            if (loader == null)
            {
                throw new ArgumentNullException("Cannot load supplementals without a loader");
            }
            this.Starship  = starship;
            ComponentCount = 0;
            InitializeComponent();
            Label     label;
            Button    button;
            TextBox   textbox;
            TextBlock textblock;

            foreach (var generated in loader.Supplementals.Where(x => (x.HullTypes & Starship.Hull.HullTypes) != 0).GroupBy(x => x.PowerGenerated))
            {
                foreach (var group in generated.GroupBy(x => x.ComponentOrigin))
                {
                    if (group.Count() > 0)
                    {
                        if (group.Key != ComponentOrigin.Standard)
                        {
                            label         = new Label();
                            label.Content = group.Key.ToString();
                            Grid.SetRow(label, ComponentCount);
                            Grid.SetColumn(label, 0);
                            ComponentGrid.Children.Add(label);
                        }
                        label         = new Label();
                        label.Content = generated.Key ? "Generated" : "Used";
                        label.HorizontalContentAlignment = HorizontalAlignment.Center;
                        Grid.SetRow(label, ComponentCount++);
                        Grid.SetColumn(label, 2);
                        ComponentGrid.Children.Add(label);
                    }
                    foreach (Supplemental baseComponent in group)
                    {
                        List <Supplemental> qualitycomponents = new List <Supplemental>();
                        if (baseComponent.RawSP > 1)//if component can have a lower cost, include poor quality
                        {
                            qualitycomponents.Add(new Supplemental(baseComponent.Name, baseComponent.HullTypes, baseComponent.RawPower, baseComponent.RawSpace, baseComponent.RawSP, baseComponent.Origin, baseComponent.PageNumber,
                                                                   baseComponent.RamDamage, baseComponent.RawSpecial, Quality.Poor, baseComponent.Speed, baseComponent.Manoeuvrability, baseComponent.HullIntegrity, baseComponent.Armour, baseComponent.TurretRating,
                                                                   baseComponent.Morale, baseComponent.CrewPopulation, baseComponent.ProwArmour, baseComponent.CrewRating, baseComponent.MiningObjective, baseComponent.CreedObjective, baseComponent.MilitaryObjective,
                                                                   baseComponent.TradeObjective, baseComponent.CriminalObjective, baseComponent.ExplorationObjective, baseComponent.PowerGenerated, baseComponent.DetectionRating, baseComponent.AuxiliaryWeapon,
                                                                   baseComponent.MacrobatteryModifier, baseComponent.BSModifier, baseComponent.NavigateWarp, baseComponent.CrewLoss, baseComponent.MoraleLoss, baseComponent.ComponentOrigin, baseComponent.Replace, baseComponent.Max,
                                                                   StarshipGenerator.Utils.Condition.Intact));
                        }
                        //always add common quality
                        qualitycomponents.Add(new Supplemental(baseComponent.Name, baseComponent.HullTypes, baseComponent.RawPower, baseComponent.RawSpace, baseComponent.RawSP, baseComponent.Origin, baseComponent.PageNumber,
                                                               baseComponent.RamDamage, baseComponent.RawSpecial, Quality.Common, baseComponent.Speed, baseComponent.Manoeuvrability, baseComponent.HullIntegrity, baseComponent.Armour, baseComponent.TurretRating,
                                                               baseComponent.Morale, baseComponent.CrewPopulation, baseComponent.ProwArmour, baseComponent.CrewRating, baseComponent.MiningObjective, baseComponent.CreedObjective, baseComponent.MilitaryObjective,
                                                               baseComponent.TradeObjective, baseComponent.CriminalObjective, baseComponent.ExplorationObjective, baseComponent.PowerGenerated, baseComponent.DetectionRating, baseComponent.AuxiliaryWeapon,
                                                               baseComponent.MacrobatteryModifier, baseComponent.BSModifier, baseComponent.NavigateWarp, baseComponent.CrewLoss, baseComponent.MoraleLoss, baseComponent.ComponentOrigin, baseComponent.Replace, baseComponent.Max,
                                                               StarshipGenerator.Utils.Condition.Intact));
                        if ((baseComponent.RawPower > 1) ^ (baseComponent.RawSpace > 1))//if only one possible upgrade for good quality, do default good
                        {
                            qualitycomponents.Add(new Supplemental(baseComponent.Name, baseComponent.HullTypes, baseComponent.RawPower, baseComponent.RawSpace, baseComponent.RawSP, baseComponent.Origin, baseComponent.PageNumber,
                                                                   baseComponent.RamDamage, baseComponent.RawSpecial, Quality.Good, baseComponent.Speed, baseComponent.Manoeuvrability, baseComponent.HullIntegrity, baseComponent.Armour, baseComponent.TurretRating,
                                                                   baseComponent.Morale, baseComponent.CrewPopulation, baseComponent.ProwArmour, baseComponent.CrewRating, baseComponent.MiningObjective, baseComponent.CreedObjective, baseComponent.MilitaryObjective,
                                                                   baseComponent.TradeObjective, baseComponent.CriminalObjective, baseComponent.ExplorationObjective, baseComponent.PowerGenerated, baseComponent.DetectionRating, baseComponent.AuxiliaryWeapon,
                                                                   baseComponent.MacrobatteryModifier, baseComponent.BSModifier, baseComponent.NavigateWarp, baseComponent.CrewLoss, baseComponent.MoraleLoss, baseComponent.ComponentOrigin, baseComponent.Replace, baseComponent.Max,
                                                                   StarshipGenerator.Utils.Condition.Intact));
                        }
                        else if (baseComponent.RawPower > 1 && baseComponent.RawSpace > 1)//If both can be added then can have efficient, slim or best(both) quality
                        {
                            qualitycomponents.Add(new Supplemental(baseComponent.Name, baseComponent.HullTypes, baseComponent.RawPower, baseComponent.RawSpace, baseComponent.RawSP, baseComponent.Origin, baseComponent.PageNumber,
                                                                   baseComponent.RamDamage, baseComponent.RawSpecial, Quality.Slim, baseComponent.Speed, baseComponent.Manoeuvrability, baseComponent.HullIntegrity, baseComponent.Armour, baseComponent.TurretRating,
                                                                   baseComponent.Morale, baseComponent.CrewPopulation, baseComponent.ProwArmour, baseComponent.CrewRating, baseComponent.MiningObjective, baseComponent.CreedObjective, baseComponent.MilitaryObjective,
                                                                   baseComponent.TradeObjective, baseComponent.CriminalObjective, baseComponent.ExplorationObjective, baseComponent.PowerGenerated, baseComponent.DetectionRating, baseComponent.AuxiliaryWeapon,
                                                                   baseComponent.MacrobatteryModifier, baseComponent.BSModifier, baseComponent.NavigateWarp, baseComponent.CrewLoss, baseComponent.MoraleLoss, baseComponent.ComponentOrigin, baseComponent.Replace, baseComponent.Max,
                                                                   StarshipGenerator.Utils.Condition.Intact));
                            qualitycomponents.Add(new Supplemental(baseComponent.Name, baseComponent.HullTypes, baseComponent.RawPower, baseComponent.RawSpace, baseComponent.RawSP, baseComponent.Origin, baseComponent.PageNumber,
                                                                   baseComponent.RamDamage, baseComponent.RawSpecial, Quality.Efficient, baseComponent.Speed, baseComponent.Manoeuvrability, baseComponent.HullIntegrity, baseComponent.Armour, baseComponent.TurretRating,
                                                                   baseComponent.Morale, baseComponent.CrewPopulation, baseComponent.ProwArmour, baseComponent.CrewRating, baseComponent.MiningObjective, baseComponent.CreedObjective, baseComponent.MilitaryObjective,
                                                                   baseComponent.TradeObjective, baseComponent.CriminalObjective, baseComponent.ExplorationObjective, baseComponent.PowerGenerated, baseComponent.DetectionRating, baseComponent.AuxiliaryWeapon,
                                                                   baseComponent.MacrobatteryModifier, baseComponent.BSModifier, baseComponent.NavigateWarp, baseComponent.CrewLoss, baseComponent.MoraleLoss, baseComponent.ComponentOrigin, baseComponent.Replace, baseComponent.Max,
                                                                   StarshipGenerator.Utils.Condition.Intact));
                            qualitycomponents.Add(new Supplemental(baseComponent.Name, baseComponent.HullTypes, baseComponent.RawPower, baseComponent.RawSpace, baseComponent.RawSP, baseComponent.Origin, baseComponent.PageNumber,
                                                                   baseComponent.RamDamage, baseComponent.RawSpecial, Quality.Best, baseComponent.Speed, baseComponent.Manoeuvrability, baseComponent.HullIntegrity, baseComponent.Armour, baseComponent.TurretRating,
                                                                   baseComponent.Morale, baseComponent.CrewPopulation, baseComponent.ProwArmour, baseComponent.CrewRating, baseComponent.MiningObjective, baseComponent.CreedObjective, baseComponent.MilitaryObjective,
                                                                   baseComponent.TradeObjective, baseComponent.CriminalObjective, baseComponent.ExplorationObjective, baseComponent.PowerGenerated, baseComponent.DetectionRating, baseComponent.AuxiliaryWeapon,
                                                                   baseComponent.MacrobatteryModifier, baseComponent.BSModifier, baseComponent.NavigateWarp, baseComponent.CrewLoss, baseComponent.MoraleLoss, baseComponent.ComponentOrigin, baseComponent.Replace, baseComponent.Max,
                                                                   StarshipGenerator.Utils.Condition.Intact));
                        }
                        foreach (Supplemental component in qualitycomponents.Where(x => Starship.SupplementalComponents.Count(y => x.QualityName == y.QualityName && x.Origin == y.Origin) == 0 && (x.Max == 0 || Starship.SupplementalComponents.Count(y => x.Name == y.Name) < x.Max)))
                        {
                            label = new Label();
                            String name = component.QualityName;
                            if (component.Max == 1)
                            {
                                name         += "†";
                                label.ToolTip = "Maximum of one " + component.Name;
                            }
                            label.Content = name;
                            Grid.SetRow(label, ComponentCount);
                            Grid.SetColumn(label, 0);
                            ComponentGrid.Children.Add(label);
                            Label countLabel = new Label();
                            countLabel.Content = 0;
                            countLabel.HorizontalContentAlignment = HorizontalAlignment.Center;
                            Grid.SetRow(countLabel, ComponentCount);
                            Grid.SetColumn(countLabel, 1);
                            ComponentGrid.Children.Add(countLabel);
                            label         = new Label();
                            label.Content = component.Power;
                            label.HorizontalContentAlignment = HorizontalAlignment.Center;
                            Grid.SetRow(label, ComponentCount);
                            Grid.SetColumn(label, 2);
                            ComponentGrid.Children.Add(label);
                            label         = new Label();
                            label.Content = component.Space;
                            label.HorizontalContentAlignment = HorizontalAlignment.Center;
                            Grid.SetRow(label, ComponentCount);
                            Grid.SetColumn(label, 3);
                            ComponentGrid.Children.Add(label);
                            label         = new Label();
                            label.Content = component.SP;
                            label.HorizontalContentAlignment = HorizontalAlignment.Center;
                            Grid.SetRow(label, ComponentCount);
                            Grid.SetColumn(label, 4);
                            ComponentGrid.Children.Add(label);
                            button         = new Button();
                            button.Content = "+";
                            button.Click  += ((s, e) => AddComponent(countLabel, component));
                            Grid.SetRow(button, ComponentCount);
                            Grid.SetColumn(button, 5);
                            ComponentGrid.Children.Add(button);
                            button         = new Button();
                            button.Content = "-";
                            button.Click  += ((s, e) => RemoveComponent(countLabel, component));
                            Grid.SetRow(button, ComponentCount);
                            Grid.SetColumn(button, 6);
                            ComponentGrid.Children.Add(button);
                            label              = new Label();
                            textbox            = new TextBox();
                            textbox.Text       = component.Origin.Name();
                            textbox.IsReadOnly = true;
                            textbox.ToolTip    = component.Origin.LongName() + ", Page: " + component.PageNumber;
                            Grid.SetRow(textbox, ComponentCount++);
                            Grid.SetColumn(textbox, 7);
                            ComponentGrid.Children.Add(textbox);
                            textblock              = new TextBlock();
                            textblock.Text         = component.Description;
                            textblock.TextWrapping = TextWrapping.WrapWithOverflow;
                            Grid.SetRow(textblock, ComponentCount++);
                            Grid.SetColumnSpan(textblock, 8);
                            ComponentGrid.Children.Add(textblock);
                        }
                    }
                }
            }
        }
    // Use this for initialization
    void Start()
    {
        // Get references to the components that we want.
        essentialComponentCanvas = essentialComponentCanvas.GetComponent<CanvasGroup>();

        // Initially, we want to show the Hull canvas but not the Essential Components
        // canvas. Set the booleans accordingly. Note that the actual code to show or
        // hide the canvases is in Update() since it was not working here.
        SetCanvas(false, essentialComponentCanvas);

        // Get a reference to the Starship object we're trying to create. This works because
        // the Starship.cs script is attached to the same object as the StarshipCreationMenu.cs
        // script.
        starship = gameObject.GetComponent<Starship>();

        componentDescriptionText = componentDescriptionText.GetComponent<Text>();
        dynamicSpecificComponentText = dynamicSpecificComponentText.GetComponent<Text>();
        componentTypeText = componentTypeText.GetComponent<Text>();
        dynamicComponentText = dynamicComponentText.GetComponent<Text>();
        leftArrow = leftArrow.GetComponent<Button>();
        rightArrow = rightArrow.GetComponent<Button>();
        selectButton = selectButton.GetComponent<Button>();
        undoButton = undoButton.GetComponent<Button>();

        hullCanvas = hullCanvas.GetComponent<CanvasGroup>();
        generalHullAttributeText = generalHullAttributeText.GetComponent<Text>();
        combatHullAttributeText = combatHullAttributeText.GetComponent<Text>();
        hullNameText = hullNameText.GetComponent<Text>();
        hullDescriptionText = hullDescriptionText.GetComponent<Text>();
        hullLeftArrow = hullLeftArrow.GetComponent<Button>();
        hullRightArrow = hullRightArrow.GetComponent<Button>();
        hullContinueButton = hullContinueButton.GetComponent<Button>();
        hullImage = hullImage.GetComponent<Image>();

        // Set all of our indices to zero.
        componentTypeIndex = 0;
        specificComponentIndex = 0;

        hullIndex = 0;

        // Display the current hull instead of the dummy text.
        DisplayHull();
    }
 public StarshipViewModel(Starship starship = null)
 {
     Title    = starship.Name;
     Starship = starship;
     LoadImage(Starship.Name);
 }
示例#19
0
        static void Main(string[] args)
        {
            Service1Client cosmos = new Service1Client();

            ServiceReference2.Service1Client firstOrder = new ServiceReference2.Service1Client();
            cosmos.InitializeGame();
            while (true)
            {
                showMenu();
                string choice = Console.ReadLine();
                if (choice == "a")
                {
                    if (_imperiumMoneyAskCount > 0)
                    {
                        int goldFromEmpire = firstOrder.GetMoneyFromImperium();
                        _gold += goldFromEmpire;
                        _imperiumMoneyAskCount--;
                        Console.WriteLine("Dostales {0} hajsu", goldFromEmpire);
                    }
                    else
                    {
                        Console.WriteLine("Nie masz prosb");
                    }
                }
                else if (choice == "b")
                {
                    Console.WriteLine("Aktualne zloto:{0}. Wpisz za ile zlota chcesz kupic statek", _gold);
                    int money = 0;
                    if (Int32.TryParse(Console.ReadLine(), out money))
                    {
                        if (money <= _gold)
                        {
                            starships.Add(cosmos.GetStarship(money));
                            _gold -= money;
                        }
                        else
                        {
                            Console.WriteLine("Nie masz tyle hajsu");
                        }
                    }
                    else
                    {
                        Console.WriteLine("Zla kwota");
                    }
                }
                else if (choice == "c")
                {
                    SSystem toSend = cosmos.GetSystem();
                    if (toSend == null)
                    {
                        _anySystem = false;
                        Console.WriteLine("Brak systemow");
                    }
                    else
                    {
                        Console.WriteLine("System {0}. Odleglosc: {1}", toSend.Name, toSend.BaseDistance);
                        Console.WriteLine("Statkow gotowych do podrozy: {0}", starships.Count);
                        if (starships.Count == 0)
                        {
                            Console.WriteLine("Brak statkow");
                        }
                        else
                        {
                            Console.WriteLine("Wybierz statek wpisujac jego numer albo wyjdz uzywajac e");
                            for (int i = 1; i <= starships.Count; i++)
                            {
                                Starship ship = starships[i - 1];
                                Console.Write("{0} {1}", i, ship.ShipPower);
                                foreach (Person p in ship.crew)
                                {
                                    Console.Write(" {0} {1} {2} ", p.Name, p.Nick, p.Age);
                                }
                                Console.WriteLine();
                            }
                            string option = Console.ReadLine();
                            if (option == "e")
                            {
                                continue;
                            }
                            else
                            {
                                int shipNumber = 0;
                                if (Int32.TryParse(option, out shipNumber))
                                {
                                    if (shipNumber <= starships.Count && shipNumber != 0)
                                    {
                                        Starship starship = starships[shipNumber - 1];
                                        starships.RemoveAt(shipNumber - 1);
                                        Starship starshipAfterSend = cosmos.sendStarship(starship, toSend.Name);
                                        if (starshipAfterSend.Gold > 0)
                                        {
                                            _gold += starshipAfterSend.Gold;
                                            starshipAfterSend.Gold = 0;
                                        }
                                        if (starshipAfterSend.crew.Length > 0)
                                        {
                                            starships.Add(starshipAfterSend);
                                        }
                                        foreach (Person p in starshipAfterSend.crew)
                                        {
                                            Console.WriteLine(p.Age);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                else if (choice == "d")
                {
                    Console.WriteLine(!_anySystem?"Wygrana":"Przegrana");
                    break;
                }
            }
            Console.ReadLine();
        }
示例#20
0
        static void Main(string[] args)
        {
            ConsoleApplication3.ServiceReference1.Service1Client cosmos   = new ConsoleApplication3.ServiceReference1.Service1Client();
            ConsoleApplication3.ServiceReference2.Service1Client imperium = new ConsoleApplication3.ServiceReference2.Service1Client();
            cosmos.InitializeGame();
            string line;

            while (condition)
            {
                Console.WriteLine("Gold: " + Program._gold);
                Console.WriteLine("Imperium money asks left: " + Program._imperiumMoneyAskCount);
                Console.WriteLine("To ask imperium for money press \'a\'.");
                Console.WriteLine("To buy a starship press \'b\'.");
                Console.WriteLine("To send a starship to a space system press \'s\'");
                Console.WriteLine("To exit the game press \'x\'");
                line = Console.ReadLine();
                switch (line)
                {
                case "a":
                    if (Program._imperiumMoneyAskCount > 0)
                    {
                        Program._gold += imperium.GetMoneyFromImperium();
                        Program._imperiumMoneyAskCount -= 1;
                    }
                    break;

                case "b":
                    Console.WriteLine("Current gold: {0}. Type an amount of money you want to spend for new starship", Program._gold);
                    int kwota = Int16.Parse(Console.ReadLine());
                    if (kwota > 0 && kwota < Program._gold)
                    {
                        Program._starships.Add(cosmos.GetStarship(kwota));
                        _gold -= kwota;
                    }
                    else
                    {
                        Console.WriteLine("You passed wrong input!");
                    }
                    break;

                case "s":
                    SpaceSystem s = cosmos.GetSystem();
                    if (s == null)
                    {
                        Console.WriteLine("No systems.");
                        Program._anySystem = false;
                        break;
                    }
                    Console.WriteLine("System: {0}, distance: {1}", s.Name, s.BaseDistance);
                    int num = Program._starships.Count;
                    if (num == 0)
                    {
                        Console.WriteLine("No starships owned.");
                        break;
                    }
                    Console.WriteLine("Starships ready to trip: {0}", num);
                    Console.WriteLine("Wybierz statek wpisując jego numer(albo wyjdź wpisując literę e)");
                    int count = 1;
                    foreach (Starship st in _starships)
                    {
                        String crew = "";
                        foreach (Person p in st.Crew)
                        {
                            crew += p.Name + " " + p.Nick + " " + p.Age + ", ";
                        }
                        crew.Remove(crew.Length - 1, 1);
                        Console.WriteLine("{0}. {1}, {2}", count, st.ShipPower, crew);
                        count += 1;
                    }
                    line = Console.ReadLine();
                    switch (line)
                    {
                    case "e":
                        break;

                    default:
                        int x = 0;
                        if (Int32.TryParse(line, out x) && Int32.Parse(line) > 0)
                        {
                            int      choice  = Int32.Parse(line);
                            Starship newShip = cosmos.SendStarship(_starships.ElementAt(choice - 1), s.Name);
                            _starships.RemoveAt(choice - 1);
                            if (newShip.Gold > 0)
                            {
                                _gold       += newShip.Gold;
                                newShip.Gold = 0;
                            }
                            if (newShip.Crew.Length > 0)
                            {
                                _starships.Add(newShip);
                            }
                        }
                        else
                        {
                            Console.WriteLine("Typed invalid ship number");
                        }
                        break;
                    }
                    break;

                case "x":
                    condition = false;
                    break;

                default:
                    Console.WriteLine("Received unknown command.");
                    break;
                }
            }
            if (_anySystem == false)
            {
                Console.WriteLine("You win!");
            }
            else
            {
                Console.WriteLine("You lost!");
            }
            Console.ReadLine();
        }
示例#21
0
    private void OnCollisionStay(Collision other)
    {
        if (other.gameObject.tag == "Starship")
        {
            timer = 0;

            if (hasLava)
            {
                Starship.ApplyDamage(lavaDamage);
            }

            if (starshipRigidbody.velocity.magnitude < 5 && Vector3.Angle(-starship.transform.up, transform.position - starship.transform.position) < angle)
            {
                // Docking
                starshipRigidbody.velocity = Vector2.Lerp(starshipRigidbody.velocity, Vector3.zero, 2 * Time.deltaTime);

                if ((Starship.fuel < 100 || Starship.health < 100 || Starship.oxygen < 96) && (currentOxygen > 0 || currentFuel > 0))
                {
                    oxygenAndFuel.Play();
                    if (dockingAudio != null)
                    {
                        dockingAudio.UnPause();
                        dockingAudio.volume = 0.0178f;
                    }

                    if (currentOxygen > 0)
                    {
                        Starship.oxygen      += 8 * Time.deltaTime;
                        currentOxygen        -= 8 * Time.deltaTime;
                        atmosphere.localScale = Vector3.Lerp(atmosphere.localScale, new Vector3(1f, 1f, 1f), Time.deltaTime * 0.3f);
                    }
                    if (currentFuel > 0)
                    {
                        Starship.fuel += 10 * Time.deltaTime;
                        currentFuel   -= 10 * Time.deltaTime;
                    }

                    if (Starship.health < 100 && !hasLava)
                    {
                        Starship.health += 8 * Time.deltaTime;
                    }
                }
                else
                {
                    oxygenAndFuel.Stop();
                    if (dockingAudio != null)
                    {
                        dockingAudio.volume = 0f;
                        dockingAudio.Pause();
                    }
                }
            }
            else
            {
                Starship.ApplyDamage(0.23f);
                dockingAudio.Pause();
                oxygenAndFuel.Stop();
                if (dockingAudio != null)
                {
                    dockingAudio.volume = 0f;
                }
            }
        }
    }
示例#22
0
 protected override double?CalculateConsumableDuration(Starship ship)
 {
     return(null);
 }
示例#23
0
 private async Task SaveAsync(Starship starship, CancellationToken cancellationToken)
 {
     await _starshipRepository.SaveAsync(starship, cancellationToken);
 }
示例#24
0
        public static void CreateTargetedTrajectory(Vessel vessel, Tuple <double, double> LZ)
        {
            targetedTrajectory = new Vector2((float)(vessel.Flight(vessel.SurfaceReferenceFrame).Latitude - LZ.Item1),
                                             (float)(vessel.Flight(vessel.SurfaceReferenceFrame).Longitude - LZ.Item2));
            Console.WriteLine("Targeted Trajectory Vector Initialized : " + targetedTrajectory.ToString());

            if (Starship.Distance(Starship.InitPos.Item1, Starship.starship.Flight(Starship.starship.SurfaceReferenceFrame).Latitude, 0, 0) < Starship.Distance(Starship.InitPos.Item2, Starship.starship.Flight(Starship.starship.SurfaceReferenceFrame).Longitude, 0, 0))
            {
                useLatitude = false;
                if (Starship.starship.Flight(Starship.starship.SurfaceReferenceFrame).Longitude > Starship.InitPos.Item2)
                {
                    BaseHeading = 270;
                    superior    = true;
                }
                else
                {
                    BaseHeading = 90;
                    superior    = false;
                }
            }
            else
            {
                useLatitude = true;

                if (Starship.starship.Flight(Starship.starship.SurfaceReferenceFrame).Latitude > Starship.InitPos.Item1)
                {
                    BaseHeading = 180;
                    superior    = true;
                }
                else
                {
                    BaseHeading = 0;
                    superior    = false;
                }
            }
        }
示例#25
0
 public PagedStarshipsDetailPage(Starship starship)
 {
     InitializeComponent();
     this.BindingContext = starship;
 }
示例#26
0
 public static void GuidanceByLatitude()
 {
     if (useLatitude == true)
     {
         Console.WriteLine("Oui 1");
         if (Starship.ImpactPoint().Item2 > Starship.InitPos.Item1 && superior == true)
         {
             if (Starship.ImpactPoint().Item1 > Starship.InitPos.Item2)
             {
                 Console.WriteLine("Non 1");
                 teta = -2;
             }
             else
             {
                 Console.WriteLine("Non 2");
                 teta = 2;
             }
         }
         else if (Starship.ImpactPoint().Item2 < Starship.InitPos.Item1 && superior == true)
         {
             if (Starship.ImpactPoint().Item1 > Starship.InitPos.Item2)
             {
                 Console.WriteLine("Non 3");
                 teta = -1;
             }
             else
             {
                 Console.WriteLine("Non 4");
                 teta = 1;
             }
         }
         else if (Starship.ImpactPoint().Item2 > Starship.InitPos.Item1 && superior == false)
         {
             if (Starship.ImpactPoint().Item1 > Starship.InitPos.Item2)
             {
                 Console.WriteLine("Non 5");
                 teta = 1;
             }
             else
             {
                 Console.WriteLine("Non 6");
                 teta = 2;
             }
         }
         else if (Starship.ImpactPoint().Item2 < Starship.InitPos.Item1 && superior == false)
         {
             if (Starship.ImpactPoint().Item1 > Starship.InitPos.Item2)
             {
                 Console.WriteLine("Non 7");
                 teta = 2;
             }
             else
             {
                 Console.WriteLine("Non 8");
                 teta = -2;
             }
         }
     }
     else
     {
         Console.WriteLine("Oui 2");
         if (Starship.ImpactPoint().Item2 > Starship.InitPos.Item2 && superior == true)
         {
             if (Starship.ImpactPoint().Item1 > Starship.InitPos.Item1)
             {
                 Console.WriteLine("Non 1");
                 teta = -2;
             }
             else
             {
                 Console.WriteLine("Non 2");
                 teta = 2;
             }
         }
         else if (Starship.ImpactPoint().Item2 < Starship.InitPos.Item2 && superior == true)
         {
             if (Starship.ImpactPoint().Item1 > Starship.InitPos.Item1)
             {
                 Console.WriteLine("Non 3");
                 teta = -1;
             }
             else
             {
                 Console.WriteLine("Non 4");
                 teta = 1;
             }
         }
         else if (Starship.ImpactPoint().Item2 > Starship.InitPos.Item2 && superior == false)
         {
             if (Starship.ImpactPoint().Item1 > Starship.InitPos.Item1)
             {
                 Console.WriteLine("Non 5");
                 teta = -2;
             }
             else
             {
                 Console.WriteLine("Non 6");
                 teta = 2;
             }
         }
         else if (Starship.ImpactPoint().Item2 < Starship.InitPos.Item2 && superior == false)
         {
             if (Starship.ImpactPoint().Item1 > Starship.InitPos.Item1)
             {
                 Console.WriteLine("Non 7");
                 teta = 1;
             }
             else
             {
                 Console.WriteLine("Non 8");
                 teta = -1;
             }
         }
     }
 }
示例#27
0
 public static double GetLength(Unit?unit, [Parent] Starship starship)
 => ConvertToUnit(starship.Length, unit);
示例#28
0
 private void PresentStarship(Starship s)
 {
     Console.Write("{0}", s.ShipPower);
     s.Crew.ForEach(p => Console.Write(", {0} {1} {2}", p.Name, p.Nick, p.Age));
     Console.WriteLine();
 }