public void SaveGameFile() { string filePath = FileManager.savPath + "savData/gameFiles/" + activeGameFileName + ".txt"; activeGameFile.chapterName = activeChapterFile; activeGameFile.chapterProgress = chapterProgress; activeGameFile.cachedLastSpeaker = cachedLastSpeaker; activeGameFile.currentTextSystemSpeakerNameText = DialogueSystem.instance.speakerNameText.text; activeGameFile.currentTextSystemDisplayText = DialogueSystem.instance.speechText.text; //get all the characters and save their stats. activeGameFile.charactersInScene.Clear(); for (int i = 0; i < CharacterManager.instance.characters.Count; i++) { Character character = CharacterManager.instance.characters[i]; GAMEFILE.CHARACTERDATA data = new GAMEFILE.CHARACTERDATA(character); activeGameFile.charactersInScene.Add(data); } //save the layers to disk BCFC b = BCFC.instance; activeGameFile.background = b.background.activeImage != null ? b.background.activeImage.texture : null; activeGameFile.cinematic = b.cinematic.activeImage != null ? b.cinematic.activeImage.texture : null; activeGameFile.foreground = b.foreground.activeImage != null ? b.foreground.activeImage.texture : null; //save the music to disk activeGameFile.music = AudioManager.activeSong != null ? AudioManager.activeSong.clip : null; //save the ambiance to disk if there is any playing. activeGameFile.ambiance = AudioManager.activeAmbianceClips; //save a preview image (screenshot) to be viewed from the save load screen string screenShotPath = FileManager.savPath + "savData/gameFiles/" + activeGameFileName + ".png"; if (FileManager.TryCreateDirectoryFromPath(screenShotPath + ".png")) { GAMEFILE.activeFile.previewImage = ScreenCapture.CaptureScreenshotAsTexture(); byte[] textureData = activeGameFile.previewImage.EncodeToPNG(); FileManager.SaveComposingBytes(screenShotPath, textureData); } //save the data and time this file was created or modified activeGameFile.modificationDate = System.DateTime.Now.ToString(); if (encryptGameFile) { FileManager.SaveEncryptedJSON(filePath, activeGameFile, keys); } else { FileManager.SaveJSON(filePath, activeGameFile); } }
public void SaveGameFile() { string filePath = FileManager.savPath + "savData/gameFiles/" + activeGameFileName + ".txt"; activeGameFile.chapterName = activeChapterFile; activeGameFile.chapterProgress = chapterProgress + 1; //DANGER!!!!! RETURN TO THIS AND FIX LATER IF NEEDED?! STOPGAP MEASURE! AHHHHHHHHH!; activeGameFile.cachedLastSpeaker = cachedLastSpeaker; // AAAAAAAAAAAH! THIS IS ALSO PANICY AND DUMB, AND SHOULD BE FIXED, BUT DOES SOLVE PROBLEM OF REMOVING PEOPLE FROM SCREEN. /* * activeGameFile.currentTextSystemSpeakerNameText = DialogueSystem.instance.speakerNameText.text; * activeGameFile.currentTextSystemDisplayText = DialogueSystem.instance.speechText.text; * //get all the characters and save their stats. * activeGameFile.charactersInScene.Clear(); * for (int i = 0; i < CharacterManager.instance.characters.Count; i++) * { * Character character = CharacterManager.instance.characters[i]; * GAMEFILE.CHARACTERDATA data = new GAMEFILE.CHARACTERDATA(character); * activeGameFile.charactersInScene.Add(data); * } */ //save the layers to disk BCFC b = BCFC.instance; activeGameFile.background = b.background.activeImage != null ? b.background.activeImage.texture : null; activeGameFile.cinematic = b.cinematic.activeImage != null ? b.cinematic.activeImage.texture : null; activeGameFile.foreground = b.foreground.activeImage != null ? b.foreground.activeImage.texture : null; //save the music to disk activeGameFile.music = AudioManager.activeSong != null ? AudioManager.activeSong.clip : null; //save CACHE to disk activeGameFile.cache = CACHE.tempVals; FileManager.SaveJSON(filePath, activeGameFile); }
// public MovieTexture mov; // Start is called before the first frame update void Start() { controller = BCFC.instance; }
void Awake() { instance = this; }