private void PerformSaveOrLoad() { ClearAllEvents(); if (saveHandling == SaveHandling.ContinueFromLastSave || saveHandling == SaveHandling.LoadGame) { EventManager.OnFinishLoading += OnComplete; EventManager.OnFailLoading += OnComplete; } else if (saveHandling == SaveHandling.OverwriteExistingSave || saveHandling == SaveHandling.SaveNewGame) { EventManager.OnFinishSaving += OnComplete; EventManager.OnFailSaving += OnComplete; } if ((saveHandling == SaveHandling.LoadGame || saveHandling == SaveHandling.ContinueFromLastSave) && doSelectiveLoad) { KickStarter.saveSystem.SetSelectiveLoadOptions(selectiveLoad); } string newSaveLabel = ""; if (customLabel && ((updateLabel && saveHandling == SaveHandling.OverwriteExistingSave) || saveHandling == AC.SaveHandling.SaveNewGame)) { if (selectSaveType != SelectSaveType.Autosave) { GVar gVar = GlobalVariables.GetVariable(varID); if (gVar != null) { newSaveLabel = gVar.GetValue(Options.GetLanguage()); } else { ACDebug.LogWarning("Could not " + saveHandling.ToString() + " - no variable found."); return; } } } int i = Mathf.Max(0, saveIndex); if (saveHandling == SaveHandling.ContinueFromLastSave) { SaveSystem.ContinueGame(); return; } if (saveHandling == SaveHandling.LoadGame || saveHandling == SaveHandling.OverwriteExistingSave) { if (selectSaveType == SelectSaveType.Autosave) { if (saveHandling == SaveHandling.LoadGame) { SaveSystem.LoadAutoSave(); return; } else { if (PlayerMenus.IsSavingLocked(this)) { ACDebug.LogWarning("Cannot save at this time - either blocking ActionLists, a Conversation is active, or saving has been manually locked."); OnComplete(); } else { SaveSystem.SaveAutoSave(); } return; } } else if (selectSaveType == SelectSaveType.SlotIndexFromVariable) { GVar gVar = GlobalVariables.GetVariable(slotVarID); if (gVar != null) { i = gVar.val; } else { ACDebug.LogWarning("Could not get save slot index - no variable found."); return; } } } if (menuName != "" && elementName != "") { MenuElement menuElement = PlayerMenus.GetElementWithName(menuName, elementName); if (menuElement != null && menuElement is MenuSavesList) { MenuSavesList menuSavesList = (MenuSavesList)menuElement; i += menuSavesList.GetOffset(); } else { ACDebug.LogWarning("Cannot find ProfilesList element '" + elementName + "' in Menu '" + menuName + "'."); } } else { ACDebug.LogWarning("No SavesList element referenced when trying to find slot slot " + i.ToString()); } if (saveHandling == SaveHandling.LoadGame) { SaveSystem.LoadGame(i, -1, false); } else if (saveHandling == SaveHandling.OverwriteExistingSave || saveHandling == SaveHandling.SaveNewGame) { if (PlayerMenus.IsSavingLocked(this)) { ACDebug.LogWarning("Cannot save at this time - either blocking ActionLists, a Conversation is active, or saving has been manually locked."); OnComplete(); } else { if (saveHandling == SaveHandling.OverwriteExistingSave) { SaveSystem.SaveGame(i, -1, false, updateLabel, newSaveLabel); } else if (saveHandling == SaveHandling.SaveNewGame) { SaveSystem.SaveNewGame(updateLabel, newSaveLabel); } } } }
override public float Run() { string newSaveLabel = ""; if (customLabel && ((updateLabel && saveHandling == SaveHandling.OverwriteExistingSave) || saveHandling == AC.SaveHandling.SaveNewGame)) { if (selectSaveType != SelectSaveType.Autosave) { GVar gVar = GlobalVariables.GetVariable(varID); if (gVar != null) { newSaveLabel = gVar.textVal; } else { Debug.LogWarning("Could not " + saveHandling.ToString() + " - no variable found."); return(0f); } } } int i = Mathf.Max(0, saveIndex); if (saveHandling == SaveHandling.ContinueFromLastSave) { SaveSystem.ContinueGame(); return(0f); } if (saveHandling == SaveHandling.LoadGame || saveHandling == SaveHandling.OverwriteExistingSave) { if (selectSaveType == SelectSaveType.Autosave) { if (saveHandling == SaveHandling.LoadGame) { SaveSystem.LoadAutoSave(); return(0f); } else { if (!PlayerMenus.IsSavingLocked(this)) { SaveSystem.SaveAutoSave(); } else { Debug.LogWarning("Cannot save at this time - either blocking ActionLists, a Converation is active, or saving has been manually locked."); } return(0f); } } else if (selectSaveType == SelectSaveType.SlotIndexFromVariable) { GVar gVar = GlobalVariables.GetVariable(slotVarID); if (gVar != null) { i = gVar.val; } else { Debug.LogWarning("Could not create profile - no variable found."); return(0f); } } } if (menuName != "" && elementName != "") { MenuElement menuElement = PlayerMenus.GetElementWithName(menuName, elementName); if (menuElement != null && menuElement is MenuSavesList) { MenuSavesList menuSavesList = (MenuSavesList)menuElement; i += menuSavesList.GetOffset(); } else { Debug.LogWarning("Cannot find ProfilesList element '" + elementName + "' in Menu '" + menuName + "'."); } } else { Debug.LogWarning("No SavesList element referenced when trying to find slot slot " + i.ToString()); } if (saveHandling == SaveHandling.LoadGame) { SaveSystem.LoadGame(i, -1, false); } else if (saveHandling == SaveHandling.OverwriteExistingSave || saveHandling == SaveHandling.SaveNewGame) { if (!PlayerMenus.IsSavingLocked(this)) { if (saveHandling == SaveHandling.OverwriteExistingSave) { SaveSystem.SaveGame(i, -1, false, updateLabel, newSaveLabel); } else if (saveHandling == SaveHandling.SaveNewGame) { SaveSystem.SaveNewGame(updateLabel, newSaveLabel); } } else { Debug.LogWarning("Cannot save at this time - either blocking ActionLists, a Converation is active, or saving has been manually locked."); } } return(0f); }
protected void PerformSaveOrLoad() { ClearAllEvents(); if (saveHandling == SaveHandling.ContinueFromLastSave || saveHandling == SaveHandling.LoadGame) { EventManager.OnFinishLoading += OnFinishLoading; EventManager.OnFailLoading += OnFail; } else if (saveHandling == SaveHandling.OverwriteExistingSave || saveHandling == SaveHandling.SaveNewGame) { EventManager.OnFinishSaving += OnFinishSaving; EventManager.OnFailSaving += OnFail; } if ((saveHandling == SaveHandling.LoadGame || saveHandling == SaveHandling.ContinueFromLastSave) && doSelectiveLoad) { KickStarter.saveSystem.SetSelectiveLoadOptions(selectiveLoad); } string newSaveLabel = string.Empty; if (customLabel && ((updateLabel && saveHandling == SaveHandling.OverwriteExistingSave) || saveHandling == AC.SaveHandling.SaveNewGame)) { if (selectSaveType != SelectSaveType.Autosave) { GVar gVar = GlobalVariables.GetVariable(varID); if (gVar != null) { newSaveLabel = gVar.GetValue(Options.GetLanguage()); } else { LogWarning("Could not " + saveHandling.ToString() + " - no variable found."); return; } } } int i = saveIndex; if (saveHandling == SaveHandling.ContinueFromLastSave) { SaveSystem.ContinueGame(); return; } if (saveHandling == SaveHandling.LoadGame || saveHandling == SaveHandling.OverwriteExistingSave) { if (selectSaveType == SelectSaveType.Autosave) { if (saveHandling == SaveHandling.LoadGame) { SaveSystem.LoadAutoSave(); return; } else { if (PlayerMenus.IsSavingLocked(this, true)) { OnComplete(); } else { SaveSystem.SaveAutoSave(); } return; } } else if (selectSaveType == SelectSaveType.SlotIndexFromVariable) { GVar gVar = GlobalVariables.GetVariable(slotVarID); if (gVar != null) { i = gVar.IntegerValue; } else { LogWarning("Could not get save slot index - no variable found."); return; } } } if (selectSaveType != SelectSaveType.Autosave && selectSaveType != SelectSaveType.SetSaveID) { if (!string.IsNullOrEmpty(menuName) && !string.IsNullOrEmpty(elementName)) { MenuElement menuElement = PlayerMenus.GetElementWithName(menuName, elementName); if (menuElement != null && menuElement is MenuSavesList) { MenuSavesList menuSavesList = (MenuSavesList)menuElement; i += menuSavesList.GetOffset(); } else { LogWarning("Cannot find ProfilesList element '" + elementName + "' in Menu '" + menuName + "'."); } } else { LogWarning("No SavesList element referenced when trying to find slot slot " + i.ToString()); } } if (saveHandling == SaveHandling.LoadGame) { if (selectSaveType == SelectSaveType.SetSaveID) { SaveSystem.LoadGame(i); } else { SaveSystem.LoadGame(i, -1, false); } } else if (saveHandling == SaveHandling.OverwriteExistingSave || saveHandling == SaveHandling.SaveNewGame) { if (PlayerMenus.IsSavingLocked(this, true)) { OnComplete(); } else { if (saveHandling == SaveHandling.OverwriteExistingSave) { if (selectSaveType == SelectSaveType.SetSaveID) { SaveSystem.SaveGame(0, i, true, updateLabel, newSaveLabel); } else { SaveSystem.SaveGame(i, -1, false, updateLabel, newSaveLabel); } } else if (saveHandling == SaveHandling.SaveNewGame) { SaveSystem.SaveNewGame(updateLabel, newSaveLabel); } } } }
override public float Run() { string newSaveLabel = ""; if (manageSaveType == ManageSaveType.RenameSave) { GVar gVar = GlobalVariables.GetVariable(varID); if (gVar != null) { newSaveLabel = gVar.textVal; } else { ACDebug.LogWarning("Could not " + manageSaveType.ToString() + " - no variable found."); return(0f); } } int i = Mathf.Max(0, saveIndex); if (selectSaveType == SelectSaveType.SlotIndexFromVariable) { GVar gVar = GlobalVariables.GetVariable(slotVarID); if (gVar != null) { i = gVar.val; } else { ACDebug.LogWarning("Could not rename save - no variable found."); return(0f); } } if (menuName != "" && elementName != "") { MenuElement menuElement = PlayerMenus.GetElementWithName(menuName, elementName); if (menuElement != null && menuElement is MenuSavesList) { MenuSavesList menuSavesList = (MenuSavesList)menuElement; i += menuSavesList.GetOffset(); } else { ACDebug.LogWarning("Cannot find SavesList element '" + elementName + "' in Menu '" + menuName + "'."); } } else { ACDebug.LogWarning("No SavesList element referenced when trying to find save slot " + i.ToString()); } if (manageSaveType == ManageSaveType.DeleteSave) { KickStarter.saveSystem.DeleteSave(i, -1, false); } else if (manageSaveType == ManageSaveType.RenameSave) { KickStarter.saveSystem.RenameSave(newSaveLabel, i); } return(0f); }
public override float Run() { string newSaveLabel = string.Empty; if (manageSaveType == ManageSaveType.RenameSave) { GVar gVar = GlobalVariables.GetVariable(varID); if (gVar != null) { newSaveLabel = gVar.TextValue; } else { LogWarning("Could not " + manageSaveType.ToString() + " - no variable found."); return(0f); } } int i = Mathf.Max(0, saveIndex); if (selectSaveType == SelectSaveType.SlotIndexFromVariable) { GVar gVar = GlobalVariables.GetVariable(slotVarID); if (gVar != null) { i = gVar.IntegerValue; } else { LogWarning("Could not rename save - no variable found."); return(0f); } } else if (selectSaveType == SelectSaveType.Autosave) { if (manageSaveType == ManageSaveType.DeleteSave) { SaveSystem.DeleteSave(0); } else if (manageSaveType == ManageSaveType.RenameSave) { LogWarning("The Autosave file cannot be renamed."); return(0f); } } if (selectSaveType != SelectSaveType.Autosave && selectSaveType != SelectSaveType.SetSaveID) { if (!string.IsNullOrEmpty(menuName) && !string.IsNullOrEmpty(elementName)) { MenuElement menuElement = PlayerMenus.GetElementWithName(menuName, elementName); if (menuElement != null && menuElement is MenuSavesList) { MenuSavesList menuSavesList = (MenuSavesList)menuElement; i += menuSavesList.GetOffset(); } else { LogWarning("Cannot find SavesList element '" + elementName + "' in Menu '" + menuName + "'."); } } else { LogWarning("No SavesList element referenced when trying to find save slot " + i.ToString()); } } if (manageSaveType == ManageSaveType.DeleteSave) { if (selectSaveType == SelectSaveType.SetSaveID) { SaveSystem.DeleteSave(i); } else { KickStarter.saveSystem.DeleteSave(i, -1, false); } } else if (manageSaveType == ManageSaveType.RenameSave) { if (selectSaveType == SelectSaveType.SetSaveID) { KickStarter.saveSystem.RenameSaveByID(newSaveLabel, i); } else { KickStarter.saveSystem.RenameSave(newSaveLabel, i); } } return(0f); }