Arma Reforger Script API
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
SCR_SaveManagerCore Interface Reference

Manager of external session save files. More...

Inheritance diagram for SCR_SaveManagerCore:
[legend]

Public Member Functions

void UploadToWorkshop (string fileName)
 
string FindFileNameById (string id)
 Find name of save file base on provided id.
 
void LoadOnInit ()
 
override void OnUpdate (float timeSlice)
 
override void OnGameStart ()
 
override void OnGameEnd ()
 
Actions
bool Save (ESaveType type, string customName=string.Empty, WorldSaveManifest manifest=null, WorldSaveItem usedSave=null)
 Create a save of given type.
 
bool OverrideCurrentSave (ESaveType type)
 Create the current save of given type.
 
bool Load (string fileName)
 Load the given save file.
 
bool RestartAndLoad ()
 Restart the current world and load the latest save.
 
bool RestartAndLoad (ESaveType type, string customName=string.Empty)
 Restart the current world and load save file of given type.
 
bool RestartAndLoad (string fileName)
 Restart the current world and load given save file.
 
bool Delete (ESaveType type, string customName=string.Empty)
 Delete a save file.
 
bool Delete (string fileName)
 Delete a save file.
 
bool FileExists (ESaveType type, string customName=string.Empty)
 Check if file of given type exists.
 
bool FileExists (string fileName)
 Check if file exists.
 
bool CanSaveToCloud ()
 
SCR_MetaStruct GetMeta (string fileName)
 Open file name and read its meta header.
 
Lists
int GetLocalSaveFiles (out notnull array< string > outLocalSaves, ESaveType saveTypes, bool currentMissionOnly)
 Get save file names of given save type.
 
int GetLocalSaveFiles (out notnull array< string > outLocalSaves, ESaveType saveTypes, string missionFileName=string.Empty)
 Get save file names of given save type.
 
Save Types
bool CanSave (ESaveType type)
 Check if saving is allowed at this moment.
 
void SetStruct (ESaveType type, SCR_MissionStruct struct)
 Assign JSON struct to specific save type.
 
void Log (ESaveType type)
 Print out JSON struct of given save type.
 
string GetMissionFileName (string fileName)
 Extract mission file name from save file name.
 
string GetCustomName (string fileName)
 Extract custom name from save file name.
 
SCR_UIInfo GetSaveTypeInfo (string fileName)
 Get UI info representing save of type defined by the file name.
 
File Name To Load
bool SetFileNameToLoad (SCR_MissionHeader missionHeader)
 Set the latest save file of given mission as the save that should be loaded upon mission start.
 
bool SetFileNameToLoad (string fileName)
 Set which save file should be loaded upon mission start.
 
void ResetFileNameToLoad ()
 Remove save file name marked to be loaded after mission start.
 
bool FindFileNameToLoad (out string fileNameToLoad)
 Check which save file should be loaded after mission start.
 
Latest Save
void SetCurrentMissionLatestSave (string saveFileName)
 Set the latest save for the currently running mission.
 
void RemoveCurrentMissionLatestSave ()
 Remove the latest save for the currently running mission.
 
bool FindCurrentMissionLatestSave (out string outSaveFileName)
 Find the latest save for the currently running mission.
 
void SetLatestSave (string missionFileName, string saveFileName)
 Set the latest save for the given mission.
 
void RemoveLatestSave (string missionFileName)
 Remove the latest save for the given mission.
 
bool FindLatestSave (string missionFileName, out string outSaveFileName)
 Find the latest save for the given mission.
 
bool FindLatestSave (SCR_MissionHeader missionHeader, out string outSaveFileName)
 Set the latest save for the given mission.
 
bool HasLatestSave (string missionFileName)
 Check if the mission has a latest save.
 
bool HasLatestSave (SCR_MissionHeader missionHeader)
 Check if the mission has a latest save.
 
Invokers
ScriptInvoker_SaveManagerCore GetOnSaved ()
 
ScriptInvoker_SaveManagerCore GetOnSaveFailed ()
 
ScriptInvoker_SaveManagerCore GetOnLoaded ()
 
ScriptInvoker_SaveManagerCore GetOnDeleted ()
 
ScriptInvokerString GetOnLatestSave ()
 
SCR_ServerSaveRequestCallback GetUploadCallback ()
 

Protected Member Functions

bool IsDownloaded (string fileName)
 
SCR_DSSessionCallback FindCallback (ESaveType type)
 
SCR_DSSessionCallback FindCallback (string fileName)
 
void InitDebugMissionHeader (out SCR_MissionHeader missionHeader)
 
void OnGameStorageInitialize ()
 

Protected Attributes

ref array< ref SCR_DSSessionCallbackm_aCallbacks
 
ref SCR_LatestSaveDSSessionCallback m_LatestSaveCallback
 
ref SCR_DSSessionCallbackSessionStorage m_SessionStorageCallback
 
string m_sMissionSaveFileName
 
ref SCR_MissionHeader m_WorkbenchMissionHeader
 
ref ScriptInvoker_SaveManagerCore m_OnSaved = new ScriptInvoker_SaveManagerCore()
 
ref ScriptInvoker_SaveManagerCore m_OnSaveFailed = new ScriptInvoker_SaveManagerCore()
 
ref ScriptInvoker_SaveManagerCore m_OnLoaded = new ScriptInvoker_SaveManagerCore()
 
ref ScriptInvoker_SaveManagerCore m_OnDeleted = new ScriptInvoker_SaveManagerCore()
 
ref ScriptInvokerString m_OnLatestSave = new ScriptInvokerString()
 
bool m_bLoadedOnInit
 
bool m_bDebugDelete
 
ref SCR_ServerSaveRequestCallback m_UploadCallback
 

Static Protected Attributes

const string ITEM_SAVE_POSTFIX = ".save_"
 
const string GAME_SESSION_STORAGE_FILE_NAME_TO_LOAD = "SCR_SaveFileManager_FileNameToLoad"
 
const string GAME_SESSION_STORAGE_USED_CLI = "SCR_SaveFileManager_UsedCLI"
 
const string CLI_PARAM = "loadSessionSave"
 

Detailed Description

Manager of external session save files.

Member Function Documentation

◆ CanSave()

bool SCR_SaveManagerCore.CanSave ( ESaveType  type)

Check if saving is allowed at this moment.

Parameters
typeSave type
Returns
True if saving is allowed

◆ CanSaveToCloud()

bool SCR_SaveManagerCore.CanSaveToCloud ( )
Returns
True if save files can be saved online.

◆ Delete() [1/2]

bool SCR_SaveManagerCore.Delete ( ESaveType  type,
string  customName = string::Empty 
)

Delete a save file.

Parameters
fileNameMission save file name
customNameCustom addition to file name (optional; applicable only to some save types)
Returns
True if the file was deleted

◆ Delete() [2/2]

bool SCR_SaveManagerCore.Delete ( string  fileName)

Delete a save file.

Parameters
fileNameFull save file name
Returns
True if the file was deleted

◆ FileExists() [1/2]

bool SCR_SaveManagerCore.FileExists ( ESaveType  type,
string  customName = string::Empty 
)

Check if file of given type exists.

Parameters
typeSave type
customNameCustom addition to file name (optional; applicable only to some save types)
Returns
True if the file exists

◆ FileExists() [2/2]

bool SCR_SaveManagerCore.FileExists ( string  fileName)

Check if file exists.

Parameters
fileNameFull save file name
Returns
True if the file exists

◆ FindCallback() [1/2]

SCR_DSSessionCallback SCR_SaveManagerCore.FindCallback ( ESaveType  type)
protected

◆ FindCallback() [2/2]

SCR_DSSessionCallback SCR_SaveManagerCore.FindCallback ( string  fileName)
protected

◆ FindCurrentMissionLatestSave()

bool SCR_SaveManagerCore.FindCurrentMissionLatestSave ( out string  outSaveFileName)

Find the latest save for the currently running mission.

Parameters
[out]outSaveFileNameString to be filled with the latest save file name

◆ FindFileNameById()

string SCR_SaveManagerCore.FindFileNameById ( string  id)

Find name of save file base on provided id.

Parameters
idof world save item save is coming from
Returns
name of file cointaining id if any is found

◆ FindFileNameToLoad()

bool SCR_SaveManagerCore.FindFileNameToLoad ( out string  fileNameToLoad)

Check which save file should be loaded after mission start.

Parameters
[out]fileNameToLoadSave file name
Returns
True if some save file is marked to be loaded after mission start

◆ FindLatestSave() [1/2]

bool SCR_SaveManagerCore.FindLatestSave ( SCR_MissionHeader  missionHeader,
out string  outSaveFileName 
)

Set the latest save for the given mission.

Parameters
missionFileNameMission header
saveFileNameSave file name

◆ FindLatestSave() [2/2]

bool SCR_SaveManagerCore.FindLatestSave ( string  missionFileName,
out string  outSaveFileName 
)

Find the latest save for the given mission.

Parameters
missionFileNameMission save file name
saveFileNameSave file name

◆ GetCustomName()

string SCR_SaveManagerCore.GetCustomName ( string  fileName)

Extract custom name from save file name.

Parameters
fileNameSave file name
Returns
Custom name

◆ GetLocalSaveFiles() [1/2]

int SCR_SaveManagerCore.GetLocalSaveFiles ( out notnull array< string >  outLocalSaves,
ESaveType  saveTypes,
bool  currentMissionOnly 
)

Get save file names of given save type.

Parameters
[out]outLocalSavesArray to be filled with save file names
typeSave type
currentMissionOnlyWhen true, return onlyu save files belonging to currently loaded mission
Returns
Number of save file names

◆ GetLocalSaveFiles() [2/2]

int SCR_SaveManagerCore.GetLocalSaveFiles ( out notnull array< string >  outLocalSaves,
ESaveType  saveTypes,
string  missionFileName = string::Empty 
)

Get save file names of given save type.

Parameters
[out]outLocalSavesArray to be filled with save file names
typeSave type
missionFileNameWhen not an empty string, return only save files belonging to this mission
Returns
Number of save file names

◆ GetMeta()

SCR_MetaStruct SCR_SaveManagerCore.GetMeta ( string  fileName)

Open file name and read its meta header.

Parameters
Savefile name
Returns
Meta header

◆ GetMissionFileName()

string SCR_SaveManagerCore.GetMissionFileName ( string  fileName)

Extract mission file name from save file name.

Parameters
fileNameSave file name
Returns
Mission file name

◆ GetOnDeleted()

ScriptInvoker_SaveManagerCore SCR_SaveManagerCore.GetOnDeleted ( )
Returns
Invoker called when a save file is deleted.

◆ GetOnLatestSave()

ScriptInvokerString SCR_SaveManagerCore.GetOnLatestSave ( )
Returns
Invoker called when a record about the latest save is stored.

◆ GetOnLoaded()

ScriptInvoker_SaveManagerCore SCR_SaveManagerCore.GetOnLoaded ( )
Returns
Invoker called when the game is successfully loaded.

◆ GetOnSaved()

ScriptInvoker_SaveManagerCore SCR_SaveManagerCore.GetOnSaved ( )
Returns
Invoker called when the game is successfully saved.

◆ GetOnSaveFailed()

ScriptInvoker_SaveManagerCore SCR_SaveManagerCore.GetOnSaveFailed ( )
Returns
Invoker called when the game is unsuccessfully saved.

◆ GetSaveTypeInfo()

SCR_UIInfo SCR_SaveManagerCore.GetSaveTypeInfo ( string  fileName)

Get UI info representing save of type defined by the file name.

Parameters
fileNameSave file name
Returns
UI info

◆ GetUploadCallback()

SCR_ServerSaveRequestCallback SCR_SaveManagerCore.GetUploadCallback ( )

◆ HasLatestSave() [1/2]

bool SCR_SaveManagerCore.HasLatestSave ( SCR_MissionHeader  missionHeader)

Check if the mission has a latest save.

Parameters
missionFileNameMission header

◆ HasLatestSave() [2/2]

bool SCR_SaveManagerCore.HasLatestSave ( string  missionFileName)

Check if the mission has a latest save.

Parameters
missionFileNameMission save file name

◆ InitDebugMissionHeader()

void SCR_SaveManagerCore.InitDebugMissionHeader ( out SCR_MissionHeader  missionHeader)
protected

◆ IsDownloaded()

bool SCR_SaveManagerCore.IsDownloaded ( string  fileName)
protected

◆ Load()

bool SCR_SaveManagerCore.Load ( string  fileName)

Load the given save file.

This will "insert" it straight to running session, which can lead to issues (especially when loading the save file multiple times). Consider restarting the world first.

Parameters
Savefile name
Returns
True if load request was initiated

◆ LoadOnInit()

void SCR_SaveManagerCore.LoadOnInit ( )
Returns
Load a save file upon mission start.

◆ Log()

void SCR_SaveManagerCore.Log ( ESaveType  type)

Print out JSON struct of given save type.

Parameters
typeSave type

◆ OnGameEnd()

override void SCR_SaveManagerCore.OnGameEnd ( )

◆ OnGameStart()

override void SCR_SaveManagerCore.OnGameStart ( )

◆ OnGameStorageInitialize()

void SCR_SaveManagerCore.OnGameStorageInitialize ( )
protected

◆ OnUpdate()

override void SCR_SaveManagerCore.OnUpdate ( float  timeSlice)

◆ OverrideCurrentSave()

bool SCR_SaveManagerCore.OverrideCurrentSave ( ESaveType  type)

Create the current save of given type.

Parameters
typeSave type
Returns
True if save request was initiated

◆ RemoveCurrentMissionLatestSave()

void SCR_SaveManagerCore.RemoveCurrentMissionLatestSave ( )

Remove the latest save for the currently running mission.

Parameters
saveFileNameSave file name

◆ RemoveLatestSave()

void SCR_SaveManagerCore.RemoveLatestSave ( string  missionFileName)

Remove the latest save for the given mission.

Parameters
missionFileNameMission save file name
saveFileNameSave file name

◆ ResetFileNameToLoad()

void SCR_SaveManagerCore.ResetFileNameToLoad ( )

Remove save file name marked to be loaded after mission start.

Does not remove the file itself.

◆ RestartAndLoad() [1/3]

bool SCR_SaveManagerCore.RestartAndLoad ( )

Restart the current world and load the latest save.

Returns
True if load request was initiated

◆ RestartAndLoad() [2/3]

bool SCR_SaveManagerCore.RestartAndLoad ( ESaveType  type,
string  customName = string::Empty 
)

Restart the current world and load save file of given type.

Parameters
typeSave type
customNameCustom addition to file name (optional; applicable only to some save types)
Returns
True if load request was initiated

◆ RestartAndLoad() [3/3]

bool SCR_SaveManagerCore.RestartAndLoad ( string  fileName)

Restart the current world and load given save file.

Parameters
Savefile name
Returns
True if load request was initiated

◆ Save()

bool SCR_SaveManagerCore.Save ( ESaveType  type,
string  customName = string::Empty,
WorldSaveManifest  manifest = null,
WorldSaveItem  usedSave = null 
)

Create a save of given type.

Parameters
typeSave type
customNameCustom addition to file name (optional; applicable only to some save types)
Returns
True if save request was initiated

◆ SetCurrentMissionLatestSave()

void SCR_SaveManagerCore.SetCurrentMissionLatestSave ( string  saveFileName)

Set the latest save for the currently running mission.

Parameters
saveFileNameSave file name

◆ SetFileNameToLoad() [1/2]

bool SCR_SaveManagerCore.SetFileNameToLoad ( SCR_MissionHeader  missionHeader)

Set the latest save file of given mission as the save that should be loaded upon mission start.

Parameters
missionHeaderMission header
Returns
True if save file exists and was marked for load

◆ SetFileNameToLoad() [2/2]

bool SCR_SaveManagerCore.SetFileNameToLoad ( string  fileName)

Set which save file should be loaded upon mission start.

Parameters
fileNameSave file name
Returns
True if save file exists and was marked for load

◆ SetLatestSave()

void SCR_SaveManagerCore.SetLatestSave ( string  missionFileName,
string  saveFileName 
)

Set the latest save for the given mission.

Parameters
missionFileNameMission save file name
saveFileNameSave file name

◆ SetStruct()

void SCR_SaveManagerCore.SetStruct ( ESaveType  type,
SCR_MissionStruct  struct 
)

Assign JSON struct to specific save type.

Multiple save types can reuse the same struct.

Parameters
typeSave type
structJSON mission struct to be assigned.

◆ UploadToWorkshop()

void SCR_SaveManagerCore.UploadToWorkshop ( string  fileName)

Member Data Documentation

◆ CLI_PARAM

const string SCR_SaveManagerCore.CLI_PARAM = "loadSessionSave"
staticprotected

◆ GAME_SESSION_STORAGE_FILE_NAME_TO_LOAD

const string SCR_SaveManagerCore.GAME_SESSION_STORAGE_FILE_NAME_TO_LOAD = "SCR_SaveFileManager_FileNameToLoad"
staticprotected

◆ GAME_SESSION_STORAGE_USED_CLI

const string SCR_SaveManagerCore.GAME_SESSION_STORAGE_USED_CLI = "SCR_SaveFileManager_UsedCLI"
staticprotected

◆ ITEM_SAVE_POSTFIX

const string SCR_SaveManagerCore.ITEM_SAVE_POSTFIX = ".save_"
staticprotected

◆ m_aCallbacks

ref array<ref SCR_DSSessionCallback> SCR_SaveManagerCore.m_aCallbacks
protected

◆ m_bDebugDelete

bool SCR_SaveManagerCore.m_bDebugDelete
protected

◆ m_bLoadedOnInit

bool SCR_SaveManagerCore.m_bLoadedOnInit
protected

◆ m_LatestSaveCallback

ref SCR_LatestSaveDSSessionCallback SCR_SaveManagerCore.m_LatestSaveCallback
protected

◆ m_OnDeleted

ref ScriptInvoker_SaveManagerCore SCR_SaveManagerCore.m_OnDeleted = new ScriptInvoker_SaveManagerCore()
protected

◆ m_OnLatestSave

ref ScriptInvokerString SCR_SaveManagerCore.m_OnLatestSave = new ScriptInvokerString()
protected

◆ m_OnLoaded

ref ScriptInvoker_SaveManagerCore SCR_SaveManagerCore.m_OnLoaded = new ScriptInvoker_SaveManagerCore()
protected

◆ m_OnSaved

ref ScriptInvoker_SaveManagerCore SCR_SaveManagerCore.m_OnSaved = new ScriptInvoker_SaveManagerCore()
protected

◆ m_OnSaveFailed

ref ScriptInvoker_SaveManagerCore SCR_SaveManagerCore.m_OnSaveFailed = new ScriptInvoker_SaveManagerCore()
protected

◆ m_SessionStorageCallback

ref SCR_DSSessionCallbackSessionStorage SCR_SaveManagerCore.m_SessionStorageCallback
protected

◆ m_sMissionSaveFileName

string SCR_SaveManagerCore.m_sMissionSaveFileName
protected

◆ m_UploadCallback

ref SCR_ServerSaveRequestCallback SCR_SaveManagerCore.m_UploadCallback
protected

◆ m_WorkbenchMissionHeader

ref SCR_MissionHeader SCR_SaveManagerCore.m_WorkbenchMissionHeader
protected

The documentation for this interface was generated from the following file: