public async Task <IActionResult> PutScoreClass([FromRoute] int id, [FromBody] ScoreClass scoreClass) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != scoreClass.ID) { return(BadRequest()); } _context.Entry(scoreClass).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ScoreClassExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public static void Initialize(Context context) { context.Database.EnsureCreated(); // Look for any students. if (context.Scores.Any()) { return; // DB has been seeded } var scores = new ScoreClass[] { new ScoreClass { Nickname = "Carson", Points = 3542, TypeOfScorer = "Human" }, new ScoreClass { Nickname = "Benson", Points = 1234, TypeOfScorer = "AI" }, new ScoreClass { Nickname = "Larson", Points = 4312, TypeOfScorer = "Human" }, }; foreach (ScoreClass s in scores) { context.Scores.Add(s); } context.SaveChanges(); }
public SingleplayerWindow() { InitializeComponent(); backgroundMusic.Open(new Uri("sounds/gameMusic.mp3", UriKind.RelativeOrAbsolute)); backgroundMusic.Play(); Backgr.ImageSource = new BitmapImage(new Uri("images/backgame.png", UriKind.Relative)); score = 0; Width = width + 100; foodCanvas.Width = canvas.Width = width; canvas.Height = foodCanvas.Height = Height = height; myGrid.Height = height; myGrid.Children.Add(new Rectangle { Height = height, Width = 100, StrokeDashCap = PenLineCap.Round, Stroke = Brushes.Gray }); bestScore.Text = ScoreClass.GetBestScore(); time = new DispatcherTimer(); currentDurection = Directions.Stay; snakeBody = new List <SnakeElement>(); snakeBody.Add(new SnakeElement(new Point(moveSize, moveSize))); snakeBody[0].rectangle.Fill = SettingsClass.PlayerColor; time.Interval = new TimeSpan(0, 0, 0, 0, SettingsClass.Difficulty); time.Tick += time_Tick; }
// Use this for initialization void Start() { timerObject = GameObject.Find("Timer"); score = GameObject.FindGameObjectWithTag("ScoreObject").GetComponent <ScoreClass>(); turnTimer = (int)waitTime; timerObject.GetComponent <TextMeshProUGUI>().text = turnTimer.ToString(); sprites = new Dictionary <char, GameObject[]>(); // Permet de reset le score à 0 dans le cas où le joueur rejoue resetScore(); // Remplissage du tableau de sprites for (char c = 'A'; c <= 'Z'; c++) { sprites[c] = GameObject.FindGameObjectsWithTag("Letter_" + c); } letters = GameObject.FindGameObjectsWithTag("Letters"); // Initialisation des valeurs par défaut if (nb_letters < 5) { nb_letters = 5; } if (max_turns == 0) { max_turns = 5; } gameAlive = true; // On lance la boucle via changeLetter, puis on lance un timer Invoke("changeLetters", 0.25f); InvokeRepeating("timerIncrement", 1.25f, 1f); }
// Use this for initialization void Start() { score = GameObject.FindGameObjectWithTag("ScoreObject").GetComponent <ScoreClass>(); gameGenerator = GameObject.FindGameObjectWithTag("GameGenerator").GetComponent <GameGenerator>(); isWin = false; }
// Lorsqu'on arrive dans la scène de fin, on récupère les différentes variables de score // On les affiche et on envoie le nombre de bonnes réponses void Start() { score = GameObject.FindGameObjectWithTag("ScoreObject").GetComponent <ScoreClass>(); goodAnswer.text = score.goodAnswer.ToString() + " / 20"; badAnswer.text = score.wrongAnswer.ToString() + " mauvaises réponses."; totalTime.text = score.countSeconds.ToString() + " secondes au total."; timeOuts.text = score.timeOut.ToString() + " timeouts."; SendScore(score.goodAnswer); }
private void GameOver(string cause) { backgroundMusic.Stop(); MessageBox.Show(cause); Close(); time.Stop(); this.Owner.Show(); ScoreClass.AddScore(0); //нужно только для подсчета количества игр MainWindow.player.Play(); }
private void GameOver(string cause) { backgroundMusic.Stop(); MessageBox.Show(cause); Close(); time.Stop(); this.Owner.Show(); ScoreClass.AddScore(score); MainWindow.player.Play(); }
public async Task <ActionResult <ScoreClass> > PostScoreClass([FromBody] ScoreClass scoreClass) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.Scores.Add(scoreClass); await _context.SaveChangesAsync(); return(CreatedAtAction("GetScoreClass", new { id = scoreClass.ID }, scoreClass)); }
public TeamID GetWinningTeam() { ScoreClass bestTeam = currentTeams[0]; foreach (ScoreClass team in currentTeams) { if (team.score > bestTeam.score) { bestTeam = team; } } return(bestTeam.teamID); }
public ScoreForm(MainForm mainForm, int score) { this.mainForms = mainForm; this.mainForms.Enabled = false; Diem = score; InitializeComponent(); string[] lines = File.ReadAllLines("Result.txt"); foreach (var i in lines) { string[] temp = i.Split(); ScoreClass newOne = new ScoreClass(temp[0].ToString(), Convert.ToInt32(temp[1])); listScore.Add(newOne); } for (int i = 0; i < listScore.Count; i++) { if (listScore[i].score <= score) { positions = i; break; } } if (positions != 0) { ScoreClass newone = new ScoreClass("You", score); listScore.Insert(positions, newone); } for (int i = 0; i < 10; i++) { this.dataGridView1.Rows.Add(i + 1, listScore[i].name, listScore[i].score); } label_score.Text = "Score: " + score; if (positions != 0) { label_score.Text += " Top: " + Convert.ToInt32(positions + 1).ToString(); dataGridView1.CurrentCell = dataGridView1.Rows[positions].Cells[1]; } else { label_score.Text += " Top: UnRank"; textBox_Name.Hide(); label_name.Hide(); dataGridView1.CurrentCell = null; } dataGridView1.ReadOnly = true; }
public void Reset() { if (currentTeams != null) { currentTeams.Clear(); } currentTeams = new List <ScoreClass>(); foreach (TeamID teamID in gameManager.teamManager.currentTeams.Select(x => x.ID)) { ScoreClass newTeam = new ScoreClass(); newTeam.teamID = teamID; currentTeams.Add(newTeam); } currentTeams.Where(x => x.teamID == TeamID.NONE).First().numTiles = gameManager.GetComponent <MapManager>().tiles.Select(x => x.GetTeam()).Where(x => x == TeamID.NONE).Count(); }
private void AddToScoreBoard(ScoreClass newOne) { if (positions != 0) { string[] lines = File.ReadAllLines("Result.txt"); using (StreamWriter writer = new StreamWriter("Result.txt")) { for (int i = 0; i < positions; i++) { writer.WriteLine(lines[i]); } writer.WriteLine(newOne.name + " " + newOne.score); for (int i = positions; i < (lines.Length - 1); i++) { writer.WriteLine(lines[i]); } } } }
private void button_submit_Click(object sender, EventArgs e) { if (positions != 0) { ScoreClass newOne = new ScoreClass(dataGridView1.Rows[positions].Cells[1].Value.ToString(), Diem); string[] lines = File.ReadAllLines("Result.txt"); using (StreamWriter writer = new StreamWriter("Result.txt")) { for (int i = 0; i < positions; i++) { writer.WriteLine(lines[i]); } writer.WriteLine(newOne.name + " " + newOne.score); for (int i = positions; i < (lines.Length - 1); i++) { writer.WriteLine(lines[i]); } } } Close(); }
public Scores() { InitializeComponent(); Backgr.ImageSource = new BitmapImage(new Uri("images/main.jpg", UriKind.Relative)); StackPanel stackPanel = new StackPanel(); stackPanel.HorizontalAlignment = HorizontalAlignment.Left; stackPanel.Margin = new Thickness(10, 30, 0, 0); stackPanel.Height = Height - 100; var scores = ScoreClass.GetFirstScoresArray(); for (int i = 0; i < scores.Length; i++) { var txtbl = new TextBlock(); txtbl.FontSize = 24; txtbl.Text = (i + 1).ToString() + ". " + scores[i]; stackPanel.Children.Add(txtbl); } stackPanel.Children.Add(new TextBlock { Text = "Игр сыграно: " + ScoreClass.GetGamesCount(), FontSize = 26 }); myGrid.Children.Add(stackPanel); }
public CreditCard(ScoreClass scoreClass) { }
// Attach Event void OnTriggerEnter2D(Collider2D other) { if ((other.gameObject.layer == 8 || other.gameObject.layer == 9)) { animator.SetBool("isJumping", false); } if (other.gameObject.layer == 9 && rigid.velocity.y < 0) { Block_obj_status block = other.gameObject.GetComponentInChildren <Block_obj_status>(true); Debug.Log(block.type); switch (block.type) { case "Up": { Vector2 upVelocity = new Vector2(0, block.value); rigid.AddForce(upVelocity, ForceMode2D.Impulse); break; } } } Debug.Log(other.gameObject.tag); Debug.Log("y - " + rigid.velocity.y); if (other.gameObject.tag == "mob" && !other.isTrigger && rigid.velocity.y < -5) { // bouncing Vector2 killVelocity = new Vector2(0, 10f); rigid.AddForce(killVelocity, ForceMode2D.Impulse); // kill monster MonsterMovement monster = other.gameObject.GetComponent <MonsterMovement>(); monster.die(); // get Score ScoreClass.setScore(monster.score); Debug.Log(monster.score); ScoreClass.addScore(); } else if (other.gameObject.tag == "mob" && !other.isTrigger && !(rigid.velocity.y < -5)) { Vector2 attackedVelocity = Vector2.zero; if (other.gameObject.transform.position.x > transform.position.x) { attackedVelocity = new Vector2(-2f, 3f); } else { attackedVelocity = new Vector2(2f, 3f); } rigid.AddForce(attackedVelocity, ForceMode2D.Impulse); hp--; Debug.Log(hp); } if (other.gameObject.tag == "gameover") { hp = 0; } if (other.gameObject.tag == "coin") { // get Score Block_obj_status coin = other.gameObject.GetComponent <Block_obj_status>(); ScoreClass.setScore((int)coin.value); // Remove Coin Destroy(other.gameObject, 0f); ScoreClass.addScore(); } if (other.gameObject.tag == "goal") { GameManager.EndGame(); } }
public void LoadHighScore() { string jsonData = File.ReadAllText(string.Concat(Application.persistentDataPath, "/Score.txt")); sc = JsonUtility.FromJson <ScoreClass>(jsonData); }
// 初期化処理 public ScoreList() { for(int i = 0; i < Val.Length; i++) { Val[i] = new ScoreClass(); } }
/// <summary> /// 後方シフト /// </summary> /// <param name="i">0を挿入するインデックス</param> private void BackShift(int i) { for(int n = Val.Length - 2; n >= i; n--) { Val[n + 1] = Val[n]; } Val[i] = new ScoreClass(); }