Adds screenshot previews to save files

fix
Jonathan Miller 4 years ago
parent d55df21e82
commit 6a6afc79cb

@ -1699,7 +1699,7 @@ namespace Suimono.Core
//check for visibility //check for visibility
for (int sX = 0; sX < sObjects.Count; sX++) for (int sX = 0; sX < sObjects.Count; sX++)
{ {
if (sRends[sX] == null || !sRends[sX].isVisible) continue; if (sRends == null || sX > sRends.Count || sRends[sX] == null || !sRends[sX].isVisible) continue;
if (sObjects[sX].typeIndex == 0) if (sObjects[sX].typeIndex == 0)
{ {

@ -645,7 +645,7 @@ namespace Suimono.Core
Shader.SetGlobalFloat("cmScaleY", enableCustomMesh ? cmScaleY : 1f); Shader.SetGlobalFloat("cmScaleY", enableCustomMesh ? cmScaleY : 1f);
//set scale mesh //set scale mesh
if (suimonoModuleLibrary.texNormalC && scaleMesh != null) scaleMesh.mesh = suimonoModuleLibrary.meshLevel[1]; if (suimonoModuleLibrary != null && suimonoModuleLibrary.texNormalC && scaleMesh != null) scaleMesh.mesh = suimonoModuleLibrary.meshLevel[1];
//------------------------------------------------------- //-------------------------------------------------------
@ -1009,7 +1009,7 @@ namespace Suimono.Core
if (oceanScale < 1.0f) oceanScale = 1.0f; if (oceanScale < 1.0f) oceanScale = 1.0f;
offamt = (0.4027f * oceanScale)/waveScale; offamt = (0.4027f * oceanScale)/waveScale;
spacer = (suimonoObject.transform.localScale.x * 4.0f); spacer = (suimonoObject.transform.localScale.x * 4.0f);
newPos = new Vector3(moduleObject.setCamera.position.x,suimonoObject.transform.position.y,moduleObject.setCamera.position.z); if (moduleObject.setCamera != null) newPos = new Vector3(moduleObject.setCamera.position.x,suimonoObject.transform.position.y,moduleObject.setCamera.position.z);
if (Mathf.Abs(suimonoObject.transform.position.x - newPos.x) > spacer){ if (Mathf.Abs(suimonoObject.transform.position.x - newPos.x) > spacer){
if (suimonoObject.transform.position.x > newPos.x) setScaleX -= offamt; if (suimonoObject.transform.position.x > newPos.x) setScaleX -= offamt;
if (suimonoObject.transform.position.x < newPos.x) setScaleX += offamt; if (suimonoObject.transform.position.x < newPos.x) setScaleX += offamt;

File diff suppressed because it is too large Load Diff

@ -0,0 +1,75 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using SiegeSong;
namespace SiegeSong
{
public class HeadTurn : MonoBehaviour
{
public Transform HeadBone;
public Transform RibcageBone;
public Transform LookTarget;
public CameraManager CameraManager;
public Motor Motor;
private float rotationXMin = 350.0f;
private float rotationXMax = 350.0f;
private float rotationYMin = -60.0f;
private float rotationYMax = 80.0f;
private float rotationXOffset = 0.0f;
private float rotationYOffset = 180.0f;
private float rotationXModifier = 1.0f;
private float rotationYModifier = 1.0f;
private float rotationZModifier = 1.0f;
private float previousX;
private float previousY;
private float previousZ;
void Start()
{
}
void LateUpdate()
{
if (Motor.Moving == false)
{
var direction = new Vector3(1, -1, 1);
if (LookTarget == null)
direction = new Vector3(
(CameraManager.ActiveCamera.transform.rotation.eulerAngles.x + rotationXOffset) * rotationXModifier,
(CameraManager.ActiveCamera.transform.rotation.eulerAngles.y + rotationYOffset) * rotationYModifier,
-CameraManager.ActiveCamera.transform.rotation.eulerAngles.z * rotationZModifier);
else
direction = LookTarget.position - HeadBone.position;
var resetingHeadTurn = true;
if (direction.y - rotationYOffset > rotationYMax)
{
previousY = direction.y;
resetingHeadTurn = false;
}
if (direction.y + rotationYOffset < rotationYMin)
{
previousY = direction.y;
resetingHeadTurn = false;
}
if (resetingHeadTurn)
{
direction.y = previousY;
resetingHeadTurn = false;
}
else
{
HeadBone.eulerAngles = direction;
}
}
}
}
}

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ad1fd1255c13b834fbf89aebd46db885
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

@ -77,6 +77,8 @@ namespace SiegeSong
public float AlphaStep = 0.05f; public float AlphaStep = 0.05f;
public float DefaultDisplayTime = 2.0f; public float DefaultDisplayTime = 2.0f;
public GameObject UIWrapper;
public void DisplayUIGroup(HUDGroup uiGroup, float displayTime = 2.0f) public void DisplayUIGroup(HUDGroup uiGroup, float displayTime = 2.0f)
{ {
switch (uiGroup) switch (uiGroup)

@ -1,75 +1,75 @@
using System.Collections; //using System.Collections;
using System.Collections.Generic; //using System.Collections.Generic;
using UnityEngine; //using UnityEngine;
using SiegeSong; //using SiegeSong;
namespace SiegeSong //namespace SiegeSong
{ //{
public class HeadTurn : MonoBehaviour // public class HeadTurn : MonoBehaviour
{ // {
public Transform HeadBone; // public Transform HeadBone;
public Transform RibcageBone; // public Transform RibcageBone;
public Transform LookTarget; // public Transform LookTarget;
public CameraManager CameraManager; // public CameraManager CameraManager;
public Motor Motor; // public Motor Motor;
private float rotationXMin = 350.0f; // private float rotationXMin = 350.0f;
private float rotationXMax = 350.0f; // private float rotationXMax = 350.0f;
private float rotationYMin = -60.0f; // private float rotationYMin = -60.0f;
private float rotationYMax = 80.0f; // private float rotationYMax = 80.0f;
private float rotationXOffset = 0.0f; // private float rotationXOffset = 0.0f;
private float rotationYOffset = 180.0f; // private float rotationYOffset = 180.0f;
private float rotationXModifier = 1.0f; // private float rotationXModifier = 1.0f;
private float rotationYModifier = 1.0f; // private float rotationYModifier = 1.0f;
private float rotationZModifier = 1.0f; // private float rotationZModifier = 1.0f;
private float previousX; // private float previousX;
private float previousY; // private float previousY;
private float previousZ; // private float previousZ;
void Start() // void Start()
{ // {
} // }
void LateUpdate() // void LateUpdate()
{ // {
if (Motor.Moving == false) // if (Motor.Moving == false)
{ // {
var direction = new Vector3(1, -1, 1); // var direction = new Vector3(1, -1, 1);
if (LookTarget == null) // if (LookTarget == null)
direction = new Vector3( // direction = new Vector3(
(CameraManager.ActiveCamera.transform.rotation.eulerAngles.x + rotationXOffset) * rotationXModifier, // (CameraManager.ActiveCamera.transform.rotation.eulerAngles.x + rotationXOffset) * rotationXModifier,
(CameraManager.ActiveCamera.transform.rotation.eulerAngles.y + rotationYOffset) * rotationYModifier, // (CameraManager.ActiveCamera.transform.rotation.eulerAngles.y + rotationYOffset) * rotationYModifier,
-CameraManager.ActiveCamera.transform.rotation.eulerAngles.z * rotationZModifier); // -CameraManager.ActiveCamera.transform.rotation.eulerAngles.z * rotationZModifier);
else // else
direction = LookTarget.position - HeadBone.position; // direction = LookTarget.position - HeadBone.position;
var resetingHeadTurn = true; // var resetingHeadTurn = true;
if (direction.y - rotationYOffset > rotationYMax) // if (direction.y - rotationYOffset > rotationYMax)
{ // {
previousY = direction.y; // previousY = direction.y;
resetingHeadTurn = false; // resetingHeadTurn = false;
} // }
if (direction.y + rotationYOffset < rotationYMin) // if (direction.y + rotationYOffset < rotationYMin)
{ // {
previousY = direction.y; // previousY = direction.y;
resetingHeadTurn = false; // resetingHeadTurn = false;
} // }
if (resetingHeadTurn) // if (resetingHeadTurn)
{ // {
direction.y = previousY; // direction.y = previousY;
resetingHeadTurn = false; // resetingHeadTurn = false;
} // }
else // else
{ // {
HeadBone.eulerAngles = direction; // HeadBone.eulerAngles = direction;
} // }
} // }
} // }
} // }
} //}

@ -17,13 +17,17 @@ namespace SiegeSong
public GameObject StartMenuOptions; public GameObject StartMenuOptions;
public GameObject SettingsSubMenuOptions; public GameObject SettingsSubMenuOptions;
public GameObject SaveLoadContainer; public GameObject FileMenu;
public GameObject SaveLoadListDisplay; public GameObject FileListDisplay;
public GameObject SaveLoadMetaDataTextDisplay; public Text FileMetaDataDisplay;
public GameObject SaveLoadMetaDataImageDisplay; public Image FilePreviewImageDisplay;
public MetaData[] SavedGames; public MetaData[] SavedGames;
public bool MenuActive = true;
public Sprite DefaultImagePreview;
private string pauseGamepadInput = "Start"; private string pauseGamepadInput = "Start";
private string menuVerticalGamepadInput = "D-Pad Vertical"; private string menuVerticalGamepadInput = "D-Pad Vertical";
private string menuHorizontalGamepadInput = "D-Pad Horizontal"; private string menuHorizontalGamepadInput = "D-Pad Horizontal";
@ -37,7 +41,6 @@ namespace SiegeSong
private bool oldSubmenuOpenState = false; private bool oldSubmenuOpenState = false;
private bool menuOpen = true;
private int selectedIndex; private int selectedIndex;
private int subMenuSelectedIndex; private int subMenuSelectedIndex;
@ -57,13 +60,19 @@ namespace SiegeSong
void Start() { } void Start() { }
void Update() void LateUpdate()
{ {
if (!menuOpen && Input.GetButton(pauseGamepadInput)) if (!MenuActive && Input.GetButton(pauseGamepadInput))
menuOpen = true; {
StartCoroutine(SaveFileLoader.TakeTemporaryScreenCapture());
MenuActive = true;
}
}
MenuContainer.active = menuOpen; void Update()
SaveLoadContainer.active = saveLoadSubmenuOpen; {
MenuContainer.active = MenuActive;
FileMenu.active = saveLoadSubmenuOpen;
var newConfirmState = Input.GetButton(menuConfirmGamepadInput); var newConfirmState = Input.GetButton(menuConfirmGamepadInput);
var newRejectState = Input.GetButton(menuRejectGamepadInput); var newRejectState = Input.GetButton(menuRejectGamepadInput);
@ -71,9 +80,10 @@ namespace SiegeSong
var newHorizontalState = Input.GetAxis(menuHorizontalGamepadInput); var newHorizontalState = Input.GetAxis(menuHorizontalGamepadInput);
var newSubmenuOpenState = saveLoadSubmenuOpen || settingsSubmenuOpen; var newSubmenuOpenState = saveLoadSubmenuOpen || settingsSubmenuOpen;
if (menuOpen) if (MenuActive)
{ {
Time.timeScale = 0.0f; Time.timeScale = 0.0f;
SaveFileLoader.RuntimeManager.DePopulateReferences();
var menuOptions = startMenu ? StartMenuOptions : PauseMenuOptions; var menuOptions = startMenu ? StartMenuOptions : PauseMenuOptions;
StartMenuOptions.active = startMenu; StartMenuOptions.active = startMenu;
PauseMenuOptions.active = !startMenu; PauseMenuOptions.active = !startMenu;
@ -222,6 +232,7 @@ namespace SiegeSong
SaveFileLoader.SaveGameFile(); SaveFileLoader.SaveGameFile();
else else
SaveFileLoader.SaveGameFile($"{Application.persistentDataPath.Replace("/", "\\")}\\{SaveFileLoader.DirectoryName}\\{SavedGames[subMenuSelectedIndex - 1].PlayerFullName.Replace(" ", "_")}_{SavedGames[subMenuSelectedIndex - 1].FileNameSuffix}"); SaveFileLoader.SaveGameFile($"{Application.persistentDataPath.Replace("/", "\\")}\\{SaveFileLoader.DirectoryName}\\{SavedGames[subMenuSelectedIndex - 1].PlayerFullName.Replace(" ", "_")}_{SavedGames[subMenuSelectedIndex - 1].FileNameSuffix}");
ResumeGame(); ResumeGame();
SaveFileLoader.RuntimeManager.PlayerInstance.GetComponentInChildren<NotificationManager>().Notify("Game Saved!"); SaveFileLoader.RuntimeManager.PlayerInstance.GetComponentInChildren<NotificationManager>().Notify("Game Saved!");
InitializeSaveLoadSubmenu(); InitializeSaveLoadSubmenu();
@ -230,16 +241,32 @@ namespace SiegeSong
void UpdateSaveLoadMetaDataTextDisplay() void UpdateSaveLoadMetaDataTextDisplay()
{ {
var selectedSavedGame = !(saveLoadSubmenuInSavingMode && subMenuSelectedIndex == 0) ? SavedGames[subMenuSelectedIndex - (saveLoadSubmenuInSavingMode ? 1 : 0)] : new MetaData(); var selectedSavedGame = !(saveLoadSubmenuInSavingMode && subMenuSelectedIndex == 0) ? SavedGames[subMenuSelectedIndex - (saveLoadSubmenuInSavingMode ? 1 : 0)] : new MetaData();
var filePath = $"{Application.persistentDataPath.Replace("/", "\\")}\\{SaveFileLoader.DirectoryName}\\{selectedSavedGame.PlayerFullName.Replace(" ", "_")}_{selectedSavedGame.FileNameSuffix}";
if (!saveLoadSubmenuInSavingMode) if (!saveLoadSubmenuInSavingMode)
SaveFileLoader.ActiveSaveFileLocation = $"{Application.persistentDataPath.Replace("/", "\\")}\\{SaveFileLoader.DirectoryName}\\{SavedGames[subMenuSelectedIndex].PlayerFullName.Replace(" ", "_")}_{SavedGames[subMenuSelectedIndex].FileNameSuffix}"; SaveFileLoader.ActiveSaveFileLocation = filePath;
FileMetaDataDisplay.text = $"{selectedSavedGame.PlayerFullName}\n{selectedSavedGame.PlayerLevel}\n{selectedSavedGame.PlayerActiveQuestFriendlyName}\n{selectedSavedGame.InGameDate}\n{selectedSavedGame.LastPlayedOn}";
if (System.IO.File.Exists($"{filePath}.png"))
{
var imagePreviewData = System.IO.File.ReadAllBytes($"{filePath}.png");
var imagePreviewTexture = new Texture2D(selectedSavedGame.ScreenWidth, selectedSavedGame.ScreenHeight);
imagePreviewTexture.filterMode = FilterMode.Trilinear;
imagePreviewTexture.LoadImage(imagePreviewData);
var imagePreviewSprite = Sprite.Create(imagePreviewTexture, new Rect(0, 0, selectedSavedGame.ScreenWidth, selectedSavedGame.ScreenHeight), new Vector2(0.5f, 0.0f), 1.0f);
SaveLoadMetaDataTextDisplay.GetComponent<Text>().text = $"{selectedSavedGame.PlayerFullName}\n{selectedSavedGame.PlayerLevel}\n{selectedSavedGame.PlayerActiveQuestFriendlyName}\n{selectedSavedGame.InGameDate}\n{selectedSavedGame.LastPlayedOn}"; FilePreviewImageDisplay.sprite = imagePreviewSprite;
}
else
{
FilePreviewImageDisplay.sprite = DefaultImagePreview;
}
} }
void StartNewGame() void StartNewGame()
{ {
startMenu = false; startMenu = false;
menuOpen = false; MenuActive = false;
saveLoadSubmenuOpen = false; saveLoadSubmenuOpen = false;
settingsSubmenuOpen = false; settingsSubmenuOpen = false;
@ -249,8 +276,9 @@ namespace SiegeSong
void ResumeGame() void ResumeGame()
{ {
SaveFileLoader.RuntimeManager.PopulateReferences();
startMenu = false; startMenu = false;
menuOpen = false; MenuActive = false;
saveLoadSubmenuOpen = false; saveLoadSubmenuOpen = false;
saveLoadSubmenuInSavingMode = false; saveLoadSubmenuInSavingMode = false;
selectedIndex = 0; selectedIndex = 0;
@ -266,11 +294,11 @@ namespace SiegeSong
void UpdateSaveLoadSubmenu() void UpdateSaveLoadSubmenu()
{ {
for (var i = 0; i < SaveLoadListDisplay.transform.childCount; i++) for (var i = 0; i < FileListDisplay.transform.childCount; i++)
if (SaveLoadListDisplay.transform.GetChild(i).gameObject.active) if (FileListDisplay.transform.GetChild(i).gameObject.active)
GameObject.Destroy(SaveLoadListDisplay.transform.GetChild(i).gameObject); GameObject.Destroy(FileListDisplay.transform.GetChild(i).gameObject);
else else
SaveLoadListDisplay.transform.GetChild(i).gameObject.active = false; FileListDisplay.transform.GetChild(i).gameObject.active = false;
for (var i = 0; i < SavedGames.Length + (saveLoadSubmenuInSavingMode ? 1 : 0); i++) for (var i = 0; i < SavedGames.Length + (saveLoadSubmenuInSavingMode ? 1 : 0); i++)
{ {
@ -308,7 +336,7 @@ namespace SiegeSong
} }
} }
newRowText.transform.parent = SaveLoadListDisplay.transform; newRowText.transform.parent = FileListDisplay.transform;
newRowText.transform.localScale = Vector3.one; newRowText.transform.localScale = Vector3.one;
newRowRect.position = new Vector2(-300, (newRowText.fontSize + rowSizeBuffer) * -(i + 1 + (saveLoadSubmenuInSavingMode ? 1 : 0))); newRowRect.position = new Vector2(-300, (newRowText.fontSize + rowSizeBuffer) * -(i + 1 + (saveLoadSubmenuInSavingMode ? 1 : 0)));

@ -20,8 +20,10 @@ namespace SiegeSong
public string InGameDate = "N/A"; public string InGameDate = "N/A";
public string PreviewImageBase64DataString;
public string FileNameSuffix = "00001"; public string FileNameSuffix = "00001";
public int ScreenWidth;
public int ScreenHeight;
} }
} }

@ -32,6 +32,7 @@ namespace SiegeSong
private int StartingHour = 9; private int StartingHour = 9;
private int StartingDay = 1; private int StartingDay = 1;
private int StartingYear = 1136; private int StartingYear = 1136;
private WaitForEndOfFrame waitForEndOfFrame = new WaitForEndOfFrame();
public string DirectoryName = "SaveGameData"; public string DirectoryName = "SaveGameData";
@ -78,6 +79,8 @@ namespace SiegeSong
ActiveSaveFileMeta.PlayerFullName = playerFriendlyFullName; ActiveSaveFileMeta.PlayerFullName = playerFriendlyFullName;
ActiveSaveFileMeta.PlayerLevel = actor.Stats.Level; ActiveSaveFileMeta.PlayerLevel = actor.Stats.Level;
ActiveSaveFileMeta.PlayerActiveQuestFriendlyName = "None"; ActiveSaveFileMeta.PlayerActiveQuestFriendlyName = "None";
ActiveSaveFileMeta.ScreenWidth = Screen.width;
ActiveSaveFileMeta.ScreenHeight = Screen.height;
} }
} }
ActiveSaveFile.Actors = actorList; ActiveSaveFile.Actors = actorList;
@ -95,6 +98,7 @@ namespace SiegeSong
if (!string.IsNullOrWhiteSpace(overwrittenFilePath)) if (!string.IsNullOrWhiteSpace(overwrittenFilePath))
{ {
OutputScreenCapture($"{overwrittenFilePath.Replace("/", "\\")}.png");
System.IO.File.WriteAllText($"{overwrittenFilePath.Replace("/", "\\")}.ssng", JsonUtility.ToJson(ActiveSaveFile)); System.IO.File.WriteAllText($"{overwrittenFilePath.Replace("/", "\\")}.ssng", JsonUtility.ToJson(ActiveSaveFile));
System.IO.File.WriteAllText($"{overwrittenFilePath.Replace("/", "\\")}.sngm", JsonUtility.ToJson(ActiveSaveFileMeta)); System.IO.File.WriteAllText($"{overwrittenFilePath.Replace("/", "\\")}.sngm", JsonUtility.ToJson(ActiveSaveFileMeta));
} }
@ -110,6 +114,7 @@ namespace SiegeSong
} }
ActiveSaveFileMeta.FileNameSuffix = saveFileNameSuffix; ActiveSaveFileMeta.FileNameSuffix = saveFileNameSuffix;
ActiveSaveFileLocation = $"{Application.persistentDataPath}/{DirectoryName}/{ActiveSaveFileMeta.PlayerFullName.Replace(" ", "_")}_{saveFileNameSuffix}"; ActiveSaveFileLocation = $"{Application.persistentDataPath}/{DirectoryName}/{ActiveSaveFileMeta.PlayerFullName.Replace(" ", "_")}_{saveFileNameSuffix}";
OutputScreenCapture($"{ActiveSaveFileLocation.Replace("/", "\\")}.png");
ActiveSaveFileMeta.Title = $"{playerFriendlyFullName} - Save Game {i}"; ActiveSaveFileMeta.Title = $"{playerFriendlyFullName} - Save Game {i}";
System.IO.File.WriteAllText($"{ActiveSaveFileLocation.Replace("/", "\\")}.ssng", JsonUtility.ToJson(ActiveSaveFile)); System.IO.File.WriteAllText($"{ActiveSaveFileLocation.Replace("/", "\\")}.ssng", JsonUtility.ToJson(ActiveSaveFile));
System.IO.File.WriteAllText($"{ActiveSaveFileLocation.Replace("/", "\\")}.sngm", JsonUtility.ToJson(ActiveSaveFileMeta)); System.IO.File.WriteAllText($"{ActiveSaveFileLocation.Replace("/", "\\")}.sngm", JsonUtility.ToJson(ActiveSaveFileMeta));
@ -118,7 +123,7 @@ namespace SiegeSong
public void LoadGameFile() public void LoadGameFile()
{ {
RuntimeManager.SetVolatileReferencesActiveState(false); RuntimeManager.DePopulateReferences();
InstanceManager.ClearAndUnload(); InstanceManager.ClearAndUnload();
//RuntimeManager.ClearAndUnload(); //RuntimeManager.ClearAndUnload();
@ -191,7 +196,6 @@ namespace SiegeSong
RuntimeManager.Calendar.SetDateTime(ActiveSaveFile.Minute, ActiveSaveFile.Hour, ActiveSaveFile.Day, ActiveSaveFile.Year); RuntimeManager.Calendar.SetDateTime(ActiveSaveFile.Minute, ActiveSaveFile.Hour, ActiveSaveFile.Day, ActiveSaveFile.Year);
RuntimeManager.PopulateReferences(); RuntimeManager.PopulateReferences();
RuntimeManager.SetVolatileReferencesActiveState(true);
} }
public void RunNewGameSetup() public void RunNewGameSetup()
@ -249,11 +253,44 @@ namespace SiegeSong
playerInstance.gameObject.active = true; playerInstance.gameObject.active = true;
RuntimeManager.PopulateReferences(); RuntimeManager.PopulateReferences();
RuntimeManager.Calendar.SetDateTime(StartingMinute, StartingHour, StartingDay, StartingYear); RuntimeManager.Calendar.SetDateTime(StartingMinute, StartingHour, StartingDay, StartingYear);
RuntimeManager.SetVolatileReferencesActiveState(true);
//ActorEditor.ChangeAppearance(actor); //ActorEditor.ChangeAppearance(actor);
//StoryBeatManager.BeginNewTimeline(); //StoryBeatManager.BeginNewTimeline();
} }
public void OutputScreenCapture(string savedCaptureOutputFilePath = "")
{
if (!string.IsNullOrWhiteSpace(savedCaptureOutputFilePath))
{
if (System.IO.File.Exists($"{savedCaptureOutputFilePath.Replace("/", "\\")}"))
System.IO.File.Delete($"{savedCaptureOutputFilePath.Replace("/", "\\")}");
System.IO.File.Move($"{Application.persistentDataPath.Replace("/", "\\")}\\{DirectoryName}\\_Temp.png", $"{savedCaptureOutputFilePath.Replace("/", "\\")}");
}
System.IO.File.Delete($"{Application.persistentDataPath.Replace("/", "\\")}\\{DirectoryName}\\_Temp.png");
}
public IEnumerator TakeTemporaryScreenCapture()
{
var camera = RuntimeManager.PlayerInstance.GetComponentInChildren<CameraManager>().ActiveCamera.GetComponentInChildren<Camera>();
var screenTexture = new RenderTexture(Screen.width, Screen.height, 16);
var oldTargetTexture = camera.targetTexture;
RuntimeManager.PlayerInstance.GetComponentInChildren<HUDManager>().UIWrapper.active = false;
camera.targetTexture = screenTexture;
camera.Render();
var renderedTexture = new Texture2D(Screen.width, Screen.height);
yield return waitForEndOfFrame;
renderedTexture.ReadPixels(new Rect(0, 0, Screen.width, Screen.height), 0, 0);
camera.targetTexture = oldTargetTexture;
var byteArray = renderedTexture.EncodeToPNG();
RuntimeManager.PlayerInstance.GetComponentInChildren<HUDManager>().UIWrapper.active = true;
System.IO.File.WriteAllBytes($"{Application.persistentDataPath.Replace("/", "\\")}\\{DirectoryName}\\_Temp.png", byteArray);
}
void Start() { } void Start() { }
void Update() { } void Update() { }

@ -13,13 +13,16 @@ namespace SiegeSong
public GaiaGlobal GaiaGlobalSettings; public GaiaGlobal GaiaGlobalSettings;
public Suimono.Core.SuimonoObject WaterSurface; public Suimono.Core.SuimonoObject WaterSurface;
public Suimono.Core.SuimonoModule WaterModule; public Suimono.Core.SuimonoModule WaterModule;
public EnviroSky EnviroSky; //public EnviroSky EnviroSky;
public Calendar Calendar; public Calendar Calendar;
public void PopulateReferences() public void PopulateReferences()
{ {
if (EnviroSkyMgr.instance != null) if (EnviroSkyMgr.instance != null)
{
EnviroSkyMgr.instance.Player = PlayerInstance; EnviroSkyMgr.instance.Player = PlayerInstance;
EnviroSkyMgr.instance.Camera = GetComponent<Camera>();
}
if (GaiaPlayer != null) if (GaiaPlayer != null)
{ {
@ -39,18 +42,36 @@ namespace SiegeSong
WaterModule.mainCamera = PlayerInstance.GetComponentInChildren<CameraManager>().ActiveCamera.transform.GetChild(0); WaterModule.mainCamera = PlayerInstance.GetComponentInChildren<CameraManager>().ActiveCamera.transform.GetChild(0);
WaterModule.manualCamera = PlayerInstance.GetComponentInChildren<CameraManager>().ActiveCamera.transform.GetChild(0); WaterModule.manualCamera = PlayerInstance.GetComponentInChildren<CameraManager>().ActiveCamera.transform.GetChild(0);
WaterModule.setTrack = PlayerInstance.transform; WaterModule.setTrack = PlayerInstance.transform;
WaterModule.playSounds = true;
} }
GaiaGlobalSettings.m_mainCamera = PlayerInstance.GetComponentInChildren<CameraManager>().ActiveCamera.GetComponentInChildren<Camera>();
EnviroSky.PlayerCamera = camera; if (GaiaGlobalSettings != null)
EnviroSky.Player = PlayerInstance; GaiaGlobalSettings.m_mainCamera = PlayerInstance.GetComponentInChildren<CameraManager>().ActiveCamera.GetComponentInChildren<Camera>();
} }
} }
// This will toggled the active state of anything that causes errors when the Runtime Manager doesn't have an Actor Instance for the Player, such as before Starting or Loading a save file (in the start menu) public void DePopulateReferences()
public void SetVolatileReferencesActiveState(bool active)
{ {
WaterModule.gameObject.active = active; if (EnviroSkyMgr.instance != null)
WaterSurface.gameObject.active = active; {
EnviroSkyMgr.instance.Player = null;
EnviroSkyMgr.instance.Camera = null;
}
if (GaiaPlayer != null)
GaiaPlayer = null;
if (WaterModule != null)
{
WaterModule.setCamera = null;
WaterModule.mainCamera = null;
WaterModule.manualCamera = null;
WaterModule.setTrack = null;
WaterModule.playSounds = false;
}
GaiaGlobalSettings.m_mainCamera = null;
} }
void Start() { } void Start() { }

@ -1 +0,0 @@
{"Title":"Human Being - Save Game 1","PlayerFullName":"Human Being","PlayerLevel":1,"PlayerActiveQuestFriendlyName":"None","LastPlayedOn":"08:42PM 24/10/2022","InGameDate":"00:48PM 1/00/1136","PreviewImageBase64DataString":"","FileNameSuffix":"00001"}

@ -1 +0,0 @@
{"Actors":[{"ID":0,"InstanceID":"CAAAA","LocationX":114.89908599853516,"LocationY":61.764015197753909,"LocationZ":289.1904296875,"RotationX":-1.4622918154127974e-10,"RotationY":266.3935546875,"RotationZ":-8.537744520253909e-7,"InventoryItemIDs":[],"InventoryItemQuantities":[],"ActiveInventoryItemIDs":[],"SpeciesKey":"_Human","FirstName":"Human","LastName":"Being","Alive":true,"IsPlayer":true,"HairstyleID":0,"FacialHairID":0,"FacialDetailID":0,"HairColorR":0,"HairColorG":0,"HairColorB":0,"HairColorA":0,"Recoil":false,"NoiseBeingProduced":2,"VisualStealthRating":0,"StaminaRecoveryRate":0.20000000298023225,"MagicRecoveryRate":0.20000000298023225,"HealthRecoveryRate":0.20000000298023225,"MaxHealth":100,"MaxStamina":100,"MaxMagic":100,"Health":100.0,"Stamina":100.0,"Magic":100.0,"SprintCost":2,"InCombat":false,"Staggered":false,"OffBalance":false,"Fallen":false,"Invincible":false,"Hunger":0,"Thirst":0,"Exhaustion":0,"Heat":0,"CarryWeight":0,"MaxCarryWeight":100,"Gold":0,"Level":1,"Experience":0,"ExperienceToNextLevel":1000,"CanHealH":true,"CanHealS":true,"CanHealM":true,"StaminaTemporarilyRemovedIncrements":[],"MagicTemporarilyRemovedIncrements":[],"HealthTemporarilyRemovedIncrements":[]}],"Year":1136,"Day":1,"Hour":12,"Minute":48}

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save