Ejemplo n.º 1
0
        public void Setting_the_score_should_return_true_if_box_is_empty()
        {
            var roll1 = new List <int> {
                1, 1, 1, 1, 5
            };
            ScoreGrid grid = new ScoreGrid();

            Assert.True(grid.SetScore(Box.Aces, roll1));
        }
Ejemplo n.º 2
0
        public void Add_Score_In_Empty_Box_with_only_ones()
        {
            var roll = new List <int> {
                1, 1, 1, 1, 1
            };
            ScoreGrid grid = new ScoreGrid();

            grid.SetScore(Box.Aces, roll);
            Assert.Equal(5, grid.GetScore(Box.Aces));
        }
Ejemplo n.º 3
0
        public void Should_be_able_to_score_in_box_two()
        {
            var roll = new List <int> {
                1, 2, 1, 1, 5
            };
            ScoreGrid grid = new ScoreGrid();

            grid.SetScore(Box.Twos, roll);
            Assert.Equal(2, grid.GetScore(Box.Twos));
        }
Ejemplo n.º 4
0
        public void Add_Score_In_Empty_Box_ones_and_one_five()
        {
            var roll = new List <int> {
                1, 1, 1, 1, 5
            };
            ScoreGrid grid = new ScoreGrid();

            grid.SetScore(Box.Aces, roll);
            Assert.Equal(4, grid.GetScore(Box.Aces));
        }
        protected override void OnAppearing()
        {
            base.OnAppearing();
            LoadingIndicatorText.Text = "Loading Game Data";
            quitButton.IsVisible      = false;
            overlay.IsVisible         = true;
            Easing animationType = Easing.Linear;
            Random randomNumber  = new Random();

            Device.StartTimer(TimeSpan.FromSeconds(3), () =>
            {
                if (GameViewModel.IsPlayerTurn == false)
                {
                    switch (randomNumber.Next(3))
                    {
                    case 0:
                        animationType = Easing.SpringOut;
                        break;

                    case 1:
                        animationType = Easing.Linear;
                        break;

                    case 2:
                        animationType = Easing.CubicOut;
                        break;

                    case 3:
                        animationType = Easing.SinInOut;
                        break;

                    default:
                        animationType = Easing.BounceOut;
                        break;
                    }
                    {
                        ScoreGrid.AnchorX   = 0;
                        ScoreGrid.RotationY = 0;
                        ScoreGrid.RotateYTo(360, 1000, animationType);
                        ScoreGrid.AnchorX = 0.5;
                    }
                    return(true);
                }
                else
                {
                }
                return(true);
            });
            Task.Run(() =>
            {
                ReturnMyData();
            });
        }
Ejemplo n.º 6
0
        public void Setting_the_score_should_return_false_if_box_is_already_full()
        {
            var roll1 = new List <int> {
                1, 1, 1, 1, 5
            };
            var roll2 = new List <int> {
                1, 1, 1, 5, 5
            };
            ScoreGrid grid = new ScoreGrid();

            grid.SetScore(Box.Aces, roll1);
            Assert.False(grid.SetScore(Box.Aces, roll2));
        }
Ejemplo n.º 7
0
        public void should_be_able_to_score_in_an_empty_box_when_another_is_filled()
        {
            var roll1 = new List <int> {
                1, 1, 1, 1, 5
            };
            var roll2 = new List <int> {
                2, 1, 1, 5, 5
            };
            ScoreGrid grid = new ScoreGrid();

            grid.SetScore(Box.Aces, roll1);
            Assert.True(grid.SetScore(Box.Twos, roll2));
        }
Ejemplo n.º 8
0
        public void Add_Score_In_Ace_That_is_not_empty_and_score_stay_the_same()
        {
            var roll1 = new List <int> {
                1, 1, 1, 1, 5
            };
            var roll2 = new List <int> {
                1, 1, 1, 5, 5
            };
            ScoreGrid grid = new ScoreGrid();

            grid.SetScore(Box.Aces, roll1);
            grid.SetScore(Box.Aces, roll2);
            Assert.Equal(4, grid.GetScore(Box.Aces));
        }
Ejemplo n.º 9
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
     }
     lbl.Text = Session["username"].ToString() + ", you have logged in successfully.";
     using (var context = new Testdata1Entities())
     {
         var a = (from u in context.user_scores
                  orderby u.score descending
                  select u).Take(10).ToList();
         ScoreGrid.DataSource = a;
         ScoreGrid.DataBind();
     }
 }
Ejemplo n.º 10
0
        public void Scores_should_be_correct_when_two_boxes_are_filled()
        {
            var roll1 = new List <int> {
                1, 1, 1, 1, 5
            };
            var roll2 = new List <int> {
                2, 1, 1, 5, 5
            };
            ScoreGrid grid = new ScoreGrid();

            grid.SetScore(Box.Aces, roll1);
            grid.SetScore(Box.Twos, roll2);
            Assert.Equal(4, grid.GetScore(Box.Aces));
            Assert.Equal(2, grid.GetScore(Box.Twos));
        }
        protected override void OnAppearing()
        {
            base.OnAppearing();
            Easing animationType = Easing.Linear;
            Random randomNumber  = new Random();

            Device.StartTimer(TimeSpan.FromSeconds(3), () =>
            {
                if (GameViewModel.IsPlayerTurn == false)
                {
                    switch (randomNumber.Next(3))
                    {
                    case 0:
                        animationType = Easing.SpringOut;
                        break;

                    case 1:
                        animationType = Easing.Linear;
                        break;

                    case 2:
                        animationType = Easing.CubicOut;
                        break;

                    case 3:
                        animationType = Easing.SinInOut;
                        break;

                    default:
                        animationType = Easing.BounceOut;
                        break;
                    }
                    //if (counter >= 3)
                    //{
                    //    MainGrid.AnchorX = 0;
                    //    MainGrid.RotationY = 0;
                    //    MainGrid.RotateYTo(360, 1000, animationType);
                    //    MainGrid.AnchorX = 0.5;
                    //    counter = 0;
                    //    return true;
                    //}
                    //if (counter >= 100)
                    //{
                    //    j.AnchorX = 0;
                    //    j.RotationY = 0;
                    //    j.RotateYTo(-360, 1000, animationType);
                    //    j.AnchorX = 0.5;
                    //}
                    //if (counter >= 1)
                    //{
                    //    k.AnchorX = 0;
                    //    k.RotationY = 0;
                    //    k.RotateYTo(360, 1000, animationType);
                    //    k.AnchorX = 0.5;
                    //}
                    //if (counter >= 2)
                    {
                        ScoreGrid.AnchorX   = 0;
                        ScoreGrid.RotationY = 0;
                        ScoreGrid.RotateYTo(360, 1000, animationType);
                        ScoreGrid.AnchorX = 0.5;
                    }
                    //counter++;
                    return(true);
                }
                else
                {
                    //if (buttonCondition == true)
                    //{
                    //    TurnButtonLayout.TranslationY = 0;
                    //    TurnButtonLayout.TranslateTo(0, -20, 2000, Easing.BounceOut);
                    //    buttonCondition = false;
                    //}
                    //else
                    //{
                    //    TurnButtonLayout.TranslationY = -20;
                    //    TurnButtonLayout.TranslateTo(0, 0, 2000, Easing.BounceOut);
                    //    buttonCondition = true;
                    //}
                }
                return(true);
            });
        }
Ejemplo n.º 12
0
 private Button GetButtonByName(string name)
 {
     return((Button)ScoreGrid.FindName(name));
 }
Ejemplo n.º 13
0
 private Label GetLabelByName(string name)
 {
     return((Label)ScoreGrid.FindName(name));
 }
Ejemplo n.º 14
0
 public IngameScreenUI()
 {
     BuildUI();
     score_grid = new ScoreGrid();
     Widgets.Insert(0, score_grid);
 }