private void Update() { if (Input.GetMouseButtonDown(0)) { Data data = DataSaver.Load(); if (data != null) { Debug.Log("--------------- String ----------------"); foreach (var str in data.str) { Debug.Log(str); } Debug.Log("--------------- List ----------------"); foreach (var list in data.lists) { foreach (var element in list) { Debug.Log(element); } } Debug.Log("--------------- Dictionary ----------------"); foreach (var dict in data.dictionaries) { foreach (KeyValuePair <string, string> kvp in dict) { Debug.Log(kvp.Key); Debug.Log(kvp.Value); } } } } }
// On load public void OnProtoDeserializeObjectTree(ProtobufSerializer _) { if (SaveData.Load()) { foreach (string slot in SlotNames) { Armour.AddSlot(slot); TechType slotItem = (TechType)SaveData.Data.GetOrDefault(slot, (int)TechType.None); if (slotItem == TechType.None) { continue; } //Pickupable itemPickup = new Pickupable(); //itemPickup.SetTechTypeOverride(slotItem); //InventoryItem item = new InventoryItem(itemPickup); GameObject itemObject = CraftData.InstantiateFromPrefab(slotItem); Pickupable itemPickupable = itemObject.GetComponent <Pickupable>(); InventoryItem item = new InventoryItem(itemPickupable); Armour.AddItem(slot, item, true); typeof(Pickupable).GetMethod("Deactivate", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(itemPickupable, null); } } else { SetSlots(); } Logger.Log($"Successfully loaded items for {ID}"); }
public void LoadCells() { List <List <int> > jsonData = DataSaver.Load(); List <IGenericCell> generatedCells = GeneticCellMutation.GenerateNewCells(jsonData); CellField.DeleteAllElements(); CellField.InitializeLiveCells(generatedCells); }
public bool Load() { data = DataSaver.Load <PlayerData>("playerData.dat"); if (data == null) { return(false); } return(!(data == null)); }
private void LoadPlayerName() { GameData playerdata = DataSaver.Load(); if (playerdata != null) { playerName = playerdata.name; } }
private void Start() { audioSrc = GetComponent <AudioSource>(); ToMainMenu(); DataSaver.Load(); PopulateHighscoreLists(); }
private void LoadPlayerStat() { GameData statData = DataSaver.Load(); if (statData != null) { stat1Text.text = "Стат 1: " + statData.stat1.ToString(); stat2Text.text = "Стат 2: " + statData.stat2.ToString(); stat3Text.text = "Стат 3: " + statData.stat3.ToString(); } }
public void Load() { if (m_DataSaver.Load(m_Path)) { currentCharacter = m_DataSaver.GetString("character"); currentLevel = m_DataSaver.GetString("level"); currentDifficulty = m_DataSaver.GetString("difficulty"); currentMuteMusicState = m_DataSaver.GetBool("mute"); } IsLoaded = true; }
private void ReloadCells() { List <List <int> > jsonData = DataSaver.Load(); List <IGenericCell> generatedCells = GeneticCellMutation.GenerateNewCells(jsonData); int[,] field = DataSaver.LoadField(); _simulationManger.DeleteAllElements(); _simulationManger.GenerateGameField(field); _simulationManger.InitializeLiveCells(generatedCells); }
public static void LoadProgress() { if (instance == null) { return; } PlayerData progress = DataSaver.Load(); if (progress != null) { NumberOfOpenedLevels = progress.levelProgress; } OpenNewLevels(); }
private void ExecuteAwaitingActions() { if (clearCategory) { gameSaves.ClearSave(); clearCategory = false; RefreshKeys(); } if (loadCategory) { gameSaves.Load(); loadCategory = false; RefreshKeys(); } }
public static void LoadVolume() { PlayerData data = DataSaver.Load(); if (data != null) { MusicVolume = data.musicVolume; SoundVolume = data.soundVolume; SetMusicVolume(MusicVolume); SetSoundVolume(SoundVolume); onVolumeChanged(MusicVolume, SoundVolume); } }
public static T Load <T>() where T : new() { var filename = Constants.SettingName + ".dat"; var saver = new DataSaver <T>(); var config = new T(); if (!File.Exists(filename)) { saver.Save(filename, config); } else { config = saver.Load(filename); } return(config); }
public void LoadCells() { List <List <int> > jsonData = DataSaver.Load(); List <IGenericCell> generatedCells = GeneticCellMutation.GenerateNewCells(jsonData); var field = DataSaver.LoadField(); if (field == null) { CellField.DeleteAllElements(); } else { CellField.DeleteAllElements(field); } CellField.InitializeLiveCells(generatedCells); }
public static T Load <T>(this T data) where T : ISaveble { return(DataSaver.Load <T>()); }
void OnDisable() { LoadButton.onClick.RemoveListener(delegate { DestroyExisting(); }); SaveButton.onClick.RemoveListener(delegate { SaveIfExist(); }); LoadButton.onClick.RemoveListener(delegate { DataSaver.Load(DataPath); }); }