Beispiel #1
0
        private void onDateChosen(SDate date)
        {
            // Gather the appropriate predictions.
            List <Mining.Prediction> predictions = Mining.ListFloorsForDate(date);

            bool          today = date == SDate.Now();
            List <string> pages = new List <string> ();

            // Build the list of predictions.
            List <string> lines = new List <string>
            {
                Helper.Translation.Get($"mining.header.{(today ? "today" : "later")}", new
                {
                    date = date.ToLocaleString(),
                })
            };

            string joiner = CultureInfo.CurrentCulture.TextInfo.ListSeparator + " ";

            foreach (Mining.FloorType type in predictions
                     .Select((p) => p.type).Distinct().ToList())
            {
                List <int> floors = predictions
                                    .Where((p) => p.type == type)
                                    .Select((p) => p.floor)
                                    .ToList();
                string floorsText;
                if (floors.Count == 1)
                {
                    floorsText = Helper.Translation.Get("mining.floor",
                                                        new { num = floors[0] });
                }
                else
                {
                    int lastNum = floors[floors.Count - 1];
                    floors.RemoveAt(floors.Count - 1);
                    floorsText = unbreak(Helper.Translation.Get("mining.floors",
                                                                new { nums = string.Join(joiner, floors), lastNum = lastNum }));
                }

                lines.Add(Helper.Translation.Get($"mining.prediction.{type}",
                                                 new { floors = floorsText }));
            }
            if (predictions.Count == 0)
            {
                lines.Add(Helper.Translation.Get("mining.prediction.none"));
            }
            pages.Add(string.Join("^", lines));

            // If going deeper in the mines could alter the results, add an
            // appropriate closing.
            if (Mining.IsProgressDependent)
            {
                pages.Add(Helper.Translation.Get("mining.closing.progress"));
            }

            // Show the predictions.
            showDialogues(pages);
            Game1.afterDialogues = extinguish;
        }
Beispiel #2
0
        internal override void show(TV tv)
        {
            SDate today = SDate.Now();
            List <Mining.Prediction> predictions = Mining.ListFloorsForDate(today);

            TemporaryAnimatedSprite background = loadBackground(tv, 0);
            TemporaryAnimatedSprite marlon     = loadPortrait(tv, "Marlon");
            TemporaryAnimatedSprite gil        = loadPortrait(tv, "Gil");

            // Opening scene: Marlon greets the viewer.
            queueScene(new Scene(Helper.Translation.Get((predictions.Count == 0)
                                ? "mining.opening.none" : "mining.opening"),
                                 background, marlon)
            {
                musicTrack = "MarlonsTheme"
            });

            // Marlon or Gil reports on each type of special floor.
            string joiner = CultureInfo.CurrentCulture.TextInfo.ListSeparator + " ";

            foreach (Mining.FloorType type in predictions
                     .Select((p) => p.type).Distinct().ToList())
            {
                List <int> floors = predictions
                                    .Where((p) => p.type == type)
                                    .Select((p) => p.floor)
                                    .ToList();
                string floorsText;
                if (floors.Count == 1)
                {
                    floorsText = Helper.Translation.Get("mining.floor",
                                                        new { num = floors[0] });
                }
                else
                {
                    int lastNum = floors[floors.Count - 1];
                    floors.RemoveAt(floors.Count - 1);
                    floorsText = Helper.Translation.Get("mining.floors",
                                                        new { nums = string.Join(joiner, floors), lastNum = lastNum });
                }

                queueScene(new Scene(Helper.Translation.Get($"mining.prediction.{type}",
                                                            new { floors = floorsText, }),
                                     loadBackground(tv, (int)type + 1),
                                     GilTypes.Contains(type) ? gil : marlon)
                {
                    musicTrack = "MarlonsTheme"
                });
            }

            // Closing scene: Marlon signs off.
            bool progress = Mining.IsProgressDependent;

            queueScene(new Scene
                           (Helper.Translation.Get($"mining.closing.{(progress? "progress" : "standard")}"),
                           background, marlon)
            {
                musicTrack = "MarlonsTheme"
            });

            runProgram(tv);
        }