public void FinishedQuiz(int score)
 {
     if (panelFinished)
     {
         panelFinished.SetActive(true);
         FinishedPanel fp = panelFinished.GetComponent <FinishedPanel>();
         fp.SetFinalScore(score);
     }
 }
Beispiel #2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            View.BackgroundColor = GameDefinition.GameSet.Color.ToUIColor();

            if (!string.IsNullOrWhiteSpace(GameDefinition.Instructions))
            {
                TopLabel.Text = GameDefinition.Instructions;
            }
            else
            {
                TopLabel.Text = GameDefinition.DisplayLevel;
            }

            if (GameDefinition.GameSet.Palette != null)
            {
                var colors = new List <UIColor>();
                foreach (var colorStr in GameDefinition.GameSet.Palette)
                {
                    var color = colorStr.ToUIColor();
                    colors.Add(color);
                }
                ColorPalette = colors;
            }


            BackButton.TouchUpInside    += (sender, e) => { CloseScreen(); };
            RestartButton.TouchUpInside += (sender, e) => { ResetGame(); };

            nextRecognizer = new UITapGestureRecognizer(() => {
                NextGame();
            });
            FinishedPanel.AddGestureRecognizer(nextRecognizer);


            Grid.ShowsHorizontalScrollIndicator = false;
            Grid.ShowsVerticalScrollIndicator   = false;

            FinishedPanel.Hidden = true;

            runner = new GameRunner(this);
            runner.SetGameDefinition(GameDefinition);

            LayoutGrid();

            Grid.BackgroundColor = GameDefinition.GameSet.Color.ToUIColor();

            runner.StartGame();
            Grid.Source = new PlayDataSource(runner, this);
            Grid.UserInteractionEnabled = true;

            Grid.TouchBegan    += Grid_TouchBegan;
            Grid.TouchMoved    += Grid_TouchMoved;
            Grid.TouchEnded    += Grid_TouchEnded;
            Grid.TouchCanceled += Grid_TouchEnded;
        }
        void ReleaseDesignerOutlets()
        {
            if (ArrowForward != null)
            {
                ArrowForward.Dispose();
                ArrowForward = null;
            }

            if (BackButton != null)
            {
                BackButton.Dispose();
                BackButton = null;
            }

            if (FinishedPanel != null)
            {
                FinishedPanel.Dispose();
                FinishedPanel = null;
            }

            if (Grid != null)
            {
                Grid.Dispose();
                Grid = null;
            }

            if (RestartButton != null)
            {
                RestartButton.Dispose();
                RestartButton = null;
            }

            if (TopLabel != null)
            {
                TopLabel.Dispose();
                TopLabel = null;
            }
        }