Example #1
0
    public int getBankCoins()
    {
        CheckFirstInit();
        string encryptedBankCoins = EasySave.Load <string>("BankCoins");

        return(crypto.Decrypt <int>(encryptedBankCoins));
    }
Example #2
0
    private void reinstantiateObjects()
    {
        //Load all of the GameObjects in Resources into an array
        Object[] resources = Resources.LoadAll(pathInResources, typeof(GameObject));

        //Instantiate the appropriate GameObjects by comparing the names
        //in the save file to the names of the objects in Resources
        string[] names = EasySave.loadStringArray("names.txt");
        instantiatedObjs = new GameObject[names.Length];

        for (int i = 0; i < names.Length; i++)
        {
            foreach (Object go in resources)
            {
                if ((go as GameObject).name == names[i])
                {
                    instantiatedObjs[i]      = Instantiate(resources[i]) as GameObject;
                    instantiatedObjs[i].name = resources[i].name;
                }
            }
        }

        //Now apply the transforms using the version of 'loadTransformArray'
        //which automatically applys the transforms to an array of game objects.
        EasySave.loadTransformArray("transforms.txt", instantiatedObjs);
        objectsDestroyed = false;
    }
Example #3
0
    public static void DeleteNode(GameObject node)
    {
        if (node.tag == "CentralTopic")
        {
            // remember the name of the map
            string mapName = GameObject.FindObjectOfType <MindMap>().mapName;
            EasySave.Save("ResetMapName", mapName);
            EasySave.Save("isMapReset", true);
            SceneManager.LoadScene(0);
        }

        foreach (var go in node.GetComponent <Node>().nextNodes)
        {
            if (go != null)
            {
                DeleteNode(go);
            }
        }

        //delete relationship
        Destroy(node.GetComponent <Node>().relationship);

        // delete node
        Destroy(node);
    }
Example #4
0
 private void CheckFirstInit()
 {
     //If no key, then save 0 coins in bank.
     if (!EasySave.HasKey <string>("BankCoins"))
     {
         EasySave.Save("BankCoins", crypto.Encrypt(0));
     }
 }
Example #5
0
 private void OnApplicationPause(bool pause)
 {
     EasySave.Save("Lvl0Cleared", Lvl0Cleared);
     EasySave.Save("Lvl1Cleared", Lvl1Cleared);
     EasySave.Save("Lvl2Cleared", Lvl2Cleared);
     EasySave.Save("Lvl3Cleared", Lvl3Cleared);
     EasySave.Save("Lvl4Cleared", Lvl4Cleared);
     EasySave.Save("Lvl5Cleared", Lvl5Cleared);
 }
Example #6
0
 private void OnApplicationQuit()
 {
     EasySave.Save("Lvl0Cleared", Lvl0Cleared);
     EasySave.Save("Lvl1Cleared", Lvl1Cleared);
     EasySave.Save("Lvl2Cleared", Lvl2Cleared);
     EasySave.Save("Lvl3Cleared", Lvl3Cleared);
     EasySave.Save("Lvl4Cleared", Lvl4Cleared);
     EasySave.Save("Lvl5Cleared", Lvl5Cleared);
 }
Example #7
0
    public void AddCoins(int Coins)
    {
        int BankCoins = getBankCoins();

        BankCoins += Coins;

        EasySave.Save("BankCoins", crypto.Encrypt(BankCoins));

        ((DeathSG)UIManager.Instance.DeathSG).UpdateBankTMP();
    }
Example #8
0
 private void Awake()
 {
     if (EasySave.HasKey <bool>("FirstRun"))
     {
         Lvl0Cleared = EasySave.Load <bool>("Lvl0Cleared");
         Lvl1Cleared = EasySave.Load <bool>("Lvl1Cleared");
         Lvl2Cleared = EasySave.Load <bool>("Lvl2Cleared");
         Lvl3Cleared = EasySave.Load <bool>("Lvl3Cleared");
         Lvl4Cleared = EasySave.Load <bool>("Lvl4Cleared");
         Lvl5Cleared = EasySave.Load <bool>("Lvl5Cleared");
     }
 }
    void Start()
    {
        creationManager  = GameObject.FindObjectOfType <CreationManager>();
        selectionManager = GameObject.FindObjectOfType <SelectionManager>();
        movingManager    = GameObject.FindObjectOfType <MovingManager>();

        if (EasySave.Load <bool>("isMapReset"))
        {
            isSaved = false;
            EasySave.Delete <bool>("isMapReset");
        }
    }
Example #10
0
    private void Start()
    {
        // Get Rid of this line of code when game is finished
        FirstRunCompleted = true;


        if (!FirstRunCompleted)
        {
            FirstRunCompleted = true;
            EasySave.Save("FirstRun", FirstRunCompleted);
        }
        CreditsPanel.SetActive(false);
    }
Example #11
0
 /// <summary>
 /// Checks score against high score and saves if higher
 /// </summary>
 private void CheckHigherScore()
 {
     // If new high score
     if (score > highScore)
     {
         highScore = score;
         EasySave.Save("highscore", crypto.Encrypt(highScore)); // Store high score
         ((DeathSG)UIManager.Instance.DeathSG).UpdateScoresTMP("new highscore\n" + score, "");
     }
     else
     {
         ((DeathSG)UIManager.Instance.DeathSG).UpdateScoresTMP("score " + score, "high score " + highScore);
     }
 }
Example #12
0
    /// <param name="Coins"></param>
    /// <returns>True if successful deduction</returns>
    public bool DeductCoins(int Coins)
    {
        int BankCoins = getBankCoins();

        if (BankCoins >= Coins)
        {
            BankCoins -= Coins;

            EasySave.Save("BankCoins", crypto.Encrypt(BankCoins));
            ((DeathSG)UIManager.Instance.DeathSG).UpdateBankTMP();

            return(true);
        }
        return(false);
    }
Example #13
0
    // Start is called before the first frame update
    void Start()
    {
        LeanTween.move(RTMText, GoTo.position, 2f).setEase(Curve);
        StartCoroutine(moveout());
        ttitty = Time.time + random();

        collsizerslider = CollSizer.GetComponent <Slider>();
        sizerslider     = Sizer.GetComponent <Slider>();
        speederslider   = Speeder.GetComponent <Slider>();
        frequencyslider = Frequencyx.GetComponent <Slider>();

        collsize  = EasySave.Load <float>("collsize", 1f); collsizerslider.value = collsize;
        size      = EasySave.Load <float>("size", 50);         sizerslider.value = size;
        speed     = EasySave.Load <float>("speed", 50000);    speederslider.value = speed;
        Frequency = EasySave.Load <float>("frequency", 1); frequencyslider.value = Frequency;
    }
Example #14
0
    public void Init()
    {
        crypto = new Cryptography();

        score = 0;

        if (EasySave.HasKey <string>("highscore"))
        {
            highScore = getHighscore();
        }
        else
        {
            highScore = 0;
        }

        UpdateInGameScoreUI(); // Set initial score in UI
    }
    // Start is called before the first frame update
    void Start()
    {
        string mapName = EasySave.Load <string>("ResetMapName");

        if (mapName != null)
        {
            GameObject.Find("Main Menu").GetComponent <MainMenu>().CreateMap();
            Spawner[] spawners = GameObject.FindObjectsOfType <Spawner>();
            foreach (var spawner in spawners)
            {
                spawner.doCreateWithCustomName = true;
                spawner.mapName = mapName;
            }
        }
        EasySave.Delete <string>("ResetMapName");
        Destroy(gameObject);
    }
Example #16
0
    private void saveAndDestroyObjects()
    {
        // Create an array containing the transform of each object
        // and another with the name of each object
        Transform[] ts    = new Transform[instantiatedObjs.Length];
        string[]    names = new string[instantiatedObjs.Length];
        for (int i = 0; i < instantiatedObjs.Length; i++)
        {
            ts[i]    = instantiatedObjs[i].transform;
            names[i] = instantiatedObjs[i].name;
            Destroy(instantiatedObjs[i]);
        }
        // Save our arrays using EasySave into two seperate files
        EasySave.save(ts, "transforms.txt");
        EasySave.save(names, "names.txt");

        objectsDestroyed = true;
    }
Example #17
0
 void settings()
 {
     print("yomom" + Settings.gameObject.activeInHierarchy);
     if (!Settings.gameObject.activeInHierarchy)
     {
         print("imdoinit");
         Settings.gameObject.SetActive(true);
         Time.timeScale = 0;
     }
     else
     {
         Time.timeScale = 1;
         Settings.gameObject.SetActive(false);
         EasySave.Save("collsize", collsize);
         EasySave.Save("size", size);
         EasySave.Save("speed", speed);
         EasySave.Save("frequency", Frequency);
     }
 }
Example #18
0
    private void Awake()
    {
        //Pass whatever you want to save in the function.
        EasySave.Save("my-int", 42);
        EasySave.Save("my-class", new MyClass(231, new List <int> {
            23, 33
        }));

        //Load your values with the key as a parameter and specify the type in the <>.
        Debug.Log("Loaded int: " + EasySave.Load <int>("my-int"));
        Debug.Log("Loaded MyClass: \n" + EasySave.Load <MyClass>("my-class"));

        //Loading with default value: defaultValue is returned if the key doesn't exist.
        Debug.Log("Loaded string: \"" + EasySave.Load("key", "Default Value") + "\"");

        //Does a key exist
        Debug.Log("The key \"int-key\" exists: " + EasySave.HasKey <int>("int-key"));
        Debug.Log("The key \"my-int\" exists: " + EasySave.HasKey <int>("my-int"));

        //Delete a key and it's values
        EasySave.Delete <int>("my-int");
        Debug.Log("The key \"my-int\" has been deleted. ");
    }
Example #19
0
 private void OnGUI()
 {
     // Display Save & Destroy button
     if (GUI.Button(new Rect(10, 10, 180, 50), "Save & Destroy Mesh"))
     {
         MeshFilter ms = (GetComponent(typeof(MeshFilter)) as MeshFilter);
         EasySave.saveMesh(ms.mesh, "myMesh.mesh");
         Destroy(ms.mesh);
     }
     // If save file exists, display the load and delete buttons
     if (EasySave.fileExists("myMesh.mesh"))
     {
         //Load Button
         if (GUI.Button(new Rect(10, 100, 180, 50), "Load Mesh"))
         {
             (GetComponent(typeof(MeshFilter)) as MeshFilter).mesh = EasySave.loadMesh("myMesh.mesh");
         }
         //Delete Button
         if (GUI.Button(new Rect(10, 200, 180, 50), "Delete Saved Mesh File"))
         {
             EasySave.deleteFile("myMesh.mesh");
         }
     }
 }
Example #20
0
 private int getHighscore()
 {
     return(crypto.Decrypt <int>(EasySave.Load <string>("highscore")));
 }