Example #1
0
 void Start()
 {
     QuickSaveReader.Create("UserData")
     .Read <string>(cryptography.Encrypt("Race"), (r) => { Race = cryptography.Decrypt <string>(r); })
     .Read <string>(cryptography.Encrypt("Class"), (r) => { Class = cryptography.Decrypt <string>(r); })
     .Read <string>(cryptography.Encrypt("Weapon"), (r) => { Weapon = cryptography.Decrypt <string>(r); })
     .Read <string>(cryptography.Encrypt("Strength"), (r) => { Strength = cryptography.Decrypt <double>(r); })
     .Read <string>(cryptography.Encrypt("Endurance"), (r) => { Endurance = cryptography.Decrypt <double>(r); })
     .Read <string>(cryptography.Encrypt("Dexternity"), (r) => { Dexternity = cryptography.Decrypt <double>(r); })
     .Read <string>(cryptography.Encrypt("Constitution"), (r) => { Constitution = cryptography.Decrypt <double>(r); })
     .Read <string>(cryptography.Encrypt("Vitality"), (r) => { Vitality = cryptography.Decrypt <double>(r); })
     .Read <string>(cryptography.Encrypt("Intelligence"), (r) => { Intelligence = cryptography.Decrypt <double>(r); })
     .Read <string>(cryptography.Encrypt("Name"), (r) => { Name = cryptography.Decrypt <string>(r); })
     .Read <string>(cryptography.Encrypt("Gender"), (r) => { Gender = cryptography.Decrypt <string>(r); })
     .Read <string>(cryptography.Encrypt("Hp"), (r) => { Hp = cryptography.Decrypt <double>(r); })
     .Read <string>(cryptography.Encrypt("Physical_Attack"), (r) => { Physical_Attack = cryptography.Decrypt <double>(r); })
     .Read <string>(cryptography.Encrypt("Magic_Attack"), (r) => { Magic_Attack = cryptography.Decrypt <double>(r); })
     .Read <string>(cryptography.Encrypt("Physical_Resistance"), (r) => { Physical_Resistance = cryptography.Decrypt <double>(r); })
     .Read <string>(cryptography.Encrypt("Physical_Defense"), (r) => { Physical_Defense = cryptography.Decrypt <double>(r); })
     .Read <string>(cryptography.Encrypt("Magic_Defense"), (r) => { Magic_Defense = cryptography.Decrypt <double>(r); })
     .Read <string>(cryptography.Encrypt("Magic_Resistance"), (r) => { Magic_Resistance = cryptography.Decrypt <double>(r); })
     .Read <string>(cryptography.Encrypt("Agility"), (r) => { Agility = cryptography.Decrypt <double>(r); })
     .Read <string>(cryptography.Encrypt("Stamina"), (r) => { Stamina = cryptography.Decrypt <double>(r); })
     .Read <string>(cryptography.Encrypt("Mana"), (r) => { Mana = cryptography.Decrypt <double>(r); })
     .Read <string>(cryptography.Encrypt("AttackSpeed"), (r) => { AttackSpeed = cryptography.Decrypt <double>(r); })
     .Read <string>(cryptography.Encrypt("Coin"), (r) => { coin = cryptography.Decrypt <int>(r); })
     .Read <string>(cryptography.Encrypt("Level"), (r) => { Level = cryptography.Decrypt <int>(r); })
     .Read <string>(cryptography.Encrypt("ULevel"), (r) => { ULevel = cryptography.Decrypt <int>(r); })
     .Read <string>(cryptography.Encrypt("Exp"), (r) => { Exp = cryptography.Decrypt <int>(r); });
 }
    public void QuickSaveReaderExample()
    {
        // Use a QuickSaveReader to read content from a file saved with QuickSaveWriter

        // An exception will be thrown if the root doesn't exist

#pragma warning disable 0219
        string  one;
        double  two;
        Vector2 three;
        Color   four;
#pragma warning restore 0219

        QuickSaveReader.Create("RootName")
        .Read <string>("Key1", (r) => { one = r; })
        .Read <double>("Key2", (r) => { two = r; })
        .Read <Vector2>("Key3", (r) => { three = r; })
        .Read <Color>("Key4", (r) => { four = r; });

        // OR

        QuickSaveReader reader = QuickSaveReader.Create("RootName");
        one   = reader.Read <string>("Key1");
        two   = reader.Read <double>("Key2");
        three = reader.Read <Vector2>("Key3");
        four  = reader.Read <Color>("Key4");
    }
Example #3
0
    public void Load()
    {
        QuickSaveReader reader = QuickSaveReader.Create("GuardianIdleSave");
        Equipment       item;
        string          key;

        for (int i = 0; i < slots.Count; i++)
        {
            key = "equipSlot" + i;

            if (reader.Exists(key))
            {
                string JsonString = reader.Read <string>(key);
                item = JsonUtility.FromJson <Equipment>(JsonString);

                string icon = reader.Read <string>(key + "_icon");
                item.SetIcon(icon);

                slots[i].AddItem(item);
            }
            else
            {
                // Saved slot is empty, clear the slot to prevent duplication
                slots[i].Clear();
            }
        }
    }
Example #4
0
    public void LoadGameData()
    {
        Dictionary <string, int> playerCardInventoryFake = new Dictionary <string, int>();
        List <string>            deckFakeList            = new List <string>();

        QuickSaveReader.Create("SaveEverything")
        .Read <string>("PlayerName", (r) => { playerName = r; })
        .Read <Sprite>("PlayerIcon", (r) => { playerIcon = r; })
        .Read <int>("PlayerLevel", (r) => { playerLevel = r; })
        .Read <int>("PlayerXP", (r) => { playerXP = r; })
        .Read <Dictionary <string, int> >("PlayerCardInventory", (r) => { playerCardInventoryFake = r; })
        .Read <List <string> >("PlayerDeck", (r) => { deckFakeList = r; });

        //Since I can't save ScriptableObjects using this, I made fake data with strings instead of Cards
        //So i fix that here
        foreach (KeyValuePair <string, int> card in playerCardInventoryFake)
        {
            Card card1 = myDeck.cards.Find(x => x.name == card.Key);

            playerCardInventory.Add(card1, card.Value);
        }
        //Reassigning Deck index numbers just makes everything easier.
        int i = 0;

        foreach (string card in deckFakeList)
        {
            Card card1 = myDeck.cards.Find(x => x.name == card);
            Deck.deck.Add(i, card1);
            i++;
        }
    }
    // Start is called before the first frame update
    void Start()
    {
        gameController            = GameObject.Find("GameController");
        mapManager                = gameController.GetComponent <ManageMap>();
        tutorialManager           = gameController.GetComponent <TutorialManager>();
        uiControl                 = gameController.GetComponent <UIControl>();
        turnManager               = gameController.GetComponent <TurnManager>();
        resourceAndUpgradeManager = gameController.GetComponent <ResourceAndUpgradeManager>();
        abilityController         = GameObject.Find("Player").GetComponent <AbilityController>();

        if (QuickSaveRoot.Exists(resourceAndUpgradeManager.ResourceAndUpgradeDataSaveFileName))                                //use the quicksave feature to check if a save file exists
        {
            QuickSaveReader instReader = QuickSaveReader.Create(resourceAndUpgradeManager.ResourceAndUpgradeDataSaveFileName); //create an instance of the quick save reader to pull in the save file
            MaxPlayerHealth  = instReader.Read <int>("currentMaxHealth");
            maxPlayerShields = instReader.Read <int>("currentMaxShields");
            uiControl.SetHealthState(maxPlayerHealth, currentPlayerHealth, maxPlayerShields, currentPlayerShields);
        }
        else
        {
            MaxPlayerHealth      = resourceAndUpgradeManager.CurrentMaxHealth;
            maxPlayerShields     = resourceAndUpgradeManager.CurrentMaxShields;
            currentPlayerHealth  = maxPlayerHealth;
            currentPlayerShields = maxPlayerShields;
            uiControl.SetHealthState(maxPlayerHealth, currentPlayerHealth, maxPlayerShields, currentPlayerShields);
        }

        movementController = gameObject.GetComponent <MovementController>();
    }
Example #6
0
 public void LoadHighScores()
 {
     if (QuickSaveRoot.Exists("HighScoreFile"))                                //if a save file exists, load data from that file
     {
         QuickSaveReader instReader = QuickSaveReader.Create("HighScoreFile"); //create an instance of the quick save reader to pull in the save file
         highScoreObjectList = instReader.Read <List <HighScoreObject> >("HighScoreObjectList");
     }
 }
 public void Load()
 {
     QuickSaveReader.Create("Inputs")
     .Read <string>("Input1", (r) => { Input5.text = r; })
     .Read <string>("Input2", (r) => { Input6.text = r; })
     .Read <string>("Input3", (r) => { Input7.text = r; })
     .Read <string>("Input4", (r) => { Input8.text = r; });
 }
Example #8
0
    public void LoadFromFile()
    {
        QuickSaveReader.Create(fileName)
        .Read <string>("File", (r) => { this.file = JsonUtility.FromJson <FileSaveData>(r); });

        QuickSaveReader.Create(fileName)
        .Read <string>("Player", (r) => { this.player = JsonUtility.FromJson <PlayerSaveData>(r); });
    }
    public void Init()
    {
        _quickSaveWriter = QuickSaveWriter.Create("MainSave");
        _quickSaveWriter.Commit();

        _quickSaveReader = QuickSaveReader.Create("MainSave");

        Load();
    }
Example #10
0
 void Start()
 {
     QuickSaveReader.Create("UserData")
     .Read <string>(cryptography.Encrypt("Name"), (r) => { strs = cryptography.Decrypt <string>(r); });
     if (strs != null)
     {
         Disable.SetActive(false);
     }
 }
Example #11
0
        public static void LoadFileSettings()
        {
            if (selectedFile == "")
            {
                return;
            }

            QuickSaveReader reader = QuickSaveReader.Create(selectedFile);

            GameInfo.mapSeed    = reader.Read <int>(GameInfo.MAP_SEED);
            GameInfo.mapSize    = reader.Read <int>(GameInfo.MAP_SIZE);
            GameInfo.playerTeam = reader.Read <int>("playerTeam");
        }
Example #12
0
    public void Load()
    {
        QuickSaveReader reader = QuickSaveReader.Create("GuardianIdleSave");

        if (reader.Exists("itemIdCounter"))
        {
            idCounter = reader.Read <int>("itemIdCounter");
        }
        else
        {
            idCounter = 0;
        }
    }
Example #13
0
    void Awake()
    {
        DontDestroyOnLoad(transform.gameObject);

        //Load

        if (QuickSaveRoot.Exists(fileName))
        {
            QuickSaveReader.Create(fileName).Read <SaveData>("Data", (r) => { data = r; });
        }
        else
        {
            Debug.Log("No Save File");
        }
    }
    public static QuickSaveReader Create(string root)
    {
        QuickSaveReader reader;

        try
        {
            reader = QuickSaveReader.Create(root);
        }
        catch (QuickSaveException)
        {
            var writer = QuickSaveWriter.Create(root);
            writer.Commit();
            reader = QuickSaveReader.Create(root);
        }

        return(reader);
    }
Example #15
0
    public SaveFile(string name)
    {
        this.fileName = name;

        try
        {
            QuickSaveReader.Create(fileName)
            .Read <string>("File", (r) => { this.file = JsonUtility.FromJson <FileSaveData>(r); });
            QuickSaveReader.Create(fileName)
            .Read <string>("Player", (r) => { this.player = JsonUtility.FromJson <PlayerSaveData>(r); });
        }
        catch (Exception e)
        {
            Debug.Log("no save file found");
            ResetFile();
        }
        Debug.Log("Save Found");
    }
Example #16
0
    public void Awake()
    {
        continueButton = GameObject.Find("ContinueButton");
        musicSource    = GameObject.Find("Music").GetComponent <AudioSource>();
        musicVolume    = musicSource.volume;

        if (QuickSaveRoot.Exists(mapSaveName) || QuickSaveRoot.Exists(resourcesSaveName))
        {
            continueButton.SetActive(true);
        }
        else
        {
            continueButton.SetActive(false);
        }
        if (QuickSaveRoot.Exists("HighScoreFile"))                                //if a save file exists, load data from that file
        {
            QuickSaveReader instReader = QuickSaveReader.Create("HighScoreFile"); //create an instance of the quick save reader to pull in the save file
            highScoreObjectList = instReader.Read <List <HighScoreObject> >("HighScoreObjectList");
            highScorePanel.SetActive(true);
            allChildren = GameObject.Find("HighScoreVerticalLayoutGroup2").GetComponentsInChildren <TMP_Text>();
            int i = 0;
            foreach (TMP_Text child in allChildren)
            {
                if (i > 0)
                {
                    child.text = highScoreObjectList[i - 1].scoreString;
                }
                i++;
            }
            i           = 0;
            allChildren = GameObject.Find("HighScoreVerticalLayoutGroup3").GetComponentsInChildren <TMP_Text>();
            foreach (TMP_Text child in allChildren)
            {
                if (i > 0)
                {
                    child.text = highScoreObjectList[i - 1].scoreValue.ToString();
                }
                i++;
            }
            highScorePanel.SetActive(false);
        }
    }
Example #17
0
    void Start()
    {
        QuickSaveReader.Create("Temp")
        .Read <string>(cryptography.Encrypt("Race"), (r) => { Race = cryptography.Decrypt <string>(r); })
        .Read <string>(cryptography.Encrypt("Class"), (r) => { Class = cryptography.Decrypt <string>(r); })
        .Read <string>(cryptography.Encrypt("Weapon"), (r) => { Weapon = cryptography.Decrypt <string>(r); })
        .Read <string>(cryptography.Encrypt("Strength"), (r) => { Strength = cryptography.Decrypt <int>(r); })
        .Read <string>(cryptography.Encrypt("Endurance"), (r) => { Endurance = cryptography.Decrypt <int>(r); })
        .Read <string>(cryptography.Encrypt("Dexternity"), (r) => { Dexternity = cryptography.Decrypt <int>(r); })
        .Read <string>(cryptography.Encrypt("Constitution"), (r) => { Constitution = cryptography.Decrypt <int>(r); })
        .Read <string>(cryptography.Encrypt("Vitality"), (r) => { Vitality = cryptography.Decrypt <int>(r); })
        .Read <string>(cryptography.Encrypt("Intelligence"), (r) => { Intelligence = cryptography.Decrypt <int>(r); })
        .Read <string>(cryptography.Encrypt("Name"), (r) => { Name = cryptography.Decrypt <string>(r); })
        .Read <string>(cryptography.Encrypt("Gender"), (r) => { Gender = cryptography.Decrypt <string>(r); });
        Race_c();
        Class_c();
        Weapon_c();

        cal();
    }
Example #18
0
 void Start()
 {
     rigidbody2d    = GetComponent <Rigidbody2D>();
     animator       = GetComponent <Animator>();
     transform      = GetComponent <Transform>();
     spriteRenderer = GetComponent <SpriteRenderer>();
     QuickSaveReader.Create("UserData")
     .Read <string>(cryptography.Encrypt("Race"), (r) => { Race = cryptography.Decrypt <string>(r); })
     .Read <string>(cryptography.Encrypt("Class"), (r) => { Class = cryptography.Decrypt <string>(r); })
     .Read <string>(cryptography.Encrypt("Weapon"), (r) => { Weapon = cryptography.Decrypt <string>(r); })
     .Read <string>(cryptography.Encrypt("Strength"), (r) => { Strength = cryptography.Decrypt <double>(r); })
     .Read <string>(cryptography.Encrypt("Endurance"), (r) => { Endurance = cryptography.Decrypt <double>(r); })
     .Read <string>(cryptography.Encrypt("Dexternity"), (r) => { Dexternity = cryptography.Decrypt <double>(r); })
     .Read <string>(cryptography.Encrypt("Constitution"), (r) => { Constitution = cryptography.Decrypt <double>(r); })
     .Read <string>(cryptography.Encrypt("Vitality"), (r) => { Vitality = cryptography.Decrypt <double>(r); })
     .Read <string>(cryptography.Encrypt("Intelligence"), (r) => { Intelligence = cryptography.Decrypt <double>(r); })
     .Read <string>(cryptography.Encrypt("Name"), (r) => { Name = cryptography.Decrypt <string>(r); })
     .Read <string>(cryptography.Encrypt("Gender"), (r) => { Gender = cryptography.Decrypt <string>(r); })
     .Read <string>(cryptography.Encrypt("Hp"), (r) => { Hp = cryptography.Decrypt <double>(r); })
     .Read <string>(cryptography.Encrypt("Physical_Attack"), (r) => { Physical_Attack = cryptography.Decrypt <double>(r); })
     .Read <string>(cryptography.Encrypt("Magic_Attack"), (r) => { Magic_Attack = cryptography.Decrypt <double>(r); })
     .Read <string>(cryptography.Encrypt("Physical_Resistance"), (r) => { Physical_Resistance = cryptography.Decrypt <double>(r); })
     .Read <string>(cryptography.Encrypt("Physical_Defense"), (r) => { Physical_Defense = cryptography.Decrypt <double>(r); })
     .Read <string>(cryptography.Encrypt("Magic_Defense"), (r) => { Magic_Defense = cryptography.Decrypt <double>(r); })
     .Read <string>(cryptography.Encrypt("Magic_Resistance"), (r) => { Magic_Resistance = cryptography.Decrypt <double>(r); })
     .Read <string>(cryptography.Encrypt("Agility"), (r) => { Agility = cryptography.Decrypt <double>(r); })
     .Read <string>(cryptography.Encrypt("Stamina"), (r) => { Stamina = cryptography.Decrypt <double>(r); })
     .Read <string>(cryptography.Encrypt("Mana"), (r) => { Mana = cryptography.Decrypt <double>(r); })
     .Read <string>(cryptography.Encrypt("AttackSpeed"), (r) => { AttackSpeed = cryptography.Decrypt <double>(r); })
     .Read <string>(cryptography.Encrypt("Coin"), (r) => { coin = cryptography.Decrypt <double>(r); })
     .Read <string>(cryptography.Encrypt("Level"), (r) => { Level = cryptography.Decrypt <int>(r); })
     .Read <string>(cryptography.Encrypt("ULevel"), (r) => { ULevel = cryptography.Decrypt <int>(r); })
     .Read <string>(cryptography.Encrypt("Exp"), (r) => { Exp = cryptography.Decrypt <double>(r); })
     .Read <string>(cryptography.Encrypt("Poval"), (r) => { Poval = cryptography.Decrypt <Vector3>(r); })
     .Read <string>(cryptography.Encrypt("fps"), (r) => { fps = cryptography.Decrypt <int>(r); });
     Hp1                         = Hp;
     Mana1                       = Mana;
     Stamina1                    = Stamina;
     transform.position          = Poval;
     Application.targetFrameRate = fps;
 }
Example #19
0
    public static Dictionary <string, float> LoadPriceMultipliers(QuickSaveReader reader = null)
    {
        reader ??= QSReader.Create("Market");
        var priceMultipliers = new Dictionary <string, float>();

        if (reader.Exists("Multipliers"))
        {
            priceMultipliers = reader.Read <Dictionary <string, float> >("Multipliers");
        }
        else
        {
            foreach (var seedName in SeedTypesInInventory)
            {
                if (!priceMultipliers.ContainsKey(seedName))
                {
                    priceMultipliers[seedName] = 1.0f;
                }
            }
        }
        return(priceMultipliers);
    }
Example #20
0
    public void Load()
    {
        QuickSaveReader reader = QuickSaveReader.Create("GuardianIdleSave");
        Item            item;
        string          key;

        for (int i = 0; i < slots.Count; i++)
        {
            key = "invslot" + i;

            if (reader.Exists(key))
            {
                string JsonString = reader.Read <string>(key);
                string type       = reader.Read <string>(key + "_type");

                if (type == "equipment")
                {
                    item = JsonUtility.FromJson <Equipment>(JsonString);
                }
                else
                {
                    item = JsonUtility.FromJson <Item>(JsonString);
                }

                string icon = reader.Read <string>(key + "_icon");
                item.SetIcon(icon);

                Debug.Log("adding item to slot: " + i);
                slots[i].AddItem(item);
            }
            else
            {
                // Saved slot is empty, clear the slot to prevent duplication
                Debug.Log("clearing slot: " + i);
                slots[i].Clear();
            }
        }
    }
 public void Load()
 {
     QuickSaveReader.Create(fileName)
     .Read <int>("ClickCount", (r) => { clickCount = r; });
 }
Example #22
0
    private void LoadResourceAndUpgradeData()
    {
        if (QuickSaveRoot.Exists(resourceAndUpgradeDataSaveFileName))                                //if a save file exists, load data from that file
        {
            QuickSaveReader instReader = QuickSaveReader.Create(resourceAndUpgradeDataSaveFileName); //create an instance of the quick save reader to pull in the save file

            resources                     = instReader.Read <int>("resources");
            TotalResources                = instReader.Read <int>("totalResources");
            SolarSystemNumber             = instReader.Read <int>("solarSystemNumber");
            currentMaxLaserRange          = instReader.Read <int>("currentMaxLaserRange");
            currentMaxLaserRecharge       = instReader.Read <int>("currentMaxLaserRecharge");
            currentMaxRocketRange         = instReader.Read <int>("currentMaxRocketRange");
            currentMaxRocketReload        = instReader.Read <int>("currentMaxRocketReload");
            currentMaxRocketYield         = instReader.Read <int>("currentMaxRocketYield");
            currentMaxJumpRange           = instReader.Read <int>("currentMaxJumpRange");
            currentMaxJumpRecharge        = instReader.Read <int>("currentMaxJumpRecharge");
            currentMaxShieldBoost         = instReader.Read <int>("currentMaxShieldBoost");
            currentShieldOverboostActive  = instReader.Read <bool>("currentShieldOverboostActive");
            currentMaxShieldBoostRecharge = instReader.Read <int>("currentMaxShieldBoostRecharge");
            currentMaxHealth              = instReader.Read <int>("currentMaxHealth");
            currentMaxShields             = instReader.Read <int>("currentMaxShields");
            currentMaxSensorRange         = instReader.Read <int>("currentMaxSensorRange");

            rocketsInstalled     = instReader.Read <bool>("rocketsInstalled");
            jumpDriveInstalled   = instReader.Read <bool>("jumpDriveInstalled");
            shieldBoostInstalled = instReader.Read <bool>("shieldBoostInstalled");

            abilityController.maxLaserRange           = currentMaxLaserRange;
            abilityController.rocketRange             = currentMaxRocketRange;
            abilityController.rocketReloadTime        = currentMaxRocketReload;
            abilityController.maxJumpRange            = currentMaxJumpRange;
            abilityController.shieldBoostRechargeTime = CurrentMaxShieldBoostRecharge;
            movementController.Vision = CurrentMaxSensorRange;
            mapManager.UpdateFogOfWar(CurrentMaxSensorRange, gridlayout.WorldToCell(player.transform.position));

            playerHealthControl.currentPlayerHealth  = instReader.Read <int>("currentHealth");
            playerHealthControl.currentPlayerShields = instReader.Read <int>("currentShields");
            abilityController.jumpRange  = instReader.Read <int>("currentJumpCharge");
            abilityController.laserRange = instReader.Read <int>("currentLaserCharge");
            //Debug.Log("Laser range loaded as " + abilityController.laserRange);
            abilityController.currentShieldBoostCharge  = instReader.Read <int>("currentShieldBoostCharge");
            abilityController.currentRocketReloadAmount = instReader.Read <int>("currentRocketReload");

            laserRangeUpgradeCost          = instReader.Read <int>("laserRangeUpgradeCost");
            laserRechargeUpgradeCost       = instReader.Read <int>("laserRechargeUpgradeCost");
            rocketRangeUpgradeCost         = instReader.Read <int>("rocketRangeUpgradeCost");
            rocketReloadUpgradeCost        = instReader.Read <int>("rocketReloadUpgradeCost");
            rocketYieldUpgradeCost         = instReader.Read <int>("rocketYieldUpgradeCost");
            jumpRangeUpgradeCost           = instReader.Read <int>("jumpRangeUpgradeCost");
            jumpRechargeUpgradeCost        = instReader.Read <int>("jumpRechargeUpgradeCost");
            shieldBoostUpgradeCost         = instReader.Read <int>("shieldBoostUpgradeCost");
            shieldOverboostUpgradeCost     = instReader.Read <int>("shieldOverboostUpgradeCost");
            shieldBoostRechargeUpgradeCost = instReader.Read <int>("shieldBoostRechargeUpgradeCost");
            shieldMaxUpgradeCost           = instReader.Read <int>("shieldMaxUpgradeCost");
            healthMaxUpgradeCost           = instReader.Read <int>("healthMaxUpgradeCost");
            sensorRangeUpgradeCost         = instReader.Read <int>("sensorRangeUpgradeCost");

            threatLevel           = instReader.Read <float>("threatLevel");
            MaxThreatLevelCounter = instReader.Read <int>("maxThreatLevelCounter");

            uiController.SetHealthState(CurrentMaxHealth, playerHealthControl.currentPlayerHealth, CurrentMaxShields, playerHealthControl.currentPlayerShields);
            uiController.SetLaserCharge(abilityController.laserRange, currentMaxLaserRange);
            uiController.SetJumpCharge(abilityController.jumpRange, CurrentMaxJumpRange);
            uiController.SetShieldBoostRechargeState(abilityController.currentShieldBoostCharge, CurrentMaxShieldBoostRecharge);
            uiController.SetRocketReloadState(abilityController.currentRocketReloadAmount, CurrentMaxRocketReload);
            uiController.SetResourceCount(resources);
            uiController.SetUpgradeButtons();
            uiController.SetThreatLevelSlider(ThreatLevel);

            Debug.Log("Tried to load resources and upgrades");
        }
    }
Example #23
0
 void Start()
 {
     QuickSaveReader.Create("UserData")
     .Read <string>(cryptography.Encrypt("fps"), (r) => { Fps1 = cryptography.Decrypt <int>(r); });
     slider.value = Fps1;
 }
Example #24
0
    void Start()
    {
        QuickSaveReader.Create("Settings")
        .Read <string>(cryptography.Encrypt("A_1_1"), (r) => { A_1_1s = cryptography.Decrypt <string>(r); })
        .Read <string>(cryptography.Encrypt("A_1_2"), (r) => { A_1_2s = cryptography.Decrypt <string>(r); })
        .Read <string>(cryptography.Encrypt("A_1_3"), (r) => { A_1_3s = cryptography.Decrypt <string>(r); })
        .Read <string>(cryptography.Encrypt("A_1_4"), (r) => { A_1_4s = cryptography.Decrypt <string>(r); })
        .Read <string>(cryptography.Encrypt("A_1_5"), (r) => { A_1_5s = cryptography.Decrypt <string>(r); })
        .Read <string>(cryptography.Encrypt("A_1_6"), (r) => { A_1_6s = cryptography.Decrypt <string>(r); })
        .Read <string>(cryptography.Encrypt("A_1_7"), (r) => { A_1_7s = cryptography.Decrypt <string>(r); })
        .Read <string>(cryptography.Encrypt("A_1_8"), (r) => { A_1_8s = cryptography.Decrypt <string>(r); })
        .Read <string>(cryptography.Encrypt("A_1_9"), (r) => { A_1_9s = cryptography.Decrypt <string>(r); })
        .Read <string>(cryptography.Encrypt("A_1_10"), (r) => { A_1_10s = cryptography.Decrypt <string>(r); })
        .Read <string>(cryptography.Encrypt("A_2_1"), (r) => { A_2_1s = cryptography.Decrypt <string>(r); })
        .Read <string>(cryptography.Encrypt("A_2_2"), (r) => { A_2_2s = cryptography.Decrypt <string>(r); })
        .Read <string>(cryptography.Encrypt("A_2_3"), (r) => { A_2_3s = cryptography.Decrypt <string>(r); })
        .Read <string>(cryptography.Encrypt("A_2_4"), (r) => { A_2_4s = cryptography.Decrypt <string>(r); })
        .Read <string>(cryptography.Encrypt("A_2_5"), (r) => { A_2_5s = cryptography.Decrypt <string>(r); })
        .Read <string>(cryptography.Encrypt("A_2_6"), (r) => { A_2_6s = cryptography.Decrypt <string>(r); })
        .Read <string>(cryptography.Encrypt("A_2_7"), (r) => { A_2_7s = cryptography.Decrypt <string>(r); })
        .Read <string>(cryptography.Encrypt("A_2_8"), (r) => { A_2_8s = cryptography.Decrypt <string>(r); })
        .Read <string>(cryptography.Encrypt("A_2_9"), (r) => { A_2_9s = cryptography.Decrypt <string>(r); })
        .Read <string>(cryptography.Encrypt("A_2_10"), (r) => { A_2_10s = cryptography.Decrypt <string>(r); })
        .Read <string>(cryptography.Encrypt("A_3_1"), (r) => { A_3_1s = cryptography.Decrypt <string>(r); })
        .Read <string>(cryptography.Encrypt("A_3_2"), (r) => { A_3_2s = cryptography.Decrypt <string>(r); })
        .Read <string>(cryptography.Encrypt("A_3_3"), (r) => { A_3_3s = cryptography.Decrypt <string>(r); })
        .Read <string>(cryptography.Encrypt("A_3_4"), (r) => { A_3_4s = cryptography.Decrypt <string>(r); })
        .Read <string>(cryptography.Encrypt("A_3_5"), (r) => { A_3_5s = cryptography.Decrypt <string>(r); })
        .Read <string>(cryptography.Encrypt("A_3_6"), (r) => { A_3_6s = cryptography.Decrypt <string>(r); })
        .Read <string>(cryptography.Encrypt("A_3_7"), (r) => { A_3_7s = cryptography.Decrypt <string>(r); })
        .Read <string>(cryptography.Encrypt("A_3_8"), (r) => { A_3_8s = cryptography.Decrypt <string>(r); })
        .Read <string>(cryptography.Encrypt("A_3_9"), (r) => { A_3_9s = cryptography.Decrypt <string>(r); })
        .Read <string>(cryptography.Encrypt("A_3_10"), (r) => { A_3_10s = cryptography.Decrypt <string>(r); })
        .Read <string>(cryptography.Encrypt("A_4_1"), (r) => { A_4_1s = cryptography.Decrypt <string>(r); })
        .Read <string>(cryptography.Encrypt("A_4_2"), (r) => { A_4_2s = cryptography.Decrypt <string>(r); })
        .Read <string>(cryptography.Encrypt("A_4_3"), (r) => { A_4_3s = cryptography.Decrypt <string>(r); })
        .Read <string>(cryptography.Encrypt("A_4_4"), (r) => { A_4_4s = cryptography.Decrypt <string>(r); })
        .Read <string>(cryptography.Encrypt("A_4_5"), (r) => { A_4_5s = cryptography.Decrypt <string>(r); })
        .Read <string>(cryptography.Encrypt("A_4_6"), (r) => { A_4_6s = cryptography.Decrypt <string>(r); })
        .Read <string>(cryptography.Encrypt("A_4_7"), (r) => { A_4_7s = cryptography.Decrypt <string>(r); })
        .Read <string>(cryptography.Encrypt("A_4_8"), (r) => { A_4_8s = cryptography.Decrypt <string>(r); })
        .Read <string>(cryptography.Encrypt("A_4_9"), (r) => { A_4_9s = cryptography.Decrypt <string>(r); })
        .Read <string>(cryptography.Encrypt("A_4_10"), (r) => { A_4_10s = cryptography.Decrypt <string>(r); });

        A_1_1.SetActive(bool.Parse(A_1_1s));
        A_1_2.SetActive(bool.Parse(A_1_2s));
        A_1_3.SetActive(bool.Parse(A_1_3s));
        A_1_4.SetActive(bool.Parse(A_1_4s));
        A_1_5.SetActive(bool.Parse(A_1_5s));
        A_1_6.SetActive(bool.Parse(A_1_6s));
        A_1_7.SetActive(bool.Parse(A_1_7s));
        A_1_8.SetActive(bool.Parse(A_1_8s));
        A_1_9.SetActive(bool.Parse(A_1_9s));
        A_1_10.SetActive(bool.Parse(A_1_10s));

        A_2_1.SetActive(bool.Parse(A_2_1s));
        A_2_2.SetActive(bool.Parse(A_2_2s));
        A_2_3.SetActive(bool.Parse(A_2_3s));
        A_2_4.SetActive(bool.Parse(A_2_4s));
        A_2_5.SetActive(bool.Parse(A_2_5s));
        A_2_6.SetActive(bool.Parse(A_2_6s));
        A_2_7.SetActive(bool.Parse(A_2_7s));
        A_2_8.SetActive(bool.Parse(A_2_8s));
        A_2_9.SetActive(bool.Parse(A_2_9s));
        A_2_10.SetActive(bool.Parse(A_2_10s));

        A_3_1.SetActive(bool.Parse(A_3_1s));
        A_3_2.SetActive(bool.Parse(A_3_2s));
        A_3_3.SetActive(bool.Parse(A_3_3s));
        A_3_4.SetActive(bool.Parse(A_3_4s));
        A_3_5.SetActive(bool.Parse(A_3_5s));
        A_3_6.SetActive(bool.Parse(A_3_6s));
        A_3_7.SetActive(bool.Parse(A_3_7s));
        A_3_8.SetActive(bool.Parse(A_3_8s));
        A_3_9.SetActive(bool.Parse(A_3_9s));
        A_3_9.SetActive(bool.Parse(A_3_10s));

        A_4_1.SetActive(bool.Parse(A_4_1s));
        A_4_2.SetActive(bool.Parse(A_4_2s));
        A_4_3.SetActive(bool.Parse(A_4_3s));
        A_4_4.SetActive(bool.Parse(A_4_4s));
        A_4_5.SetActive(bool.Parse(A_4_5s));
        A_4_6.SetActive(bool.Parse(A_4_6s));
        A_4_7.SetActive(bool.Parse(A_4_7s));
        A_4_8.SetActive(bool.Parse(A_4_8s));
        A_4_9.SetActive(bool.Parse(A_4_9s));
        A_4_10.SetActive(bool.Parse(A_4_10s));
    }
Example #25
0
 public object GetObject(string inputName)
 {
     return(JsonUtility.FromJson <object>(
                QuickSaveReader.Create(fileName)
                .Read <string>(inputName)));
 }
Example #26
0
 public void LoadTestFile()
 {
     QuickSaveReader instReader = QuickSaveReader.Create("TestFile");
 }
Example #27
0
        public static void RestoreGame()
        {
            QuickSaveReader saveReader = QuickSaveReader.Create(LoadSaveScript.selectedFile);

            int indexCount = saveReader.Read <int>("indexCount");

            for (int index = 0; index < indexCount; index++)
            {
                BaseBehavior.Load(ref saveReader, index);
            }

            foreach (GameObject unitObject in GameObject.FindGameObjectsWithTag("Building").Concat(GameObject.FindGameObjectsWithTag("Unit")))
            {
                BaseBehavior unitBaseBehavior = unitObject.GetComponent <BaseBehavior>();
                unitBaseBehavior.RestoreBehavior();
            }

            Vector3    cameraPosition = saveReader.Read <Vector3>("cameraPosition");
            Quaternion cameraRotation = saveReader.Read <Quaternion>("cameraRotation");

            Camera.main.transform.position = cameraPosition;
            Camera.main.transform.rotation = cameraRotation;

            CameraController cameraController = Camera.main.GetComponent <CameraController>();

            cameraController.resources[BaseBehavior.ResourceType.Gold]  = saveReader.Read <float>("gold");
            cameraController.resources[BaseBehavior.ResourceType.Wood]  = saveReader.Read <float>("wood");
            cameraController.resources[BaseBehavior.ResourceType.Food]  = saveReader.Read <float>("food");
            cameraController.resources[BaseBehavior.ResourceType.Favor] = saveReader.Read <float>("favor");

            // Blind texture
            TerrainGenerator terrainGenerator = Terrain.activeTerrain.GetComponent <TerrainGenerator>();

            Color[] colors    = terrainGenerator.blindTexture2D.GetPixels();
            int[]   blindInfo = saveReader.Read <int[]>("blindTextureData");
            Color   newColor  = Color.white;

            newColor.a = 0;
            for (int i = 0; i < colors.Length; i++)
            {
                colors[i] = blindInfo[i] == 1 ? Color.black : newColor;
            }
            terrainGenerator.blindTexture2D.SetPixels(colors);
            terrainGenerator.blindTexture2D.Apply();
            Graphics.Blit(terrainGenerator.blindTexture2D, terrainGenerator.blindTexture);
            terrainGenerator.initBlindTexture = true;

            try
            {
                // Binds
                for (int number = 1; number <= 9; number++)
                {
                    int[] binds = saveReader.Read <int[]>(new StringBuilder(15).AppendFormat("{0}_{1}", number, "bind").ToString());
                    int   i     = 0;
                    foreach (int bindObjectUniueId in binds)
                    {
                        cameraController.unitsBinds[KeyCode.Alpha0 + number].Add(BaseBehavior.GetObjectByUniqueId(bindObjectUniueId));
                        i++;
                    }
                }
            }
            catch (Exception e)
            { }

            selectedFile = "";
        }
Example #28
0
 void Start()
 {
     QuickSaveReader.Create("UserData")
     .Read <string>(cryptography.Encrypt("Fpss"), (r) => { strs = cryptography.Decrypt <string>(r); });
     Tog.GetComponent <Toggle>().isOn = bool.Parse(strs);
 }
Example #29
0
 public void GetString(string inputName)
 {
     QuickSaveReader.Create(fileName)
     .Read <string>(inputName);
 }