Exemple #1
0
 public void GetSaveData <T>(SaveEnum key, T obj) where T : Transform
 {
     if (ES3.KeyExists(key.ToString()))
     {
         ES3.LoadInto <T>(key.ToString(), obj);
     }
 }
Exemple #2
0
    public void Load()
    {
        if (ES3.FileExists("SaveData"))
        {
            if (ES3.KeyExists("PlayerData", "SaveData"))
            {
                ES3.LoadInto <PlayerData>("PlayerData", "SaveData", this);

                Debug.Log("PlayerDataLoaded " +
                          ", HealthLevel: " + HealthLevel +
                          ", FireRateLevel: " + FireRateLevel +
                          ", BulletDamageLevel:" + BulletDamageLevel +
                          ", BulletNumLevel: " + BulletNumLevel +
                          ", AttractorLevel: " + AttractorLevel +
                          ", Sp: " + Sp);
            }
        }
        else
        {
            HealthLevel       = 1;
            FireRateLevel     = 1;
            BulletDamageLevel = 1;
            BulletNumLevel    = 1;
            AttractorLevel    = 1;
            Sp = 0;
            ES3.Save <PlayerData>("PlayerData", this, "SaveData");
            Debug.Log("SaveData File Not found, PlayerData key created and loaded default values");
        }
    }
Exemple #3
0
    private void LoadPlayer(string loadSlot)
    {
        ES3.LoadInto("Position", loadSlot, so.playerPosition);
        ES3.LoadInto("Health", loadSlot, so.health);
        ES3.LoadInto("Mana", loadSlot, so.mana);
        ES3.LoadInto("Lumen", loadSlot, so.lumen);
        ES3.LoadInto("XP", loadSlot, so.xpSystem);

        LoadInventory("Inventory", loadSlot, so.playerInventory, so.itemDatabase);
    }
Exemple #4
0
 void ISaveDataHelper.LoadInto <T>(string path, string key, T obj) where T : class
 {
     if (string.IsNullOrEmpty(path))
     {
         ES3.LoadInto <T>(key, obj);
     }
     else
     {
         ES3.LoadInto <T>(key, obj, GetOrCreateSettings(path));
     }
 }
Exemple #5
0
 private void LoadBools(string loadSlot)
 {
     ES3.LoadInto("Chests", loadSlot, so.chests);
     ES3.LoadInto("Doors", loadSlot, so.doors);
     ES3.LoadInto("Bosses", loadSlot, so.bosses);
     ES3.LoadInto("HealthCrystals", loadSlot, so.healthCrystals);
     ES3.LoadInto("ManaCrystals", loadSlot, so.manaCrystals);
     ES3.LoadInto("Cutscenes", loadSlot, so.cutscenes);
     ES3.LoadInto("Stashes", loadSlot, so.stashes);
     ES3.LoadInto("Quests", loadSlot, so.quests);
 }
Exemple #6
0
 public override void Enter()
 {
     value.UpdateValue();
     if (value.IsNone || value.GetValue() == null)
     {
         HandleError("The 'Load Into' action requires an object to load the data into, but none was specified in the 'Value' field.");
     }
     else
     {
         ES3.LoadInto <object>(key.Value, value.GetValue(), GetSettings());
     }
 }
    private void LoadPlayer()
    {
        Player player = GetPlayer();

        if (player != null && ES3.FileExists("PlayerInfo.json"))
        {
            ES3.LoadInto <Player>("Player", "PlayerInfo.json", player);
            player.GetRigidbody().position = ES3.Load <Vector2>("Position", "PlayerInfo.json");
        }
        else
        {
            needToLoadPlayer = true;
        }
    }
    /*
     * This is called when the scene first loads.
     * This is where we load our prefabs, if there are prefabs to load.
     */
    void Start()
    {
        int count = ES3.Load <int>(id + "count", 0);

        // If there are prefabs to load, load them.
        if (count > 0)
        {
            // For each prefab we want to load, instantiate a prefab.
            for (int i = 0; i < count; i++)
            {
                InstantiatePrefab();
            }
            // Load our List of Transforms into our prefab array.
            ES3.LoadInto <List <Transform> >(id, prefabInstances);
        }
    }
 public void Load()
 {
     if (ES3.FileExists("SaveData"))
     {
         if (ES3.KeyExists(Level_ID + "_save", "SaveData"))
         {
             ES3.LoadInto(Level_ID + "_save", "SaveData", this);
             Debug.Log("Loaded " + this.name);
         }
         else
         {
             InitializeDefaultValues();
             ES3.Save <LevelSaveData>(Level_ID + "_save", this, "SaveData");
             Debug.Log("Initialized " + this.name + " with default values");
         }
     }
 }
        public void Load()
        {
            ES3.LoadInto("PartyMembers", "Party.json", partyMembers);
            ES3.LoadInto("Enemies", "Enemies.json", enemyList);
            activePartyMembers.Clear();
            ES3.Load <List <string> >("ActiveParty", "ActiveParty.json").ForEach(member => activePartyMembers.Add(member));

            partyMembers.ForEach(member => {
                foreach (Item item in member.equipment)
                {
                    if (item != null && item.icon == null)
                    {
                        item.LoadSprite();
                        inventoryController.AddToListOfCurrentItems(item);
                    }
                }
            });
        }
Exemple #11
0
 /// <summary>
 /// 加载物体
 /// </summary>
 /// <param name="key"></param>
 /// <param name="isself"></param>
 /// <param name="self"></param>
 /// <returns></returns>
 public GameObject loadGameObjectOrPrefab(string key, bool isself = false, GameObject self = null)
 {
     if (!ES3.KeyExists(key))
     {
         throw new UnityException("没有" + key + "存在!");
     }
     if (isself)
     {
         if (self != null)
         {
             ES3.LoadInto <GameObject>(key, self);
             return(self);
         }
         Debug.LogWarning("当前对象没有重载数据!");
         return(self);
     }
     return(ES3.Load <GameObject>(key));
 }
 private void LoadNPCs()
 {
     NPC[] currentNPCs = GetNPCs();
     if (GetNPCs().Length > 0)
     {
         for (int i = 0; i < currentNPCs.Length; i++)
         {
             try {
                 ES3.LoadInto <NPC>("npc", "NPCs/" + currentNPCs[i].npcName + ".json", currentNPCs[i]);
             } catch {
                 Debug.LogWarning("At index " + i + " something went wrong loading an NPC");
             }
         }
     }
     else
     {
         needToLoadNPCs = true;
     }
 }
Exemple #13
0
    public void LoadSaveFile()
    {
        List <int> cellNum = new List <int>();
        HexCell    cell    = new HexCell();

        cellNum = ES3.Load <List <int> >("cellNum");
        for (int i = 0; i < cellNum.Count; i++)
        {
            ES3.LoadInto <HexCell>("HexCell" + cellNum[i], cell);
            LoadTileToCell(hexGrid.cells[cellNum[i]],
                           cell.currentInfo.shapeOfTile[0],
                           cell.currentInfo.shapeOfTile[1],
                           cell.currentInfo.shapeOfTile[2],
                           hexGrid.cells[cellNum[i]].transform.localPosition,
                           cell.visionField,
                           cell.currentInfo);
            hexTileCounter.SetTiletoList(cell.currentInfo);
        }


/*
 *
 *              for(int i=0;i<10000;i++){
 *                      if(ES3.KeyExists("HexCell"+i)){
 *                              Debug.Log("Find Key: "+"HexCell"+i);
 *                              LoadTileToCell(hexGrid.cells[i],
 *                                                         ES3.Load<HexCell>("HexCell"+i).currentInfo.shapeOfTile[0],
 *                                                         ES3.Load<HexCell>("HexCell"+i).currentInfo.shapeOfTile[1],
 *                                                         ES3.Load<HexCell>("HexCell"+i).currentInfo.shapeOfTile[2],
 *                                                         hexGrid.cells[i].transform.localPosition,
 *                                                         ES3.Load<HexCell>("HexCell"+i).visionField,
 *                                                         ES3.Load<HexCell>("HexCell"+i).currentInfo);
 *                              hexTileCounter.SetTiletoList(ES3.Load<HexCell>("HexCell"+i).currentInfo);
 *
 *                              //hexGrid.cells[i] = hexCell;
 *                              //Debug.Log(coordinates);
 *                      }else{
 *                              continue;
 *                      }
 *              } */
    }
Exemple #14
0
 public void LoadSave()
 {
     //load chunks
     if (ES3.KeyExists($"{worldName} chunk cashe"))
     {
         ES3.LoadInto($"{worldName} chunk cashe", chunks);
         worldSize = new Vector2Int(chunks.GetLength(0), chunks.GetLength(1));
         chunkSize = new Vector2Int(chunks[0, 0].blocks.GetLength(0), chunks[0, 0].blocks.GetLength(1));
     }
     else if (WorldCreation.tempChunks != null)
     {
         chunks    = WorldCreation.tempChunks;
         worldSize = new Vector2Int(chunks.GetLength(0), chunks.GetLength(1));
         chunkSize = new Vector2Int(chunks[0, 0].blocks.GetLength(0), chunks[0, 0].blocks.GetLength(1));
     }
     else
     {
         Debug.LogError($"could not load {WorldManager.instance.worldName}");
         CancelInvoke();
         //display error
         //exit world
     }
 }
Exemple #15
0
 private void LoadTime(string loadSlot) => ES3.LoadInto("Time", loadSlot, so.timeOfDay);