1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using UnityEngine.SceneManagement;
using Assets.Scripts;
using Assets.Scripts.API;
using Assets.Scripts.Utils;
public class GameOver : MonoBehaviour
{
// private float _timer = 0f;
private int score = 0;
private GameObject _player;
public InputField PlayerName;
public InputField TeamName;
public Text Score;
public Button buttonSubmit;
public Button buttonPlay;
void Start()
{
}
void Update ()
{
// _timer += Time.deltaTime;
// if (_timer > 4f)
// SceneManager.LoadScene("Menu");
score = PlayerPrefs.GetInt("lastscore");
Score.text = "You scored " + score;
BackButtonHelper.playOnBack();
}
public void OnButtonPlayClicked()
{
GameController.Speed = GameController.InitialSpeed;
SceneManager.LoadScene("Main");
}
public void OnButtonSubmitClicked()
{
string playerText = PlayerName.text;
if (playerText == null || playerText.Length == 0) {
playerText = "Random Randy";
}
string teamText = TeamName.text;
if (teamText == null || teamText.Length == 0) {
teamText = null;
}
Server.PostScore(score, playerText, teamText);
buttonSubmit.enabled = false;
SceneManager.LoadScene("Scores");
}
}