public PlayerStatsSaveClass() { invItemEquip = new SaveListUuid(Constants.GEAR_EQUIP_SPACE); invItemBag = new SaveListUuid(Constants.GEAR_BAG_SPACE); invModuleEquip = new SaveListUuid(Constants.MODULE_EQUIP_SPACE); invModuleBag = new SaveListUuid(Constants.MODULE_BAG_SPACE); }
/// <summary> /// Loads a list of uuids into the module list. /// </summary> /// <param name="saveData"></param> public void LoadItemData(SaveListUuid saveData, ScrObjLibraryVariable itemLibrary) { if (values.Length != saveData.size) { Debug.LogWarning("Something is wrong with the size of the module list."); } for (int i = 0; i < saveData.size; i++) { values[i] = string.IsNullOrEmpty(saveData.uuids[i]) ? null : (ItemEntry)itemLibrary.GetEntry(saveData.uuids[i]); } }
//Saving and loading /// <summary> /// Generates a list of uuids in order to save the list to file. /// </summary> /// <returns></returns> public SaveListUuid GenerateSaveData() { int length = values.Length; SaveListUuid saveData = new SaveListUuid(length); for (int i = 0; i < length; i++) { saveData.uuids[i] = (values[i] != null) ? values[i].uuid : ""; } return(saveData); }
//Saving and loading /// <summary> /// Generates a list of uuids in order to save the list to file. /// </summary> /// <returns></returns> public SaveListUuid GenerateSaveData() { SaveListUuid saveData = new SaveListUuid(); int length = values.Length; saveData.size = length; saveData.uuids = new string[length]; for (int i = 0; i < length; i++) { saveData.uuids[i] = (values[i] != null) ? values[i].uuid : ""; } return(saveData); }