Exemplo n.º 1
0
    public void Save(string path)
    {
        XmlSerializer serializer = new XmlSerializer(typeof(LevelDataController));

        FileStream stream = new FileStream(path, FileMode.Create, FileAccess.Write);

        serializer.Serialize(stream, this);

        stream.Close();

        FileEncrypt.encrypt(path);
    }
Exemplo n.º 2
0
    public void showResult()
    {
        audioCotroll.playInfoSound();

        LevelDataController i = LevelDataController.Load(path);

        int k = 0;

        foreach (Level level in i.levels)
        {
            if (level.name.Equals("easy"))
            {
                easyTime  = level.getTimeInArray();
                easyScore = level.getScoreInArray();
                easyDate  = level.getDateInArray();
            }

            if (level.name.Equals("normal"))
            {
                normalTime  = level.getTimeInArray();
                normalScore = level.getScoreInArray();
                normalDate  = level.getDateInArray();
            }

            if (level.name.Equals("hard"))
            {
                hardTime  = level.getTimeInArray();
                hardScore = level.getScoreInArray();
                hardDate  = level.getDateInArray();
            }


            Data [k].text = level.frequency.ToString();
            k++;

            float time;
            int   minutes;
            int   seconds;

            if (level.frequency == 0)
            {
                Data [k].text = " - ";
                k++;

                time          = 0f;
                Data [k].text = " - ";
            }
            else
            {
                Data [k].text = level.highestScore.ToString();
                k++;

                time    = level.shortestDuration;
                minutes = (int)time / 60;
                seconds = (int)time % 60;

                Data [k].text = string.Format("{0:00} : {1:00}", minutes, seconds);
            }
            k++;
        }

        pastResult.SetActive(true);

        if (File.Exists(path))
        {
            FileEncrypt.encrypt(path);
        }
    }