コード例 #1
0
        private void LoadObscuredPrefs()
        {
            byte[] ba = ObscuredPrefs.GetByteArray(PREFS_BYTE_ARRAY, 0, 4);

            obscuredPrefs  = "int: " + ObscuredPrefs.GetInt(PREFS_INT, -1) + "\n";
            obscuredPrefs += "float: " + ObscuredPrefs.GetFloat(PREFS_FLOAT, -1) + "\n";
            obscuredPrefs += "string: " + ObscuredPrefs.GetString(PREFS_STRING, "No saved ObscuredPrefs!") + "\n";
            obscuredPrefs += "bool: " + ObscuredPrefs.GetBool(PREFS_BOOL, false) + "\n";
            obscuredPrefs += "uint: " + ObscuredPrefs.GetUInt(PREFS_UINT, 0) + "\n";
            obscuredPrefs += "long: " + ObscuredPrefs.GetLong(PREFS_LONG, -1) + "\n";
            obscuredPrefs += "double: " + ObscuredPrefs.GetDouble(PREFS_DOUBLE, -1) + "\n";
            obscuredPrefs += "Vector2: " + ObscuredPrefs.GetVector2(PREFS_VECTOR2, Vector2.zero) + "\n";
            obscuredPrefs += "Vector3: " + ObscuredPrefs.GetVector3(PREFS_VECTOR3, Vector3.zero) + "\n";
            obscuredPrefs += "Quaternion: " + ObscuredPrefs.GetQuaternion(PREFS_QUATERNION, Quaternion.identity) + "\n";
            obscuredPrefs += "Rect: " + ObscuredPrefs.GetRect(PREFS_RECT, new Rect(0, 0, 0, 0)) + "\n";
            obscuredPrefs += "Color: " + ObscuredPrefs.GetColor(PREFS_COLOR, Color.black) + "\n";
            obscuredPrefs += "byte[]: {" + ba[0] + "," + ba[1] + "," + ba[2] + "," + ba[3] + "}";
        }
コード例 #2
0
        internal void LoadObscuredPrefs()
        {
            // you can store typical int, float and string at the ObscuredPrefs
            obscuredPrefs  = "int: " + ObscuredPrefs.GetInt(PrefsInt, -1) + "\n";
            obscuredPrefs += "float: " + ObscuredPrefs.GetFloat(PrefsFloat, -1) + "\n";
            obscuredPrefs += "string: " + ObscuredPrefs.GetString(PrefsString, "No saved ObscuredPrefs!") + "\n";

            // comparing to the vanilla PlayerPrefs, you have much more freedom on what to save
            obscuredPrefs += "bool: " + ObscuredPrefs.GetBool(PrefsBool, false) + "\n";
            obscuredPrefs += "uint: " + ObscuredPrefs.GetUInt(PrefsUint, 0) + "\n";
            obscuredPrefs += "long: " + ObscuredPrefs.GetLong(PrefsLong, -1) + "\n";
            obscuredPrefs += "double: " + ObscuredPrefs.GetDouble(PrefsDouble, -1) + "\n";
            obscuredPrefs += "Vector2: " + ObscuredPrefs.GetVector2(PrefsVector2, Vector2.zero) + "\n";
            obscuredPrefs += "Vector3: " + ObscuredPrefs.GetVector3(PrefsVector3, Vector3.zero) + "\n";
            obscuredPrefs += "Quaternion: " + ObscuredPrefs.GetQuaternion(PrefsQuaternion, Quaternion.identity) + "\n";
            obscuredPrefs += "Rect: " + ObscuredPrefs.GetRect(PrefsRect, new Rect(0, 0, 0, 0)) + "\n";
            obscuredPrefs += "Color: " + ObscuredPrefs.GetColor(PrefsColor, Color.black) + "\n";

            // you can even store raw byte array with any data inside
            var ba = ObscuredPrefs.GetByteArray(PrefsByteArray, 0, 4);

            obscuredPrefs += "byte[]: {" + ba[0] + "," + ba[1] + "," + ba[2] + "," + ba[3] + "}";
        }
コード例 #3
0
        private void LoadObscuredPrefs()
        {
            byte[] byteArray = ObscuredPrefs.GetByteArray("demoByteArray", 0, 4);
            this.obscuredPrefs = "int: " + ObscuredPrefs.GetInt("money", -1) + "\n";
            string text = this.obscuredPrefs;

            this.obscuredPrefs = string.Concat(new object[]
            {
                text,
                "float: ",
                ObscuredPrefs.GetFloat("lifeBar", -1f),
                "\n"
            });
            this.obscuredPrefs = this.obscuredPrefs + "string: " + ObscuredPrefs.GetString("name", "No saved ObscuredPrefs!") + "\n";
            text = this.obscuredPrefs;
            this.obscuredPrefs = string.Concat(new object[]
            {
                text,
                "bool: ",
                ObscuredPrefs.GetBool("gameComplete", false),
                "\n"
            });
            text = this.obscuredPrefs;
            this.obscuredPrefs = string.Concat(new object[]
            {
                text,
                "uint: ",
                ObscuredPrefs.GetUInt("demoUint", 0u),
                "\n"
            });
            text = this.obscuredPrefs;
            this.obscuredPrefs = string.Concat(new object[]
            {
                text,
                "long: ",
                ObscuredPrefs.GetLong("demoLong", -1L),
                "\n"
            });
            text = this.obscuredPrefs;
            this.obscuredPrefs = string.Concat(new object[]
            {
                text,
                "double: ",
                ObscuredPrefs.GetDouble("demoDouble", -1.0),
                "\n"
            });
            text = this.obscuredPrefs;
            this.obscuredPrefs = string.Concat(new object[]
            {
                text,
                "Vector2: ",
                ObscuredPrefs.GetVector2("demoVector2", Vector2.zero),
                "\n"
            });
            text = this.obscuredPrefs;
            this.obscuredPrefs = string.Concat(new object[]
            {
                text,
                "Vector3: ",
                ObscuredPrefs.GetVector3("demoVector3", Vector3.zero),
                "\n"
            });
            text = this.obscuredPrefs;
            this.obscuredPrefs = string.Concat(new object[]
            {
                text,
                "Quaternion: ",
                ObscuredPrefs.GetQuaternion("demoQuaternion", Quaternion.identity),
                "\n"
            });
            text = this.obscuredPrefs;
            this.obscuredPrefs = string.Concat(new object[]
            {
                text,
                "Rect: ",
                ObscuredPrefs.GetRect("demoRect", new Rect(0f, 0f, 0f, 0f)),
                "\n"
            });
            text = this.obscuredPrefs;
            this.obscuredPrefs = string.Concat(new object[]
            {
                text,
                "Color: ",
                ObscuredPrefs.GetColor("demoColor", Color.black),
                "\n"
            });
            text = this.obscuredPrefs;
            this.obscuredPrefs = string.Concat(new object[]
            {
                text,
                "byte[]: {",
                byteArray[0],
                ",",
                byteArray[1],
                ",",
                byteArray[2],
                ",",
                byteArray[3],
                "}"
            });
        }