Пример #1
0
        private static void LoadDefaultProgress(GameManager gameManager)
        {
            CurrencyManager.SetCurrency(ObscuredPrefs.GetInt(WorldConsts.Currency, 80));

            gameManager.PlayerModel.Health = 100f;
            gameManager.PlayerModel.Hunger = 80f;
            gameManager.PlayerModel.Thirst = 80;
            gameManager.PlayerModel.Energy = 90f;
            gameManager.PlayerModel.Breath = 100f;

            gameManager.PlayerModel.CurrentBackpack = BackpackType.None;
            gameManager.PlayerModel.PrepareInventorySlots();

            gameManager.IapManager.IsBuyNoAds = ObscuredPrefs.GetBool(WorldConsts.BuyNoAds, false);

            TOD_Sky.Instance.Cycle.Hour = 7.0f;

            if (gameManager.CarInteractive != null)
            {
                gameManager.CarInteractive.Petrol = 0.5f;
            }

            gameManager.PlacementItemsController.AddStartLoot();

            gameManager.CurrentTerain = gameManager.Terrain1;

            //gameManager.Intro.Run(gameManager);
            //AddTestItems(gameManager);
        }
 public void ReadSavedGame(bool obscured)
 {
     if (obscured)
     {
         gameData = "Money: " + ObscuredPrefs.GetInt("money") + "\n";
         string text = gameData;
         gameData = text + "Life bar: " + ObscuredPrefs.GetFloat("lifeBar") + "\n";
         gameData = gameData + "Player name: " + ObscuredPrefs.GetString("playerName") + "\n";
         text     = gameData;
         gameData = text + "bool: " + ObscuredPrefs.GetBool("gameComplete") + "\n";
         text     = gameData;
         gameData = text + "long: " + ObscuredPrefs.GetLong("demoLong") + "\n";
         text     = gameData;
         gameData = text + "double: " + ObscuredPrefs.GetDouble("demoDouble") + "\n";
         byte[] byteArray = ObscuredPrefs.GetByteArray("demoByteArray", 0, 4);
         text     = gameData;
         gameData = text + "Vector3: " + ObscuredPrefs.GetVector3("demoVector3") + "\n";
         text     = gameData;
         gameData = text + "byte[]: {" + byteArray[0] + "," + byteArray[1] + "," + byteArray[2] + "," + byteArray[3] + "}";
     }
     else
     {
         gameData = "Money: " + PlayerPrefs.GetInt("money") + "\n";
         string text = gameData;
         gameData = text + "Life bar: " + PlayerPrefs.GetFloat("lifeBar") + "\n";
         gameData = gameData + "Player name: " + PlayerPrefs.GetString("playerName");
     }
 }
Пример #3
0
    void Start()
    {
        if (ObscuredPrefs.GetString("unique") == "")
        {
            ObscuredPrefs.SetString("unique", Md5Sum(System.DateTime.Now + "AKufRTXukcAaiT6hvyxdJ10ac8X2iIqZ"));
        }
        playModeCanvas.SetActive(false);
        isMuted = ObscuredPrefs.GetBool("isMuted");
        int max = ObscuredPrefs.GetInt("maxScore");

        if (score > 0)
        {
            scoreboard.GetComponent <Text>().text = score.ToString() + "\nHIGH SCORE: " + max.ToString();
        }
        else
        {
            scoreboard.GetComponent <Text>().text = "HIGH SCORE\n" + max.ToString();
        }

        if (isMuted)
        {
            muteButton.sprite   = muted;
            AudioListener.pause = true;
        }
        else
        {
            muteButton.sprite   = soundOn;
            AudioListener.pause = false;
        }
    }
Пример #4
0
 public static bool IsLightSOn()
 {
     if (!Application.isPlaying)
     {
         return(true);
     }
     return(ObscuredPrefs.GetBool(kIsLightsOn, true));
 }
Пример #5
0
 public static bool GetBool(SaveKey key)
 {
     if (mCache.ContainsKey(key.ToString()))
     {
         return((bool)mCache[key.ToString()]);
     }
     else
     {
         bool value = ObscuredPrefs.GetBool(key.ToString(), (bool)Default(key));
         mCache[key.ToString()] = value;
         return(value);
     }
 }
Пример #6
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] + "}";
        }
 public void ReadSavedGame(bool obscured)
 {
     if (obscured)
     {
         gameData  = "Name: " + ObscuredPrefs.GetString(PREFS_NAME) + "\n";
         gameData += "Money: " + ObscuredPrefs.GetInt(PREFS_MONEY) + "\n";
         gameData += "Level: " + ObscuredPrefs.GetInt(PREFS_LEVEL) + "\n";
         gameData += "Life bar: " + ObscuredPrefs.GetFloat(PREFS_LIFE_BAR) + "\n";
         gameData += "bool: " + ObscuredPrefs.GetBool(PREFS_GAME_COMPLETE) + "\n";
         gameData += "long: " + ObscuredPrefs.GetLong(PREFS_LONG) + "\n";
         gameData += "double: " + ObscuredPrefs.GetDouble(PREFS_DOUBLE) + "\n";
         byte[] ba = ObscuredPrefs.GetByteArray(PREFS_BYTE_ARRAY, 0, 4);
         gameData += "Vector3: " + ObscuredPrefs.GetVector3(PREFS_VECTOR3) + "\n";
         gameData += "byte[]: {" + ba[0] + "," + ba[1] + "," + ba[2] + "," + ba[3] + "}";
     }
     else
     {
         gameData  = "Name: " + PlayerPrefs.GetString(PREFS_NAME) + "\n";
         gameData += "Money: " + PlayerPrefs.GetInt(PREFS_MONEY) + "\n";
         gameData += "Level: " + PlayerPrefs.GetInt(PREFS_LEVEL) + "\n";
         gameData += "Life bar: " + PlayerPrefs.GetFloat(PREFS_LIFE_BAR);
     }
 }
Пример #8
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] + "}";
        }
Пример #9
0
    public void ReadSavedGame(bool obscured)
    {
        if (obscured)
        {
            gameData  = "Money: " + ObscuredPrefs.GetInt("money") + "\n";
            gameData += "Life bar: " + ObscuredPrefs.GetFloat("lifeBar") + "\n";
            gameData += "Player name: " + ObscuredPrefs.GetString("playerName") + "\n";
            gameData += "bool: " + ObscuredPrefs.GetBool("gameComplete") + "\n";
#if !UNITY_FLASH
            gameData += "long: " + ObscuredPrefs.GetLong("demoLong") + "\n";
            gameData += "double: " + ObscuredPrefs.GetDouble("demoDouble") + "\n";
#endif
            byte[] ba = ObscuredPrefs.GetByteArray("demoByteArray", 0, 4);
            gameData += "Vector3: " + ObscuredPrefs.GetVector3("demoVector3") + "\n";
            gameData += "byte[]: {" + ba[0] + "," + ba[1] + "," + ba[2] + "," + ba[3] + "}";
        }
        else
        {
            gameData  = "Money: " + PlayerPrefs.GetInt("money") + "\n";
            gameData += "Life bar: " + PlayerPrefs.GetFloat("lifeBar") + "\n";
            gameData += "Player name: " + PlayerPrefs.GetString("playerName");
        }
    }
Пример #10
0
    void Start()
    {
        isMuted = ObscuredPrefs.GetBool("isMuted");
        int max = ObscuredPrefs.GetInt("maxScore");

        if (GameController.score > 0)
        {
            scoreBoard.GetComponent <Text>().text = GameController.score.ToString() + "\nHIGH SCORE: " + max.ToString();
        }
        else
        {
            scoreBoard.GetComponent <Text>().text = "HIGH SCORE\n" + max.ToString();
        }

        if (isMuted)
        {
            muteButton.sprite = muted;
        }
        else
        {
            muteButton.sprite = soundOn;
        }
        quitMenuUI.SetActive(false);
    }
Пример #11
0
 public static bool HasFirstInteraction()
 {
     return(ObscuredPrefs.GetBool(kFirstInteraction, false));
 }
Пример #12
0
 public static bool IsAdsEnabled()
 {
     return(ObscuredPrefs.GetBool(kIsAdsEnabled, true));
 }
Пример #13
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],
                "}"
            });
        }