Beispiel #1
0
    void GameEnd()
    {
        PauseBG.enabled = true;
        gameStatus      = GameStatus.GameOver;

        EndGameButton.SetActive(true);

        if (LeaderBoardTable.HighestScore(totalScore))
        {
            ResultGameOver.text = "You Score: " + totalScore + " Amazing! You got the highest score!";
            EndGameButton.transform.GetChild(0).GetComponent <Text>().text = "Go back";
            EndGameButton.GetComponent <Button>().onClick.AddListener(() => LoadMain());
        }
        else if (LeaderBoardTable.LowestScore(totalScore))
        {
            ResultGameOver.text = "You Score: " + totalScore + ", Your score is low. Try again";
            EndGameButton.transform.GetChild(0).GetComponent <Text>().text = "Try again";
            EndGameButton.GetComponent <Button>().onClick.AddListener(() => ResetGame());
        }
        else
        {
            ResultGameOver.text = "Try Again.";
            EndGameButton.transform.GetChild(0).GetComponent <Text>().text = "Try again";
            EndGameButton.GetComponent <Button>().onClick.AddListener(() => ResetGame());
        }

        LeaderBoardTable.Record(totalScore);
    }
 public ActionResult Edit([Bind(Include = "Id,CompeteName,H2HContestName,Points,Referee")] LeaderBoardTable leaderBoardTable)
 {
     if (ModelState.IsValid && User.Identity.IsAuthenticated)
     {
         db.Entry(leaderBoardTable).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(leaderBoardTable));
 }
Beispiel #3
0
 public void LeaderBoard()
 {
     leaderboardCanvas.SetActive(true);
     mainCanvas.SetActive(false);
     for (int i = 0; i < LeaderBoardTable.ENTRYCOUNT; ++i)
     {
         //display the ranking with score
         var entry = LeaderBoardTable.GetEntry(i);
         scoresText[i].text = "No." + (i + 1).ToString() + "  Score: " + entry.score;
     }
 }
        public ActionResult DeleteConfirmed(int id)
        {
            if (!User.Identity.IsAuthenticated)
            {
                return(RedirectToAction("Login", "Account"));
            }

            LeaderBoardTable leaderBoardTable = db.LeaderBoardTables.Find(id);

            db.LeaderBoardTables.Remove(leaderBoardTable);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public ActionResult Create([Bind(Include = "Id,CompeteName,H2HContestName,Points,Referee")] LeaderBoardTable leaderBoardTable)
        {
            if (ModelState.IsValid && User.Identity.IsAuthenticated)
            {
                // Fill the referee who added this Compettior name
                leaderBoardTable.Referee = User.Identity.Name;

                db.LeaderBoardTables.Add(leaderBoardTable);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(leaderBoardTable));
        }
        // GET: LeaderBoardTables/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            LeaderBoardTable leaderBoardTable = db.LeaderBoardTables.Find(id);

            if (leaderBoardTable == null)
            {
                return(HttpNotFound());
            }
            return(View(leaderBoardTable));
        }
        // GET: LeaderBoardTables/Delete/5
        public ActionResult Delete(int?id)
        {
            if (!User.Identity.IsAuthenticated)
            {
                return(RedirectToAction("Login", "Account"));
            }

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            LeaderBoardTable leaderBoardTable = db.LeaderBoardTables.Find(id);

            if (leaderBoardTable == null)
            {
                return(HttpNotFound());
            }
            return(View(leaderBoardTable));
        }
Beispiel #8
0
    public void SubmitButton()
    {
        name = input.GetComponent <TMP_InputField>().text;
        newGameButton.SetActive(true);
        EventSystem.current.currentSelectedGameObject.SetActive(false);
        input.gameObject.SetActive(false);

        // Logica
        LeaderBoardTable.AddEntry(score, name);

        string path       = Application.dataPath + "/Data/Highscores.json";
        string jsonString = File.ReadAllText(path);

        LeaderBoardTable.Highscores h = JsonUtility.FromJson <LeaderBoardTable.Highscores>(jsonString);

        LeaderBoardTable.SortHighscores(h);

        if (h.highscores_entry_list.Count > 10)
        {
            LeaderBoardTable.RemoveEntry(10);
        }
    }