コード例 #1
0
        public async Task <bool> Insert(PlayerPick pick)
        {
            var isSuccess = false;
            var p         = new DynamicParameters();

            p.Add("@combinedscore", pick.CombinedScore);
            p.Add("@firstInningWickets", pick.FirstInningWickets);
            p.Add("@secondinningwickets", pick.SecondInningWickets);
            p.Add("@HighestScore", pick.HighestScore);
            p.Add("@highestWickets", pick.HighestWickets);
            p.Add("@overschase", pick.OversChase);
            p.Add("@Total4s", pick.Total4s);
            p.Add("@Total6s", pick.Total6s);
            p.Add("@TeamPick", pick.TeamPick);
            p.Add("@MaxSingleOverScore", pick.MaxSingleOverScore);
            p.Add("@userId", pick.UserId);

            try
            {
                using (IDbConnection conn = Connection)
                {
                    conn.Execute("InsertPlayerPick", p, commandType: CommandType.StoredProcedure);
                }
                isSuccess = true;
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(await Task.FromResult(isSuccess));
        }
コード例 #2
0
        public PlaySetGame2()
        {
            InitializeComponent();

            BindingContext = new PlayerPick();

            playerView.ItemsSource = Players.PlayerList;
        }
コード例 #3
0
 void Awake()
 {
     attackScript = GetComponent <PlayerAttack> ();
     shootScript  = GetComponent <PlayerShoot> ();
     pickScript   = GetComponent <PlayerPick> ();
     moveScript   = GetComponent <PlayerMove> ();
     catchingZone = GetComponent <PolygonCollider2D> ();
 }
コード例 #4
0
        public void NewGameButton_Click(object sender, RoutedEventArgs e)
        {
            launch = new PlayScreen(avatar1.Source, p1Name.Text, avatar2.Source, p2Name.Text);

            PlayerPick.Hide();
            launch.ShowDialog();
            PlayerPick.Close();
        }
コード例 #5
0
        void OnItemSelected(object sender, SelectedItemChangedEventArgs e)
        {
            PlayerPick playerPick = new PlayerPick();

            if (e.SelectedItem != null)
            {
                var selection = e.SelectedItem as Players;
                playerPick.Player1 = selection.PlayerName;
            }
        }
コード例 #6
0
        private async Task UpdatePicksImages(Pick playerPick, Pick computerPick)
        {
            await Task.WhenAll(
                PlayerPick.FadeTo(0, 200),
                ComputerPick.FadeTo(0, 200)
                );

            PlayerPick.Source   = _pickImages[playerPick];
            ComputerPick.Source = _pickImages[computerPick];
            await Task.WhenAll(
                PlayerPick.FadeTo(1, 200),
                ComputerPick.FadeTo(1, 200)
                );
        }
コード例 #7
0
        public async Task <IActionResult> Add(PlayerPick pick)
        {
            if (!this.HasGameStarted)
            {
                if (ModelState.IsValid)
                {
                    pick.UserId = this.UserId;

                    var isAddded = await _pickRepository.Insert(pick);


                    if (isAddded)
                    {
                        this.TempData["IsAdded"] = "Saved successfully. You can change these picks until game starts.";
                    }
                    else
                    {
                        this.TempData["IsAdded"] = "Something went wrong. Try again.";
                        //var msg = new ToastrMessage("error", "The email/password you entered does not match", "top");
                        //LoginController loginController = this;
                        //loginController.TempData["toasts"] = JsonConvert.SerializeObject(msg);
                    }
                }
                else
                {
                    return(BadRequest(ModelState));
                }
            }
            else
            {
                this.TempData["error"] = "Game already started, you can't make any changes.";
                var error = this.TempData["error"].ToString();
                _cookieRepository.SetCookie("Error", error, 1);
            }

            //if (isLoginVerified)
            //    return RedirectToAction(actionName: "schools", controllerName: "user");
            //else
            //    return RedirectToAction(actionName: "login", controllerName: "users");

            return(RedirectToAction("add", "picks"));
        }
コード例 #8
0
        public IActionResult Index()
        {
            var myPick = new PlayerPick()
            {
                CombinedScore       = 0,
                FirstInningWickets  = 6,
                SecondInningWickets = 7,
                HighestScore        = 54,
                HighestWickets      = 3,
                OversChase          = 19.2,
                Total4s             = 52,
                Total6s             = 21,
                TeamPick            = 2,
                UserId = this.UserId,
                AddDt  = DateTime.Now
            };

            //var isInserted = await _pickRepository.Insert(myPick);

            //this.TempData["PickInserted"] = isInserted;

            return(View());
        }
コード例 #9
0
 public void Quit_Click(object sender, RoutedEventArgs e)
 {
     PlayerPick.Close();
 }