This shows you the differences between two versions of the page.
|
pjv:laboratoare:2023:10 [2023/12/11 15:20] alexandru.gradinaru [Documentatie extinsa text] |
pjv:laboratoare:2023:10 [2024/10/07 10:49] (current) alexandru.gradinaru |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ===== Sisteme de gestiune a datelor ===== | + | ===== 10. Sisteme de gestiune a datelor ===== |
| ==== Cerinte ===== | ==== Cerinte ===== | ||
| Line 118: | Line 118: | ||
| ... | ... | ||
| - | public static string dataFilePath = Path.Combine(Application.persistentDataPath, "SaveGameData.json"); | + | private static string dataFilePath = Path.Combine(Application.persistentDataPath, "SaveGameData.json"); |
| - | | + | |
| public void SaveGame() | public void SaveGame() | ||
| { | { | ||
| GameData gameData = new GameData(); | GameData gameData = new GameData(); | ||
| gameData.level = level; | gameData.level = level; | ||
| - | ...etc | + | //...etc |
| - | + | ||
| - | + | ||
| // This creates a new StreamWriter to write to a specific file path | // This creates a new StreamWriter to write to a specific file path | ||
| using (StreamWriter writer = new StreamWriter(dataFilePath)) | using (StreamWriter writer = new StreamWriter(dataFilePath)) | ||
| Line 137: | Line 134: | ||
| } | } | ||
| } | } | ||
| - | |||
| public void LoadGame() | public void LoadGame() | ||
| { | { | ||
| Line 150: | Line 146: | ||
| } | } | ||
| } | } | ||
| - | |||
| - | | ||
| } | } | ||
| + | </code> | ||