protected void CommunicateExpedition()
        {
            int totalSystems = _navigator.SystemsRemaining();
            int totalPlanets = _navigator.CelestialsRemaining();

            string script = string.Format(_expeditionPlotted, totalSystems, totalPlanets);

            var celestialsByCategory = _navigator.GetAllRemainingCelestials()
                                       .GroupBy(c => c.Clasification)
                                       .ToDictionary(grp => grp.Key, grp => grp.ToList());

            int counter = 0;

            foreach (var item in celestialsByCategory)
            {
                counter++;

                if (counter == celestialsByCategory.Count() && celestialsByCategory.Count() > 1)
                {
                    script += $"{_andPhrase} ";
                }

                script += $"{item.Value.Count} {item.Key}{_pluralPhrase}, ";
            }

            _communicator.Communicate(script);
        }
Esempio n. 2
0
        protected void CommunicateExpedition()
        {
            int totalSystems = _navigator.SystemsRemaining();
            int totalPlanets = _navigator.CelestialsRemaining();

            string script = string.Format(_expeditionPlotted, totalSystems, totalPlanets);

            script += _navigator.SpokenCelestialList(_navigator.GetAllRemainingCelestials());
            _communicator.Communicate(script);
        }