Exemple #1
0
        private void UpdateCurrentQuestion()
        {
            var currentQuestion = CardsAgainstHumility.CurrentQuestion;

            if (CurrentQuestionView != null)
            {
                if (currentQuestion == null || CardsAgainstHumility.GameOver)
                {
                    CurrentQuestionView.Visibility = ViewStates.Invisible;
                }
                else
                {
                    UIAssets.PrepareBlackCard(CurrentQuestionView, currentQuestion);
                    CurrentQuestionView.Visibility = ViewStates.Visible;
                }
            }
        }
Exemple #2
0
        private void ShowWinnerModal()
        {
            var RoundWinner     = (CardsAgainstHumility.RoundWinner == CardsAgainstHumility.PlayerName ? "You" : CardsAgainstHumility.RoundWinner);
            var currentQuestion = CardsAgainstHumility.CurrentQuestion;
            var winningAnswer   = new WhiteCard(CardsAgainstHumility.WinningCard, 20);

            RunOnUiThread(() =>
            {
                // Prepare the builder
                var dlg  = new Dialog(this);
                var view = LayoutInflater.Inflate(Resource.Layout.RoundWinnerAnnouncement, null);

                // Show the winner's name
                var winnerName = view.FindViewById <TextView>(Resource.Id.wm_Winner);
                winnerName.SetTypeface(UIAssets.AppFont, TypefaceStyle.Normal);
                winnerName.Text = $"{RoundWinner} won the round";
                winnerName.SetTextSize(ComplexUnitType.Dip, 16);

                // Prepare the black card
                var blackCard = view.FindViewById <View>(Resource.Id.wm_BlackCard);
                UIAssets.PrepareBlackCard(blackCard, currentQuestion);

                // Prepare the white card
                var whiteCard = view.FindViewById <FrameLayout>(Resource.Id.wm_WhiteCard);
                UIAssets.PrepareWhiteCard(whiteCard, winningAnswer);

                // Place the white card just below the bottom of the black card's text
                PlaceWhiteCardBelowBlackCardText(whiteCard, blackCard);

                // Link up the close button
                var closeBtn = view.FindViewById <Button>(Resource.Id.wm_closeBtn);
                closeBtn.SetTypeface(UIAssets.AppFont, TypefaceStyle.Normal);
                closeBtn.Click += (owner, args) =>
                {
                    dlg.Dismiss();
                };

                // Show the modal
                dlg.AddContentView(view, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent));
                dlg.Window.SetBackgroundDrawable(new ColorDrawable(Color.Transparent));
                dlg.Show();
            });
        }