Esempio n. 1
0
        public Task SelectSummaryScreen(RoundSummary roundSummary, LevelData newLevel, bool mirror, Action action)
        {
            var roundSummaryScreen = RoundSummaryScreen.Select(overlaySprite, roundSummary);

            GUI.ClearCursorWait();

            var loadTask = Task.Run(async() =>
            {
                await Task.Yield();
                Rand.ThreadId = System.Threading.Thread.CurrentThread.ManagedThreadId;
                try
                {
                    GameMain.GameSession.StartRound(newLevel, mirrorLevel: mirror);
                }
                catch (Exception e)
                {
                    roundSummaryScreen.LoadException = e;
                }
                Rand.ThreadId = 0;
            });

            TaskPool.Add("AsyncCampaignStartRound", loadTask, (t) =>
            {
                overlayColor = Color.Transparent;
                action?.Invoke();
            });

            return(loadTask);
        }
Esempio n. 2
0
        public static RoundSummaryScreen Select(Sprite backgroundSprite, RoundSummary roundSummary)
        {
            var summaryScreen = new RoundSummaryScreen()
            {
                roundSummary         = roundSummary,
                backgroundSprite     = backgroundSprite,
                prevGuiElementParent = roundSummary.Frame.RectTransform.Parent,
                loadText             = TextManager.Get("campaignstartingpleasewait")
            };

            roundSummary.Frame.RectTransform.Parent = summaryScreen.Frame.RectTransform;
            summaryScreen.Select();
            summaryScreen.AddToGUIUpdateList();
            return(summaryScreen);
        }