public void Save(ES3Settings settings, bool append) { using (var writer = new StreamWriter(ES3Stream.CreateStream(settings, append ? ES3FileMode.Append : ES3FileMode.Write))) { // If data already exists and we're appending, we need to prepend a newline. if (append && ES3.FileExists(settings)) { writer.Write(NEWLINE_CHAR); } var array = ToArray(); for (int row = 0; row < rows; row++) { if (row != 0) { writer.Write(NEWLINE_CHAR); } for (int col = 0; col < cols; col++) { if (col != 0) { writer.Write(COMMA_CHAR); } writer.Write(Escape(array [col, row])); } } } if (!append) { ES3IO.CommitBackup(settings); } }
public static void DeleteSlotData(Slots slot) { string saveFileName; // Set the current slot switch (slot) { case Slots.Slot1: saveFileName = Slots.Slot1 + SAVE_FILE_EXTENSION; break; case Slots.Slot2: saveFileName = Slots.Slot2 + SAVE_FILE_EXTENSION; break; case Slots.Slot3: saveFileName = Slots.Slot3 + SAVE_FILE_EXTENSION; break; case Slots.None: saveFileName = Slots.None.ToString(); break; default: throw new ArgumentOutOfRangeException(nameof(slot), slot, null); } // Check slot if it exists and delete it if (ES3.FileExists(saveFileName)) { ES3.DeleteFile(saveFileName); } }
public void Save() { // If we're using caching and we've not already cached this file, cache it. if (settings.location == ES3.Location.Cache && !ES3.FileExists(settings)) { ES3.CacheFile(settings); } if (autoSaves == null || autoSaves.Count == 0) { ES3.DeleteKey(key, settings); } else { var gameObjects = new List <GameObject>(); foreach (var autoSave in autoSaves) { // If the ES3AutoSave component is disabled, don't save it. if (autoSave.enabled) { gameObjects.Add(autoSave.gameObject); } } ES3.Save <GameObject[]>(key, gameObjects.ToArray(), settings); } if (settings.location == ES3.Location.Cache && ES3.FileExists(settings)) { ES3.StoreCachedFile(settings); } }
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"); } }
public static void DeleteSlotData(Slots _slot) { string saveFileName; // Set the current slot switch (_slot) { case Slots.Slot1: saveFileName = Slots.Slot1.ToString() + ".sls"; break; case Slots.Slot2: saveFileName = Slots.Slot2.ToString() + ".sls"; break; case Slots.Slot3: saveFileName = Slots.Slot3.ToString() + ".sls"; break; default: saveFileName = Slots.None.ToString(); break; } // Check slot if it exists and delete it if (ES3.FileExists(saveFileName)) { ES3.DeleteFile(saveFileName); } }
public void loadSettings(string filename) { if (ES3.FileExists(this.fileName)) { Setting = ES3.Load <SettingObject>("settings", this.fileName); } }
public void Load(bool loadedFromMenu) { if (!dialogPanel.gameObject.activeSelf) { if (ES3.FileExists()) { ClearAll(); questController.Load(); menuController.CloseAllMenus(); craftingInventory.Load(); consumableInventory.Load(); characterController.Load(); sceneController.Load(); CloseDialog(); LoadSavedScene(); LoadPlayer(); LoadNPCs(); menuController.UnpauseGame(); if (loadedFromMenu) { ShowAlert("Loaded game!"); } } else { ShowAlert("No file to load from!"); } } else { ShowAlert("Can't load right now!"); } }
public void VerifyMainSaveFile() { OnSaveFileAccessed(); if (ES3.FileExists("main.es3")) { Debug.Log("Main save data exists."); } else { Debug.Log("Main save data does not exist."); } if (ES3.KeyExists("mostRecentStartup", "main.es3")) { Debug.Log("Welcome back! Last play session was " + ES3.Load <System.DateTime>("mostRecentStartup", "main.es3")); } ES3.Save <System.DateTime>("mostRecentStartup", System.DateTime.Now, "main.es3"); if (ES3.DirectoryExists(saveFilesDirectory)) { foreach (var filename in ES3.GetFiles(saveFilesDirectory)) { Debug.Log("Found save file: " + filename); } } else { Debug.Log("No save files exist."); } }
public void LoadSavedData() { if (!ES3.FileExists()) { return; } if (ES3.KeyExists("Level")) { GameVo.CurrentLevelID = ES3.Load <int>("Level"); } if (ES3.KeyExists("Vibration")) { GameVo.Vibration = ES3.Load <bool>("Vibration"); } if (ES3.KeyExists("SFX")) { GameVo.SFX = ES3.Load <bool>("SFX"); } if (ES3.KeyExists("Coin")) { GameVo.Coin = ES3.Load <int>("Coin"); } }
public void GetSpeechId() { speechSheetInfos = new List <SpeechSheetInfo>(); int temp_Id; int temp_Row; int temp_Length; if (ES3.FileExists(ScriptName)) { var sheet = new ES3Spreadsheet(); sheet.Load(ScriptName); // Output the first row of the spreadsheet to console for (int row = 0; row < sheet.RowCount; row += 50) { temp_Id = sheet.GetCell <int>(0, row - 1); temp_Row = row; temp_Length = sheet.GetCell <int>(1, row - 1); SpeechSheetInfo temp_Info = new SpeechSheetInfo(temp_Id, temp_Row, temp_Length); speechSheetInfos.Add(temp_Info); } } else { Debug.Log("Error! ScriptFile is not exist"); Debug.Log(ScriptName); } }
public static void LoadSlotData(Slots slot) { // Set the current slot switch (slot) { case Slots.Slot1: _currentSlot = Slots.Slot1; break; case Slots.Slot2: _currentSlot = Slots.Slot2; break; case Slots.Slot3: _currentSlot = Slots.Slot3; break; case Slots.None: _currentSlot = Slots.None; break; default: throw new ArgumentOutOfRangeException(nameof(slot), slot, null); } if (_currentSlot == Slots.None) { Debug.LogError("No slot has been selected!"); return; } string slotKey = _currentSlot.ToString(); string saveFileName = slotKey + SAVE_FILE_EXTENSION; DataInfo newData = new DataInfo(); if (!ES3.FileExists(saveFileName)) { // New slot! Debug.Log("Slot save not found! - Building new save..."); newData.money = 0; } else { // Unpack data Debug.Log("Slot save found! - Loading data..."); newData.money = ES3.Load <int>(slotKey + MONEY_KEY, saveFileName); } currentInfo = null; currentInfo = newData; SaveSlotData(); if (currentInfo != null) { Debug.Log("Slot was successfully loaded!"); } }
internal static void CacheFile(ES3Settings settings) { if (!ES3.FileExists(settings)) { throw new FileNotFoundException("Could not cache file " + settings.path + " because it does not exist"); } cachedFiles[settings.path] = new ES3File(ES3.LoadRawBytes(settings)); }
public override void activate() { if (ES3.FileExists("merky.txt")) { ES3.DeleteFile("merky.txt"); } Managers.Game.resetGame(false); }
public void ReturnLobby() { if (ES3.FileExists("WeaponList.es3")) { var keys = ES3.GetKeys("WeaponList.es3"); for (int i = 0; i < keys.Length; i++) { if (ES3.KeyExists(i.ToString(), "WeaponList.es3")) { ES3.DeleteKey(i.ToString(), "WeaponList.es3"); } } } if (this.weaponParent == null) { this.weaponParent = GameObject.Find("GunSlot").transform; } weaponList.Clear(); GameObject weaponObj; CWeapon weapon; if (ES3.KeyExists("BaseGun", "Weapon.es3")) { string weaponName = ES3.Load <string>("BaseGun", "Weapon.es3"); weaponObj = GameObject.Instantiate(CResourceManager.Instance.GetObjectForKey("Prefabs/Gun/" + weaponName), this.weaponParent); weapon = weaponObj.GetComponent <CWeapon>(); weapon.gunName = weaponName; } else { weaponObj = GameObject.Instantiate(CResourceManager.Instance.GetObjectForKey("Prefabs/Gun/DAKGUN"), this.weaponParent); weapon = weaponObj.GetComponent <CWeapon>(); weapon.gunName = "DAKGUN"; } weapon.SetGunImageSetting(); bulletArray[0] = weapon.GetMaxBullet(); for (int i = 1; i < bulletArray.Length; i++) { bulletArray[i] = -1; } if (this.weaponParent == null) { this.weaponParent = GameObject.Find("GunSlot").transform; } this.SetCurrentWeapon(weapon); this.AddWeapon(weapon); ES3.Save <int>("CurrentWeaponIndex", this.currentWeaponIndex, "Weapon.es3"); ES3.Save <string>("BaseGun", weapon.gunName, "Weapon.es3"); }
/// <summary> /// 指定スロットをロード(切り替える) /// </summary> /// <param name="slotID">スロット番号</param> public static void Load(int slotID) { SlotID = slotID; if (ES3.FileExists(SaveSettings) == false) { return; } CreateTempData(); }
public void Load() { // If we're using caching and we've not already cached this file, cache it. if (settings.location == ES3.Location.Cache && !ES3.FileExists(settings)) { ES3.CacheFile(settings); } ES3.Load <GameObject[]>(key, new GameObject[0], settings); }
void Start() { if (ES3.FileExists("SaveData.es3")) { ProgressIndex = ES3.Load <int>("Progress"); } else { Debug.Log("No hay data"); } }
public static string GetNextFreeFile() { int id = 0; while (ES3.FileExists(id + "info.9n")) { id++; } return(id.ToString()); }
/// <summary> /// ���ر������� /// </summary> //public void LoadLocalData() //{ // //ES3.Save<List<int>>("test", new List<int>() { 0,1} ); // //Debug.Log("ssss" + ES3.FileExists(new ES3Settings())); // if(isCleanCache) // ES3.DeleteFile(new ES3Settings()); // //Debug.Log("ssss" + ES3.FileExists(new ES3Settings())); // if(ES3.FileExists(new ES3Settings())) // NetDataManager.Instance.LoadData(); // // List<int> test = ES3.Load<List<int>>("test"); // //NetDataManager.Instance.LoadData(); // //Debug.Log("test" + test[0]); // //Debug.Log("test" + test[1]); // // LocalSaveManager.LoadData(); //} public void LoadLocalData(bool refresh) { if (refresh) { ES3.DeleteFile(new ES3Settings()); } if (ES3.FileExists(new ES3Settings())) { NetDataManager.Instance.LoadLocalData(); } }
public Texture2D LoadImage(string key) { if (ES3.FileExists($"{key}.png")) { return(ES3.LoadImage($"{key}.png")); } else { Debug.Log("Image not found"); return(null); } }
public void LoadSaveGameToButton(SaveGame save) { if (ES3.FileExists(save.SaveGameName + ".png")) { Texture2D texture = ES3.LoadImage(save.SaveGameName + ".png"); Sprite newSprite = Sprite.Create(texture, new Rect(0.0f, 0.0f, texture.width, texture.height), new Vector2(0.05f, 0.05f), 100f); saveImage.sprite = newSprite; } saveTitle.text = save.SaveGameName; activeSaveGame = save; }
// Use this for initialization void Start() { bounceHeight = jumpHeight * 1.3; trampolineHeight = bounceHeight * 2; tempBounceHeight = bounceHeight; direction = 1; //Start facing right as the default anim = GetComponent <Animator>(); idle = true; disableInput = false; disableInputTimer = (float)0.2; if (ES3.FileExists("SaveData.es3")) { hasDoubleJump = ES3.Load <bool>("hasDoubleJump"); hasAirDash = ES3.Load <bool>("hasAirDash"); hasDashBomb = ES3.Load <bool>("hasDashBomb"); hasGun = ES3.Load <bool>("hasGun"); } else { hasDoubleJump = false; hasAirDash = false; hasDashBomb = false; hasGun = false; Gun.SetActive(false); } if (hasDoubleJump) { GetComponent <doubleJump>().enabled = true; } if (hasAirDash) { GetComponent <airDash>().enabled = true; } if (hasDashBomb) { GetComponent <DashBomb>().enabled = true; } if (hasGun) { Gun.SetActive(true); } loadscenetemp = SceneManager.GetActiveScene().name; loadscene = "LocationData_" + loadscenetemp + ".es3"; if (ES3.FileExists(loadscene)) { transform.localPosition = ES3.Load <Vector3>("Location", loadscene); } }
public void LoadSettings() { var settings = FindObjectOfType <SettingsWindow>(); if (!ES3.FileExists(SettingsFile)) { return; } var settingsDto = ES3.Load("settings", SettingsFile); settings.RestoreState(settingsDto); }
public override void Enter() { exists.Value = ES3.FileExists(filePath.Value, GetSettings()); if (exists.Value && existsEvent != null) { Fsm.Event(existsEvent); } else if (doesNotExistEvent != null) { Fsm.Event(doesNotExistEvent); } }
public void loadGame() { if (ES3.FileExists("LocationData.es3")) { sceneName = ES3.Load <string>("Scene", "LocationData.es3"); Debug.Log(sceneName); SceneManager.LoadScene(sceneName); } else { SceneManager.LoadScene("ROOM1"); } }
public void Level12() { if (ES3.FileExists("LocationData_ROOM12.es3")) { if (ES3.FileExists("StartingLocation_ROOM12.es3")) { startingLocation = ES3.Load <Vector3>("startingLocation", "StartingLocation_ROOM12.es3"); ES3.Save <Vector3>("Location", startingLocation, "LocationData_ROOM12.es3"); } } SceneManager.LoadScene("ROOM12"); }
protected override QuestsContainerSerializationModel LoadQuestsContainerModel(string key) { if (ES3.FileExists(key) == false) { Debug.Log("Can't load from file " + key + " file does not exist. - Ignore on first load.", gameObject); return(new QuestsContainerSerializationModel()); } using (var reader = CreateReader(key)) { return(reader.Read <QuestsContainerSerializationModel>(key)); } }
// Use this for initialization void Start() { if (!ES3.FileExists("LocationData_" + SceneManager.GetActiveScene().name + ".es3")) { //Saves the coordinates for the level selector startingLocation = GetComponent <Transform>().position; ES3.Save <Vector3>("startingLocation", startingLocation, "StartingLocation_" + SceneManager.GetActiveScene().name + ".es3"); //Saves the coordinates for the campaign ES3.Save <Vector3>("Location", startingLocation, "LocationData_" + SceneManager.GetActiveScene().name + ".es3"); ES3.Save <string>("Scene", SceneManager.GetActiveScene().name, "LocationData.es3"); Debug.Log("Saved " + SceneManager.GetActiveScene().name); } }
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; } }
// Start is called before the first frame update void Awake() { string saveFilePath = string.Concat(Application.persistentDataPath, "/worlds"); if (ES3.FileExists("worlds")) { Debug.Log("Worlds file already exists"); } else { File.WriteAllText(saveFilePath, "{}"); Debug.Log("Created Worlds File"); } }