Beispiel #1
0
    void Start()
    {
        if (clearPlayerPrefs)
        {
            Debug.Log("Clearing PlayerPrefs...");
            PlayerPrefs.DeleteAll();
        }

        Debug.Log("Adding value change listeners...");
        ProfileData.AddIntChangeListener(TEST_INT, handleIntChanged);
        ProfileData.AddFloatChangeListener(TEST_FLOAT, handleFloatChanged);
        ProfileData.AddStringChangeListener(TEST_STRING, handleStringChanged);
        ProfileData.AddVector3ChangeListener(TEST_VECTOR3, handleVector3Changed);
        ProfileData.AddColorChangeListener(TEST_COLOR, handleColorChanged);

        Debug.Log("Adding save, load, and clear event listeners...");
        ProfileData.OnSave  += handleSaved;
        ProfileData.OnLoad  += handleLoaded;
        ProfileData.OnClear += handleCleared;

        Debug.Log("Setting values...");
        setValues();

        Debug.Log("Saving to profile: " + profileName + "...");
        ProfileData.Save(profileName);
        Debug.Log("Clearing all data...");
        ProfileData.Clear();
        Debug.Log("Printing all ProfileData values...");
        ProfileData.PrintAll();
        Debug.Log("End of ProfileData values list");

        Debug.Log("Loading from profile: " + profileName + "...");
        ProfileData.Load(profileName);
        //printValues();
        Debug.Log("Printing all ProfileData values...");
        ProfileData.PrintAll();
        Debug.Log("End of ProfileData values list");

        Debug.Log("Deleting profile: " + profileName + "...");
        ProfileData.DeleteProfile(profileName);
        Debug.Log("Loading from deleted profile: " + profileName + "...");
        ProfileData.Load(profileName);

        //printValues();
        Debug.Log("Printing all ProfileData values...");
        ProfileData.PrintAll();
        Debug.Log("End of ProfileData values list");


        Debug.Log("Removing value change listeners...");
        ProfileData.RemoveIntChangeListener(TEST_INT, handleIntChanged);
        ProfileData.RemoveFloatChangeListener(TEST_FLOAT, handleFloatChanged);
        ProfileData.RemoveStringChangeListener(TEST_STRING, handleStringChanged);
        ProfileData.RemoveVector3ChangeListener(TEST_VECTOR3, handleVector3Changed);
        ProfileData.RemoveColorChangeListener(TEST_COLOR, handleColorChanged);

        Debug.Log("Removing save, load, and clear event listeners...");
        ProfileData.OnSave  -= handleSaved;
        ProfileData.OnLoad  -= handleLoaded;
        ProfileData.OnClear -= handleCleared;
    }