Esempio n. 1
0
        private highscores load()
        {
            highscores high = new highscores();
            FileStream fs;

            try
            {
                fs = new FileStream("highscores.dat", FileMode.Open);
            }
            catch (Exception e)
            {
                fs = new FileStream("highscores.dat", FileMode.Create);
                formater.Serialize(fs, new highscores());
                fs.Close();
                fs = new FileStream("highscores.dat", FileMode.Open);
            }

            try
            {
                high = (highscores)formater.Deserialize(fs);
            }catch (Exception e)
            {
                MessageBox.Show("error");
            }

            fs.Close();
            return(high);
        }
Esempio n. 2
0
        private void save(highscores high)
        {
            FileStream fs = new FileStream("highscores.dat", FileMode.Create);

            formater.Serialize(fs, high);
            fs.Close();
        }
Esempio n. 3
0
 void Start()
 {
     for (int i = 0; i < highscoreText.Length; i++)
     {
         highscoreText [i].text = i + 1 + ". Fetching...";
     }
     highscoreManager = GetComponent <highscores> ();
     StartCoroutine("RefreshHighscores");
 }
Esempio n. 4
0
    // Start is called before the first frame update
    private void Start()
    {
        caixa      = gameObject.GetComponent <TextMeshProUGUI>();
        caixa.text = "";
        if (FindObjectOfType <highscores>() == null)
        {
            caixa.text = "Nao ha objeto highscores";
        }
        else
        if (hs == null)
        {
            hs     = FindObjectOfType <highscores>();
            scores = hs.scores;
        }

        if (caixa.text == "")
        {
            Display();
        }
    }
Esempio n. 5
0
        private void button3_Click(object sender, EventArgs e)
        {
            highscores high = new highscores();

            save(high);

            if (easy.Checked)
            {
                high.update(chart1, high.easy);
            }
            else if (medium.Checked)
            {
                high.update(chart1, high.easy);
            }
            else
            {
                high.update(chart1, high.easy);
            }
            obj = high;
        }
Esempio n. 6
0
    public void Display()
    {
        Debug.Log("TESTE");
        caixa.text = "";
        int index = 0;

        if (FindObjectOfType <highscores>() != null && hs == null)
        {
            hs     = FindObjectOfType <highscores>();
            scores = hs.scores;
        }
        if (hs != null)
        {
            scores = hs.scores;
            foreach (float este in hs.scores)
            {
                index++;
                switch (index)
                {
                case 1:
                    caixa.text += "1st " + este.ToString("F2") + "\n";
                    break;

                case 2:
                    caixa.text += "2nd " + este.ToString("F2") + "\n";
                    break;

                case 3:
                    caixa.text += "3rd " + este.ToString("F2") + "\n";
                    break;

                default:
                    caixa.text += index + "th " + este.ToString("F2") + "\n";
                    break;
                }
            }
        }
    }
Esempio n. 7
0
        private void Form1_Load(object sender, EventArgs e)
        {
            obj = load();

            obj.update(chart1, obj.easy);
        }