Exemple #1
0
    void saveLapsePref()
    {
        BinaryFormatter myBinaryFormatter = new BinaryFormatter();
        FileStream      file = File.Create(Application.persistentDataPath + "/log4.dat");

        veesData obj = new veesData();

        obj.sys    = (0);
        obj.cache  = (0);
        obj.config = (0);
        obj.tmp    = (1);
        myBinaryFormatter.Serialize(file, obj);
        file.Close();
    }
Exemple #2
0
    void saveLapseHigh(int score, float one, float escape, float equals)
    {
        BinaryFormatter myBinaryFormatter = new BinaryFormatter();
        FileStream      file = File.Create(filePath);

        veesData obj = new veesData();

        obj.sys    = nihalEncryption(one);
        obj.cache  = nihalEncryption(escape);
        obj.config = nihalEncryption(equals);
        obj.tmp    = nihalEncryption(score);
        myBinaryFormatter.Serialize(file, obj);
        file.Close();
    }
Exemple #3
0
    public static float setHighScoreDisplay()
    {
        string filePath = Application.persistentDataPath + "/log.dat";;

        if (File.Exists(filePath))
        {
            BinaryFormatter myBinaryFormatter = new BinaryFormatter();
            FileStream      file = File.Open(filePath, FileMode.OpenOrCreate);
            veesData        obj  = (veesData)myBinaryFormatter.Deserialize(file);
            file.Close();
            switch (LevelManager.getFromLevel())
            {
            case 3: return(nihalDecryption(obj.sys));

            case 5: return(nihalDecryption(obj.cache));

            case 6: return(nihalDecryption(obj.config));

            case 7: return(nihalDecryption(obj.tmp));
            }
        }
        return(0);
    }
Exemple #4
0
    void loadHighScore()
    {
        if (File.Exists(filePath))
        {
            BinaryFormatter myBinaryFormatter = new BinaryFormatter();
            FileStream      file = File.Open(filePath, FileMode.OpenOrCreate);
            veesData        obj  = (veesData)myBinaryFormatter.Deserialize(file);
            file.Close();

            float oneWayHighScore = nihalDecryption(obj.sys);
            float escapeHighScore = nihalDecryption(obj.cache);
            float equalsHighScore = nihalDecryption(obj.config);
            float lapseHighScore  = nihalDecryption(obj.tmp);

            //If previousScore>HighScore without errors BINGO! commit here
            switch (LevelManager.getFromLevel())
            {
            case 3:
                if (GameManager.getScore() > oneWayHighScore)
                {
                    saveOneWayHigh(GameManager.getScore(), escapeHighScore, equalsHighScore, lapseHighScore);
                    animator.SetTrigger("isHighScore");
                }
                break;

            case 5:
                if (GameManager.getScore() > escapeHighScore)
                {
                    saveEscapeHigh(GameManager.getScore(), oneWayHighScore, equalsHighScore, lapseHighScore);
                    animator.SetTrigger("isHighScore");
                }
                break;

            case 6:
                if (EnemySpawner.getWaveNumber() > equalsHighScore)
                {
                    saveEqualsHigh(EnemySpawner.getWaveNumber(), oneWayHighScore, escapeHighScore, lapseHighScore);
                    animator.SetTrigger("isHighScore");
                }
                break;

            case 7:
                if (GameManager.getScore() > lapseHighScore)
                {
                    saveLapseHigh(GameManager.getScore(), oneWayHighScore, escapeHighScore, equalsHighScore);
                    animator.SetTrigger("isHighScore");
                }
                break;
            }
        }
        else
        {
            switch (LevelManager.getFromLevel())
            {
            case 3:
                saveOneWayHigh(GameManager.getScore(), 0, 0, 0);
                animator.SetTrigger("isHighScore");
                break;

            case 5:
                saveEscapeHigh(GameManager.getScore(), 0, 0, 0);
                animator.SetTrigger("isHighScore");
                break;

            case 6:
                saveEqualsHigh(EnemySpawner.getWaveNumber(), 0, 0, 0);
                animator.SetTrigger("isHighScore");
                break;

            case 7:
                saveLapseHigh(GameManager.getScore(), 0, 0, 0);
                animator.SetTrigger("isHighScore");
                break;
            }
        }
    }