예제 #1
0
 public virtual async void Load()
 {
     if (!await SaveSystemAPI.ExistsAsync(this.identifier))
     {
         return;
     }
     await SaveSystemAPI.LoadAsync <GameObject[]>(this.identifier, this.settingsPreset.CustomSettings);
 }
        public override async void Load()
        {
            if (!await SaveSystemAPI.ExistsAsync(this.identifierField.text))
            {
                Debug.Log("Player data not found");
                Debug.Log("Using default player data instead");
                this.playerData = this.defaultPlayerData;
                return;
            }
            this.playerData = await SaveSystemAPI.LoadAsync <PlayerData>(this.identifierField.text);

            this.playerNameField.text            = this.playerData.name;
            this.playerCurrentHealthSlider.value = this.playerData.currentHealth;
            this.playerInventorySlotCount.text   = this.playerData.inventory.slots.Count.ToString();
            Debug.Log("Player data loaded successfully");
        }
        public override async void Load()
        {
            if (!await SaveSystemAPI.ExistsAsync(this.identifierField.text))
            {
                Debug.Log("Data not found");
                return;
            }
            for (int i = 0; i < this.spawnedInstances.Count; i++)
            {
                DestroyImmediate(this.spawnedInstances[i]);
            }
            this.spawnedInstances.Clear();
            await SaveSystemAPI.LoadIntoAsync(this.identifierField.text, this.spawnedInstances);

            Debug.Log("Data loaded successfully");
        }
 public static bool Exists(string identifier)
 {
     return(SaveSystemAPI.ExistsAsync(identifier).Result);
 }
 public static T Load <T>(string identifier, T defaultValue)
 {
     return(SaveSystemAPI.ExistsAsync(identifier).Result ? SaveSystemAPI.LoadAsync <T>(identifier).Result : defaultValue);
 }