add ckg
plantilla base para movimiento básico
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1fb111ca0a0060544962645104f6b1d9
|
||||
folderAsset: yes
|
||||
timeCreated: 1602570232
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,343 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
using System.IO;
|
||||
using System;
|
||||
|
||||
public class saveDialogInfo : saveGameInfo
|
||||
{
|
||||
public dialogManager mainDialogManager;
|
||||
|
||||
public string mainDialogManagerName = "Dialog Manager";
|
||||
|
||||
[Space]
|
||||
[Header ("Debug")]
|
||||
[Space]
|
||||
|
||||
public List<persistanceDialogContentInfo> persistanceInfoList;
|
||||
|
||||
public persistancePlayerDialogContentInfo temporalPersistancePlayerDialogContentInfo;
|
||||
|
||||
public override void saveGame (int saveNumber, int playerID, string currentSaveDataPath, bool showDebugInfo, bool savingGameToChangeScene)
|
||||
{
|
||||
saveGameContent (saveNumber, playerID, currentSaveDataPath, showDebugInfo, savingGameToChangeScene);
|
||||
}
|
||||
|
||||
public override void loadGame (int saveNumberToLoad, int playerID, string currentSaveDataPath, bool showDebugInfo)
|
||||
{
|
||||
loadGameContent (saveNumberToLoad, playerID, currentSaveDataPath, showDebugInfo);
|
||||
}
|
||||
|
||||
public void saveGameContent (int currentSaveNumber, int playerID, string currentSaveDataPath, bool showDebugInfo, bool savingGameToChangeScene)
|
||||
{
|
||||
getMainManager ();
|
||||
|
||||
if (mainDialogManager == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mainDialogManager.dialogSystemEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mainDialogManager.saveCurrentDialogContentToSaveFile) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("\n\n");
|
||||
|
||||
print ("Saving dialog");
|
||||
}
|
||||
|
||||
bool saveLocated = false;
|
||||
bool playerLocated = false;
|
||||
|
||||
int saveSlotIndex = -1;
|
||||
int listIndex = -1;
|
||||
|
||||
BinaryFormatter bf = new BinaryFormatter ();
|
||||
FileStream file;
|
||||
|
||||
persistancePlayerDialogContentInfo dialogContentToSave = getPersistanceList (playerID, showDebugInfo);
|
||||
|
||||
persistanceDialogContentListBySaveSlotInfo newPersistanceDialogContentListBySaveSlotInfo = new persistanceDialogContentListBySaveSlotInfo ();
|
||||
|
||||
List<persistanceDialogContentListBySaveSlotInfo> infoListToSave = new List<persistanceDialogContentListBySaveSlotInfo> ();
|
||||
|
||||
if (File.Exists (currentSaveDataPath)) {
|
||||
bf = new BinaryFormatter ();
|
||||
file = File.Open (currentSaveDataPath, FileMode.Open);
|
||||
object currentData = bf.Deserialize (file);
|
||||
infoListToSave = currentData as List<persistanceDialogContentListBySaveSlotInfo>;
|
||||
|
||||
file.Close ();
|
||||
}
|
||||
|
||||
int infoListToSaveCount = infoListToSave.Count;
|
||||
|
||||
for (int j = 0; j < infoListToSaveCount; j++) {
|
||||
if (infoListToSave [j].saveNumber == currentSaveNumber) {
|
||||
newPersistanceDialogContentListBySaveSlotInfo = infoListToSave [j];
|
||||
saveLocated = true;
|
||||
saveSlotIndex = j;
|
||||
}
|
||||
}
|
||||
|
||||
if (saveLocated) {
|
||||
int playerDialogContentListCount = newPersistanceDialogContentListBySaveSlotInfo.playerDialogContentList.Count;
|
||||
|
||||
for (int j = 0; j < playerDialogContentListCount; j++) {
|
||||
if (newPersistanceDialogContentListBySaveSlotInfo.playerDialogContentList [j].playerID == dialogContentToSave.playerID) {
|
||||
playerLocated = true;
|
||||
listIndex = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("\n\n");
|
||||
|
||||
print ("EXTRA INFO\n");
|
||||
print ("Number of elements on scene: " + dialogContentToSave.dialogContentList.Count);
|
||||
print ("Current Save Number " + currentSaveNumber);
|
||||
print ("Save Located " + saveLocated);
|
||||
print ("Player Located " + playerLocated);
|
||||
print ("Player ID " + dialogContentToSave.playerID);
|
||||
|
||||
print ("Scene Index " + menuPause.getCurrentActiveSceneIndex ());
|
||||
}
|
||||
|
||||
int currentSceneIndex = menuPause.getCurrentActiveSceneIndex ();
|
||||
|
||||
//if the save is located, check if the player id exists
|
||||
if (saveLocated) {
|
||||
//if player id exists, overwrite it
|
||||
if (playerLocated) {
|
||||
int elementOnSceneListCount = infoListToSave [saveSlotIndex].playerDialogContentList [listIndex].dialogContentList.Count;
|
||||
|
||||
for (int i = elementOnSceneListCount - 1; i >= 0; i--) {
|
||||
if (currentSceneIndex == infoListToSave [saveSlotIndex].playerDialogContentList [listIndex].dialogContentList [i].dialogContentScene) {
|
||||
infoListToSave [saveSlotIndex].playerDialogContentList [listIndex].dialogContentList.RemoveAt (i);
|
||||
}
|
||||
}
|
||||
|
||||
infoListToSave [saveSlotIndex].playerDialogContentList [listIndex].dialogContentList.AddRange (dialogContentToSave.dialogContentList);
|
||||
} else {
|
||||
infoListToSave [saveSlotIndex].playerDialogContentList.Add (dialogContentToSave);
|
||||
}
|
||||
} else {
|
||||
newPersistanceDialogContentListBySaveSlotInfo.saveNumber = currentSaveNumber;
|
||||
|
||||
newPersistanceDialogContentListBySaveSlotInfo.playerDialogContentList.Add (dialogContentToSave);
|
||||
|
||||
infoListToSave.Add (newPersistanceDialogContentListBySaveSlotInfo);
|
||||
}
|
||||
|
||||
bf = new BinaryFormatter ();
|
||||
file = File.Open (currentSaveDataPath, FileMode.OpenOrCreate);
|
||||
bf.Serialize (file, infoListToSave);
|
||||
|
||||
file.Close ();
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("\n\n");
|
||||
|
||||
print ("Saving Dialogs ");
|
||||
print ("Number of dialog: " + dialogContentToSave.dialogContentList.Count);
|
||||
|
||||
for (int j = 0; j < dialogContentToSave.dialogContentList.Count; j++) {
|
||||
persistanceDialogContentInfo currentPersistanceDialogContentInfo = dialogContentToSave.dialogContentList [j];
|
||||
|
||||
if (currentPersistanceDialogContentInfo.dialogContentScene == currentSceneIndex) {
|
||||
showDetailedDebugInfo (currentPersistanceDialogContentInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void loadGameContent (int saveNumberToLoad, int playerID, string currentSaveDataPath, bool showDebugInfo)
|
||||
{
|
||||
getMainManager ();
|
||||
|
||||
if (mainDialogManager == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mainDialogManager.dialogSystemEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("\n\n");
|
||||
|
||||
print ("Loading dialog");
|
||||
}
|
||||
|
||||
persistanceInfoList = new List<persistanceDialogContentInfo> ();
|
||||
|
||||
//need to store and check the current slot saved and the player which is saving, to get that concrete info
|
||||
List<persistanceDialogContentListBySaveSlotInfo> infoListToLoad = new List<persistanceDialogContentListBySaveSlotInfo> ();
|
||||
|
||||
if (File.Exists (currentSaveDataPath)) {
|
||||
BinaryFormatter bf = new BinaryFormatter ();
|
||||
FileStream file = File.Open (currentSaveDataPath, FileMode.Open);
|
||||
object currentData = bf.Deserialize (file);
|
||||
infoListToLoad = currentData as List<persistanceDialogContentListBySaveSlotInfo>;
|
||||
|
||||
file.Close ();
|
||||
}
|
||||
|
||||
if (saveNumberToLoad > -1) {
|
||||
persistanceDialogContentListBySaveSlotInfo newPersistanceDialogContentListBySaveSlotInfo = new persistanceDialogContentListBySaveSlotInfo ();
|
||||
|
||||
int infoListToLoadCount = infoListToLoad.Count;
|
||||
|
||||
for (int j = 0; j < infoListToLoadCount; j++) {
|
||||
|
||||
if (infoListToLoad [j].saveNumber == saveNumberToLoad) {
|
||||
newPersistanceDialogContentListBySaveSlotInfo = infoListToLoad [j];
|
||||
}
|
||||
}
|
||||
|
||||
int listIndex = -1;
|
||||
|
||||
int playerDialogContentListCount = newPersistanceDialogContentListBySaveSlotInfo.playerDialogContentList.Count;
|
||||
|
||||
for (int j = 0; j < playerDialogContentListCount; j++) {
|
||||
|
||||
if (newPersistanceDialogContentListBySaveSlotInfo.playerDialogContentList [j].playerID == playerID) {
|
||||
listIndex = j;
|
||||
}
|
||||
}
|
||||
|
||||
if (listIndex > -1) {
|
||||
int currentSceneIndex = menuPause.getCurrentActiveSceneIndex ();
|
||||
|
||||
temporalPersistancePlayerDialogContentInfo = newPersistanceDialogContentListBySaveSlotInfo.playerDialogContentList [listIndex];
|
||||
|
||||
int elementOnSceneListCount = temporalPersistancePlayerDialogContentInfo.dialogContentList.Count;
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("\n\n");
|
||||
|
||||
print ("Total number of elements saved in game " + elementOnSceneListCount);
|
||||
}
|
||||
|
||||
for (int j = 0; j < elementOnSceneListCount; j++) {
|
||||
if (currentSceneIndex == temporalPersistancePlayerDialogContentInfo.dialogContentList [j].dialogContentScene) {
|
||||
persistanceInfoList.Add (temporalPersistancePlayerDialogContentInfo.dialogContentList [j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("\n\n");
|
||||
|
||||
print ("Dialogs Loaded in Save Number " + saveNumberToLoad);
|
||||
print ("Number of dialog: " + persistanceInfoList.Count);
|
||||
|
||||
print ("Scene Index " + menuPause.getCurrentActiveSceneIndex ());
|
||||
|
||||
print ("\n\n");
|
||||
|
||||
for (int j = 0; j < persistanceInfoList.Count; j++) {
|
||||
print ("\n\n");
|
||||
|
||||
persistanceDialogContentInfo currentPersistanceDialogContentInfo = persistanceInfoList [j];
|
||||
|
||||
showDetailedDebugInfo (currentPersistanceDialogContentInfo);
|
||||
}
|
||||
}
|
||||
|
||||
loadInfoOnMainComponent ();
|
||||
}
|
||||
|
||||
public persistancePlayerDialogContentInfo getPersistanceList (int playerID, bool showDebugInfo)
|
||||
{
|
||||
persistancePlayerDialogContentInfo newPersistancePlayerDialogContentInfo = new persistancePlayerDialogContentInfo ();
|
||||
|
||||
newPersistancePlayerDialogContentInfo.playerID = playerID;
|
||||
|
||||
List<persistanceDialogContentInfo> newPersistanceDialogContentInfoList = new List<persistanceDialogContentInfo> ();
|
||||
|
||||
List<dialogContentSystem> dialogContentSystemList = mainDialogManager.dialogContentSystemList;
|
||||
|
||||
int dialogContentSystemListCount = dialogContentSystemList.Count;
|
||||
|
||||
for (int k = 0; k < dialogContentSystemListCount; k++) {
|
||||
|
||||
dialogContentSystem currentDialogContentSystem = dialogContentSystemList [k];
|
||||
|
||||
if (currentDialogContentSystem != null) {
|
||||
persistanceDialogContentInfo newPersistanceDialogContentInfo = new persistanceDialogContentInfo ();
|
||||
|
||||
newPersistanceDialogContentInfo.dialogContentID = currentDialogContentSystem.getDialogContentID ();
|
||||
newPersistanceDialogContentInfo.dialogContentScene = currentDialogContentSystem.getDialogContentScene ();
|
||||
newPersistanceDialogContentInfo.currentDialogIndex = currentDialogContentSystem.getCurrentDialogIndex ();
|
||||
|
||||
newPersistanceDialogContentInfoList.Add (newPersistanceDialogContentInfo);
|
||||
}
|
||||
}
|
||||
|
||||
newPersistancePlayerDialogContentInfo.dialogContentList = newPersistanceDialogContentInfoList;
|
||||
|
||||
return newPersistancePlayerDialogContentInfo;
|
||||
}
|
||||
|
||||
|
||||
void loadInfoOnMainComponent ()
|
||||
{
|
||||
if (persistanceInfoList != null && persistanceInfoList.Count > 0) {
|
||||
int persistanceInfoListCount = persistanceInfoList.Count;
|
||||
|
||||
for (int i = 0; i < persistanceInfoListCount; i++) {
|
||||
|
||||
persistanceDialogContentInfo currentPersistanceDialogContentInfo = persistanceInfoList [i];
|
||||
|
||||
dialogContentSystem currentDialogContentSystem = mainDialogManager.getDialogContentSystem (currentPersistanceDialogContentInfo.dialogContentID,
|
||||
currentPersistanceDialogContentInfo.dialogContentScene);
|
||||
|
||||
if (currentDialogContentSystem != null) {
|
||||
currentDialogContentSystem.setCompleteDialogIndex (currentPersistanceDialogContentInfo.currentDialogIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void showDetailedDebugInfo (persistanceDialogContentInfo currentPersistanceDialogContentInfo)
|
||||
{
|
||||
print ("Dialog Content ID " + currentPersistanceDialogContentInfo.dialogContentID);
|
||||
print ("Dialog Scene " + currentPersistanceDialogContentInfo.dialogContentScene);
|
||||
print ("Dialog Index " + currentPersistanceDialogContentInfo.currentDialogIndex);
|
||||
|
||||
print ("\n\n");
|
||||
}
|
||||
|
||||
void getMainManager ()
|
||||
{
|
||||
bool mainDialogManagerLocated = mainDialogManager != null;
|
||||
|
||||
if (!mainDialogManagerLocated) {
|
||||
mainDialogManager = dialogManager.Instance;
|
||||
|
||||
mainDialogManagerLocated = mainDialogManager != null;
|
||||
}
|
||||
|
||||
if (!mainDialogManagerLocated) {
|
||||
GKC_Utils.instantiateMainManagerOnSceneWithTypeOnApplicationPlaying (dialogManager.getMainManagerName (), typeof (dialogManager), true);
|
||||
|
||||
mainDialogManager = dialogManager.Instance;
|
||||
|
||||
mainDialogManagerLocated = mainDialogManager != null;
|
||||
}
|
||||
|
||||
if (!mainDialogManagerLocated) {
|
||||
mainDialogManager = FindObjectOfType<dialogManager> ();
|
||||
|
||||
mainDialogManagerLocated = mainDialogManager != null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b2159d06282132b4eb1ac92408f92418
|
||||
timeCreated: 1602213732
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Save System/Custom Class To Save/saveDialogInfo.cs
|
||||
uploadId: 814740
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7b3e2665ca071144d9f3190e9fad41f0
|
||||
timeCreated: 1650494788
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Save System/Custom Class To Save/saveElementsOnSceneInfo.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,70 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class saveGameInfo : MonoBehaviour
|
||||
{
|
||||
[Header ("Main Settings")]
|
||||
[Space]
|
||||
|
||||
public bool gameSavedOnHomeMenu;
|
||||
|
||||
[Space]
|
||||
|
||||
public bool ignorePlayerIDOnSaveLoadInfo;
|
||||
public bool ignoreSaveNumberOnSaveLoadInfo;
|
||||
|
||||
public int saveNumberToIgnoreSaveLoadInfo = -1;
|
||||
|
||||
[Space]
|
||||
[Space]
|
||||
|
||||
public bool saveInfoOnRegularTxtFile;
|
||||
|
||||
public string saveInfoOnRegulaFileName;
|
||||
public string loadInfoOnRegulaFileName;
|
||||
|
||||
|
||||
public virtual void saveGame (int saveNumber, int playerID, string currentSaveDataPath, bool showDebugInfo, bool savingGameToChangeScene)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void loadGame (int saveNumberToLoad, int playerID, string currentSaveDataPath, bool showDebugInfo)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void saveGameFromEditor (int saveNumber, int playerID, string currentSaveDataPath, bool showDebugInfo)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void initializeValuesOnComponent ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void deleteGameInfo (int saveNumberToDelete, int playerID, string currentSaveDataPath, bool showDebugInfo)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void copyGameInfo (int saveNumberToStoreDuplicate, int saveNumberToDuplicate, int playerID,
|
||||
string currentSaveDataPath, bool copyAllInfoWithoutChecks, bool showDebugInfo)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void showSaveInfoDebug (int saveNumberToShow, int playerID, string currentSaveDataPath,
|
||||
bool showAllGameInfoDebug, bool showDebugInfo)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void checkSaveInfoToLoadOnStartOnAllScenes (int saveNumberToLoad, int playerID,
|
||||
string currentSaveDataPath, bool showDebugInfo)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0be5476b1d980a94fb9b648aaffb1d24
|
||||
timeCreated: 1602145496
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Save System/Custom Class To Save/saveGameInfo.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,19 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[System.Serializable]
|
||||
public class saveInfo
|
||||
{
|
||||
public string Name;
|
||||
|
||||
public bool saveInfoEnabled = true;
|
||||
|
||||
public bool loadInfoEnabled = true;
|
||||
|
||||
public string saveFileName;
|
||||
|
||||
public bool showDebugInfo;
|
||||
|
||||
public saveGameInfo mainSaveGameInfo;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b9ba533f9bc4b734eb01145cf6a89094
|
||||
timeCreated: 1602147267
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Save System/Custom Class To Save/saveInfo.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,406 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
using System.IO;
|
||||
using System;
|
||||
|
||||
public class saveInventoryBankInfo : saveGameInfo
|
||||
{
|
||||
public inventoryBankManager mainInventoryBankManager;
|
||||
|
||||
public string mainInventoryManagerName = "Main Inventory Manager";
|
||||
|
||||
List<inventoryListElement> persistanceInfoList;
|
||||
|
||||
|
||||
public override void saveGame (int saveNumber, int playerID, string currentSaveDataPath, bool showDebugInfo, bool savingGameToChangeScene)
|
||||
{
|
||||
saveGameContent (saveNumber, playerID, currentSaveDataPath, showDebugInfo, savingGameToChangeScene);
|
||||
}
|
||||
|
||||
public override void loadGame (int saveNumberToLoad, int playerID, string currentSaveDataPath, bool showDebugInfo)
|
||||
{
|
||||
loadGameContent (saveNumberToLoad, playerID, currentSaveDataPath, showDebugInfo);
|
||||
}
|
||||
|
||||
public override void saveGameFromEditor (int saveNumber, int playerID, string currentSaveDataPath, bool showDebugInfo)
|
||||
{
|
||||
saveGameContentFromEditor (saveNumber, playerID, currentSaveDataPath, showDebugInfo);
|
||||
}
|
||||
|
||||
public void saveGameContent (int currentSaveNumber, int playerID, string currentSaveDataPath, bool showDebugInfo, bool savingGameToChangeScene)
|
||||
{
|
||||
getMainManager ();
|
||||
|
||||
if (mainInventoryBankManager == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mainInventoryBankManager.saveCurrentBankInventoryToSaveFile) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("\n\n");
|
||||
|
||||
print ("Saving inventory bank");
|
||||
}
|
||||
|
||||
bool saveLocated = false;
|
||||
bool playerLocated = false;
|
||||
|
||||
int saveSlotIndex = -1;
|
||||
int listIndex = -1;
|
||||
|
||||
BinaryFormatter bf = new BinaryFormatter ();
|
||||
FileStream file;
|
||||
|
||||
persistanceInventoryListByPlayerInfo vendorToSave = getPersistanceList (playerID, showDebugInfo);
|
||||
|
||||
persistanceInventoryListBySaveSlotInfo newPersistanceInventoryListBySaveSlotInfo = new persistanceInventoryListBySaveSlotInfo ();
|
||||
|
||||
List<persistanceInventoryListBySaveSlotInfo> infoListToSave = new List<persistanceInventoryListBySaveSlotInfo> ();
|
||||
|
||||
if (File.Exists (currentSaveDataPath)) {
|
||||
bf = new BinaryFormatter ();
|
||||
file = File.Open (currentSaveDataPath, FileMode.Open);
|
||||
object currentData = bf.Deserialize (file);
|
||||
infoListToSave = currentData as List<persistanceInventoryListBySaveSlotInfo>;
|
||||
|
||||
file.Close ();
|
||||
}
|
||||
|
||||
int infoListToSaveCount = infoListToSave.Count;
|
||||
|
||||
for (int j = 0; j < infoListToSaveCount; j++) {
|
||||
if (saveSlotIndex == -1) {
|
||||
persistanceInventoryListBySaveSlotInfo currentSlot = infoListToSave [j];
|
||||
|
||||
if (currentSlot.saveNumber == currentSaveNumber) {
|
||||
newPersistanceInventoryListBySaveSlotInfo = currentSlot;
|
||||
saveLocated = true;
|
||||
saveSlotIndex = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("\n\n");
|
||||
|
||||
print ("INVENTORY BANK");
|
||||
print ("Number of objects: " + vendorToSave.inventoryObjectList.Count);
|
||||
print ("Current Save Number " + currentSaveNumber);
|
||||
print ("Save Located " + saveLocated);
|
||||
}
|
||||
|
||||
if (saveLocated) {
|
||||
if (newPersistanceInventoryListBySaveSlotInfo.playerInventoryList.Count > 0) {
|
||||
playerLocated = true;
|
||||
listIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//if the save is located, check if the bank exists
|
||||
if (saveLocated) {
|
||||
//if player id exists, overwrite it
|
||||
if (playerLocated) {
|
||||
infoListToSave [saveSlotIndex].playerInventoryList [listIndex].inventoryObjectList = vendorToSave.inventoryObjectList;
|
||||
} else {
|
||||
infoListToSave [saveSlotIndex].playerInventoryList.Add (vendorToSave);
|
||||
}
|
||||
} else {
|
||||
newPersistanceInventoryListBySaveSlotInfo.saveNumber = currentSaveNumber;
|
||||
newPersistanceInventoryListBySaveSlotInfo.playerInventoryList.Add (vendorToSave);
|
||||
infoListToSave.Add (newPersistanceInventoryListBySaveSlotInfo);
|
||||
}
|
||||
|
||||
bf = new BinaryFormatter ();
|
||||
file = File.Open (currentSaveDataPath, FileMode.OpenOrCreate);
|
||||
bf.Serialize (file, infoListToSave);
|
||||
|
||||
file.Close ();
|
||||
}
|
||||
|
||||
public void loadGameContent (int saveNumberToLoad, int playerID, string currentSaveDataPath, bool showDebugInfo)
|
||||
{
|
||||
getMainManager ();
|
||||
|
||||
if (mainInventoryBankManager == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("\n\n");
|
||||
|
||||
print ("Loading inventory bank");
|
||||
}
|
||||
|
||||
//need to store and check the current slot saved and the player which is saving, to get that concrete info
|
||||
persistanceInfoList = new List<inventoryListElement> ();
|
||||
|
||||
List<persistanceInventoryListBySaveSlotInfo> infoListToLoad = new List<persistanceInventoryListBySaveSlotInfo> ();
|
||||
|
||||
if (File.Exists (currentSaveDataPath)) {
|
||||
BinaryFormatter bf = new BinaryFormatter ();
|
||||
FileStream file = File.Open (currentSaveDataPath, FileMode.Open);
|
||||
object currentData = bf.Deserialize (file);
|
||||
infoListToLoad = currentData as List<persistanceInventoryListBySaveSlotInfo>;
|
||||
|
||||
file.Close ();
|
||||
}
|
||||
|
||||
if (saveNumberToLoad > -1) {
|
||||
persistanceInventoryListBySaveSlotInfo newPersistanceInventoryListBySaveSlotInfo = new persistanceInventoryListBySaveSlotInfo ();
|
||||
|
||||
int infoListToLoadCount = infoListToLoad.Count;
|
||||
|
||||
bool slotLocated = false;
|
||||
|
||||
for (int j = 0; j < infoListToLoadCount; j++) {
|
||||
if (!slotLocated) {
|
||||
persistanceInventoryListBySaveSlotInfo currentSlot = infoListToLoad [j];
|
||||
|
||||
if (currentSlot.saveNumber == saveNumberToLoad) {
|
||||
newPersistanceInventoryListBySaveSlotInfo = currentSlot;
|
||||
|
||||
slotLocated = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int bankInventoryIndex = 0;
|
||||
|
||||
if (newPersistanceInventoryListBySaveSlotInfo.playerInventoryList.Count > 0) {
|
||||
persistanceInventoryListByPlayerInfo bankInventoryListToLoad = newPersistanceInventoryListBySaveSlotInfo.playerInventoryList [bankInventoryIndex];
|
||||
|
||||
int inventoryObjectListCount = bankInventoryListToLoad.inventoryObjectList.Count;
|
||||
|
||||
for (int j = 0; j < inventoryObjectListCount; j++) {
|
||||
inventoryListElement newInventoryListElement = new inventoryListElement ();
|
||||
|
||||
persistanceInventoryObjectInfo currentInventorInfo = bankInventoryListToLoad.inventoryObjectList [j];
|
||||
|
||||
newInventoryListElement.Name = currentInventorInfo.Name;
|
||||
newInventoryListElement.amount = currentInventorInfo.amount;
|
||||
newInventoryListElement.infiniteAmount = currentInventorInfo.infiniteAmount;
|
||||
newInventoryListElement.inventoryObjectName = currentInventorInfo.inventoryObjectName;
|
||||
|
||||
newInventoryListElement.categoryIndex = currentInventorInfo.categoryIndex;
|
||||
newInventoryListElement.elementIndex = currentInventorInfo.elementIndex;
|
||||
|
||||
persistanceInfoList.Add (newInventoryListElement);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("\n\n");
|
||||
|
||||
print ("INVENTORY BANK");
|
||||
|
||||
print ("Inventory Bank Loaded in Save Number " + saveNumberToLoad);
|
||||
print ("Number of objects: " + persistanceInfoList.Count);
|
||||
|
||||
for (int j = 0; j < persistanceInfoList.Count; j++) {
|
||||
inventoryListElement currentElement = persistanceInfoList [j];
|
||||
|
||||
print ("Object Name: " + currentElement.Name + " Amount: " + currentElement.amount);
|
||||
}
|
||||
}
|
||||
|
||||
loadInfoOnMainComponent ();
|
||||
}
|
||||
|
||||
|
||||
public persistanceInventoryListByPlayerInfo getPersistanceList (int playerID, bool showDebugInfo)
|
||||
{
|
||||
persistanceInventoryListByPlayerInfo newPersistanceInventoryListByPlayerInfo = new persistanceInventoryListByPlayerInfo ();
|
||||
|
||||
newPersistanceInventoryListByPlayerInfo.playerID = playerID;
|
||||
|
||||
List<persistanceInventoryObjectInfo> newPersistanceInventoryObjectInfoList = new List<persistanceInventoryObjectInfo> ();
|
||||
|
||||
List<inventoryInfo> bankInventoryList = mainInventoryBankManager.bankInventoryList;
|
||||
|
||||
int bankInventoryListCount = bankInventoryList.Count;
|
||||
|
||||
for (int k = 0; k < bankInventoryListCount; k++) {
|
||||
persistanceInventoryObjectInfo newPersistanceInventoryObjectInfo = new persistanceInventoryObjectInfo ();
|
||||
|
||||
inventoryInfo currentInventoryInfo = bankInventoryList [k];
|
||||
|
||||
newPersistanceInventoryObjectInfo.Name = currentInventoryInfo.Name;
|
||||
newPersistanceInventoryObjectInfo.amount = currentInventoryInfo.amount;
|
||||
newPersistanceInventoryObjectInfo.infiniteAmount = currentInventoryInfo.infiniteAmount;
|
||||
newPersistanceInventoryObjectInfo.inventoryObjectName = currentInventoryInfo.Name;
|
||||
|
||||
newPersistanceInventoryObjectInfo.categoryIndex = currentInventoryInfo.categoryIndex;
|
||||
newPersistanceInventoryObjectInfo.elementIndex = currentInventoryInfo.elementIndex;
|
||||
|
||||
newPersistanceInventoryObjectInfoList.Add (newPersistanceInventoryObjectInfo);
|
||||
}
|
||||
|
||||
newPersistanceInventoryListByPlayerInfo.inventoryObjectList = newPersistanceInventoryObjectInfoList;
|
||||
|
||||
return newPersistanceInventoryListByPlayerInfo;
|
||||
}
|
||||
|
||||
|
||||
void loadInfoOnMainComponent ()
|
||||
{
|
||||
if (persistanceInfoList != null && persistanceInfoList.Count > 0) {
|
||||
mainInventoryBankManager.setNewInventoryListManagerList (persistanceInfoList);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void getMainManager ()
|
||||
{
|
||||
if (mainInventoryBankManager == null) {
|
||||
|
||||
inventoryListManager mainInventoryListManager = inventoryListManager.Instance;
|
||||
|
||||
bool mainInventoryManagerLocated = mainInventoryListManager != null;
|
||||
|
||||
if (!mainInventoryManagerLocated) {
|
||||
GKC_Utils.instantiateMainManagerOnSceneWithTypeOnApplicationPlaying (inventoryListManager.getMainManagerName (), typeof(inventoryListManager), true);
|
||||
|
||||
mainInventoryListManager = inventoryListManager.Instance;
|
||||
|
||||
mainInventoryManagerLocated = (mainInventoryListManager != null);
|
||||
}
|
||||
|
||||
if (!mainInventoryManagerLocated) {
|
||||
mainInventoryListManager = FindObjectOfType<inventoryListManager> ();
|
||||
|
||||
mainInventoryManagerLocated = mainInventoryListManager != null;
|
||||
}
|
||||
|
||||
if (mainInventoryManagerLocated) {
|
||||
mainInventoryBankManager = mainInventoryListManager.getMainInventoryBankManager ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void saveGameContentFromEditor (int currentSaveNumber, int playerID, string currentSaveDataPath, bool showDebugInfo)
|
||||
{
|
||||
getMainManager ();
|
||||
|
||||
if (mainInventoryBankManager == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
bool saveLocated = false;
|
||||
bool playerLocated = false;
|
||||
|
||||
int saveSlotIndex = -1;
|
||||
int listIndex = -1;
|
||||
|
||||
BinaryFormatter bf = new BinaryFormatter ();
|
||||
FileStream file;
|
||||
|
||||
persistanceInventoryListByPlayerInfo vendorToSave = getPersistanceVendorListElement (playerID, showDebugInfo);
|
||||
|
||||
persistanceInventoryListBySaveSlotInfo newPersistanceInventoryListBySaveSlotInfo = new persistanceInventoryListBySaveSlotInfo ();
|
||||
|
||||
List<persistanceInventoryListBySaveSlotInfo> infoListToSave = new List<persistanceInventoryListBySaveSlotInfo> ();
|
||||
|
||||
if (File.Exists (currentSaveDataPath)) {
|
||||
bf = new BinaryFormatter ();
|
||||
file = File.Open (currentSaveDataPath, FileMode.Open);
|
||||
object currentData = bf.Deserialize (file);
|
||||
infoListToSave = currentData as List<persistanceInventoryListBySaveSlotInfo>;
|
||||
|
||||
file.Close ();
|
||||
}
|
||||
|
||||
int infoListToSaveCount = infoListToSave.Count;
|
||||
|
||||
for (int j = 0; j < infoListToSaveCount; j++) {
|
||||
if (saveSlotIndex == -1) {
|
||||
persistanceInventoryListBySaveSlotInfo currentSlot = infoListToSave [j];
|
||||
|
||||
if (currentSlot.saveNumber == currentSaveNumber) {
|
||||
newPersistanceInventoryListBySaveSlotInfo = currentSlot;
|
||||
saveLocated = true;
|
||||
saveSlotIndex = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("\n\n");
|
||||
|
||||
print ("INVENTORY BANK");
|
||||
|
||||
print ("Number of objects: " + vendorToSave.inventoryObjectList.Count);
|
||||
print ("Current Save Number " + currentSaveNumber);
|
||||
print ("Save Located " + saveLocated);
|
||||
}
|
||||
|
||||
if (saveLocated) {
|
||||
if (newPersistanceInventoryListBySaveSlotInfo.playerInventoryList.Count > 0) {
|
||||
playerLocated = true;
|
||||
listIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//if the save is located, check if the bank exists
|
||||
if (saveLocated) {
|
||||
//if player id exists, overwrite it
|
||||
if (playerLocated) {
|
||||
infoListToSave [saveSlotIndex].playerInventoryList [listIndex].inventoryObjectList = vendorToSave.inventoryObjectList;
|
||||
} else {
|
||||
infoListToSave [saveSlotIndex].playerInventoryList.Add (vendorToSave);
|
||||
}
|
||||
} else {
|
||||
newPersistanceInventoryListBySaveSlotInfo.saveNumber = currentSaveNumber;
|
||||
newPersistanceInventoryListBySaveSlotInfo.playerInventoryList.Add (vendorToSave);
|
||||
infoListToSave.Add (newPersistanceInventoryListBySaveSlotInfo);
|
||||
}
|
||||
|
||||
bf = new BinaryFormatter ();
|
||||
file = File.Create (currentSaveDataPath);
|
||||
bf.Serialize (file, infoListToSave);
|
||||
file.Close ();
|
||||
}
|
||||
|
||||
public persistanceInventoryListByPlayerInfo getPersistanceVendorListElement (int playerID, bool showDebugInfo)
|
||||
{
|
||||
persistanceInventoryListByPlayerInfo newPersistanceInventoryListByPlayerInfo = new persistanceInventoryListByPlayerInfo ();
|
||||
|
||||
newPersistanceInventoryListByPlayerInfo.playerID = playerID;
|
||||
|
||||
List<persistanceInventoryObjectInfo> newPersistanceInventoryObjectInfoList = new List<persistanceInventoryObjectInfo> ();
|
||||
|
||||
List<inventoryListElement> inventoryListManagerList = mainInventoryBankManager.inventoryListManagerList;
|
||||
|
||||
int inventoryListManagerListCount = inventoryListManagerList.Count;
|
||||
|
||||
for (int k = 0; k < inventoryListManagerListCount; k++) {
|
||||
persistanceInventoryObjectInfo newPersistanceInventoryObjectInfo = new persistanceInventoryObjectInfo ();
|
||||
|
||||
inventoryListElement currentElement = inventoryListManagerList [k];
|
||||
|
||||
newPersistanceInventoryObjectInfo.Name = currentElement.Name;
|
||||
newPersistanceInventoryObjectInfo.amount = currentElement.amount;
|
||||
newPersistanceInventoryObjectInfo.infiniteAmount = currentElement.infiniteAmount;
|
||||
newPersistanceInventoryObjectInfo.inventoryObjectName = currentElement.inventoryObjectName;
|
||||
|
||||
newPersistanceInventoryObjectInfo.elementIndex = currentElement.elementIndex;
|
||||
newPersistanceInventoryObjectInfo.categoryIndex = currentElement.categoryIndex;
|
||||
|
||||
if (showDebugInfo) {
|
||||
print (newPersistanceInventoryObjectInfo.Name + " " + newPersistanceInventoryObjectInfo.amount);
|
||||
}
|
||||
|
||||
newPersistanceInventoryObjectInfoList.Add (newPersistanceInventoryObjectInfo);
|
||||
}
|
||||
|
||||
newPersistanceInventoryListByPlayerInfo.inventoryObjectList = newPersistanceInventoryObjectInfoList;
|
||||
|
||||
return newPersistanceInventoryListByPlayerInfo;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fe215edec7ef2ce44810f69dc762d3df
|
||||
timeCreated: 1602224062
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Save System/Custom Class To Save/saveInventoryBankInfo.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,313 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
using System.IO;
|
||||
using System;
|
||||
|
||||
public class saveMeleeWeaponsInfo : saveGameInfo
|
||||
{
|
||||
public meleeWeaponsGrabbedManager mainMeleeWeaponsGrabbedManager;
|
||||
|
||||
List<persistanceMeleeInfo> persistanceInfoList;
|
||||
|
||||
bool valuesInitializedOnLoad;
|
||||
|
||||
|
||||
public override void saveGame (int saveNumber, int playerID, string currentSaveDataPath, bool showDebugInfo, bool savingGameToChangeScene)
|
||||
{
|
||||
saveGameContent (saveNumber, playerID, currentSaveDataPath, showDebugInfo, savingGameToChangeScene);
|
||||
}
|
||||
|
||||
public override void loadGame (int saveNumberToLoad, int playerID, string currentSaveDataPath, bool showDebugInfo)
|
||||
{
|
||||
loadGameContent (saveNumberToLoad, playerID, currentSaveDataPath, showDebugInfo);
|
||||
}
|
||||
|
||||
public override void initializeValuesOnComponent ()
|
||||
{
|
||||
initializeValues ();
|
||||
}
|
||||
|
||||
public void saveGameContent (int currentSaveNumber, int playerID, string currentSaveDataPath, bool showDebugInfo, bool savingGameToChangeScene)
|
||||
{
|
||||
if (mainMeleeWeaponsGrabbedManager == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mainMeleeWeaponsGrabbedManager.meleeWeaponsGrabbedManagerEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mainMeleeWeaponsGrabbedManager.saveCurrentMeleeWeaponListToSaveFile) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mainMeleeWeaponsGrabbedManager.storePickedWeaponsOnInventory) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("\n\n");
|
||||
|
||||
print ("Saving melee weapons");
|
||||
}
|
||||
|
||||
bool saveLocated = false;
|
||||
bool playerLocated = false;
|
||||
|
||||
int saveSlotIndex = -1;
|
||||
int listIndex = -1;
|
||||
|
||||
BinaryFormatter bf = new BinaryFormatter ();
|
||||
FileStream file;
|
||||
|
||||
persistanceMeleeWeaponInfo meleeWeaponsToSave = getPersistanceList (playerID, showDebugInfo);
|
||||
|
||||
persistanceMeleeWeaponListBySaveSlotInfo newPersistanceMeleeWeaponListBySaveSlotInfo = new persistanceMeleeWeaponListBySaveSlotInfo ();
|
||||
|
||||
List<persistanceMeleeWeaponListBySaveSlotInfo> infoListToSave = new List<persistanceMeleeWeaponListBySaveSlotInfo> ();
|
||||
|
||||
if (File.Exists (currentSaveDataPath)) {
|
||||
bf = new BinaryFormatter ();
|
||||
file = File.Open (currentSaveDataPath, FileMode.Open);
|
||||
object currentData = bf.Deserialize (file);
|
||||
|
||||
infoListToSave = currentData as List<persistanceMeleeWeaponListBySaveSlotInfo>;
|
||||
|
||||
file.Close ();
|
||||
}
|
||||
|
||||
int infoListToSaveCount = infoListToSave.Count;
|
||||
|
||||
for (int j = 0; j < infoListToSaveCount; j++) {
|
||||
if (infoListToSave [j].saveNumber == currentSaveNumber) {
|
||||
newPersistanceMeleeWeaponListBySaveSlotInfo = infoListToSave [j];
|
||||
|
||||
saveLocated = true;
|
||||
saveSlotIndex = j;
|
||||
}
|
||||
}
|
||||
|
||||
if (saveLocated) {
|
||||
int meleeWeaponListCount = newPersistanceMeleeWeaponListBySaveSlotInfo.meleeWeaponList.Count;
|
||||
|
||||
for (int j = 0; j < meleeWeaponListCount; j++) {
|
||||
if (newPersistanceMeleeWeaponListBySaveSlotInfo.meleeWeaponList [j].playerID == meleeWeaponsToSave.playerID) {
|
||||
playerLocated = true;
|
||||
listIndex = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//if the save is located, check if the player id exists
|
||||
if (saveLocated) {
|
||||
//if player id exists, overwrite it
|
||||
if (playerLocated) {
|
||||
infoListToSave [saveSlotIndex].meleeWeaponList [listIndex].meleeList = meleeWeaponsToSave.meleeList;
|
||||
} else {
|
||||
infoListToSave [saveSlotIndex].meleeWeaponList.Add (meleeWeaponsToSave);
|
||||
}
|
||||
} else {
|
||||
newPersistanceMeleeWeaponListBySaveSlotInfo.saveNumber = currentSaveNumber;
|
||||
newPersistanceMeleeWeaponListBySaveSlotInfo.meleeWeaponList.Add (meleeWeaponsToSave);
|
||||
|
||||
infoListToSave.Add (newPersistanceMeleeWeaponListBySaveSlotInfo);
|
||||
}
|
||||
|
||||
bf = new BinaryFormatter ();
|
||||
file = File.Open (currentSaveDataPath, FileMode.OpenOrCreate);
|
||||
bf.Serialize (file, infoListToSave);
|
||||
|
||||
file.Close ();
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("\n\n");
|
||||
|
||||
print ("Melee Weapons Saved in Save Number " + currentSaveNumber);
|
||||
}
|
||||
}
|
||||
|
||||
public void loadGameContent (int saveNumberToLoad, int playerID, string currentSaveDataPath, bool showDebugInfo)
|
||||
{
|
||||
if (mainMeleeWeaponsGrabbedManager == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mainMeleeWeaponsGrabbedManager.meleeWeaponsGrabbedManagerEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mainMeleeWeaponsGrabbedManager.storePickedWeaponsOnInventory) {
|
||||
return;
|
||||
}
|
||||
|
||||
initializeValues ();
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("\n\n");
|
||||
|
||||
print ("Loading melee weapons");
|
||||
}
|
||||
|
||||
//need to store and check the current slot saved and the player which is saving, to get that concrete info
|
||||
persistanceInfoList = new List<persistanceMeleeInfo> ();
|
||||
|
||||
List<persistanceMeleeWeaponListBySaveSlotInfo> infoListToLoad = new List<persistanceMeleeWeaponListBySaveSlotInfo> ();
|
||||
|
||||
if (File.Exists (currentSaveDataPath)) {
|
||||
BinaryFormatter bf = new BinaryFormatter ();
|
||||
FileStream file = File.Open (currentSaveDataPath, FileMode.Open);
|
||||
object currentData = bf.Deserialize (file);
|
||||
|
||||
infoListToLoad = currentData as List<persistanceMeleeWeaponListBySaveSlotInfo>;
|
||||
|
||||
file.Close ();
|
||||
}
|
||||
|
||||
if (saveNumberToLoad > -1) {
|
||||
persistanceMeleeWeaponListBySaveSlotInfo newPersistanceMeleeWeaponListBySaveSlotInfo = new persistanceMeleeWeaponListBySaveSlotInfo ();
|
||||
|
||||
int infoListToLoadCount = infoListToLoad.Count;
|
||||
|
||||
for (int j = 0; j < infoListToLoadCount; j++) {
|
||||
|
||||
if (infoListToLoad [j].saveNumber == saveNumberToLoad) {
|
||||
newPersistanceMeleeWeaponListBySaveSlotInfo = infoListToLoad [j];
|
||||
}
|
||||
}
|
||||
|
||||
int listIndex = -1;
|
||||
|
||||
int meleeWeaponListCount = newPersistanceMeleeWeaponListBySaveSlotInfo.meleeWeaponList.Count;
|
||||
|
||||
for (int j = 0; j < meleeWeaponListCount; j++) {
|
||||
|
||||
if (newPersistanceMeleeWeaponListBySaveSlotInfo.meleeWeaponList [j].playerID == playerID) {
|
||||
listIndex = j;
|
||||
}
|
||||
}
|
||||
|
||||
if (listIndex > -1) {
|
||||
persistanceInfoList.AddRange (newPersistanceMeleeWeaponListBySaveSlotInfo.meleeWeaponList [listIndex].meleeList);
|
||||
}
|
||||
}
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("\n\n");
|
||||
|
||||
print ("Melee Weapons Loaded in Save Number " + saveNumberToLoad);
|
||||
print ("Number of Melee Weapons: " + persistanceInfoList.Count);
|
||||
}
|
||||
|
||||
loadInfoOnMainComponent ();
|
||||
}
|
||||
|
||||
|
||||
persistanceMeleeWeaponInfo getPersistanceList (int playerID, bool showDebugInfo)
|
||||
{
|
||||
persistanceMeleeWeaponInfo newPersistanceMeleeWeaponInfo = new persistanceMeleeWeaponInfo ();
|
||||
|
||||
newPersistanceMeleeWeaponInfo.playerID = playerID;
|
||||
|
||||
List<persistanceMeleeInfo> newPersistanceMeleeInfoList = new List<persistanceMeleeInfo> ();
|
||||
|
||||
List<meleeWeaponsGrabbedManager.meleeWeaponGrabbedInfo> meleeWeaponGrabbedInfoList = mainMeleeWeaponsGrabbedManager.meleeWeaponGrabbedInfoList;
|
||||
|
||||
int meleeWeaponGrabbedInfoListCount = meleeWeaponGrabbedInfoList.Count;
|
||||
|
||||
for (int k = 0; k < meleeWeaponGrabbedInfoListCount; k++) {
|
||||
persistanceMeleeInfo newPersistanceMeleeInfo = new persistanceMeleeInfo ();
|
||||
|
||||
meleeWeaponsGrabbedManager.meleeWeaponGrabbedInfo currentWeapon = meleeWeaponGrabbedInfoList [k];
|
||||
|
||||
newPersistanceMeleeInfo.weaponActiveIndex = currentWeapon.weaponPrefabIndex;
|
||||
newPersistanceMeleeInfo.isCurrentWeapon = currentWeapon.isCurrentWeapon;
|
||||
|
||||
newPersistanceMeleeInfoList.Add (newPersistanceMeleeInfo);
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("Weapon " + currentWeapon.Name + " " + currentWeapon.weaponPrefabIndex + " " + currentWeapon.isCurrentWeapon);
|
||||
}
|
||||
}
|
||||
|
||||
newPersistanceMeleeWeaponInfo.meleeList = newPersistanceMeleeInfoList;
|
||||
|
||||
return newPersistanceMeleeWeaponInfo;
|
||||
}
|
||||
|
||||
|
||||
void loadInfoOnMainComponent ()
|
||||
{
|
||||
valuesInitializedOnLoad = true;
|
||||
|
||||
initializeValues ();
|
||||
|
||||
if (persistanceInfoList != null && persistanceInfoList.Count > 0) {
|
||||
|
||||
List<meleeWeaponsGrabbedManager.meleeWeaponPrefabInfo> meleeWeaponPrefabInfoList = mainMeleeWeaponsGrabbedManager.meleeWeaponPrefabInfoList;
|
||||
|
||||
List<meleeWeaponsGrabbedManager.meleeWeaponGrabbedInfo> meleeWeaponGrabbedInfoList = mainMeleeWeaponsGrabbedManager.meleeWeaponGrabbedInfoList;
|
||||
|
||||
int persistanceInfoListCount = persistanceInfoList.Count;
|
||||
|
||||
for (int i = 0; i < persistanceInfoListCount; i++) {
|
||||
|
||||
persistanceMeleeInfo currentPersistanceMeleeInfo = persistanceInfoList [i];
|
||||
|
||||
meleeWeaponsGrabbedManager.meleeWeaponPrefabInfo currentMeleeWeaponPrefabInfo = meleeWeaponPrefabInfoList [currentPersistanceMeleeInfo.weaponActiveIndex];
|
||||
|
||||
if (currentMeleeWeaponPrefabInfo != null) {
|
||||
meleeWeaponsGrabbedManager.meleeWeaponGrabbedInfo newMeleeWeaponGrabbedInfo = new meleeWeaponsGrabbedManager.meleeWeaponGrabbedInfo ();
|
||||
|
||||
newMeleeWeaponGrabbedInfo.Name = currentMeleeWeaponPrefabInfo.Name;
|
||||
|
||||
newMeleeWeaponGrabbedInfo.weaponPrefabIndex = currentMeleeWeaponPrefabInfo.weaponPrefabIndex;
|
||||
|
||||
meleeWeaponGrabbedInfoList.Add (newMeleeWeaponGrabbedInfo);
|
||||
|
||||
if (currentPersistanceMeleeInfo.isCurrentWeapon) {
|
||||
mainMeleeWeaponsGrabbedManager.currentWeaponIndex = currentMeleeWeaponPrefabInfo.weaponPrefabIndex;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!mainMeleeWeaponsGrabbedManager.isGrabObjectsEnabled ()) {
|
||||
return;
|
||||
}
|
||||
|
||||
int meleeWeaponGrabbedInfoListCount = meleeWeaponGrabbedInfoList.Count;
|
||||
|
||||
for (int k = 0; k < meleeWeaponGrabbedInfoListCount; k++) {
|
||||
meleeWeaponsGrabbedManager.meleeWeaponGrabbedInfo currentMeleeWeaponGrabbedInfo = meleeWeaponGrabbedInfoList [k];
|
||||
|
||||
currentMeleeWeaponGrabbedInfo.weaponInstantiated = true;
|
||||
|
||||
meleeWeaponsGrabbedManager.meleeWeaponPrefabInfo currentMeleeWeaponPrefabInfo = mainMeleeWeaponsGrabbedManager.getWeaponPrefabByName (currentMeleeWeaponGrabbedInfo.Name);
|
||||
|
||||
if (currentMeleeWeaponPrefabInfo != null) {
|
||||
currentMeleeWeaponGrabbedInfo.weaponStored = (GameObject)Instantiate (currentMeleeWeaponPrefabInfo.weaponPrefab, Vector3.up * 1000, Quaternion.identity);
|
||||
|
||||
currentMeleeWeaponGrabbedInfo.weaponPrefabIndex = currentMeleeWeaponPrefabInfo.weaponPrefabIndex;
|
||||
|
||||
mainMeleeWeaponsGrabbedManager.checkObjectMeshToEnableOrDisable (!currentMeleeWeaponGrabbedInfo.hideWeaponMeshWhenNotUsed, currentMeleeWeaponGrabbedInfo);
|
||||
|
||||
currentMeleeWeaponGrabbedInfo.weaponStored.SetActive (false);
|
||||
}
|
||||
}
|
||||
|
||||
mainMeleeWeaponsGrabbedManager.isLoadingGame = true;
|
||||
}
|
||||
|
||||
mainMeleeWeaponsGrabbedManager.initializeMeleeManagerValues ();
|
||||
}
|
||||
|
||||
void initializeValues ()
|
||||
{
|
||||
mainMeleeWeaponsGrabbedManager.isLoadingGame = false;
|
||||
|
||||
if (!valuesInitializedOnLoad) {
|
||||
mainMeleeWeaponsGrabbedManager.initializeMeleeManagerValues ();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6717e2fa25602b84dab33238db4d3bf2
|
||||
timeCreated: 1602147456
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Save System/Custom Class To Save/saveMeleeWeaponsInfo.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,426 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
using System.IO;
|
||||
using System;
|
||||
|
||||
public class saveMissionsInfo : saveGameInfo
|
||||
{
|
||||
public objectiveLogSystem mainObjectiveLogSystem;
|
||||
|
||||
List<persistanceMissionInfo> persistanceInfoList;
|
||||
|
||||
bool showCurrentDebugInfo;
|
||||
|
||||
public override void saveGame (int saveNumber, int playerID, string currentSaveDataPath, bool showDebugInfo, bool savingGameToChangeScene)
|
||||
{
|
||||
saveGameContent (saveNumber, playerID, currentSaveDataPath, showDebugInfo, savingGameToChangeScene);
|
||||
}
|
||||
|
||||
public override void loadGame (int saveNumberToLoad, int playerID, string currentSaveDataPath, bool showDebugInfo)
|
||||
{
|
||||
loadGameContent (saveNumberToLoad, playerID, currentSaveDataPath, showDebugInfo);
|
||||
}
|
||||
|
||||
public override void initializeValuesOnComponent ()
|
||||
{
|
||||
initializeValues ();
|
||||
}
|
||||
|
||||
public void saveGameContent (int currentSaveNumber, int playerID, string currentSaveDataPath, bool showDebugInfo, bool savingGameToChangeScene)
|
||||
{
|
||||
getMainManager ();
|
||||
|
||||
if (mainObjectiveLogSystem == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mainObjectiveLogSystem.isObjectiveMenuActive ()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mainObjectiveLogSystem.saveCurrentPlayerMissionsToSaveFile) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("\n\n");
|
||||
|
||||
print ("Saving missions");
|
||||
}
|
||||
|
||||
bool saveLocated = false;
|
||||
bool playerLocated = false;
|
||||
|
||||
int saveSlotIndex = -1;
|
||||
int listIndex = -1;
|
||||
|
||||
BinaryFormatter bf = new BinaryFormatter ();
|
||||
FileStream file;
|
||||
|
||||
persistancePlayerMissionInfo missionsToSave = getPersistanceList (playerID, showDebugInfo);
|
||||
|
||||
persistancePlayerMissionsListBySaveSlotInfo newPersistancePlayerMissionsListBySaveSlotInfo = new persistancePlayerMissionsListBySaveSlotInfo ();
|
||||
|
||||
List<persistancePlayerMissionsListBySaveSlotInfo> infoListToSave = new List<persistancePlayerMissionsListBySaveSlotInfo> ();
|
||||
|
||||
if (File.Exists (currentSaveDataPath)) {
|
||||
bf = new BinaryFormatter ();
|
||||
file = File.Open (currentSaveDataPath, FileMode.Open);
|
||||
object currentData = bf.Deserialize (file);
|
||||
infoListToSave = currentData as List<persistancePlayerMissionsListBySaveSlotInfo>;
|
||||
|
||||
file.Close ();
|
||||
}
|
||||
|
||||
int infoListToSaveCount = infoListToSave.Count;
|
||||
|
||||
for (int j = 0; j < infoListToSaveCount; j++) {
|
||||
if (infoListToSave [j].saveNumber == currentSaveNumber) {
|
||||
newPersistancePlayerMissionsListBySaveSlotInfo = infoListToSave [j];
|
||||
saveLocated = true;
|
||||
saveSlotIndex = j;
|
||||
}
|
||||
}
|
||||
|
||||
if (saveLocated) {
|
||||
int playerMissionsListCount = newPersistancePlayerMissionsListBySaveSlotInfo.playerMissionsList.Count;
|
||||
|
||||
for (int j = 0; j < playerMissionsListCount; j++) {
|
||||
if (newPersistancePlayerMissionsListBySaveSlotInfo.playerMissionsList [j].playerID == missionsToSave.playerID) {
|
||||
playerLocated = true;
|
||||
listIndex = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("\n\n");
|
||||
|
||||
print ("EXTRA INFO\n");
|
||||
print ("Number of missions: " + missionsToSave.missionsList.Count);
|
||||
print ("Current Save Number " + currentSaveNumber);
|
||||
print ("Save Located " + saveLocated);
|
||||
print ("Player Located " + playerLocated);
|
||||
print ("Player ID " + missionsToSave.playerID);
|
||||
}
|
||||
|
||||
//if the save is located, check if the player id exists
|
||||
if (saveLocated) {
|
||||
//if player id exists, overwrite it
|
||||
if (playerLocated) {
|
||||
infoListToSave [saveSlotIndex].playerMissionsList [listIndex].missionsList = missionsToSave.missionsList;
|
||||
} else {
|
||||
infoListToSave [saveSlotIndex].playerMissionsList.Add (missionsToSave);
|
||||
}
|
||||
} else {
|
||||
newPersistancePlayerMissionsListBySaveSlotInfo.saveNumber = currentSaveNumber;
|
||||
newPersistancePlayerMissionsListBySaveSlotInfo.playerMissionsList.Add (missionsToSave);
|
||||
infoListToSave.Add (newPersistancePlayerMissionsListBySaveSlotInfo);
|
||||
}
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("\n\n");
|
||||
|
||||
for (int j = 0; j < missionsToSave.missionsList.Count; j++) {
|
||||
persistanceMissionInfo currentPersistanceMissionInfo = missionsToSave.missionsList [j];
|
||||
|
||||
showDetailedDebugInfo (currentPersistanceMissionInfo);
|
||||
}
|
||||
}
|
||||
|
||||
bf = new BinaryFormatter ();
|
||||
file = File.Open (currentSaveDataPath, FileMode.OpenOrCreate);
|
||||
bf.Serialize (file, infoListToSave);
|
||||
|
||||
file.Close ();
|
||||
}
|
||||
|
||||
public void loadGameContent (int saveNumberToLoad, int playerID, string currentSaveDataPath, bool showDebugInfo)
|
||||
{
|
||||
getMainManager ();
|
||||
|
||||
if (mainObjectiveLogSystem == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mainObjectiveLogSystem.isObjectiveMenuActive ()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mainObjectiveLogSystem.saveCurrentPlayerMissionsToSaveFile) {
|
||||
initializeValues ();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("\n\n");
|
||||
|
||||
print ("Loading missions");
|
||||
}
|
||||
|
||||
//need to store and check the current slot saved and the player which is saving, to get that concrete info
|
||||
persistanceInfoList = new List<persistanceMissionInfo> ();
|
||||
|
||||
List<persistancePlayerMissionsListBySaveSlotInfo> infoListToLoad = new List<persistancePlayerMissionsListBySaveSlotInfo> ();
|
||||
|
||||
if (File.Exists (currentSaveDataPath)) {
|
||||
BinaryFormatter bf = new BinaryFormatter ();
|
||||
FileStream file = File.Open (currentSaveDataPath, FileMode.Open);
|
||||
object currentData = bf.Deserialize (file);
|
||||
infoListToLoad = currentData as List<persistancePlayerMissionsListBySaveSlotInfo>;
|
||||
|
||||
file.Close ();
|
||||
}
|
||||
|
||||
if (saveNumberToLoad > -1) {
|
||||
persistancePlayerMissionsListBySaveSlotInfo newPersistancePlayerMissionsListBySaveSlotInfo = new persistancePlayerMissionsListBySaveSlotInfo ();
|
||||
|
||||
int infoListToLoadCount = infoListToLoad.Count;
|
||||
|
||||
for (int j = 0; j < infoListToLoadCount; j++) {
|
||||
|
||||
if (infoListToLoad [j].saveNumber == saveNumberToLoad) {
|
||||
newPersistancePlayerMissionsListBySaveSlotInfo = infoListToLoad [j];
|
||||
}
|
||||
}
|
||||
|
||||
int listIndex = -1;
|
||||
|
||||
int playerMissionsListCount = newPersistancePlayerMissionsListBySaveSlotInfo.playerMissionsList.Count;
|
||||
|
||||
for (int j = 0; j < playerMissionsListCount; j++) {
|
||||
|
||||
if (newPersistancePlayerMissionsListBySaveSlotInfo.playerMissionsList [j].playerID == playerID) {
|
||||
listIndex = j;
|
||||
}
|
||||
}
|
||||
|
||||
if (listIndex > -1) {
|
||||
persistanceInfoList.AddRange (newPersistancePlayerMissionsListBySaveSlotInfo.playerMissionsList [listIndex].missionsList);
|
||||
}
|
||||
}
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("\n\n");
|
||||
|
||||
print ("Missions Loaded in Save Number " + saveNumberToLoad);
|
||||
print ("Number of missions: " + persistanceInfoList.Count);
|
||||
|
||||
print ("\n\n");
|
||||
|
||||
for (int j = 0; j < persistanceInfoList.Count; j++) {
|
||||
print ("\n\n");
|
||||
|
||||
persistanceMissionInfo currentPersistanceMissionInfo = persistanceInfoList [j];
|
||||
|
||||
showDetailedDebugInfo (currentPersistanceMissionInfo);
|
||||
}
|
||||
}
|
||||
|
||||
showCurrentDebugInfo = showDebugInfo;
|
||||
|
||||
loadInfoOnMainComponent ();
|
||||
}
|
||||
|
||||
|
||||
public persistancePlayerMissionInfo getPersistanceList (int playerID, bool showDebugInfo)
|
||||
{
|
||||
persistancePlayerMissionInfo newMissionsList = new persistancePlayerMissionInfo ();
|
||||
|
||||
newMissionsList.playerID = playerID;
|
||||
|
||||
List<persistanceMissionInfo> newPersistanceMissionInfoList = new List<persistanceMissionInfo> ();
|
||||
|
||||
List<objectiveLogSystem.objectiveSlotInfo> objectiveSlotInfoList = mainObjectiveLogSystem.objectiveSlotInfoList;
|
||||
|
||||
int objectiveSlotInfoListCount = objectiveSlotInfoList.Count;
|
||||
|
||||
for (int k = 0; k < objectiveSlotInfoListCount; k++) {
|
||||
persistanceMissionInfo newPersistanceMissionInfo = new persistanceMissionInfo ();
|
||||
|
||||
objectiveLogSystem.objectiveSlotInfo currentSlotInfo = objectiveSlotInfoList [k];
|
||||
|
||||
newPersistanceMissionInfo.missionScene = currentSlotInfo.missionScene;
|
||||
newPersistanceMissionInfo.missionID = currentSlotInfo.missionID;
|
||||
|
||||
newPersistanceMissionInfo.disableObjectivePanelOnMissionComplete = currentSlotInfo.disableObjectivePanelOnMissionComplete;
|
||||
|
||||
newPersistanceMissionInfo.addObjectiveToPlayerLogSystem = currentSlotInfo.addObjectiveToPlayerLogSystem;
|
||||
|
||||
newPersistanceMissionInfo.missionComplete = currentSlotInfo.missionComplete;
|
||||
newPersistanceMissionInfo.missionInProcess = currentSlotInfo.missionInProcess;
|
||||
newPersistanceMissionInfo.rewardObtained = currentSlotInfo.rewardObtained;
|
||||
newPersistanceMissionInfo.missionAccepted = currentSlotInfo.missionAccepted;
|
||||
|
||||
newPersistanceMissionInfo.objectiveName = currentSlotInfo.objectiveName;
|
||||
newPersistanceMissionInfo.objectiveDescription = currentSlotInfo.objectiveDescription;
|
||||
newPersistanceMissionInfo.objectiveFullDescription = currentSlotInfo.objectiveFullDescription;
|
||||
newPersistanceMissionInfo.objectiveLocation = currentSlotInfo.objectiveLocation;
|
||||
newPersistanceMissionInfo.objectiveRewards = currentSlotInfo.objectiveRewards;
|
||||
|
||||
newPersistanceMissionInfo.subObjectiveCompleteList = currentSlotInfo.subObjectiveCompleteList;
|
||||
|
||||
if (showDebugInfo) {
|
||||
debugMissionInfo (newPersistanceMissionInfo);
|
||||
}
|
||||
|
||||
newPersistanceMissionInfoList.Add (newPersistanceMissionInfo);
|
||||
}
|
||||
|
||||
newMissionsList.missionsList = newPersistanceMissionInfoList;
|
||||
|
||||
return newMissionsList;
|
||||
}
|
||||
|
||||
|
||||
void loadInfoOnMainComponent ()
|
||||
{
|
||||
initializeValues ();
|
||||
|
||||
if (persistanceInfoList != null && persistanceInfoList.Count > 0) {
|
||||
|
||||
int persistanceInfoListCount = persistanceInfoList.Count;
|
||||
|
||||
for (int k = 0; k < persistanceInfoListCount; k++) {
|
||||
|
||||
persistanceMissionInfo currentPersistanceMissionInfo = persistanceInfoList [k];
|
||||
|
||||
//Seach the objective event system, the mission it self, in the main objective manager, to see the info needed on it
|
||||
objectiveEventSystem currentObjectiveEventSystem =
|
||||
mainObjectiveLogSystem.getObjectiveEventSystem (currentPersistanceMissionInfo.missionID, currentPersistanceMissionInfo.missionScene);
|
||||
|
||||
//if the current mission to search is found in the level, assign the info and set its state, including to add the log info on the player's menu
|
||||
if (currentObjectiveEventSystem != null) {
|
||||
if (showCurrentDebugInfo) {
|
||||
debugMissionInfo (currentPersistanceMissionInfo);
|
||||
}
|
||||
|
||||
currentObjectiveEventSystem.setCurrentPlayer (mainObjectiveLogSystem.playerControllerGameObject);
|
||||
|
||||
bool updateSubobjectivesCompleteOnMission = currentPersistanceMissionInfo.missionInProcess ||
|
||||
currentObjectiveEventSystem.updateSubobjectivesCompleteOnLoadGame;
|
||||
|
||||
if (updateSubobjectivesCompleteOnMission) {
|
||||
if (currentPersistanceMissionInfo.subObjectiveCompleteList.Count > 0) {
|
||||
currentObjectiveEventSystem.setSubObjectiveCompleteListState (currentPersistanceMissionInfo.subObjectiveCompleteList);
|
||||
}
|
||||
|
||||
currentObjectiveEventSystem.initializeNumberOfObjectives ();
|
||||
}
|
||||
|
||||
bool resumeMissionOnLoadGameIfNotComplete = !currentPersistanceMissionInfo.missionComplete &&
|
||||
(currentObjectiveEventSystem.resumeMissionOnLoadGameIfNotComplete ||
|
||||
currentPersistanceMissionInfo.missionInProcess);
|
||||
|
||||
if (resumeMissionOnLoadGameIfNotComplete) {
|
||||
currentObjectiveEventSystem.startObjective ();
|
||||
} else {
|
||||
currentObjectiveEventSystem.addObjectiveToPlayerLogMenu ();
|
||||
|
||||
if (currentPersistanceMissionInfo.missionComplete) {
|
||||
currentObjectiveEventSystem.setObjectiveAsCompleteOnLoad (currentPersistanceMissionInfo.rewardObtained);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
//If the mission system is not found, it means the mission is assigned in other level, so just assign the info in the player's log
|
||||
mainObjectiveLogSystem.addObjective (currentPersistanceMissionInfo.objectiveName,
|
||||
currentPersistanceMissionInfo.objectiveDescription,
|
||||
currentPersistanceMissionInfo.objectiveFullDescription,
|
||||
currentPersistanceMissionInfo.objectiveLocation,
|
||||
currentPersistanceMissionInfo.objectiveRewards,
|
||||
null,
|
||||
currentPersistanceMissionInfo.addObjectiveToPlayerLogSystem);
|
||||
|
||||
objectiveLogSystem.objectiveSlotInfo currentobjectiveSlotInfo =
|
||||
mainObjectiveLogSystem.objectiveSlotInfoList [mainObjectiveLogSystem.objectiveSlotInfoList.Count - 1];
|
||||
|
||||
currentobjectiveSlotInfo.missionScene = currentPersistanceMissionInfo.missionScene;
|
||||
currentobjectiveSlotInfo.missionID = currentPersistanceMissionInfo.missionID;
|
||||
|
||||
currentobjectiveSlotInfo.disableObjectivePanelOnMissionComplete = currentPersistanceMissionInfo.disableObjectivePanelOnMissionComplete;
|
||||
|
||||
currentobjectiveSlotInfo.addObjectiveToPlayerLogSystem = currentPersistanceMissionInfo.addObjectiveToPlayerLogSystem;
|
||||
|
||||
currentobjectiveSlotInfo.missionComplete = currentPersistanceMissionInfo.missionComplete;
|
||||
currentobjectiveSlotInfo.missionInProcess = currentPersistanceMissionInfo.missionInProcess;
|
||||
currentobjectiveSlotInfo.rewardObtained = currentPersistanceMissionInfo.rewardObtained;
|
||||
currentobjectiveSlotInfo.missionAccepted = currentPersistanceMissionInfo.missionAccepted;
|
||||
|
||||
if (currentobjectiveSlotInfo.missionComplete) {
|
||||
mainObjectiveLogSystem.updateObjectiveCompleteSlotInfo (mainObjectiveLogSystem.objectiveSlotInfoList.Count - 1);
|
||||
} else {
|
||||
if (currentPersistanceMissionInfo.subObjectiveCompleteList.Count > 0) {
|
||||
mainObjectiveLogSystem.updateSubObjectiveCompleteListSlotInfo (mainObjectiveLogSystem.objectiveSlotInfoList.Count - 1,
|
||||
currentPersistanceMissionInfo.subObjectiveCompleteList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mainObjectiveLogSystem.updateUIElements ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void getMainManager ()
|
||||
{
|
||||
if (mainObjectiveLogSystem == null) {
|
||||
mainObjectiveLogSystem = FindObjectOfType<objectiveLogSystem> ();
|
||||
}
|
||||
}
|
||||
|
||||
void initializeValues ()
|
||||
{
|
||||
mainObjectiveLogSystem.initializeMissionValues ();
|
||||
}
|
||||
|
||||
public void debugMissionInfo (persistanceMissionInfo missinInfo)
|
||||
{
|
||||
print (
|
||||
|
||||
missinInfo.missionScene + " " +
|
||||
missinInfo.missionID + " " +
|
||||
missinInfo.disableObjectivePanelOnMissionComplete + " " +
|
||||
missinInfo.addObjectiveToPlayerLogSystem + " " +
|
||||
missinInfo.missionComplete + " " +
|
||||
missinInfo.missionInProcess + " " +
|
||||
missinInfo.rewardObtained + " " +
|
||||
missinInfo.missionAccepted + " " +
|
||||
missinInfo.objectiveName + " " +
|
||||
missinInfo.objectiveDescription + " " +
|
||||
missinInfo.objectiveFullDescription + " " +
|
||||
missinInfo.objectiveRewards
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
void showDetailedDebugInfo (persistanceMissionInfo currentPersistanceMissionInfo)
|
||||
{
|
||||
print ("Mission Scene " + currentPersistanceMissionInfo.missionScene);
|
||||
print ("Mission ID " + currentPersistanceMissionInfo.missionID);
|
||||
print ("Disable Panel On Mission Complete " + currentPersistanceMissionInfo.disableObjectivePanelOnMissionComplete);
|
||||
print ("Add Objective To Player Log System " + currentPersistanceMissionInfo.addObjectiveToPlayerLogSystem);
|
||||
print ("Mission Complete " + currentPersistanceMissionInfo.missionComplete);
|
||||
print ("Mission In Process " + currentPersistanceMissionInfo.missionInProcess);
|
||||
print ("Mission Reward Obtained " + currentPersistanceMissionInfo.rewardObtained);
|
||||
print ("Mission Accepted " + currentPersistanceMissionInfo.missionAccepted);
|
||||
print ("Objective Name " + currentPersistanceMissionInfo.objectiveName);
|
||||
print ("Objective Description " + currentPersistanceMissionInfo.objectiveDescription);
|
||||
print ("Full Description " + currentPersistanceMissionInfo.objectiveFullDescription);
|
||||
print ("Objective Location " + currentPersistanceMissionInfo.objectiveLocation);
|
||||
print ("Objective Rewards " + currentPersistanceMissionInfo.objectiveRewards);
|
||||
|
||||
|
||||
print ("Sub Objectives Complete\n");
|
||||
|
||||
for (int j = 0; j < currentPersistanceMissionInfo.subObjectiveCompleteList.Count; j++) {
|
||||
print (currentPersistanceMissionInfo.subObjectiveCompleteList [j]);
|
||||
}
|
||||
|
||||
print ("\n\n");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ea7d764431e170d41ade3fecdc16ad18
|
||||
timeCreated: 1602221056
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Save System/Custom Class To Save/saveMissionsInfo.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,317 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
using System.IO;
|
||||
using System;
|
||||
|
||||
public class savePlayerBlendshapesInfo : saveGameInfo
|
||||
{
|
||||
public characterCustomizationBlendshapesHelper mainCharacterCustomizationBlendshapesHelper;
|
||||
|
||||
List<persistanceBlendshapesInfo> persistanceInfoList;
|
||||
|
||||
List<string> accessoriesList = new List<string> ();
|
||||
|
||||
public override void saveGame (int saveNumber, int playerID, string currentSaveDataPath, bool showDebugInfo, bool savingGameToChangeScene)
|
||||
{
|
||||
saveGameContent (saveNumber, playerID, currentSaveDataPath, showDebugInfo, savingGameToChangeScene);
|
||||
}
|
||||
|
||||
public override void loadGame (int saveNumberToLoad, int playerID, string currentSaveDataPath, bool showDebugInfo)
|
||||
{
|
||||
loadGameContent (saveNumberToLoad, playerID, currentSaveDataPath, showDebugInfo);
|
||||
}
|
||||
|
||||
public override void initializeValuesOnComponent ()
|
||||
{
|
||||
initializeValues ();
|
||||
}
|
||||
|
||||
public void saveGameContent (int currentSaveNumber, int playerID, string currentSaveDataPath, bool showDebugInfo, bool savingGameToChangeScene)
|
||||
{
|
||||
if (mainCharacterCustomizationBlendshapesHelper == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("\n\n");
|
||||
|
||||
print ("Saving player blendshapes");
|
||||
}
|
||||
|
||||
bool saveLocated = false;
|
||||
bool playerLocated = false;
|
||||
|
||||
int saveSlotIndex = -1;
|
||||
int listIndex = -1;
|
||||
|
||||
BinaryFormatter bf = new BinaryFormatter ();
|
||||
FileStream file;
|
||||
|
||||
mainCharacterCustomizationBlendshapesHelper.storeBlendshapesCustomization ();
|
||||
|
||||
persistancePlayerBlendshapesInfo blendShapeListToSave = getPersistanceList (playerID, showDebugInfo);
|
||||
|
||||
persistanceBlendshapesListBySaveSlotInfo newPersistanceListBySaveSlotInfo = new persistanceBlendshapesListBySaveSlotInfo ();
|
||||
|
||||
List<persistanceBlendshapesListBySaveSlotInfo> infoListToSave = new List<persistanceBlendshapesListBySaveSlotInfo> ();
|
||||
|
||||
if (File.Exists (currentSaveDataPath)) {
|
||||
bf = new BinaryFormatter ();
|
||||
file = File.Open (currentSaveDataPath, FileMode.Open);
|
||||
object currentData = bf.Deserialize (file);
|
||||
infoListToSave = currentData as List<persistanceBlendshapesListBySaveSlotInfo>;
|
||||
|
||||
file.Close ();
|
||||
}
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("Number of save list for player blendshapes " + infoListToSave.Count);
|
||||
}
|
||||
|
||||
int infoListToSaveCount = infoListToSave.Count;
|
||||
|
||||
for (int j = 0; j < infoListToSaveCount; j++) {
|
||||
if (saveSlotIndex == -1) {
|
||||
persistanceBlendshapesListBySaveSlotInfo currentSlot = infoListToSave [j];
|
||||
|
||||
if (ignoreSaveNumberOnSaveLoadInfo || currentSlot.saveNumber == currentSaveNumber) {
|
||||
newPersistanceListBySaveSlotInfo = currentSlot;
|
||||
saveLocated = true;
|
||||
saveSlotIndex = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (saveLocated) {
|
||||
int listCount = newPersistanceListBySaveSlotInfo.playerBlendshapesList.Count;
|
||||
|
||||
int playerIDToSearch = blendShapeListToSave.playerID;
|
||||
|
||||
for (int j = 0; j < listCount; j++) {
|
||||
if (listIndex == -1) {
|
||||
if (ignorePlayerIDOnSaveLoadInfo ||
|
||||
newPersistanceListBySaveSlotInfo.playerBlendshapesList [j].playerID == playerIDToSearch) {
|
||||
playerLocated = true;
|
||||
listIndex = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("\n\n");
|
||||
|
||||
print ("EXTRA INFO\n");
|
||||
print ("PLAYER BLENDSHAPES");
|
||||
print ("Number of blendshpaes: " + blendShapeListToSave.blendshapesList.Count);
|
||||
print ("Current Save Number " + currentSaveNumber);
|
||||
print ("Save Located " + saveLocated);
|
||||
print ("Player Located " + playerLocated);
|
||||
|
||||
print ("Save List Index " + listIndex);
|
||||
}
|
||||
|
||||
//if the save is located, check if the player id exists
|
||||
if (saveLocated) {
|
||||
//if player id exists, overwrite it
|
||||
if (playerLocated) {
|
||||
infoListToSave [saveSlotIndex].playerBlendshapesList [listIndex] = blendShapeListToSave;
|
||||
} else {
|
||||
infoListToSave [saveSlotIndex].playerBlendshapesList.Add (blendShapeListToSave);
|
||||
}
|
||||
} else {
|
||||
newPersistanceListBySaveSlotInfo.saveNumber = currentSaveNumber;
|
||||
newPersistanceListBySaveSlotInfo.playerBlendshapesList.Add (blendShapeListToSave);
|
||||
|
||||
infoListToSave.Add (newPersistanceListBySaveSlotInfo);
|
||||
}
|
||||
|
||||
bf = new BinaryFormatter ();
|
||||
file = File.Open (currentSaveDataPath, FileMode.OpenOrCreate);
|
||||
bf.Serialize (file, infoListToSave);
|
||||
|
||||
file.Close ();
|
||||
}
|
||||
|
||||
public void loadGameContent (int saveNumberToLoad, int playerID, string currentSaveDataPath, bool showDebugInfo)
|
||||
{
|
||||
if (mainCharacterCustomizationBlendshapesHelper == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("\n\n");
|
||||
|
||||
print ("Loading player blendshapes with PLAYER ID " + playerID);
|
||||
}
|
||||
|
||||
persistanceInfoList = new List<persistanceBlendshapesInfo> ();
|
||||
|
||||
List<persistanceBlendshapesListBySaveSlotInfo> infoListToLoad = new List<persistanceBlendshapesListBySaveSlotInfo> ();
|
||||
|
||||
if (File.Exists (currentSaveDataPath)) {
|
||||
BinaryFormatter bf = new BinaryFormatter ();
|
||||
FileStream file = File.Open (currentSaveDataPath, FileMode.Open);
|
||||
object currentData = bf.Deserialize (file);
|
||||
infoListToLoad = currentData as List<persistanceBlendshapesListBySaveSlotInfo>;
|
||||
|
||||
file.Close ();
|
||||
}
|
||||
|
||||
if (saveNumberToLoad > -1) {
|
||||
|
||||
if (showDebugInfo) {
|
||||
print (infoListToLoad.Count);
|
||||
}
|
||||
|
||||
persistanceBlendshapesListBySaveSlotInfo newPersistanceListBySaveSlotInfo = new persistanceBlendshapesListBySaveSlotInfo ();
|
||||
|
||||
int infoListToLoadCount = infoListToLoad.Count;
|
||||
|
||||
bool slotLocated = false;
|
||||
|
||||
for (int j = 0; j < infoListToLoadCount; j++) {
|
||||
if (!slotLocated) {
|
||||
persistanceBlendshapesListBySaveSlotInfo currentSlot = infoListToLoad [j];
|
||||
|
||||
bool checkSlot = false;
|
||||
|
||||
if (ignoreSaveNumberOnSaveLoadInfo) {
|
||||
checkSlot = true;
|
||||
}
|
||||
|
||||
if (saveNumberToIgnoreSaveLoadInfo == saveNumberToLoad && saveNumberToIgnoreSaveLoadInfo > -1) {
|
||||
checkSlot = true;
|
||||
}
|
||||
|
||||
if (currentSlot.saveNumber == saveNumberToLoad) {
|
||||
checkSlot = true;
|
||||
}
|
||||
|
||||
if (checkSlot) {
|
||||
newPersistanceListBySaveSlotInfo = currentSlot;
|
||||
|
||||
slotLocated = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int listIndex = -1;
|
||||
|
||||
int listCount = newPersistanceListBySaveSlotInfo.playerBlendshapesList.Count;
|
||||
|
||||
for (int j = 0; j < listCount; j++) {
|
||||
if (listIndex == -1) {
|
||||
bool checkSlot = false;
|
||||
|
||||
if (ignorePlayerIDOnSaveLoadInfo) {
|
||||
checkSlot = true;
|
||||
}
|
||||
|
||||
if (saveNumberToIgnoreSaveLoadInfo == saveNumberToLoad && saveNumberToIgnoreSaveLoadInfo > -1) {
|
||||
checkSlot = true;
|
||||
}
|
||||
|
||||
if (newPersistanceListBySaveSlotInfo.playerBlendshapesList [j].playerID == playerID) {
|
||||
checkSlot = true;
|
||||
}
|
||||
|
||||
if (checkSlot) {
|
||||
listIndex = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (listIndex > -1) {
|
||||
persistancePlayerBlendshapesInfo blendshapeListToLoad = newPersistanceListBySaveSlotInfo.playerBlendshapesList [listIndex];
|
||||
|
||||
persistanceInfoList.AddRange (newPersistanceListBySaveSlotInfo.playerBlendshapesList [listIndex].blendshapesList);
|
||||
|
||||
accessoriesList.AddRange (newPersistanceListBySaveSlotInfo.playerBlendshapesList [listIndex].accessoriesList);
|
||||
}
|
||||
}
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("\n\n");
|
||||
|
||||
print ("PLAYER BLENDSHAPES");
|
||||
|
||||
print ("Blendshapes Loaded in Save Number " + saveNumberToLoad);
|
||||
print ("Number of objects: " + persistanceInfoList.Count);
|
||||
|
||||
for (int j = 0; j < persistanceInfoList.Count; j++) {
|
||||
persistanceBlendshapesInfo currentPersistanceBlendshapesInfo = persistanceInfoList [j];
|
||||
|
||||
print (currentPersistanceBlendshapesInfo.Name + " " + currentPersistanceBlendshapesInfo.blendShapeValue);
|
||||
}
|
||||
}
|
||||
|
||||
loadInfoOnMainComponent ();
|
||||
}
|
||||
|
||||
|
||||
public persistancePlayerBlendshapesInfo getPersistanceList (int playerID, bool showDebugInfo)
|
||||
{
|
||||
persistancePlayerBlendshapesInfo newPersistancePlayerBlendshapesInfo = new persistancePlayerBlendshapesInfo ();
|
||||
|
||||
newPersistancePlayerBlendshapesInfo.playerID = playerID;
|
||||
|
||||
List<persistanceBlendshapesInfo> newPersistanceBlendshapesInfoList = new List<persistanceBlendshapesInfo> ();
|
||||
|
||||
List<characterCustomizationManager.temporalBlendshapeInfo> temporalBlendshapeInfoList = mainCharacterCustomizationBlendshapesHelper.temporalBlendshapeInfoList;
|
||||
|
||||
int temporalBlendshapeInfoListCount = temporalBlendshapeInfoList.Count;
|
||||
|
||||
for (int k = 0; k < temporalBlendshapeInfoListCount; k++) {
|
||||
persistanceBlendshapesInfo newPersistanceBlendshapesInfo = new persistanceBlendshapesInfo ();
|
||||
|
||||
characterCustomizationManager.temporalBlendshapeInfo currentBlendshape = temporalBlendshapeInfoList [k];
|
||||
|
||||
newPersistanceBlendshapesInfo.Name = currentBlendshape.Name;
|
||||
|
||||
newPersistanceBlendshapesInfo.blendShapeValue = currentBlendshape.blendShapeValue;
|
||||
|
||||
newPersistanceBlendshapesInfoList.Add (newPersistanceBlendshapesInfo);
|
||||
}
|
||||
|
||||
newPersistancePlayerBlendshapesInfo.blendshapesList = newPersistanceBlendshapesInfoList;
|
||||
|
||||
newPersistancePlayerBlendshapesInfo.accessoriesList = mainCharacterCustomizationBlendshapesHelper.temporalCurrentAccessoriesList;
|
||||
|
||||
return newPersistancePlayerBlendshapesInfo;
|
||||
}
|
||||
|
||||
|
||||
void loadInfoOnMainComponent ()
|
||||
{
|
||||
initializeValues ();
|
||||
|
||||
if (persistanceInfoList != null && persistanceInfoList.Count > 0) {
|
||||
|
||||
int persistanceInfoListCount = persistanceInfoList.Count;
|
||||
|
||||
for (int i = 0; i < persistanceInfoListCount; i++) {
|
||||
|
||||
persistanceBlendshapesInfo currentPersistanceBlendshapesInfo = persistanceInfoList [i];
|
||||
|
||||
characterCustomizationManager.temporalBlendshapeInfo newBlendshape = new characterCustomizationManager.temporalBlendshapeInfo ();
|
||||
|
||||
newBlendshape.Name = currentPersistanceBlendshapesInfo.Name;
|
||||
newBlendshape.blendShapeValue = currentPersistanceBlendshapesInfo.blendShapeValue;
|
||||
|
||||
mainCharacterCustomizationBlendshapesHelper.temporalBlendshapeInfoList.Add (newBlendshape);
|
||||
}
|
||||
|
||||
mainCharacterCustomizationBlendshapesHelper.temporalCurrentAccessoriesList.AddRange (accessoriesList);
|
||||
|
||||
mainCharacterCustomizationBlendshapesHelper.setBlendshapeList ();
|
||||
}
|
||||
}
|
||||
|
||||
void initializeValues ()
|
||||
{
|
||||
mainCharacterCustomizationBlendshapesHelper.checkMainCHaracterCustomizatationManager ();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8c65dcaf87d9b89438fe77f4bf770ddf
|
||||
timeCreated: 1640422152
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Save System/Custom Class To Save/savePlayerBlendshapesInfo.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,696 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
using System.IO;
|
||||
using System;
|
||||
|
||||
public class savePlayerInventoryInfo : saveGameInfo
|
||||
{
|
||||
[Space]
|
||||
[Header ("Other Options")]
|
||||
[Space]
|
||||
|
||||
public bool ignoreAssignLoadedInventoryIfEmpty;
|
||||
|
||||
[Space]
|
||||
[Header ("Debug")]
|
||||
[Space]
|
||||
|
||||
public List<inventoryListElement> persistanceInfoList;
|
||||
|
||||
[Space]
|
||||
[Header ("Components")]
|
||||
[Space]
|
||||
|
||||
public inventoryManagerInfo mainInventoryManager;
|
||||
|
||||
bool lastGameSavedOnHomeMenuValue;
|
||||
|
||||
|
||||
public override void saveGame (int saveNumber, int playerID, string currentSaveDataPath, bool showDebugInfo, bool savingGameToChangeScene)
|
||||
{
|
||||
saveGameContent (saveNumber, playerID, currentSaveDataPath, showDebugInfo, savingGameToChangeScene);
|
||||
}
|
||||
|
||||
public override void loadGame (int saveNumberToLoad, int playerID, string currentSaveDataPath, bool showDebugInfo)
|
||||
{
|
||||
loadGameContent (saveNumberToLoad, playerID, currentSaveDataPath, showDebugInfo);
|
||||
}
|
||||
|
||||
public override void saveGameFromEditor (int saveNumber, int playerID, string currentSaveDataPath, bool showDebugInfo)
|
||||
{
|
||||
saveGameContentFromEditor (saveNumber, playerID, currentSaveDataPath, showDebugInfo);
|
||||
}
|
||||
|
||||
public override void initializeValuesOnComponent ()
|
||||
{
|
||||
initializeValues ();
|
||||
}
|
||||
|
||||
public void saveGameContent (int currentSaveNumber, int playerID, string currentSaveDataPath, bool showDebugInfo, bool savingGameToChangeScene)
|
||||
{
|
||||
if (mainInventoryManager == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mainInventoryManager.isSaveCurrentPlayerInventoryToSaveFileActive ()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("\n\n");
|
||||
|
||||
print ("Saving player inventory");
|
||||
}
|
||||
|
||||
bool saveLocated = false;
|
||||
bool playerLocated = false;
|
||||
|
||||
int saveSlotIndex = -1;
|
||||
int listIndex = -1;
|
||||
|
||||
BinaryFormatter bf = new BinaryFormatter ();
|
||||
FileStream file;
|
||||
|
||||
persistanceInventoryListByPlayerInfo inventoryListToSave = getPersistanceList (playerID, showDebugInfo);
|
||||
|
||||
persistanceInventoryListBySaveSlotInfo newPersistanceInventoryListBySaveSlotInfo = new persistanceInventoryListBySaveSlotInfo ();
|
||||
|
||||
List<persistanceInventoryListBySaveSlotInfo> infoListToSave = new List<persistanceInventoryListBySaveSlotInfo> ();
|
||||
|
||||
if (File.Exists (currentSaveDataPath)) {
|
||||
bf = new BinaryFormatter ();
|
||||
file = File.Open (currentSaveDataPath, FileMode.Open);
|
||||
object currentData = bf.Deserialize (file);
|
||||
infoListToSave = currentData as List<persistanceInventoryListBySaveSlotInfo>;
|
||||
|
||||
file.Close ();
|
||||
}
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("Number of save list for player inventory " + infoListToSave.Count);
|
||||
}
|
||||
|
||||
int infoListToSaveCount = infoListToSave.Count;
|
||||
|
||||
for (int j = 0; j < infoListToSaveCount; j++) {
|
||||
if (saveSlotIndex == -1) {
|
||||
persistanceInventoryListBySaveSlotInfo currentSlot = infoListToSave [j];
|
||||
|
||||
if (currentSlot.saveNumber == currentSaveNumber) {
|
||||
newPersistanceInventoryListBySaveSlotInfo = currentSlot;
|
||||
saveLocated = true;
|
||||
saveSlotIndex = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (saveLocated) {
|
||||
int playerInventoryListCount = newPersistanceInventoryListBySaveSlotInfo.playerInventoryList.Count;
|
||||
|
||||
int playerIDToSearch = inventoryListToSave.playerID;
|
||||
|
||||
for (int j = 0; j < playerInventoryListCount; j++) {
|
||||
if (listIndex == -1) {
|
||||
if (newPersistanceInventoryListBySaveSlotInfo.playerInventoryList [j].playerID == playerIDToSearch) {
|
||||
playerLocated = true;
|
||||
listIndex = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("\n\n");
|
||||
|
||||
print ("EXTRA INFO\n");
|
||||
print ("PLAYER INVENTORY");
|
||||
print ("Number of objects: " + inventoryListToSave.inventoryObjectList.Count);
|
||||
print ("Current Save Number " + currentSaveNumber);
|
||||
print ("Save Located " + saveLocated);
|
||||
print ("Player Located " + playerLocated);
|
||||
print ("Player ID " + inventoryListToSave.playerID);
|
||||
|
||||
print ("Save List Index " + listIndex);
|
||||
}
|
||||
|
||||
//if the save is located, check if the player id exists
|
||||
if (saveLocated) {
|
||||
//if player id exists, overwrite it
|
||||
if (playerLocated) {
|
||||
// infoListToSave [saveSlotIndex].playerInventoryList [listIndex].inventoryObjectList = inventoryListToSave.inventoryObjectList;
|
||||
|
||||
infoListToSave [saveSlotIndex].playerInventoryList [listIndex] = inventoryListToSave;
|
||||
} else {
|
||||
infoListToSave [saveSlotIndex].playerInventoryList.Add (inventoryListToSave);
|
||||
}
|
||||
} else {
|
||||
newPersistanceInventoryListBySaveSlotInfo.saveNumber = currentSaveNumber;
|
||||
newPersistanceInventoryListBySaveSlotInfo.gameSavedOnHomeMenu = gameSavedOnHomeMenu;
|
||||
newPersistanceInventoryListBySaveSlotInfo.playerInventoryList.Add (inventoryListToSave);
|
||||
infoListToSave.Add (newPersistanceInventoryListBySaveSlotInfo);
|
||||
|
||||
if (showDebugInfo) {
|
||||
if (gameSavedOnHomeMenu) {
|
||||
print ("Game saved on home menu");
|
||||
|
||||
print ("\n\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bf = new BinaryFormatter ();
|
||||
file = File.Open (currentSaveDataPath, FileMode.OpenOrCreate);
|
||||
bf.Serialize (file, infoListToSave);
|
||||
|
||||
file.Close ();
|
||||
}
|
||||
|
||||
public void loadGameContent (int saveNumberToLoad, int playerID, string currentSaveDataPath, bool showDebugInfo)
|
||||
{
|
||||
if (mainInventoryManager == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mainInventoryManager.isLoadCurrentPlayerInventoryFromSaveFileActive ()) {
|
||||
initializeValues ();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("\n\n");
|
||||
|
||||
print ("Loading player inventory with PLAYER ID " + playerID + " and saveNumberToLoad " + saveNumberToLoad);
|
||||
}
|
||||
|
||||
//need to store and check the current slot saved and the player which is saving, to get that concrete info
|
||||
persistanceInfoList = new List<inventoryListElement> ();
|
||||
|
||||
List<persistanceInventoryListBySaveSlotInfo> infoListToLoad = new List<persistanceInventoryListBySaveSlotInfo> ();
|
||||
|
||||
if (File.Exists (currentSaveDataPath)) {
|
||||
BinaryFormatter bf = new BinaryFormatter ();
|
||||
FileStream file = File.Open (currentSaveDataPath, FileMode.Open);
|
||||
object currentData = bf.Deserialize (file);
|
||||
infoListToLoad = currentData as List<persistanceInventoryListBySaveSlotInfo>;
|
||||
|
||||
file.Close ();
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("Save File located " + currentSaveDataPath);
|
||||
|
||||
print ("\n\n");
|
||||
}
|
||||
} else {
|
||||
if (showDebugInfo) {
|
||||
print ("Save File not located " + currentSaveDataPath);
|
||||
|
||||
print ("\n\n");
|
||||
}
|
||||
}
|
||||
|
||||
lastGameSavedOnHomeMenuValue = false;
|
||||
|
||||
if (saveNumberToLoad > -1) {
|
||||
|
||||
if (showDebugInfo) {
|
||||
print (infoListToLoad.Count);
|
||||
}
|
||||
|
||||
bool removeSaveInfo = false;
|
||||
|
||||
persistanceInventoryListBySaveSlotInfo newPersistanceInventoryListBySaveSlotInfo = new persistanceInventoryListBySaveSlotInfo ();
|
||||
|
||||
int infoListToLoadCount = infoListToLoad.Count;
|
||||
|
||||
bool slotLocated = false;
|
||||
|
||||
for (int j = 0; j < infoListToLoadCount; j++) {
|
||||
if (!slotLocated) {
|
||||
persistanceInventoryListBySaveSlotInfo currentSlot = infoListToLoad [j];
|
||||
|
||||
bool checkSlot = false;
|
||||
|
||||
// if (ignoreSaveNumberOnSaveLoadInfo) {
|
||||
// checkSlot = true;
|
||||
// }
|
||||
|
||||
if (saveNumberToIgnoreSaveLoadInfo == saveNumberToLoad && saveNumberToIgnoreSaveLoadInfo > -1 && currentSlot.gameSavedOnHomeMenu) {
|
||||
removeSaveInfo = true;
|
||||
|
||||
checkSlot = true;
|
||||
}
|
||||
|
||||
if (currentSlot.saveNumber == saveNumberToLoad) {
|
||||
checkSlot = true;
|
||||
}
|
||||
|
||||
if (checkSlot) {
|
||||
newPersistanceInventoryListBySaveSlotInfo = currentSlot;
|
||||
|
||||
slotLocated = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//print ("number " + newPersistanceInventoryListBySaveSlotInfo.playerInventoryList.Count);
|
||||
|
||||
int listIndex = -1;
|
||||
|
||||
int playerInventoryListCount = newPersistanceInventoryListBySaveSlotInfo.playerInventoryList.Count;
|
||||
|
||||
for (int j = 0; j < playerInventoryListCount; j++) {
|
||||
// print (newPersistanceInventoryListBySaveSlotInfo.playerInventoryList [j].playerID + " " +
|
||||
// newPersistanceInventoryListBySaveSlotInfo.playerInventoryList [j].inventorySlotAmount);
|
||||
//
|
||||
if (listIndex == -1) {
|
||||
bool checkSlot = false;
|
||||
|
||||
// if (ignorePlayerIDOnSaveLoadInfo) {
|
||||
// checkSlot = true;
|
||||
// }
|
||||
|
||||
if (saveNumberToIgnoreSaveLoadInfo == saveNumberToLoad && saveNumberToIgnoreSaveLoadInfo > -1) {
|
||||
checkSlot = true;
|
||||
}
|
||||
|
||||
if (newPersistanceInventoryListBySaveSlotInfo.playerInventoryList [j].playerID == playerID) {
|
||||
checkSlot = true;
|
||||
}
|
||||
|
||||
if (checkSlot) {
|
||||
listIndex = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//print ("index " + listIndex);
|
||||
|
||||
if (listIndex > -1) {
|
||||
lastGameSavedOnHomeMenuValue = newPersistanceInventoryListBySaveSlotInfo.gameSavedOnHomeMenu;
|
||||
|
||||
persistanceInventoryListByPlayerInfo playerInventoryListToLoad = newPersistanceInventoryListBySaveSlotInfo.playerInventoryList [listIndex];
|
||||
|
||||
int inventoryObjectListCount = playerInventoryListToLoad.inventoryObjectList.Count;
|
||||
|
||||
for (int j = 0; j < inventoryObjectListCount; j++) {
|
||||
inventoryListElement newInventoryListElement = new inventoryListElement ();
|
||||
|
||||
persistanceInventoryObjectInfo currentInventoryInfo = playerInventoryListToLoad.inventoryObjectList [j];
|
||||
|
||||
newInventoryListElement.Name = currentInventoryInfo.Name;
|
||||
newInventoryListElement.amount = currentInventoryInfo.amount;
|
||||
newInventoryListElement.infiniteAmount = currentInventoryInfo.infiniteAmount;
|
||||
newInventoryListElement.inventoryObjectName = currentInventoryInfo.inventoryObjectName;
|
||||
|
||||
newInventoryListElement.categoryIndex = currentInventoryInfo.categoryIndex;
|
||||
newInventoryListElement.elementIndex = currentInventoryInfo.elementIndex;
|
||||
|
||||
newInventoryListElement.isEquipped = currentInventoryInfo.isEquipped;
|
||||
|
||||
newInventoryListElement.quickAccessSlotIndex = currentInventoryInfo.quickAccessSlotIndex;
|
||||
|
||||
newInventoryListElement.useDurability = currentInventoryInfo.useDurability;
|
||||
newInventoryListElement.durabilityAmount = currentInventoryInfo.durabilityAmount;
|
||||
newInventoryListElement.maxDurabilityAmount = currentInventoryInfo.maxDurabilityAmount;
|
||||
newInventoryListElement.objectIsBroken = currentInventoryInfo.objectIsBroken;
|
||||
|
||||
newInventoryListElement.isWeapon = currentInventoryInfo.isWeapon;
|
||||
newInventoryListElement.isMeleeWeapon = currentInventoryInfo.isMeleeWeapon;
|
||||
|
||||
newInventoryListElement.projectilesInMagazine = currentInventoryInfo.projectilesInMagazine;
|
||||
|
||||
persistanceInfoList.Add (newInventoryListElement);
|
||||
}
|
||||
|
||||
int inventorySlotAmount = playerInventoryListToLoad.inventorySlotAmount;
|
||||
|
||||
if (inventorySlotAmount > -1) {
|
||||
mainInventoryManager.setInventorySlotAmountValue (inventorySlotAmount);
|
||||
}
|
||||
|
||||
mainInventoryManager.setInventoryWasEmptyWhenSavedState (playerInventoryListToLoad.inventoryWasEmptyWhenSaved);
|
||||
|
||||
if (mainInventoryManager.isSetInfiniteSlotValuesOnSaveLoadActive ()) {
|
||||
mainInventoryManager.setInfiniteSlotsState (playerInventoryListToLoad.infiniteSlots);
|
||||
}
|
||||
|
||||
if (playerInventoryListToLoad.useOnlyBlueprintsUnlocked) {
|
||||
GKC_Utils.setUseOnlyBlueprintsUnlockedState (mainInventoryManager.gameObject, true);
|
||||
|
||||
GKC_Utils.setBlueprintsUnlockedListValue (mainInventoryManager.gameObject, playerInventoryListToLoad.blueprintsUnlockedList);
|
||||
}
|
||||
|
||||
if (playerInventoryListToLoad.anyObjectToCraftInTimeActive) {
|
||||
GKC_Utils.setCraftObjectInTimeInfoList (mainInventoryManager.gameObject, playerInventoryListToLoad.craftObjectInTimeSimpleInfoList);
|
||||
}
|
||||
|
||||
if (playerInventoryListToLoad.objectCategoriesToCraftAvailableAtAnyMoment != null && playerInventoryListToLoad.objectCategoriesToCraftAvailableAtAnyMoment.Count > 0) {
|
||||
GKC_Utils.setObjectCategoriesToCraftAvailableAtAnyMomentValue (mainInventoryManager.gameObject, playerInventoryListToLoad.objectCategoriesToCraftAvailableAtAnyMoment);
|
||||
}
|
||||
|
||||
mainInventoryManager.setLastWeaponCarriedOnHandsName (playerInventoryListToLoad.lastWeaponCarriedOnHandsName);
|
||||
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("\n\n");
|
||||
print ("Number of inventory slots available: " + playerInventoryListToLoad.inventorySlotAmount);
|
||||
print ("\n\n");
|
||||
|
||||
if (playerInventoryListToLoad.useOnlyBlueprintsUnlocked) {
|
||||
print ("\n\n");
|
||||
print ("Use only blueprints unlocked active with the amount: " + playerInventoryListToLoad.blueprintsUnlockedList.Count);
|
||||
print ("\n\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (removeSaveInfo) {
|
||||
infoListToLoad.Remove (newPersistanceInventoryListBySaveSlotInfo);
|
||||
|
||||
BinaryFormatter bf = new BinaryFormatter ();
|
||||
|
||||
FileStream file = File.Create (currentSaveDataPath);
|
||||
|
||||
bf.Serialize (file, infoListToLoad);
|
||||
|
||||
file.Close ();
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("REMOVE SLOT FROM INITIAL INVENTORY ON NEW GAME");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("\n\n");
|
||||
|
||||
print ("PLAYER INVENTORY");
|
||||
|
||||
print ("Inventory Loaded in Save Number " + saveNumberToLoad);
|
||||
print ("Number of objects: " + persistanceInfoList.Count);
|
||||
|
||||
for (int j = 0; j < persistanceInfoList.Count; j++) {
|
||||
inventoryListElement currentElement = persistanceInfoList [j];
|
||||
|
||||
print ("Object Name: " + currentElement.Name + " Amount: " + currentElement.amount);
|
||||
|
||||
if (currentElement.isWeapon && !currentElement.isMeleeWeapon) {
|
||||
print ("Object is weapon with " + currentElement.projectilesInMagazine + " projectiles in the magazine");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
loadInfoOnMainComponent ();
|
||||
}
|
||||
|
||||
|
||||
public persistanceInventoryListByPlayerInfo getPersistanceList (int playerID, bool showDebugInfo)
|
||||
{
|
||||
persistanceInventoryListByPlayerInfo newPersistanceInventoryListByPlayerInfo = new persistanceInventoryListByPlayerInfo ();
|
||||
|
||||
newPersistanceInventoryListByPlayerInfo.playerID = playerID;
|
||||
|
||||
mainInventoryManager.updateDurabilityAmountStateOnAllInventoryObjects ();
|
||||
|
||||
int inventorySlotAmount = mainInventoryManager.getInventorySlotAmount ();
|
||||
|
||||
newPersistanceInventoryListByPlayerInfo.inventorySlotAmount = inventorySlotAmount;
|
||||
|
||||
newPersistanceInventoryListByPlayerInfo.infiniteSlots = mainInventoryManager.isInfiniteSlotsActive ();
|
||||
|
||||
|
||||
//Crafting elements
|
||||
newPersistanceInventoryListByPlayerInfo.useOnlyBlueprintsUnlocked = GKC_Utils.isUseOnlyBlueprintsUnlockedActive (mainInventoryManager.gameObject);
|
||||
|
||||
if (newPersistanceInventoryListByPlayerInfo.useOnlyBlueprintsUnlocked) {
|
||||
|
||||
List<string> blueprintsUnlockedList = GKC_Utils.getBlueprintsUnlockedListValue (mainInventoryManager.gameObject);
|
||||
|
||||
if (blueprintsUnlockedList != null) {
|
||||
newPersistanceInventoryListByPlayerInfo.blueprintsUnlockedList = new List<string> (blueprintsUnlockedList);
|
||||
}
|
||||
}
|
||||
|
||||
newPersistanceInventoryListByPlayerInfo.anyObjectToCraftInTimeActive = GKC_Utils.anyObjectToCraftInTimeActive (mainInventoryManager.gameObject);
|
||||
|
||||
if (newPersistanceInventoryListByPlayerInfo.anyObjectToCraftInTimeActive) {
|
||||
newPersistanceInventoryListByPlayerInfo.craftObjectInTimeSimpleInfoList = GKC_Utils.getCraftObjectInTimeInfoList (mainInventoryManager.gameObject);
|
||||
}
|
||||
|
||||
newPersistanceInventoryListByPlayerInfo.objectCategoriesToCraftAvailableAtAnyMoment = GKC_Utils.getObjectCategoriesToCraftAvailableAtAnyMomentValue (mainInventoryManager.gameObject);
|
||||
|
||||
newPersistanceInventoryListByPlayerInfo.lastWeaponCarriedOnHandsName = mainInventoryManager.getLastWeaponCarriedOnHandsName ();
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("\n\n");
|
||||
print ("Number of inventory slots available: " + inventorySlotAmount);
|
||||
print ("\n\n");
|
||||
|
||||
if (newPersistanceInventoryListByPlayerInfo.useOnlyBlueprintsUnlocked) {
|
||||
print ("\n\n");
|
||||
print ("Use only blueprints unlocked active with the amount: " + newPersistanceInventoryListByPlayerInfo.blueprintsUnlockedList.Count);
|
||||
print ("\n\n");
|
||||
}
|
||||
}
|
||||
|
||||
List<persistanceInventoryObjectInfo> newPersistanceInventoryObjectInfoList = new List<persistanceInventoryObjectInfo> ();
|
||||
|
||||
List<inventoryInfo> inventoryList = mainInventoryManager.getInventoryList ();
|
||||
|
||||
int inventoryListCount = inventoryList.Count;
|
||||
|
||||
bool inventoryWasEmptyWhenSaved = true;
|
||||
|
||||
for (int k = 0; k < inventoryListCount; k++) {
|
||||
inventoryInfo currentInventoryInfo = inventoryList [k];
|
||||
|
||||
if (currentInventoryInfo.amount > 0) {
|
||||
persistanceInventoryObjectInfo newPersistanceInventoryObjectInfo = new persistanceInventoryObjectInfo ();
|
||||
|
||||
newPersistanceInventoryObjectInfo.Name = currentInventoryInfo.Name;
|
||||
newPersistanceInventoryObjectInfo.amount = currentInventoryInfo.amount;
|
||||
newPersistanceInventoryObjectInfo.infiniteAmount = currentInventoryInfo.infiniteAmount;
|
||||
newPersistanceInventoryObjectInfo.inventoryObjectName = currentInventoryInfo.Name;
|
||||
|
||||
newPersistanceInventoryObjectInfo.categoryIndex = currentInventoryInfo.categoryIndex;
|
||||
newPersistanceInventoryObjectInfo.elementIndex = currentInventoryInfo.elementIndex;
|
||||
|
||||
newPersistanceInventoryObjectInfo.isEquipped = currentInventoryInfo.isEquipped;
|
||||
|
||||
newPersistanceInventoryObjectInfo.quickAccessSlotIndex = currentInventoryInfo.quickAccessSlotIndex;
|
||||
|
||||
newPersistanceInventoryObjectInfo.useDurability = currentInventoryInfo.useDurability;
|
||||
newPersistanceInventoryObjectInfo.durabilityAmount = currentInventoryInfo.durabilityAmount;
|
||||
newPersistanceInventoryObjectInfo.maxDurabilityAmount = currentInventoryInfo.maxDurabilityAmount;
|
||||
newPersistanceInventoryObjectInfo.objectIsBroken = currentInventoryInfo.objectIsBroken;
|
||||
|
||||
newPersistanceInventoryObjectInfo.isWeapon = currentInventoryInfo.isWeapon;
|
||||
newPersistanceInventoryObjectInfo.isMeleeWeapon = currentInventoryInfo.isMeleeWeapon;
|
||||
|
||||
if (newPersistanceInventoryObjectInfo.isWeapon && !newPersistanceInventoryObjectInfo.isMeleeWeapon) {
|
||||
if (currentInventoryInfo.mainWeaponObjectInfo != null) {
|
||||
newPersistanceInventoryObjectInfo.projectilesInMagazine = currentInventoryInfo.mainWeaponObjectInfo.getProjectilesInWeaponMagazine ();
|
||||
}
|
||||
}
|
||||
|
||||
newPersistanceInventoryObjectInfoList.Add (newPersistanceInventoryObjectInfo);
|
||||
|
||||
inventoryWasEmptyWhenSaved = false;
|
||||
}
|
||||
}
|
||||
|
||||
newPersistanceInventoryListByPlayerInfo.inventoryWasEmptyWhenSaved = inventoryWasEmptyWhenSaved;
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("\n\n");
|
||||
|
||||
for (int j = 0; j < newPersistanceInventoryObjectInfoList.Count; j++) {
|
||||
persistanceInventoryObjectInfo currentInfo = newPersistanceInventoryObjectInfoList [j];
|
||||
|
||||
print ("Object Name: " + currentInfo.Name + " Amount: " + currentInfo.amount + " category index " +
|
||||
currentInfo.categoryIndex + " element index " + currentInfo.elementIndex);
|
||||
|
||||
if (currentInfo.isWeapon && !currentInfo.isMeleeWeapon) {
|
||||
print ("Object is weapon with " + currentInfo.projectilesInMagazine + " projectiles in the magazine");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
newPersistanceInventoryListByPlayerInfo.inventoryObjectList = newPersistanceInventoryObjectInfoList;
|
||||
|
||||
return newPersistanceInventoryListByPlayerInfo;
|
||||
}
|
||||
|
||||
|
||||
void loadInfoOnMainComponent ()
|
||||
{
|
||||
mainInventoryManager.setIsLoadingGameState (true);
|
||||
|
||||
initializeValues ();
|
||||
|
||||
if (persistanceInfoList != null) {
|
||||
bool sendNewInventoryResult = true;
|
||||
|
||||
//when loading, it can be from a new game or from a continue/load action, so if the loaded inventory is an
|
||||
//empty list, then:
|
||||
//-when doing a new game, it should allow to use the initial inventory if configured
|
||||
//-when loading/continuing a game, it should load the inventory list saved, even if empty
|
||||
|
||||
//check the state also when the player options menu is used on home menu
|
||||
|
||||
if (ignoreAssignLoadedInventoryIfEmpty) {
|
||||
if (persistanceInfoList.Count == 0 && !mainInventoryManager.getInventoryWasEmptyWhenSaved ()) {
|
||||
sendNewInventoryResult = false;
|
||||
}
|
||||
|
||||
if (persistanceInfoList.Count == 0 && mainInventoryManager.getInventoryWasEmptyWhenSaved () && lastGameSavedOnHomeMenuValue) {
|
||||
sendNewInventoryResult = false;
|
||||
}
|
||||
}
|
||||
|
||||
//print (persistanceInfoList.Count + " " + mainInventoryManager.getInventoryWasEmptyWhenSaved () + " " + lastGameSavedOnHomeMenuValue + " " +
|
||||
//sendNewInventoryResult);
|
||||
|
||||
if (sendNewInventoryResult) {
|
||||
mainInventoryManager.setNewInventoryListManagerList (persistanceInfoList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void initializeValues ()
|
||||
{
|
||||
mainInventoryManager.initializeInventoryValues ();
|
||||
}
|
||||
|
||||
|
||||
public void saveGameContentFromEditor (int currentSaveNumber, int playerID, string currentSaveDataPath, bool showDebugInfo)
|
||||
{
|
||||
if (mainInventoryManager == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
bool saveLocated = false;
|
||||
bool playerLocated = false;
|
||||
|
||||
int saveSlotIndex = -1;
|
||||
int listIndex = -1;
|
||||
|
||||
BinaryFormatter bf = new BinaryFormatter ();
|
||||
FileStream file;
|
||||
|
||||
persistanceInventoryListByPlayerInfo inventoryListToSave = getPersistanceInventoryListElement (playerID, showDebugInfo);
|
||||
|
||||
persistanceInventoryListBySaveSlotInfo newPersistanceInventoryListBySaveSlotInfo = new persistanceInventoryListBySaveSlotInfo ();
|
||||
|
||||
List<persistanceInventoryListBySaveSlotInfo> infoListToSave = new List<persistanceInventoryListBySaveSlotInfo> ();
|
||||
|
||||
if (File.Exists (currentSaveDataPath)) {
|
||||
bf = new BinaryFormatter ();
|
||||
file = File.Open (currentSaveDataPath, FileMode.Open);
|
||||
object currentData = bf.Deserialize (file);
|
||||
infoListToSave = currentData as List<persistanceInventoryListBySaveSlotInfo>;
|
||||
|
||||
file.Close ();
|
||||
}
|
||||
|
||||
int infoListToSaveCount = infoListToSave.Count;
|
||||
|
||||
for (int j = 0; j < infoListToSaveCount; j++) {
|
||||
if (saveSlotIndex == -1) {
|
||||
persistanceInventoryListBySaveSlotInfo currentSlot = infoListToSave [j];
|
||||
|
||||
if (currentSlot.saveNumber == currentSaveNumber) {
|
||||
newPersistanceInventoryListBySaveSlotInfo = currentSlot;
|
||||
saveLocated = true;
|
||||
saveSlotIndex = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (saveLocated) {
|
||||
|
||||
int playerInventoryListCount = newPersistanceInventoryListBySaveSlotInfo.playerInventoryList.Count;
|
||||
|
||||
int playerIDToSearch = inventoryListToSave.playerID;
|
||||
|
||||
for (int j = 0; j < playerInventoryListCount; j++) {
|
||||
if (listIndex == -1 && newPersistanceInventoryListBySaveSlotInfo.playerInventoryList [j].playerID == playerIDToSearch) {
|
||||
playerLocated = true;
|
||||
listIndex = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("\n\n");
|
||||
|
||||
print ("EXTRA INFO\n");
|
||||
print ("PLAYER INVENTORY");
|
||||
|
||||
print ("Number of objects: " + inventoryListToSave.inventoryObjectList.Count);
|
||||
print ("Current Save Number " + currentSaveNumber);
|
||||
print ("Save Located " + saveLocated);
|
||||
print ("Player Located " + playerLocated);
|
||||
print ("Player ID " + inventoryListToSave.playerID);
|
||||
}
|
||||
|
||||
//if the save is located, check if the player id exists
|
||||
if (saveLocated) {
|
||||
//if player id exists, overwrite it
|
||||
if (playerLocated) {
|
||||
infoListToSave [saveSlotIndex].playerInventoryList [listIndex].inventoryObjectList = inventoryListToSave.inventoryObjectList;
|
||||
} else {
|
||||
infoListToSave [saveSlotIndex].playerInventoryList.Add (inventoryListToSave);
|
||||
}
|
||||
} else {
|
||||
newPersistanceInventoryListBySaveSlotInfo.saveNumber = currentSaveNumber;
|
||||
newPersistanceInventoryListBySaveSlotInfo.playerInventoryList.Add (inventoryListToSave);
|
||||
infoListToSave.Add (newPersistanceInventoryListBySaveSlotInfo);
|
||||
}
|
||||
|
||||
bf = new BinaryFormatter ();
|
||||
file = File.Create (currentSaveDataPath);
|
||||
bf.Serialize (file, infoListToSave);
|
||||
file.Close ();
|
||||
}
|
||||
|
||||
public persistanceInventoryListByPlayerInfo getPersistanceInventoryListElement (int playerID, bool showDebugInfo)
|
||||
{
|
||||
persistanceInventoryListByPlayerInfo newPersistanceInventoryListByPlayerInfo = new persistanceInventoryListByPlayerInfo ();
|
||||
|
||||
newPersistanceInventoryListByPlayerInfo.playerID = playerID;
|
||||
|
||||
List<persistanceInventoryObjectInfo> newPersistanceInventoryObjectInfoList = new List<persistanceInventoryObjectInfo> ();
|
||||
|
||||
List<inventoryListElement> inventoryListManagerList = mainInventoryManager.getCurrentInventoryListManagerList ();
|
||||
|
||||
int inventoryListManagerListCount = inventoryListManagerList.Count;
|
||||
|
||||
for (int k = 0; k < inventoryListManagerListCount; k++) {
|
||||
persistanceInventoryObjectInfo newPersistanceInventoryObjectInfo = new persistanceInventoryObjectInfo ();
|
||||
|
||||
inventoryListElement currentElement = inventoryListManagerList [k];
|
||||
|
||||
newPersistanceInventoryObjectInfo.Name = currentElement.Name;
|
||||
newPersistanceInventoryObjectInfo.amount = currentElement.amount;
|
||||
newPersistanceInventoryObjectInfo.infiniteAmount = currentElement.infiniteAmount;
|
||||
newPersistanceInventoryObjectInfo.inventoryObjectName = currentElement.inventoryObjectName;
|
||||
|
||||
newPersistanceInventoryObjectInfo.elementIndex = currentElement.elementIndex;
|
||||
newPersistanceInventoryObjectInfo.categoryIndex = currentElement.categoryIndex;
|
||||
|
||||
if (showDebugInfo) {
|
||||
print (newPersistanceInventoryObjectInfo.Name + " " + newPersistanceInventoryObjectInfo.amount);
|
||||
}
|
||||
|
||||
newPersistanceInventoryObjectInfoList.Add (newPersistanceInventoryObjectInfo);
|
||||
}
|
||||
|
||||
newPersistanceInventoryListByPlayerInfo.inventoryObjectList = newPersistanceInventoryObjectInfoList;
|
||||
|
||||
return newPersistanceInventoryListByPlayerInfo;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e702c9927f6168046b43a73301c640c8
|
||||
timeCreated: 1602224180
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Save System/Custom Class To Save/savePlayerInventoryInfo.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,442 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
using System.IO;
|
||||
using System;
|
||||
|
||||
public class savePlayerOptionsInfo : saveGameInfo
|
||||
{
|
||||
[Header ("Custom Settings")]
|
||||
[Space]
|
||||
|
||||
public playerOptionsEditorSystem mainPlayerOptionsEditorSystem;
|
||||
|
||||
List<persistanceOptionsInfo> persistanceInfoList;
|
||||
|
||||
|
||||
public override void saveGame (int saveNumber, int playerID, string currentSaveDataPath, bool showDebugInfo, bool savingGameToChangeScene)
|
||||
{
|
||||
saveGameContent (saveNumber, playerID, currentSaveDataPath, showDebugInfo, savingGameToChangeScene);
|
||||
}
|
||||
|
||||
public override void loadGame (int saveNumberToLoad, int playerID, string currentSaveDataPath, bool showDebugInfo)
|
||||
{
|
||||
loadGameContent (saveNumberToLoad, playerID, currentSaveDataPath, showDebugInfo);
|
||||
}
|
||||
|
||||
|
||||
public void saveGameContent (int currentSaveNumber, int playerID, string currentSaveDataPath, bool showDebugInfo, bool savingGameToChangeScene)
|
||||
{
|
||||
if (mainPlayerOptionsEditorSystem == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mainPlayerOptionsEditorSystem.playerOptionsEditorEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mainPlayerOptionsEditorSystem.saveCurrentPlayerOptionsToSaveFile) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("\n\n");
|
||||
|
||||
print ("Saving player options");
|
||||
}
|
||||
|
||||
|
||||
bool saveLocated = false;
|
||||
bool playerLocated = false;
|
||||
|
||||
int saveSlotIndex = -1;
|
||||
int listIndex = -1;
|
||||
|
||||
BinaryFormatter bf = new BinaryFormatter ();
|
||||
FileStream file;
|
||||
|
||||
persistancePlayerOptionsInfo playerOptionsToSave = getPersistanceList (playerID, showDebugInfo);
|
||||
|
||||
persistancePlayerOptionsListBySaveSlotInfo newPersistancePlayerOptionsListBySaveSlotInfo = new persistancePlayerOptionsListBySaveSlotInfo ();
|
||||
|
||||
List<persistancePlayerOptionsListBySaveSlotInfo> infoListToSave = new List<persistancePlayerOptionsListBySaveSlotInfo> ();
|
||||
|
||||
if (File.Exists (currentSaveDataPath)) {
|
||||
bf = new BinaryFormatter ();
|
||||
file = File.Open (currentSaveDataPath, FileMode.Open);
|
||||
object currentData = bf.Deserialize (file);
|
||||
infoListToSave = currentData as List<persistancePlayerOptionsListBySaveSlotInfo>;
|
||||
|
||||
file.Close ();
|
||||
}
|
||||
|
||||
int infoListToSaveCount = infoListToSave.Count;
|
||||
|
||||
for (int j = 0; j < infoListToSaveCount; j++) {
|
||||
if (!saveLocated) {
|
||||
if (ignoreSaveNumberOnSaveLoadInfo || infoListToSave [j].saveNumber == currentSaveNumber) {
|
||||
newPersistancePlayerOptionsListBySaveSlotInfo = infoListToSave [j];
|
||||
saveLocated = true;
|
||||
saveSlotIndex = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (saveLocated) {
|
||||
int playerOptionsListCount = newPersistancePlayerOptionsListBySaveSlotInfo.playerOptionsList.Count;
|
||||
|
||||
for (int j = 0; j < playerOptionsListCount; j++) {
|
||||
if (!playerLocated) {
|
||||
if (ignorePlayerIDOnSaveLoadInfo ||
|
||||
newPersistancePlayerOptionsListBySaveSlotInfo.playerOptionsList [j].playerID == playerOptionsToSave.playerID) {
|
||||
playerLocated = true;
|
||||
listIndex = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("\n\n");
|
||||
|
||||
print ("EXTRA INFO\n");
|
||||
print ("Number of options: " + playerOptionsToSave.optionsList.Count);
|
||||
print ("Current Save Number " + currentSaveNumber);
|
||||
print ("Save Located " + saveLocated);
|
||||
print ("Player Located " + playerLocated);
|
||||
print ("Player ID " + playerOptionsToSave.playerID);
|
||||
|
||||
showDetailedDebugInfo ();
|
||||
}
|
||||
|
||||
//if the save is located, check if the player id exists
|
||||
if (saveLocated) {
|
||||
//if player id exists, overwrite it
|
||||
if (playerLocated) {
|
||||
infoListToSave [saveSlotIndex].playerOptionsList [listIndex].optionsList = playerOptionsToSave.optionsList;
|
||||
} else {
|
||||
infoListToSave [saveSlotIndex].playerOptionsList.Add (playerOptionsToSave);
|
||||
}
|
||||
} else {
|
||||
newPersistancePlayerOptionsListBySaveSlotInfo.saveNumber = currentSaveNumber;
|
||||
newPersistancePlayerOptionsListBySaveSlotInfo.playerOptionsList.Add (playerOptionsToSave);
|
||||
infoListToSave.Add (newPersistancePlayerOptionsListBySaveSlotInfo);
|
||||
}
|
||||
|
||||
bf = new BinaryFormatter ();
|
||||
file = File.Open (currentSaveDataPath, FileMode.OpenOrCreate);
|
||||
bf.Serialize (file, infoListToSave);
|
||||
|
||||
file.Close ();
|
||||
|
||||
if (saveInfoOnRegularTxtFile) {
|
||||
writeDetailedDebugInfo (false);
|
||||
}
|
||||
}
|
||||
|
||||
public void loadGameContent (int saveNumberToLoad, int playerID, string currentSaveDataPath, bool showDebugInfo)
|
||||
{
|
||||
if (mainPlayerOptionsEditorSystem == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mainPlayerOptionsEditorSystem.playerOptionsEditorEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("\n\n");
|
||||
|
||||
print ("Loading player options");
|
||||
}
|
||||
|
||||
persistanceInfoList = new List<persistanceOptionsInfo> ();
|
||||
|
||||
//need to store and check the current slot saved and the player which is saving, to get that concrete info
|
||||
List<persistancePlayerOptionsListBySaveSlotInfo> infoListToLoad = new List<persistancePlayerOptionsListBySaveSlotInfo> ();
|
||||
|
||||
if (File.Exists (currentSaveDataPath)) {
|
||||
BinaryFormatter bf = new BinaryFormatter ();
|
||||
FileStream file = File.Open (currentSaveDataPath, FileMode.Open);
|
||||
object currentData = bf.Deserialize (file);
|
||||
infoListToLoad = currentData as List<persistancePlayerOptionsListBySaveSlotInfo>;
|
||||
|
||||
file.Close ();
|
||||
}
|
||||
|
||||
if (saveNumberToLoad > -1) {
|
||||
persistancePlayerOptionsListBySaveSlotInfo newPersistancePlayerOptionsListBySaveSlotInfo = new persistancePlayerOptionsListBySaveSlotInfo ();
|
||||
|
||||
int infoListToLoadCount = infoListToLoad.Count;
|
||||
|
||||
bool saveLocated = false;
|
||||
|
||||
for (int j = 0; j < infoListToLoadCount; j++) {
|
||||
|
||||
if (!saveLocated) {
|
||||
|
||||
if (ignoreSaveNumberOnSaveLoadInfo || infoListToLoad [j].saveNumber == saveNumberToLoad) {
|
||||
newPersistancePlayerOptionsListBySaveSlotInfo = infoListToLoad [j];
|
||||
|
||||
saveLocated = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int listIndex = -1;
|
||||
|
||||
int playerOptionsListCount = newPersistancePlayerOptionsListBySaveSlotInfo.playerOptionsList.Count;
|
||||
|
||||
bool playerLocated = false;
|
||||
|
||||
for (int j = 0; j < playerOptionsListCount; j++) {
|
||||
if (!playerLocated) {
|
||||
if (ignorePlayerIDOnSaveLoadInfo || newPersistancePlayerOptionsListBySaveSlotInfo.playerOptionsList [j].playerID == playerID) {
|
||||
listIndex = j;
|
||||
|
||||
playerLocated = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (listIndex > -1) {
|
||||
persistanceInfoList.AddRange (newPersistancePlayerOptionsListBySaveSlotInfo.playerOptionsList [listIndex].optionsList);
|
||||
}
|
||||
}
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("\n\n");
|
||||
|
||||
print ("Player Options Loaded in Save Number " + saveNumberToLoad);
|
||||
print ("Number of Player Options: " + persistanceInfoList.Count);
|
||||
|
||||
|
||||
showDetailedDebugInfo ();
|
||||
}
|
||||
|
||||
loadInfoOnMainComponent ();
|
||||
|
||||
if (saveInfoOnRegularTxtFile) {
|
||||
writeDetailedDebugInfo (true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public persistancePlayerOptionsInfo getPersistanceList (int playerID, bool showDebugInfo)
|
||||
{
|
||||
persistancePlayerOptionsInfo newPersistancePlayerOptionsInfo = new persistancePlayerOptionsInfo ();
|
||||
|
||||
newPersistancePlayerOptionsInfo.playerID = playerID;
|
||||
|
||||
List<persistanceOptionsInfo> newPersistanceOptionsInfoList = new List<persistanceOptionsInfo> ();
|
||||
|
||||
List<playerOptionsEditorSystem.optionInfo> optionInfoList = mainPlayerOptionsEditorSystem.optionInfoList;
|
||||
|
||||
int optionInfoListCount = optionInfoList.Count;
|
||||
|
||||
for (int k = 0; k < optionInfoListCount; k++) {
|
||||
persistanceOptionsInfo newPersistanceOptionsInfo = new persistanceOptionsInfo ();
|
||||
|
||||
playerOptionsEditorSystem.optionInfo currentOptionInfo = optionInfoList [k];
|
||||
|
||||
newPersistanceOptionsInfo.optionName = currentOptionInfo.Name;
|
||||
|
||||
newPersistanceOptionsInfo.currentScrollBarValue = currentOptionInfo.currentScrollBarValue;
|
||||
newPersistanceOptionsInfo.currentSliderValue = currentOptionInfo.currentSliderValue;
|
||||
newPersistanceOptionsInfo.currentToggleValue = currentOptionInfo.currentToggleValue;
|
||||
newPersistanceOptionsInfo.currentDropDownValue = currentOptionInfo.currentDropDownValue;
|
||||
|
||||
newPersistanceOptionsInfoList.Add (newPersistanceOptionsInfo);
|
||||
}
|
||||
|
||||
newPersistancePlayerOptionsInfo.optionsList = newPersistanceOptionsInfoList;
|
||||
|
||||
return newPersistancePlayerOptionsInfo;
|
||||
}
|
||||
|
||||
|
||||
void loadInfoOnMainComponent ()
|
||||
{
|
||||
if (persistanceInfoList != null && persistanceInfoList.Count > 0) {
|
||||
|
||||
List<playerOptionsEditorSystem.optionInfo> optionInfoList = mainPlayerOptionsEditorSystem.optionInfoList;
|
||||
|
||||
int persistanceInfoListCount = persistanceInfoList.Count;
|
||||
|
||||
for (int i = 0; i < persistanceInfoListCount; i++) {
|
||||
|
||||
persistanceOptionsInfo currentPersistanceOptionsInfo = persistanceInfoList [i];
|
||||
|
||||
int currentOptionIndex = optionInfoList.FindIndex (s => s.Name.Equals (currentPersistanceOptionsInfo.optionName));
|
||||
|
||||
if (currentOptionIndex > -1) {
|
||||
|
||||
playerOptionsEditorSystem.optionInfo currentOptionInfo = optionInfoList [currentOptionIndex];
|
||||
|
||||
if (currentOptionInfo.useScrollBar) {
|
||||
currentOptionInfo.currentScrollBarValue = currentPersistanceOptionsInfo.currentScrollBarValue;
|
||||
}
|
||||
|
||||
if (currentOptionInfo.useSlider) {
|
||||
currentOptionInfo.currentSliderValue = currentPersistanceOptionsInfo.currentSliderValue;
|
||||
}
|
||||
|
||||
if (currentOptionInfo.useToggle) {
|
||||
currentOptionInfo.currentToggleValue = currentPersistanceOptionsInfo.currentToggleValue;
|
||||
}
|
||||
|
||||
if (currentOptionInfo.useDropDown) {
|
||||
currentOptionInfo.currentDropDownValue = currentPersistanceOptionsInfo.currentDropDownValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mainPlayerOptionsEditorSystem.setIsLoadingGameState (true);
|
||||
}
|
||||
}
|
||||
|
||||
public override void checkSaveInfoToLoadOnStartOnAllScenes (int saveNumberToLoad, int playerID, string currentSaveDataPath, bool showDebugInfo)
|
||||
{
|
||||
if (showDebugInfo) {
|
||||
print (saveNumberToLoad + " " + playerID + " " + currentSaveDataPath + " " + showDebugInfo);
|
||||
}
|
||||
|
||||
if (File.Exists (currentSaveDataPath)) {
|
||||
loadGameContent (saveNumberToLoad, playerID, currentSaveDataPath, showDebugInfo);
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("save filed found, loading");
|
||||
}
|
||||
} else {
|
||||
if (mainPlayerOptionsEditorSystem == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mainPlayerOptionsEditorSystem.playerOptionsEditorEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("\n\n");
|
||||
|
||||
print ("Checking info to load on start on all scenes for player options");
|
||||
|
||||
print ("no save file found, loading values from inspector");
|
||||
|
||||
}
|
||||
|
||||
mainPlayerOptionsEditorSystem.setIsLoadingGameState (true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void showDetailedDebugInfo ()
|
||||
{
|
||||
List<playerOptionsEditorSystem.optionInfo> optionInfoList = mainPlayerOptionsEditorSystem.optionInfoList;
|
||||
|
||||
if (optionInfoList != null && optionInfoList.Count > 0 && persistanceInfoList != null && persistanceInfoList.Count > 0) {
|
||||
|
||||
int persistanceInfoListCount = persistanceInfoList.Count;
|
||||
for (int i = 0; i < persistanceInfoListCount; i++) {
|
||||
|
||||
persistanceOptionsInfo currentPersistanceOptionsInfo = persistanceInfoList [i];
|
||||
|
||||
int currentOptionIndex = optionInfoList.FindIndex (s => s.Name.Equals (currentPersistanceOptionsInfo.optionName));
|
||||
|
||||
if (currentOptionIndex > -1) {
|
||||
|
||||
playerOptionsEditorSystem.optionInfo currentOptionInfo = optionInfoList [currentOptionIndex];
|
||||
|
||||
print (currentOptionInfo.Name + " " + currentOptionInfo.useScrollBar + " " + currentPersistanceOptionsInfo.currentScrollBarValue);
|
||||
|
||||
print (currentOptionInfo.Name + " " + currentOptionInfo.useSlider + " " + currentPersistanceOptionsInfo.currentSliderValue);
|
||||
|
||||
print (currentOptionInfo.Name + " " + currentOptionInfo.useToggle + " " + currentPersistanceOptionsInfo.currentToggleValue);
|
||||
|
||||
print (currentOptionInfo.Name + " " + currentOptionInfo.useDropDown + " " + currentPersistanceOptionsInfo.currentDropDownValue);
|
||||
}
|
||||
}
|
||||
|
||||
print ("\n\n");
|
||||
}
|
||||
}
|
||||
|
||||
void writeDetailedDebugInfo (bool loadingFile)
|
||||
{
|
||||
string filePath = GKC_Utils.getMainDataPath ();
|
||||
|
||||
string newContent = "";
|
||||
|
||||
List<playerOptionsEditorSystem.optionInfo> optionInfoList = mainPlayerOptionsEditorSystem.optionInfoList;
|
||||
|
||||
if (loadingFile) {
|
||||
int persistanceInfoListCount = persistanceInfoList.Count;
|
||||
|
||||
for (int i = 0; i < persistanceInfoListCount; i++) {
|
||||
|
||||
persistanceOptionsInfo currentPersistanceOptionsInfo = persistanceInfoList [i];
|
||||
|
||||
int currentOptionIndex = optionInfoList.FindIndex (s => s.Name.Equals (currentPersistanceOptionsInfo.optionName));
|
||||
|
||||
if (currentOptionIndex > -1) {
|
||||
|
||||
playerOptionsEditorSystem.optionInfo currentOptionInfo = optionInfoList [currentOptionIndex];
|
||||
|
||||
newContent += currentOptionInfo.Name;
|
||||
|
||||
if (currentOptionInfo.useScrollBar) {
|
||||
newContent += " " + currentPersistanceOptionsInfo.currentScrollBarValue + " " + currentOptionInfo.currentScrollBarValue;
|
||||
}
|
||||
|
||||
if (currentOptionInfo.useSlider) {
|
||||
newContent += " " + currentPersistanceOptionsInfo.currentSliderValue + " " + currentOptionInfo.currentSliderValue;
|
||||
}
|
||||
|
||||
if (currentOptionInfo.useToggle) {
|
||||
newContent += " " + currentPersistanceOptionsInfo.currentToggleValue + " " + currentOptionInfo.currentToggleValue;
|
||||
}
|
||||
|
||||
if (currentOptionInfo.useDropDown) {
|
||||
newContent += " " + currentPersistanceOptionsInfo.currentDropDownValue + " " + currentOptionInfo.currentDropDownValue;
|
||||
}
|
||||
|
||||
newContent += ("\n\n");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < optionInfoList.Count; i++) {
|
||||
|
||||
playerOptionsEditorSystem.optionInfo currentOptionInfo = optionInfoList [i];
|
||||
|
||||
newContent += currentOptionInfo.Name;
|
||||
|
||||
if (currentOptionInfo.useScrollBar) {
|
||||
newContent += " " + currentOptionInfo.currentScrollBarValue;
|
||||
}
|
||||
|
||||
if (currentOptionInfo.useSlider) {
|
||||
newContent += " " + currentOptionInfo.currentSliderValue;
|
||||
}
|
||||
|
||||
if (currentOptionInfo.useToggle) {
|
||||
newContent += " " + currentOptionInfo.currentToggleValue;
|
||||
}
|
||||
|
||||
if (currentOptionInfo.useDropDown) {
|
||||
newContent += " " + currentOptionInfo.currentDropDownValue;
|
||||
}
|
||||
|
||||
newContent += ("\n\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (loadingFile) {
|
||||
filePath += loadInfoOnRegulaFileName + ".txt";
|
||||
} else {
|
||||
filePath += saveInfoOnRegulaFileName + ".txt";
|
||||
}
|
||||
|
||||
File.WriteAllText (filePath, newContent);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 50d274514d4c6e444bb2fef1f7b9fe44
|
||||
timeCreated: 1602175129
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Save System/Custom Class To Save/savePlayerOptionsInfo.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,334 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
using System.IO;
|
||||
using System;
|
||||
|
||||
public class savePlayerWeaponsInfo : saveGameInfo
|
||||
{
|
||||
public playerWeaponsManager mainPlayerWeaponsManager;
|
||||
|
||||
List<persistanceWeaponInfo> persistanceInfoList;
|
||||
|
||||
|
||||
public override void saveGame (int saveNumber, int playerID, string currentSaveDataPath, bool showDebugInfo, bool savingGameToChangeScene)
|
||||
{
|
||||
saveGameContent (saveNumber, playerID, currentSaveDataPath, showDebugInfo, savingGameToChangeScene);
|
||||
}
|
||||
|
||||
public override void loadGame (int saveNumberToLoad, int playerID, string currentSaveDataPath, bool showDebugInfo)
|
||||
{
|
||||
loadGameContent (saveNumberToLoad, playerID, currentSaveDataPath, showDebugInfo);
|
||||
}
|
||||
|
||||
public override void initializeValuesOnComponent ()
|
||||
{
|
||||
initializeValues ();
|
||||
}
|
||||
|
||||
public void saveGameContent (int currentSaveNumber, int playerID, string currentSaveDataPath, bool showDebugInfo, bool savingGameToChangeScene)
|
||||
{
|
||||
if (mainPlayerWeaponsManager == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mainPlayerWeaponsManager.saveCurrentPlayerWeaponsToSaveFile) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("\n\n");
|
||||
|
||||
print ("Saving player weapons");
|
||||
}
|
||||
|
||||
bool saveLocated = false;
|
||||
bool playerLocated = false;
|
||||
|
||||
int saveSlotIndex = -1;
|
||||
int listIndex = -1;
|
||||
|
||||
BinaryFormatter bf = new BinaryFormatter ();
|
||||
FileStream file;
|
||||
|
||||
persistanceWeaponListByPlayerInfo weaponsToSave = getPersistanceList (playerID, showDebugInfo);
|
||||
|
||||
persistanceWeaponListBySaveSlotInfo newPersistanceWeaponListBySaveSlotInfo = new persistanceWeaponListBySaveSlotInfo ();
|
||||
|
||||
List<persistanceWeaponListBySaveSlotInfo> infoListToSave = new List<persistanceWeaponListBySaveSlotInfo> ();
|
||||
|
||||
if (File.Exists (currentSaveDataPath)) {
|
||||
bf = new BinaryFormatter ();
|
||||
file = File.Open (currentSaveDataPath, FileMode.Open);
|
||||
object currentData = bf.Deserialize (file);
|
||||
infoListToSave = currentData as List<persistanceWeaponListBySaveSlotInfo>;
|
||||
|
||||
file.Close ();
|
||||
}
|
||||
|
||||
int infoListToSaveCount = infoListToSave.Count;
|
||||
|
||||
for (int j = 0; j < infoListToSaveCount; j++) {
|
||||
if (infoListToSave [j].saveNumber == currentSaveNumber) {
|
||||
newPersistanceWeaponListBySaveSlotInfo = infoListToSave [j];
|
||||
saveLocated = true;
|
||||
saveSlotIndex = j;
|
||||
}
|
||||
}
|
||||
|
||||
if (saveLocated) {
|
||||
int playerWeaponListCount = newPersistanceWeaponListBySaveSlotInfo.playerWeaponList.Count;
|
||||
|
||||
for (int j = 0; j < playerWeaponListCount; j++) {
|
||||
if (newPersistanceWeaponListBySaveSlotInfo.playerWeaponList [j].playerID == weaponsToSave.playerID) {
|
||||
playerLocated = true;
|
||||
listIndex = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("\n\n");
|
||||
|
||||
print ("Number of weapons: " + weaponsToSave.weaponList.Count);
|
||||
|
||||
print ("Current Save Number " + currentSaveNumber);
|
||||
print ("Save Located " + saveLocated);
|
||||
print ("Player Located " + playerLocated);
|
||||
}
|
||||
|
||||
//if the save is located, check if the player id exists
|
||||
if (saveLocated) {
|
||||
//if player id exists, overwrite it
|
||||
if (playerLocated) {
|
||||
infoListToSave [saveSlotIndex].playerWeaponList [listIndex].weaponList = weaponsToSave.weaponList;
|
||||
} else {
|
||||
infoListToSave [saveSlotIndex].playerWeaponList.Add (weaponsToSave);
|
||||
}
|
||||
} else {
|
||||
newPersistanceWeaponListBySaveSlotInfo.saveNumber = currentSaveNumber;
|
||||
newPersistanceWeaponListBySaveSlotInfo.playerWeaponList.Add (weaponsToSave);
|
||||
infoListToSave.Add (newPersistanceWeaponListBySaveSlotInfo);
|
||||
}
|
||||
|
||||
bf = new BinaryFormatter ();
|
||||
file = File.Open (currentSaveDataPath, FileMode.OpenOrCreate);
|
||||
bf.Serialize (file, infoListToSave);
|
||||
|
||||
file.Close ();
|
||||
}
|
||||
|
||||
public void loadGameContent (int saveNumberToLoad, int playerID, string currentSaveDataPath, bool showDebugInfo)
|
||||
{
|
||||
if (mainPlayerWeaponsManager == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mainPlayerWeaponsManager.loadWeaponAttachmentsInfoFromSaveFile) {
|
||||
initializeValues ();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("\n\n");
|
||||
|
||||
print ("Loading player weapons");
|
||||
}
|
||||
|
||||
persistanceInfoList = new List<persistanceWeaponInfo> ();
|
||||
|
||||
List<persistanceWeaponListBySaveSlotInfo> infoListToLoad = new List<persistanceWeaponListBySaveSlotInfo> ();
|
||||
|
||||
if (File.Exists (currentSaveDataPath)) {
|
||||
BinaryFormatter bf = new BinaryFormatter ();
|
||||
FileStream file = File.Open (currentSaveDataPath, FileMode.Open);
|
||||
object currentData = bf.Deserialize (file);
|
||||
infoListToLoad = currentData as List<persistanceWeaponListBySaveSlotInfo>;
|
||||
|
||||
file.Close ();
|
||||
}
|
||||
|
||||
if (saveNumberToLoad > -1) {
|
||||
persistanceWeaponListBySaveSlotInfo newPersistanceWeaponListBySaveSlotInfo = new persistanceWeaponListBySaveSlotInfo ();
|
||||
|
||||
int infoListToLoadCount = infoListToLoad.Count;
|
||||
|
||||
for (int j = 0; j < infoListToLoadCount; j++) {
|
||||
if (infoListToLoad [j].saveNumber == saveNumberToLoad) {
|
||||
newPersistanceWeaponListBySaveSlotInfo = infoListToLoad [j];
|
||||
}
|
||||
}
|
||||
|
||||
int listIndex = -1;
|
||||
|
||||
int playerWeaponListCount = newPersistanceWeaponListBySaveSlotInfo.playerWeaponList.Count;
|
||||
|
||||
for (int j = 0; j < playerWeaponListCount; j++) {
|
||||
if (newPersistanceWeaponListBySaveSlotInfo.playerWeaponList [j].playerID == playerID) {
|
||||
listIndex = j;
|
||||
}
|
||||
}
|
||||
|
||||
if (listIndex > -1) {
|
||||
persistanceInfoList = newPersistanceWeaponListBySaveSlotInfo.playerWeaponList [listIndex].weaponList;
|
||||
}
|
||||
}
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("\n\n");
|
||||
|
||||
print ("Weapons Loaded in Save Number " + saveNumberToLoad);
|
||||
print ("Weapons amount: " + persistanceInfoList.Count);
|
||||
|
||||
for (int j = 0; j < persistanceInfoList.Count; j++) {
|
||||
print ("Weapon Name: " + persistanceInfoList [j].Name + " Is Enabled: " + persistanceInfoList [j].isWeaponEnabled +
|
||||
"Is Current Weapon: " + persistanceInfoList [j].isCurrentWeapon + " Remain Ammo: " + persistanceInfoList [j].remainingAmmo);
|
||||
}
|
||||
}
|
||||
|
||||
loadInfoOnMainComponent ();
|
||||
}
|
||||
|
||||
|
||||
public persistanceWeaponListByPlayerInfo getPersistanceList (int playerID, bool showDebugInfo)
|
||||
{
|
||||
persistanceWeaponListByPlayerInfo newPersistanceWeaponListByPlayerInfo = new persistanceWeaponListByPlayerInfo ();
|
||||
|
||||
newPersistanceWeaponListByPlayerInfo.playerID = playerID;
|
||||
|
||||
List<persistanceWeaponInfo> newPersistanceWeaponInfoList = new List<persistanceWeaponInfo> ();
|
||||
|
||||
List<IKWeaponSystem> weaponsList = mainPlayerWeaponsManager.weaponsList;
|
||||
|
||||
int weaponsListCount = weaponsList.Count;
|
||||
|
||||
for (int k = 0; k < weaponsListCount; k++) {
|
||||
persistanceWeaponInfo newPersistanceWeaponInfo = new persistanceWeaponInfo ();
|
||||
|
||||
IKWeaponSystem currentWeapon = weaponsList [k];
|
||||
|
||||
newPersistanceWeaponInfo.Name = currentWeapon.getWeaponSystemName ();
|
||||
newPersistanceWeaponInfo.index = k;
|
||||
newPersistanceWeaponInfo.isWeaponEnabled = currentWeapon.isWeaponEnabled ();
|
||||
newPersistanceWeaponInfo.isCurrentWeapon = currentWeapon.isCurrentWeapon ();
|
||||
newPersistanceWeaponInfo.remainingAmmo = currentWeapon.getWeaponSystemManager ().weaponSettings.remainAmmo + currentWeapon.getWeaponSystemManager ().getWeaponClipSize ();
|
||||
|
||||
if (mainPlayerWeaponsManager.saveWeaponAttachmentsInfoToSaveFile) {
|
||||
if (currentWeapon.weaponUsesAttachment) {
|
||||
newPersistanceWeaponInfo.weaponUsesAttachment = true;
|
||||
|
||||
weaponAttachmentSystem currentWeaponAttachmentSystem = currentWeapon.getWeaponAttachmentSystem ();
|
||||
|
||||
if (currentWeaponAttachmentSystem != null) {
|
||||
newPersistanceWeaponInfo.weaponAttachmentPlaceList = currentWeaponAttachmentSystem.getPersistanceAttachmentWeaponInfoList ();
|
||||
}
|
||||
}
|
||||
|
||||
newPersistanceWeaponInfoList.Add (newPersistanceWeaponInfo);
|
||||
}
|
||||
}
|
||||
|
||||
newPersistanceWeaponListByPlayerInfo.weaponList = newPersistanceWeaponInfoList;
|
||||
|
||||
return newPersistanceWeaponListByPlayerInfo;
|
||||
}
|
||||
|
||||
|
||||
void loadInfoOnMainComponent ()
|
||||
{
|
||||
initializeValues ();
|
||||
|
||||
if (persistanceInfoList != null && persistanceInfoList.Count > 0) {
|
||||
|
||||
List<IKWeaponSystem> weaponsList = mainPlayerWeaponsManager.weaponsList;
|
||||
|
||||
if (mainPlayerWeaponsManager.storePickedWeaponsOnInventory) {
|
||||
|
||||
if (mainPlayerWeaponsManager.loadWeaponAttachmentsInfoFromSaveFile) {
|
||||
if (mainPlayerWeaponsManager.loadCurrentPlayerWeaponsFromSaveFile) {
|
||||
|
||||
int persistanceInfoListCount = persistanceInfoList.Count;
|
||||
|
||||
for (int i = 0; i < persistanceInfoListCount; i++) {
|
||||
|
||||
persistanceWeaponInfo currentPersistanceWeaponInfo = persistanceInfoList [i];
|
||||
|
||||
int currentIndex = currentPersistanceWeaponInfo.index;
|
||||
|
||||
if (weaponsList.Count > currentIndex && currentIndex > -1) {
|
||||
|
||||
IKWeaponSystem currentIKWeaponToCheck = weaponsList [currentIndex];
|
||||
|
||||
if (currentPersistanceWeaponInfo.weaponUsesAttachment) {
|
||||
weaponAttachmentSystem currentWeaponAttachmentSystem = currentIKWeaponToCheck.getWeaponAttachmentSystem ();
|
||||
|
||||
if (currentWeaponAttachmentSystem != null) {
|
||||
currentWeaponAttachmentSystem.initializeAttachmentValues (currentPersistanceWeaponInfo.weaponAttachmentPlaceList);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (mainPlayerWeaponsManager.loadCurrentPlayerWeaponsFromSaveFile) {
|
||||
bool thereIsCurrentWeapon = false;
|
||||
|
||||
int persistanceInfoListCount = persistanceInfoList.Count;
|
||||
|
||||
for (int i = 0; i < persistanceInfoListCount; i++) {
|
||||
persistanceWeaponInfo currentPersistanceWeaponInfo = persistanceInfoList [i];
|
||||
|
||||
int currentIndex = currentPersistanceWeaponInfo.index;
|
||||
|
||||
if (weaponsList.Count > currentIndex && currentIndex > -1) {
|
||||
|
||||
IKWeaponSystem currentIKWeaponToCheck = weaponsList [currentIndex];
|
||||
|
||||
currentIKWeaponToCheck.setWeaponEnabledState (currentPersistanceWeaponInfo.isWeaponEnabled);
|
||||
currentIKWeaponToCheck.setCurrentWeaponState (currentPersistanceWeaponInfo.isCurrentWeapon);
|
||||
currentIKWeaponToCheck.weaponSystemManager.weaponSettings.remainAmmo = currentPersistanceWeaponInfo.remainingAmmo
|
||||
- currentIKWeaponToCheck.weaponSystemManager.getWeaponClipSize ();
|
||||
|
||||
if (currentIKWeaponToCheck.isCurrentWeapon ()) {
|
||||
thereIsCurrentWeapon = true;
|
||||
}
|
||||
|
||||
if (mainPlayerWeaponsManager.loadWeaponAttachmentsInfoFromSaveFile) {
|
||||
if (currentPersistanceWeaponInfo.weaponUsesAttachment) {
|
||||
weaponAttachmentSystem currentWeaponAttachmentSystem = currentIKWeaponToCheck.getWeaponAttachmentSystem ();
|
||||
|
||||
if (currentWeaponAttachmentSystem != null) {
|
||||
currentWeaponAttachmentSystem.initializeAttachmentValues (currentPersistanceWeaponInfo.weaponAttachmentPlaceList);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!thereIsCurrentWeapon) {
|
||||
int weaponsListCount = weaponsList.Count;
|
||||
|
||||
for (int k = 0; k < weaponsListCount; k++) {
|
||||
IKWeaponSystem currentIKWeaponToCheck = weaponsList [k];
|
||||
|
||||
if (!thereIsCurrentWeapon && currentIKWeaponToCheck.isWeaponEnabled ()) {
|
||||
currentIKWeaponToCheck.setCurrentWeaponState (true);
|
||||
thereIsCurrentWeapon = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void initializeValues ()
|
||||
{
|
||||
mainPlayerWeaponsManager.initializePlayerWeaponsValues ();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5ae017e3ec6c8894d908fdd992e1310e
|
||||
timeCreated: 1602224300
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Save System/Custom Class To Save/savePlayerWeaponsInfo.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,312 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
using System.IO;
|
||||
using System;
|
||||
|
||||
public class saveSkillsInfo : saveGameInfo
|
||||
{
|
||||
public playerSkillsSystem mainPlayerSkillsSystem;
|
||||
|
||||
List<persistanceCategorySkillInfo> persistanceInfoList;
|
||||
|
||||
bool valuesInitializedOnLoad;
|
||||
|
||||
|
||||
public override void saveGame (int saveNumber, int playerID, string currentSaveDataPath, bool showDebugInfo, bool savingGameToChangeScene)
|
||||
{
|
||||
saveGameContent (saveNumber, playerID, currentSaveDataPath, showDebugInfo, savingGameToChangeScene);
|
||||
}
|
||||
|
||||
public override void loadGame (int saveNumberToLoad, int playerID, string currentSaveDataPath, bool showDebugInfo)
|
||||
{
|
||||
loadGameContent (saveNumberToLoad, playerID, currentSaveDataPath, showDebugInfo);
|
||||
}
|
||||
|
||||
public override void initializeValuesOnComponent ()
|
||||
{
|
||||
initializeValues ();
|
||||
}
|
||||
|
||||
public void saveGameContent (int currentSaveNumber, int playerID, string currentSaveDataPath, bool showDebugInfo, bool savingGameToChangeScene)
|
||||
{
|
||||
getMainManager ();
|
||||
|
||||
if (mainPlayerSkillsSystem == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mainPlayerSkillsSystem.playerSkillsActive) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mainPlayerSkillsSystem.saveCurrentPlayerSkillsToSaveFile) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("\n\n");
|
||||
|
||||
print ("Saving skills");
|
||||
}
|
||||
|
||||
bool saveLocated = false;
|
||||
bool playerLocated = false;
|
||||
|
||||
int saveSlotIndex = -1;
|
||||
int listIndex = -1;
|
||||
|
||||
BinaryFormatter bf = new BinaryFormatter ();
|
||||
FileStream file;
|
||||
|
||||
persistancePlayerCategorySkillInfo skillsToSave = getPersistanceList (playerID, showDebugInfo);
|
||||
|
||||
persistancePlayerSkillsListBySaveSlotInfo newPersistancePlayerSkillsListBySaveSlotInfo = new persistancePlayerSkillsListBySaveSlotInfo ();
|
||||
|
||||
List<persistancePlayerSkillsListBySaveSlotInfo> infoListToSave = new List<persistancePlayerSkillsListBySaveSlotInfo> ();
|
||||
|
||||
if (File.Exists (currentSaveDataPath)) {
|
||||
bf = new BinaryFormatter ();
|
||||
file = File.Open (currentSaveDataPath, FileMode.Open);
|
||||
object currentData = bf.Deserialize (file);
|
||||
infoListToSave = currentData as List<persistancePlayerSkillsListBySaveSlotInfo>;
|
||||
|
||||
file.Close ();
|
||||
}
|
||||
|
||||
int infoListToSaveCount = infoListToSave.Count;
|
||||
|
||||
for (int j = 0; j < infoListToSaveCount; j++) {
|
||||
if (infoListToSave [j].saveNumber == currentSaveNumber) {
|
||||
newPersistancePlayerSkillsListBySaveSlotInfo = infoListToSave [j];
|
||||
saveLocated = true;
|
||||
saveSlotIndex = j;
|
||||
}
|
||||
}
|
||||
|
||||
if (saveLocated) {
|
||||
int playerSkillsListCount = newPersistancePlayerSkillsListBySaveSlotInfo.playerSkillsList.Count;
|
||||
|
||||
for (int j = 0; j < playerSkillsListCount; j++) {
|
||||
if (newPersistancePlayerSkillsListBySaveSlotInfo.playerSkillsList [j].playerID == skillsToSave.playerID) {
|
||||
playerLocated = true;
|
||||
listIndex = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("\n\n");
|
||||
|
||||
print ("EXTRA INFO\n");
|
||||
print ("Number of skills: " + skillsToSave.categorySkillsList.Count);
|
||||
print ("Current Save Number " + currentSaveNumber);
|
||||
print ("Save Located " + saveLocated);
|
||||
print ("Player Located " + playerLocated);
|
||||
print ("Player ID " + skillsToSave.playerID);
|
||||
}
|
||||
|
||||
//if the save is located, check if the player id exists
|
||||
if (saveLocated) {
|
||||
//if player id exists, overwrite it
|
||||
if (playerLocated) {
|
||||
infoListToSave [saveSlotIndex].playerSkillsList [listIndex].categorySkillsList = skillsToSave.categorySkillsList;
|
||||
} else {
|
||||
infoListToSave [saveSlotIndex].playerSkillsList.Add (skillsToSave);
|
||||
}
|
||||
} else {
|
||||
newPersistancePlayerSkillsListBySaveSlotInfo.saveNumber = currentSaveNumber;
|
||||
newPersistancePlayerSkillsListBySaveSlotInfo.playerSkillsList.Add (skillsToSave);
|
||||
infoListToSave.Add (newPersistancePlayerSkillsListBySaveSlotInfo);
|
||||
}
|
||||
|
||||
bf = new BinaryFormatter ();
|
||||
file = File.Open (currentSaveDataPath, FileMode.OpenOrCreate);
|
||||
bf.Serialize (file, infoListToSave);
|
||||
|
||||
file.Close ();
|
||||
}
|
||||
|
||||
public void loadGameContent (int saveNumberToLoad, int playerID, string currentSaveDataPath, bool showDebugInfo)
|
||||
{
|
||||
getMainManager ();
|
||||
|
||||
if (mainPlayerSkillsSystem == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mainPlayerSkillsSystem.playerSkillsActive) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mainPlayerSkillsSystem.saveCurrentPlayerSkillsToSaveFile) {
|
||||
initializeValues ();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("\n\n");
|
||||
|
||||
print ("Loading skills");
|
||||
}
|
||||
|
||||
//need to store and check the current slot saved and the player which is saving, to get that concrete info
|
||||
persistanceInfoList = new List<persistanceCategorySkillInfo> ();
|
||||
|
||||
List<persistancePlayerSkillsListBySaveSlotInfo> infoListToLoad = new List<persistancePlayerSkillsListBySaveSlotInfo> ();
|
||||
|
||||
if (File.Exists (currentSaveDataPath)) {
|
||||
BinaryFormatter bf = new BinaryFormatter ();
|
||||
FileStream file = File.Open (currentSaveDataPath, FileMode.Open);
|
||||
object currentData = bf.Deserialize (file);
|
||||
infoListToLoad = currentData as List<persistancePlayerSkillsListBySaveSlotInfo>;
|
||||
|
||||
file.Close ();
|
||||
}
|
||||
|
||||
if (saveNumberToLoad > -1) {
|
||||
persistancePlayerSkillsListBySaveSlotInfo newPersistancePlayerSkillsListBySaveSlotInfo = new persistancePlayerSkillsListBySaveSlotInfo ();
|
||||
|
||||
int infoListToLoadCount = infoListToLoad.Count;
|
||||
|
||||
for (int j = 0; j < infoListToLoadCount; j++) {
|
||||
|
||||
if (infoListToLoad [j].saveNumber == saveNumberToLoad) {
|
||||
newPersistancePlayerSkillsListBySaveSlotInfo = infoListToLoad [j];
|
||||
}
|
||||
}
|
||||
|
||||
int listIndex = -1;
|
||||
|
||||
int playerSkillsListCount = newPersistancePlayerSkillsListBySaveSlotInfo.playerSkillsList.Count;
|
||||
|
||||
for (int j = 0; j < playerSkillsListCount; j++) {
|
||||
|
||||
if (newPersistancePlayerSkillsListBySaveSlotInfo.playerSkillsList [j].playerID == playerID) {
|
||||
listIndex = j;
|
||||
}
|
||||
}
|
||||
|
||||
if (listIndex > -1) {
|
||||
persistanceInfoList.AddRange (newPersistancePlayerSkillsListBySaveSlotInfo.playerSkillsList [listIndex].categorySkillsList);
|
||||
}
|
||||
}
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("\n\n");
|
||||
|
||||
print ("Skills Loaded in Save Number " + saveNumberToLoad);
|
||||
}
|
||||
|
||||
loadInfoOnMainComponent ();
|
||||
}
|
||||
|
||||
|
||||
public persistancePlayerCategorySkillInfo getPersistanceList (int playerID, bool showDebugInfo)
|
||||
{
|
||||
persistancePlayerCategorySkillInfo newSkillsList = new persistancePlayerCategorySkillInfo ();
|
||||
|
||||
newSkillsList.playerID = playerID;
|
||||
|
||||
List<persistanceCategorySkillInfo> newPersistanceCategorySkillInfoList = new List<persistanceCategorySkillInfo> ();
|
||||
|
||||
List<playerSkillsSystem.skillCategoryInfo> skillCategoryInfoList = mainPlayerSkillsSystem.skillCategoryInfoList;
|
||||
|
||||
int skillCategoryInfoListCount = skillCategoryInfoList.Count;
|
||||
|
||||
for (int i = 0; i < skillCategoryInfoListCount; i++) {
|
||||
|
||||
persistanceCategorySkillInfo newPersistanceCategorySkillInfo = new persistanceCategorySkillInfo ();
|
||||
|
||||
List<persistanceSkillInfo> newPersistanceSkillInfoList = new List<persistanceSkillInfo> ();
|
||||
|
||||
playerSkillsSystem.skillCategoryInfo currentSkillCategory = skillCategoryInfoList [i];
|
||||
|
||||
int skillInfoListCount = currentSkillCategory.skillInfoList.Count;
|
||||
|
||||
for (int k = 0; k < skillInfoListCount; k++) {
|
||||
|
||||
playerSkillsSystem.skillInfo currentSkillInfo = currentSkillCategory.skillInfoList [k];
|
||||
|
||||
persistanceSkillInfo newpersistanceSkillInfo = new persistanceSkillInfo ();
|
||||
|
||||
newpersistanceSkillInfo.skillUnlocked = currentSkillInfo.skillUnlocked;
|
||||
newpersistanceSkillInfo.skillActive = currentSkillInfo.skillActive;
|
||||
newpersistanceSkillInfo.skillComplete = currentSkillInfo.skillComplete;
|
||||
newpersistanceSkillInfo.currentBoolState = currentSkillInfo.currentBoolState;
|
||||
newpersistanceSkillInfo.currentValue = currentSkillInfo.currentValue;
|
||||
newpersistanceSkillInfo.currentSkillLevel = currentSkillInfo.currentSkillLevel;
|
||||
|
||||
newPersistanceSkillInfoList.Add (newpersistanceSkillInfo);
|
||||
}
|
||||
|
||||
newPersistanceCategorySkillInfo.skillsList = newPersistanceSkillInfoList;
|
||||
|
||||
newPersistanceCategorySkillInfoList.Add (newPersistanceCategorySkillInfo);
|
||||
}
|
||||
|
||||
newSkillsList.categorySkillsList = newPersistanceCategorySkillInfoList;
|
||||
|
||||
return newSkillsList;
|
||||
}
|
||||
|
||||
|
||||
void loadInfoOnMainComponent ()
|
||||
{
|
||||
valuesInitializedOnLoad = true;
|
||||
|
||||
initializeValues ();
|
||||
|
||||
if (persistanceInfoList != null && persistanceInfoList.Count > 0) {
|
||||
List<playerSkillsSystem.skillCategoryInfo> skillCategoryInfoList = mainPlayerSkillsSystem.skillCategoryInfoList;
|
||||
|
||||
int skillCategoryInfoListCount = skillCategoryInfoList.Count;
|
||||
|
||||
for (int i = 0; i < skillCategoryInfoListCount; i++) {
|
||||
|
||||
playerSkillsSystem.skillCategoryInfo currentSkillCategory = skillCategoryInfoList [i];
|
||||
|
||||
int skillInfoListCount = currentSkillCategory.skillInfoList.Count;
|
||||
|
||||
for (int k = 0; k < skillInfoListCount; k++) {
|
||||
|
||||
playerSkillsSystem.skillInfo currentSkillInfo = currentSkillCategory.skillInfoList [k];
|
||||
|
||||
persistanceSkillInfo currentPersistanceSkillInfo = persistanceInfoList [i].skillsList [k];
|
||||
|
||||
currentSkillInfo.skillUnlocked = currentPersistanceSkillInfo.skillUnlocked;
|
||||
currentSkillInfo.skillActive = currentPersistanceSkillInfo.skillActive;
|
||||
|
||||
currentSkillInfo.skillComplete = currentPersistanceSkillInfo.skillComplete;
|
||||
currentSkillInfo.currentBoolState = currentPersistanceSkillInfo.currentBoolState;
|
||||
|
||||
currentSkillInfo.currentValue = currentPersistanceSkillInfo.currentValue;
|
||||
currentSkillInfo.currentSkillLevel = currentPersistanceSkillInfo.currentSkillLevel;
|
||||
}
|
||||
}
|
||||
|
||||
mainPlayerSkillsSystem.setIsLoadingGameState (true);
|
||||
}
|
||||
|
||||
mainPlayerSkillsSystem.initializeSkillsValues ();
|
||||
}
|
||||
|
||||
|
||||
void getMainManager ()
|
||||
{
|
||||
if (mainPlayerSkillsSystem == null) {
|
||||
mainPlayerSkillsSystem = FindObjectOfType<playerSkillsSystem> ();
|
||||
}
|
||||
}
|
||||
|
||||
void initializeValues ()
|
||||
{
|
||||
mainPlayerSkillsSystem.setIsLoadingGameState (false);
|
||||
|
||||
if (!valuesInitializedOnLoad) {
|
||||
mainPlayerSkillsSystem.initializeSkillsValues ();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e0a9ea24bbaf99c49b6671180fa0ae69
|
||||
timeCreated: 1602218192
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Save System/Custom Class To Save/saveSkillsInfo.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,299 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
using System.IO;
|
||||
using System;
|
||||
|
||||
public class saveStatsInfo : saveGameInfo
|
||||
{
|
||||
public playerStatsSystem mainPlayerStatsSystem;
|
||||
|
||||
List<persistanceStatInfo> persistanceInfoList;
|
||||
|
||||
bool valuesInitializedOnLoad;
|
||||
|
||||
|
||||
public override void saveGame (int saveNumber, int playerID, string currentSaveDataPath, bool showDebugInfo, bool savingGameToChangeScene)
|
||||
{
|
||||
saveGameContent (saveNumber, playerID, currentSaveDataPath, showDebugInfo, savingGameToChangeScene);
|
||||
}
|
||||
|
||||
public override void loadGame (int saveNumberToLoad, int playerID, string currentSaveDataPath, bool showDebugInfo)
|
||||
{
|
||||
loadGameContent (saveNumberToLoad, playerID, currentSaveDataPath, showDebugInfo);
|
||||
}
|
||||
|
||||
public override void initializeValuesOnComponent ()
|
||||
{
|
||||
initializeValues ();
|
||||
}
|
||||
|
||||
public void saveGameContent (int currentSaveNumber, int playerID, string currentSaveDataPath, bool showDebugInfo, bool savingGameToChangeScene)
|
||||
{
|
||||
getMainManager ();
|
||||
|
||||
if (mainPlayerStatsSystem == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mainPlayerStatsSystem.playerStatsActive) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mainPlayerStatsSystem.saveCurrentPlayerStatsToSaveFile) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("\n\n");
|
||||
|
||||
print ("Saving stats");
|
||||
}
|
||||
|
||||
bool saveLocated = false;
|
||||
bool playerLocated = false;
|
||||
|
||||
int saveSlotIndex = -1;
|
||||
int listIndex = -1;
|
||||
|
||||
BinaryFormatter bf = new BinaryFormatter ();
|
||||
FileStream file;
|
||||
|
||||
persistancePlayerStatInfo statsToSave = getPersistanceList (playerID, showDebugInfo);
|
||||
|
||||
persistancePlayerStatsListBySaveSlotInfo newPersistancePlayerStatsListBySaveSlotInfo = new persistancePlayerStatsListBySaveSlotInfo ();
|
||||
|
||||
List<persistancePlayerStatsListBySaveSlotInfo> infoListToSave = new List<persistancePlayerStatsListBySaveSlotInfo> ();
|
||||
|
||||
if (File.Exists (currentSaveDataPath)) {
|
||||
bf = new BinaryFormatter ();
|
||||
file = File.Open (currentSaveDataPath, FileMode.Open);
|
||||
object currentData = bf.Deserialize (file);
|
||||
infoListToSave = currentData as List<persistancePlayerStatsListBySaveSlotInfo>;
|
||||
|
||||
file.Close ();
|
||||
}
|
||||
|
||||
int infoListToSaveCount = infoListToSave.Count;
|
||||
|
||||
for (int j = 0; j < infoListToSaveCount; j++) {
|
||||
if (infoListToSave [j].saveNumber == currentSaveNumber) {
|
||||
newPersistancePlayerStatsListBySaveSlotInfo = infoListToSave [j];
|
||||
saveLocated = true;
|
||||
saveSlotIndex = j;
|
||||
}
|
||||
}
|
||||
|
||||
if (saveLocated) {
|
||||
int playerStatsListCount = newPersistancePlayerStatsListBySaveSlotInfo.playerStatsList.Count;
|
||||
|
||||
for (int j = 0; j < playerStatsListCount; j++) {
|
||||
if (newPersistancePlayerStatsListBySaveSlotInfo.playerStatsList [j].playerID == statsToSave.playerID) {
|
||||
playerLocated = true;
|
||||
listIndex = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("\n\n");
|
||||
|
||||
print ("EXTRA INFO\n");
|
||||
print ("Number of stats: " + statsToSave.statsList.Count);
|
||||
print ("Current Save Number " + currentSaveNumber);
|
||||
print ("Save Located " + saveLocated);
|
||||
print ("Player Located " + playerLocated);
|
||||
print ("Player ID " + statsToSave.playerID);
|
||||
}
|
||||
|
||||
//if the save is located, check if the player id exists
|
||||
if (saveLocated) {
|
||||
//if player id exists, overwrite it
|
||||
if (playerLocated) {
|
||||
infoListToSave [saveSlotIndex].playerStatsList [listIndex].statsList = statsToSave.statsList;
|
||||
} else {
|
||||
infoListToSave [saveSlotIndex].playerStatsList.Add (statsToSave);
|
||||
}
|
||||
} else {
|
||||
newPersistancePlayerStatsListBySaveSlotInfo.saveNumber = currentSaveNumber;
|
||||
newPersistancePlayerStatsListBySaveSlotInfo.playerStatsList.Add (statsToSave);
|
||||
infoListToSave.Add (newPersistancePlayerStatsListBySaveSlotInfo);
|
||||
}
|
||||
|
||||
bf = new BinaryFormatter ();
|
||||
file = File.Open (currentSaveDataPath, FileMode.OpenOrCreate);
|
||||
bf.Serialize (file, infoListToSave);
|
||||
|
||||
file.Close ();
|
||||
}
|
||||
|
||||
public void loadGameContent (int saveNumberToLoad, int playerID, string currentSaveDataPath, bool showDebugInfo)
|
||||
{
|
||||
getMainManager ();
|
||||
|
||||
if (mainPlayerStatsSystem == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mainPlayerStatsSystem.playerStatsActive) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mainPlayerStatsSystem.saveCurrentPlayerStatsToSaveFile) {
|
||||
initializeValues ();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("\n\n");
|
||||
|
||||
print ("Loading stats");
|
||||
}
|
||||
|
||||
//need to store and check the current slot saved and the player which is saving, to get that concrete info
|
||||
persistanceInfoList = new List<persistanceStatInfo> ();
|
||||
|
||||
List<persistancePlayerStatsListBySaveSlotInfo> infoListToLoad = new List<persistancePlayerStatsListBySaveSlotInfo> ();
|
||||
|
||||
if (File.Exists (currentSaveDataPath)) {
|
||||
BinaryFormatter bf = new BinaryFormatter ();
|
||||
FileStream file = File.Open (currentSaveDataPath, FileMode.Open);
|
||||
|
||||
object currentData = bf.Deserialize (file);
|
||||
infoListToLoad = currentData as List<persistancePlayerStatsListBySaveSlotInfo>;
|
||||
|
||||
file.Close ();
|
||||
}
|
||||
|
||||
if (saveNumberToLoad > -1) {
|
||||
persistancePlayerStatsListBySaveSlotInfo newPersistancePlayerStatsListBySaveSlotInfo = new persistancePlayerStatsListBySaveSlotInfo ();
|
||||
|
||||
int infoListToLoadCount = infoListToLoad.Count;
|
||||
|
||||
for (int j = 0; j < infoListToLoadCount; j++) {
|
||||
|
||||
if (infoListToLoad [j].saveNumber == saveNumberToLoad) {
|
||||
newPersistancePlayerStatsListBySaveSlotInfo = infoListToLoad [j];
|
||||
}
|
||||
}
|
||||
|
||||
int listIndex = -1;
|
||||
|
||||
int playerStatsListCount = newPersistancePlayerStatsListBySaveSlotInfo.playerStatsList.Count;
|
||||
|
||||
for (int j = 0; j < playerStatsListCount; j++) {
|
||||
|
||||
if (newPersistancePlayerStatsListBySaveSlotInfo.playerStatsList [j].playerID == playerID) {
|
||||
listIndex = j;
|
||||
}
|
||||
}
|
||||
|
||||
if (listIndex > -1) {
|
||||
persistanceInfoList.AddRange (newPersistancePlayerStatsListBySaveSlotInfo.playerStatsList [listIndex].statsList);
|
||||
}
|
||||
}
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("\n\n");
|
||||
|
||||
print ("Stats Loaded in Save Number " + saveNumberToLoad);
|
||||
print ("Number of stats: " + persistanceInfoList.Count);
|
||||
}
|
||||
|
||||
loadInfoOnMainComponent (showDebugInfo);
|
||||
}
|
||||
|
||||
|
||||
public persistancePlayerStatInfo getPersistanceList (int playerID, bool showDebugInfo)
|
||||
{
|
||||
persistancePlayerStatInfo newStatsList = new persistancePlayerStatInfo ();
|
||||
|
||||
newStatsList.playerID = playerID;
|
||||
|
||||
List<persistanceStatInfo> newPersistanceStatInfoList = new List<persistanceStatInfo> ();
|
||||
|
||||
playerStatsSystem.statInfo currentStatInfo = null;
|
||||
|
||||
List<playerStatsSystem.statInfo> statInfoList = mainPlayerStatsSystem.statInfoList;
|
||||
|
||||
int statInfoListCount = statInfoList.Count;
|
||||
|
||||
for (int k = 0; k < statInfoListCount; k++) {
|
||||
currentStatInfo = statInfoList [k];
|
||||
|
||||
persistanceStatInfo newpersistanceStatInfo = new persistanceStatInfo ();
|
||||
|
||||
newpersistanceStatInfo.currentValue = currentStatInfo.currentValue;
|
||||
|
||||
newpersistanceStatInfo.extraCurrentValue = currentStatInfo.extraCurrentValue;
|
||||
|
||||
if (newpersistanceStatInfo.extraCurrentValue > 0) {
|
||||
newpersistanceStatInfo.currentValue -= newpersistanceStatInfo.extraCurrentValue;
|
||||
|
||||
newpersistanceStatInfo.currentValue = Mathf.Clamp (newpersistanceStatInfo.currentValue, 0, newpersistanceStatInfo.currentValue);
|
||||
}
|
||||
|
||||
newpersistanceStatInfo.currentBoolState = currentStatInfo.currentBoolState;
|
||||
|
||||
newPersistanceStatInfoList.Add (newpersistanceStatInfo);
|
||||
}
|
||||
|
||||
newStatsList.statsList = newPersistanceStatInfoList;
|
||||
|
||||
return newStatsList;
|
||||
}
|
||||
|
||||
|
||||
void loadInfoOnMainComponent (bool showDebugInfo)
|
||||
{
|
||||
valuesInitializedOnLoad = true;
|
||||
|
||||
initializeValues ();
|
||||
|
||||
if (persistanceInfoList != null && persistanceInfoList.Count > 0) {
|
||||
|
||||
List<playerStatsSystem.statInfo> statInfoList = mainPlayerStatsSystem.statInfoList;
|
||||
|
||||
int statInfoListCount = statInfoList.Count;
|
||||
|
||||
for (int k = 0; k < statInfoListCount; k++) {
|
||||
playerStatsSystem.statInfo currentStatInfo = statInfoList [k];
|
||||
|
||||
persistanceStatInfo currentPersistanceStatInfo = persistanceInfoList [k];
|
||||
|
||||
if (!currentStatInfo.ignoreStatInitializationOnLoadGame) {
|
||||
|
||||
currentStatInfo.currentValue = currentPersistanceStatInfo.currentValue;
|
||||
currentStatInfo.currentBoolState = currentPersistanceStatInfo.currentBoolState;
|
||||
|
||||
if (showDebugInfo) {
|
||||
print (statInfoList [k].Name + " " + statInfoList [k].currentValue + " " + statInfoList [k].currentBoolState);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mainPlayerStatsSystem.setIsLoadingGameState (true);
|
||||
}
|
||||
|
||||
mainPlayerStatsSystem.initializeStatsValues ();
|
||||
}
|
||||
|
||||
|
||||
void getMainManager ()
|
||||
{
|
||||
if (mainPlayerStatsSystem == null) {
|
||||
mainPlayerStatsSystem = FindObjectOfType<playerStatsSystem> ();
|
||||
}
|
||||
}
|
||||
|
||||
void initializeValues ()
|
||||
{
|
||||
mainPlayerStatsSystem.setIsLoadingGameState (false);
|
||||
|
||||
if (!valuesInitializedOnLoad) {
|
||||
mainPlayerStatsSystem.initializeStatsValues ();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 524a8737699a14b48ac2ef81f6505503
|
||||
timeCreated: 1602222626
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Save System/Custom Class To Save/saveStatsInfo.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,250 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
using System.IO;
|
||||
using System;
|
||||
|
||||
public class saveTravelStationInfo : saveGameInfo
|
||||
{
|
||||
public travelStationUISystem mainTravelStationUISystem;
|
||||
|
||||
List<persistanceTravelStationInfo> persistanceInfoList;
|
||||
|
||||
|
||||
public override void saveGame (int saveNumber, int playerID, string currentSaveDataPath, bool showDebugInfo, bool savingGameToChangeScene)
|
||||
{
|
||||
saveGameContent (saveNumber, playerID, currentSaveDataPath, showDebugInfo, savingGameToChangeScene);
|
||||
}
|
||||
|
||||
public override void loadGame (int saveNumberToLoad, int playerID, string currentSaveDataPath, bool showDebugInfo)
|
||||
{
|
||||
loadGameContent (saveNumberToLoad, playerID, currentSaveDataPath, showDebugInfo);
|
||||
}
|
||||
|
||||
public override void initializeValuesOnComponent ()
|
||||
{
|
||||
initializeValues ();
|
||||
}
|
||||
|
||||
public void saveGameContent (int currentSaveNumber, int playerID, string currentSaveDataPath, bool showDebugInfo, bool savingGameToChangeScene)
|
||||
{
|
||||
if (mainTravelStationUISystem == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mainTravelStationUISystem.travelStationUIActive) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mainTravelStationUISystem.saveCurrentTravelStationToSaveFile) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("\n\n");
|
||||
|
||||
print ("Saving travel stations");
|
||||
}
|
||||
|
||||
bool saveLocated = false;
|
||||
bool playerLocated = false;
|
||||
|
||||
int saveSlotIndex = -1;
|
||||
int listIndex = -1;
|
||||
|
||||
BinaryFormatter bf = new BinaryFormatter ();
|
||||
FileStream file;
|
||||
|
||||
persistancePlayerTravelStationInfo traveStationListToSave = getPersistanceList (playerID, showDebugInfo);
|
||||
|
||||
persistanceTravelStationListBySaveSlotInfo newPersistanceTravelStationListBySaveSlotInfo = new persistanceTravelStationListBySaveSlotInfo ();
|
||||
|
||||
List<persistanceTravelStationListBySaveSlotInfo> infoListToSave = new List<persistanceTravelStationListBySaveSlotInfo> ();
|
||||
|
||||
if (File.Exists (currentSaveDataPath)) {
|
||||
bf = new BinaryFormatter ();
|
||||
file = File.Open (currentSaveDataPath, FileMode.Open);
|
||||
object currentData = bf.Deserialize (file);
|
||||
infoListToSave = currentData as List<persistanceTravelStationListBySaveSlotInfo>;
|
||||
|
||||
file.Close ();
|
||||
}
|
||||
|
||||
int infoListToSaveCount = infoListToSave.Count;
|
||||
|
||||
for (int j = 0; j < infoListToSaveCount; j++) {
|
||||
if (infoListToSave [j].saveNumber == currentSaveNumber) {
|
||||
newPersistanceTravelStationListBySaveSlotInfo = infoListToSave [j];
|
||||
saveLocated = true;
|
||||
saveSlotIndex = j;
|
||||
}
|
||||
}
|
||||
|
||||
if (saveLocated) {
|
||||
int playerTravelStationListCount = newPersistanceTravelStationListBySaveSlotInfo.playerTravelStationList.Count;
|
||||
|
||||
for (int j = 0; j < playerTravelStationListCount; j++) {
|
||||
if (newPersistanceTravelStationListBySaveSlotInfo.playerTravelStationList [j].playerID == traveStationListToSave.playerID) {
|
||||
playerLocated = true;
|
||||
listIndex = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//if the save is located, check if the player id exists
|
||||
if (saveLocated) {
|
||||
//if player id exists, overwrite it
|
||||
if (playerLocated) {
|
||||
infoListToSave [saveSlotIndex].playerTravelStationList [listIndex].travelStationList = traveStationListToSave.travelStationList;
|
||||
} else {
|
||||
infoListToSave [saveSlotIndex].playerTravelStationList.Add (traveStationListToSave);
|
||||
}
|
||||
} else {
|
||||
newPersistanceTravelStationListBySaveSlotInfo.saveNumber = currentSaveNumber;
|
||||
newPersistanceTravelStationListBySaveSlotInfo.playerTravelStationList.Add (traveStationListToSave);
|
||||
infoListToSave.Add (newPersistanceTravelStationListBySaveSlotInfo);
|
||||
}
|
||||
|
||||
bf = new BinaryFormatter ();
|
||||
file = File.Open (currentSaveDataPath, FileMode.OpenOrCreate);
|
||||
bf.Serialize (file, infoListToSave);
|
||||
|
||||
file.Close ();
|
||||
}
|
||||
|
||||
public void loadGameContent (int saveNumberToLoad, int playerID, string currentSaveDataPath, bool showDebugInfo)
|
||||
{
|
||||
if (mainTravelStationUISystem == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mainTravelStationUISystem.travelStationUIActive) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mainTravelStationUISystem.saveCurrentTravelStationToSaveFile) {
|
||||
initializeValues ();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("\n\n");
|
||||
|
||||
print ("Loading travel stations");
|
||||
}
|
||||
|
||||
persistanceInfoList = new List<persistanceTravelStationInfo> ();
|
||||
|
||||
//need to store and check the current slot saved and the player which is saving, to get that concrete info
|
||||
List<persistanceTravelStationListBySaveSlotInfo> infoListToLoad = new List<persistanceTravelStationListBySaveSlotInfo> ();
|
||||
|
||||
if (File.Exists (currentSaveDataPath)) {
|
||||
BinaryFormatter bf = new BinaryFormatter ();
|
||||
FileStream file = File.Open (currentSaveDataPath, FileMode.Open);
|
||||
object currentData = bf.Deserialize (file);
|
||||
infoListToLoad = currentData as List<persistanceTravelStationListBySaveSlotInfo>;
|
||||
|
||||
file.Close ();
|
||||
}
|
||||
|
||||
if (saveNumberToLoad > -1) {
|
||||
persistanceTravelStationListBySaveSlotInfo newPersistanceTravelStationListBySaveSlotInfo = new persistanceTravelStationListBySaveSlotInfo ();
|
||||
|
||||
int infoListToLoadCount = infoListToLoad.Count;
|
||||
|
||||
for (int j = 0; j < infoListToLoadCount; j++) {
|
||||
|
||||
if (infoListToLoad [j].saveNumber == saveNumberToLoad) {
|
||||
newPersistanceTravelStationListBySaveSlotInfo = infoListToLoad [j];
|
||||
}
|
||||
}
|
||||
|
||||
int listIndex = -1;
|
||||
|
||||
int playerTravelStationListCount = newPersistanceTravelStationListBySaveSlotInfo.playerTravelStationList.Count;
|
||||
|
||||
for (int j = 0; j < playerTravelStationListCount; j++) {
|
||||
|
||||
if (newPersistanceTravelStationListBySaveSlotInfo.playerTravelStationList [j].playerID == playerID) {
|
||||
listIndex = j;
|
||||
}
|
||||
}
|
||||
|
||||
if (listIndex > -1) {
|
||||
persistanceInfoList.AddRange (newPersistanceTravelStationListBySaveSlotInfo.playerTravelStationList [listIndex].travelStationList);
|
||||
}
|
||||
}
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("\n\n");
|
||||
|
||||
print ("Travel Stations Loaded in Save Number " + saveNumberToLoad);
|
||||
print ("Number of travel station: " + persistanceInfoList.Count);
|
||||
}
|
||||
|
||||
loadInfoOnMainComponent ();
|
||||
}
|
||||
|
||||
|
||||
persistancePlayerTravelStationInfo getPersistanceList (int playerID, bool showDebugInfo)
|
||||
{
|
||||
persistancePlayerTravelStationInfo newPersistancePlayerTravelStationInfo = new persistancePlayerTravelStationInfo ();
|
||||
|
||||
newPersistancePlayerTravelStationInfo.playerID = playerID;
|
||||
|
||||
List<persistanceTravelStationInfo> newPersistanceTravelStationInfoList = new List<persistanceTravelStationInfo> ();
|
||||
|
||||
List<travelStationUISystem.foundTravelStationInfo> foundTravelStationInfoList = mainTravelStationUISystem.foundTravelStationInfoList;
|
||||
|
||||
int foundTravelStationInfoListCount = foundTravelStationInfoList.Count;
|
||||
|
||||
for (int k = 0; k < foundTravelStationInfoListCount; k++) {
|
||||
persistanceTravelStationInfo newPersistanceTravelStationInfo = new persistanceTravelStationInfo ();
|
||||
|
||||
travelStationUISystem.foundTravelStationInfo currentStationInfo = foundTravelStationInfoList [k];
|
||||
|
||||
newPersistanceTravelStationInfo.sceneNumberToLoad = currentStationInfo.sceneNumberToLoad;
|
||||
newPersistanceTravelStationInfo.levelManagerIDToLoad = currentStationInfo.levelManagerIDToLoad;
|
||||
|
||||
newPersistanceTravelStationInfoList.Add (newPersistanceTravelStationInfo);
|
||||
}
|
||||
|
||||
newPersistancePlayerTravelStationInfo.travelStationList = newPersistanceTravelStationInfoList;
|
||||
|
||||
return newPersistancePlayerTravelStationInfo;
|
||||
}
|
||||
|
||||
|
||||
void loadInfoOnMainComponent ()
|
||||
{
|
||||
initializeValues ();
|
||||
|
||||
if (persistanceInfoList != null && persistanceInfoList.Count > 0) {
|
||||
|
||||
int persistanceInfoListCount = persistanceInfoList.Count;
|
||||
|
||||
// print (persistanceInfoListCount);
|
||||
|
||||
List<travelStationUISystem.foundTravelStationInfo> foundTravelStationInfoList = mainTravelStationUISystem.foundTravelStationInfoList;
|
||||
|
||||
for (int i = 0; i < persistanceInfoListCount; i++) {
|
||||
|
||||
persistanceTravelStationInfo currentPersistanceTravelStationInfo = persistanceInfoList [i];
|
||||
|
||||
travelStationUISystem.foundTravelStationInfo newFoundTravelStationInfo = new travelStationUISystem.foundTravelStationInfo ();
|
||||
|
||||
newFoundTravelStationInfo.sceneNumberToLoad = currentPersistanceTravelStationInfo.sceneNumberToLoad;
|
||||
newFoundTravelStationInfo.levelManagerIDToLoad = currentPersistanceTravelStationInfo.levelManagerIDToLoad;
|
||||
|
||||
foundTravelStationInfoList.Add (newFoundTravelStationInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void initializeValues ()
|
||||
{
|
||||
mainTravelStationUISystem.initializeTravelStationValues ();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 57fc4e01f8773cc4593616d9fe40923d
|
||||
timeCreated: 1602177608
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Save System/Custom Class To Save/saveTravelStationInfo.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,432 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
using System.IO;
|
||||
using System;
|
||||
|
||||
public class saveVendorInfo : saveGameInfo
|
||||
{
|
||||
public vendorSystem mainVendorSystem;
|
||||
|
||||
List<inventoryListElement> persistanceInfoList;
|
||||
|
||||
|
||||
public override void saveGame (int saveNumber, int playerID, string currentSaveDataPath, bool showDebugInfo, bool savingGameToChangeScene)
|
||||
{
|
||||
saveGameContent (saveNumber, playerID, currentSaveDataPath, showDebugInfo, savingGameToChangeScene);
|
||||
}
|
||||
|
||||
public override void loadGame (int saveNumberToLoad, int playerID, string currentSaveDataPath, bool showDebugInfo)
|
||||
{
|
||||
loadGameContent (saveNumberToLoad, playerID, currentSaveDataPath, showDebugInfo);
|
||||
}
|
||||
|
||||
public override void saveGameFromEditor (int saveNumber, int playerID, string currentSaveDataPath, bool showDebugInfo)
|
||||
{
|
||||
saveGameContentFromEditor (saveNumber, playerID, currentSaveDataPath, showDebugInfo);
|
||||
}
|
||||
|
||||
public void saveGameContent (int currentSaveNumber, int playerID, string currentSaveDataPath, bool showDebugInfo, bool savingGameToChangeScene)
|
||||
{
|
||||
getMainManager ();
|
||||
|
||||
if (mainVendorSystem == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mainVendorSystem.saveCurrentVendorInventoryToSaveFile) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("\n\n");
|
||||
|
||||
print ("Saving vendor");
|
||||
}
|
||||
|
||||
|
||||
bool saveLocated = false;
|
||||
bool vendorLocated = false;
|
||||
|
||||
int saveSlotIndex = -1;
|
||||
int listIndex = -1;
|
||||
|
||||
BinaryFormatter bf = new BinaryFormatter ();
|
||||
FileStream file;
|
||||
|
||||
persistanceInventoryListByPlayerInfo vendorToSave = getPersistanceList (playerID, showDebugInfo);
|
||||
|
||||
persistanceInventoryListBySaveSlotInfo newPersistanceInventoryListBySaveSlotInfo = new persistanceInventoryListBySaveSlotInfo ();
|
||||
|
||||
List<persistanceInventoryListBySaveSlotInfo> infoListToSave = new List<persistanceInventoryListBySaveSlotInfo> ();
|
||||
|
||||
if (File.Exists (currentSaveDataPath)) {
|
||||
bf = new BinaryFormatter ();
|
||||
file = File.Open (currentSaveDataPath, FileMode.Open);
|
||||
object currentData = bf.Deserialize (file);
|
||||
infoListToSave = currentData as List<persistanceInventoryListBySaveSlotInfo>;
|
||||
|
||||
file.Close ();
|
||||
}
|
||||
|
||||
int infoListToSaveCount = infoListToSave.Count;
|
||||
|
||||
for (int j = 0; j < infoListToSaveCount; j++) {
|
||||
if (saveSlotIndex == -1) {
|
||||
persistanceInventoryListBySaveSlotInfo currentSlot = infoListToSave [j];
|
||||
|
||||
if (currentSlot.saveNumber == currentSaveNumber) {
|
||||
newPersistanceInventoryListBySaveSlotInfo = currentSlot;
|
||||
saveLocated = true;
|
||||
saveSlotIndex = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("\n\n");
|
||||
|
||||
print ("VENDOR SYSTEM");
|
||||
print ("Number of objects: " + vendorToSave.inventoryObjectList.Count);
|
||||
print ("Current Save Number " + currentSaveNumber);
|
||||
print ("Save Located " + saveLocated);
|
||||
}
|
||||
|
||||
if (saveLocated) {
|
||||
if (newPersistanceInventoryListBySaveSlotInfo.playerInventoryList.Count > 0) {
|
||||
vendorLocated = true;
|
||||
listIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//if the save is located, check if the vendor exists
|
||||
if (saveLocated) {
|
||||
//if player id exists, overwrite it
|
||||
if (vendorLocated) {
|
||||
infoListToSave [saveSlotIndex].playerInventoryList [listIndex].inventoryObjectList = vendorToSave.inventoryObjectList;
|
||||
} else {
|
||||
infoListToSave [saveSlotIndex].playerInventoryList.Add (vendorToSave);
|
||||
}
|
||||
} else {
|
||||
newPersistanceInventoryListBySaveSlotInfo.saveNumber = currentSaveNumber;
|
||||
newPersistanceInventoryListBySaveSlotInfo.playerInventoryList.Add (vendorToSave);
|
||||
infoListToSave.Add (newPersistanceInventoryListBySaveSlotInfo);
|
||||
}
|
||||
|
||||
if (showDebugInfo) {
|
||||
|
||||
print ("\n\n");
|
||||
|
||||
for (int j = 0; j < vendorToSave.inventoryObjectList.Count; j++) {
|
||||
persistanceInventoryObjectInfo currentInfo = vendorToSave.inventoryObjectList [j];
|
||||
|
||||
print ("Object Name: " + currentInfo.Name + " Amount: " + currentInfo.amount);
|
||||
}
|
||||
}
|
||||
|
||||
bf = new BinaryFormatter ();
|
||||
file = File.Open (currentSaveDataPath, FileMode.OpenOrCreate);
|
||||
bf.Serialize (file, infoListToSave);
|
||||
|
||||
file.Close ();
|
||||
}
|
||||
|
||||
public void loadGameContent (int saveNumberToLoad, int playerID, string currentSaveDataPath, bool showDebugInfo)
|
||||
{
|
||||
getMainManager ();
|
||||
|
||||
if (mainVendorSystem == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("\n\n");
|
||||
|
||||
print ("Loading vendor");
|
||||
}
|
||||
|
||||
//need to store and check the current slot saved and the player which is saving, to get that concrete info
|
||||
persistanceInfoList = new List<inventoryListElement> ();
|
||||
|
||||
List<persistanceInventoryListBySaveSlotInfo> infoListToLoad = new List<persistanceInventoryListBySaveSlotInfo> ();
|
||||
|
||||
if (File.Exists (currentSaveDataPath)) {
|
||||
BinaryFormatter bf = new BinaryFormatter ();
|
||||
FileStream file = File.Open (currentSaveDataPath, FileMode.Open);
|
||||
object currentData = bf.Deserialize (file);
|
||||
infoListToLoad = currentData as List<persistanceInventoryListBySaveSlotInfo>;
|
||||
|
||||
file.Close ();
|
||||
}
|
||||
|
||||
if (saveNumberToLoad > -1) {
|
||||
persistanceInventoryListBySaveSlotInfo newPersistanceInventoryListBySaveSlotInfo = new persistanceInventoryListBySaveSlotInfo ();
|
||||
|
||||
int infoListToLoadCount = infoListToLoad.Count;
|
||||
|
||||
bool slotLocated = false;
|
||||
|
||||
for (int j = 0; j < infoListToLoadCount; j++) {
|
||||
if (!slotLocated) {
|
||||
persistanceInventoryListBySaveSlotInfo currentSlot = infoListToLoad [j];
|
||||
|
||||
if (currentSlot.saveNumber == saveNumberToLoad) {
|
||||
newPersistanceInventoryListBySaveSlotInfo = currentSlot;
|
||||
|
||||
slotLocated = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int vendorIndex = 0;
|
||||
|
||||
if (newPersistanceInventoryListBySaveSlotInfo.playerInventoryList.Count > 0) {
|
||||
persistanceInventoryListByPlayerInfo vendorListToLoad = newPersistanceInventoryListBySaveSlotInfo.playerInventoryList [vendorIndex];
|
||||
|
||||
int inventoryObjectListCount = vendorListToLoad.inventoryObjectList.Count;
|
||||
|
||||
for (int j = 0; j < inventoryObjectListCount; j++) {
|
||||
|
||||
inventoryListElement newInventoryListElement = new inventoryListElement ();
|
||||
|
||||
persistanceInventoryObjectInfo currentInventoryInfo = vendorListToLoad.inventoryObjectList [j];
|
||||
|
||||
newInventoryListElement.Name = currentInventoryInfo.Name;
|
||||
newInventoryListElement.amount = currentInventoryInfo.amount;
|
||||
newInventoryListElement.infiniteAmount = currentInventoryInfo.infiniteAmount;
|
||||
newInventoryListElement.inventoryObjectName = currentInventoryInfo.inventoryObjectName;
|
||||
|
||||
newInventoryListElement.categoryIndex = currentInventoryInfo.categoryIndex;
|
||||
newInventoryListElement.elementIndex = currentInventoryInfo.elementIndex;
|
||||
|
||||
newInventoryListElement.vendorPrice = currentInventoryInfo.vendorPrice;
|
||||
newInventoryListElement.infiniteVendorAmountAvailable = currentInventoryInfo.infiniteVendorAmountAvailable;
|
||||
|
||||
newInventoryListElement.sellPrice = currentInventoryInfo.sellPrice;
|
||||
|
||||
newInventoryListElement.useMinLevelToBuy = currentInventoryInfo.useMinLevelToBuy;
|
||||
newInventoryListElement.minLevelToBuy = currentInventoryInfo.minLevelToBuy;
|
||||
|
||||
newInventoryListElement.spawnObject = currentInventoryInfo.spawnObject;
|
||||
|
||||
persistanceInfoList.Add (newInventoryListElement);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("\n\n");
|
||||
|
||||
print ("VENDOR SYSTEM");
|
||||
|
||||
print ("Vendor Loaded in Save Number " + saveNumberToLoad);
|
||||
print ("Number of objects: " + persistanceInfoList.Count);
|
||||
|
||||
for (int j = 0; j < persistanceInfoList.Count; j++) {
|
||||
inventoryListElement currentElement = persistanceInfoList [j];
|
||||
|
||||
print ("Object Name: " + currentElement.Name + " Amount: " + currentElement.amount);
|
||||
}
|
||||
}
|
||||
|
||||
loadInfoOnMainComponent ();
|
||||
}
|
||||
|
||||
|
||||
public persistanceInventoryListByPlayerInfo getPersistanceList (int playerID, bool showDebugInfo)
|
||||
{
|
||||
persistanceInventoryListByPlayerInfo newPersistanceInventoryListByPlayerInfo = new persistanceInventoryListByPlayerInfo ();
|
||||
|
||||
newPersistanceInventoryListByPlayerInfo.playerID = playerID;
|
||||
|
||||
List<persistanceInventoryObjectInfo> newPersistanceInventoryObjectInfoList = new List<persistanceInventoryObjectInfo> ();
|
||||
|
||||
List<inventoryInfo> vendorInventoryList = mainVendorSystem.vendorInventoryList;
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("\n\n");
|
||||
}
|
||||
|
||||
int vendorInventoryListCount = vendorInventoryList.Count;
|
||||
|
||||
for (int k = 0; k < vendorInventoryListCount; k++) {
|
||||
persistanceInventoryObjectInfo newPersistanceInventoryObjectInfo = new persistanceInventoryObjectInfo ();
|
||||
|
||||
inventoryInfo currentInventoryInfo = vendorInventoryList [k];
|
||||
|
||||
newPersistanceInventoryObjectInfo.Name = currentInventoryInfo.Name;
|
||||
newPersistanceInventoryObjectInfo.amount = currentInventoryInfo.amount;
|
||||
newPersistanceInventoryObjectInfo.infiniteAmount = currentInventoryInfo.infiniteAmount;
|
||||
newPersistanceInventoryObjectInfo.inventoryObjectName = currentInventoryInfo.Name;
|
||||
|
||||
newPersistanceInventoryObjectInfo.elementIndex = currentInventoryInfo.elementIndex;
|
||||
newPersistanceInventoryObjectInfo.categoryIndex = currentInventoryInfo.categoryIndex;
|
||||
|
||||
newPersistanceInventoryObjectInfo.vendorPrice = currentInventoryInfo.vendorPrice;
|
||||
newPersistanceInventoryObjectInfo.infiniteVendorAmountAvailable = currentInventoryInfo.infiniteVendorAmountAvailable;
|
||||
|
||||
newPersistanceInventoryObjectInfo.sellPrice = currentInventoryInfo.sellPrice;
|
||||
|
||||
newPersistanceInventoryObjectInfo.useMinLevelToBuy = currentInventoryInfo.useMinLevelToBuy;
|
||||
newPersistanceInventoryObjectInfo.minLevelToBuy = currentInventoryInfo.minLevelToBuy;
|
||||
|
||||
newPersistanceInventoryObjectInfo.spawnObject = currentInventoryInfo.spawnObject;
|
||||
|
||||
if (showDebugInfo) {
|
||||
print (newPersistanceInventoryObjectInfo.Name + " " + newPersistanceInventoryObjectInfo.amount);
|
||||
}
|
||||
|
||||
newPersistanceInventoryObjectInfoList.Add (newPersistanceInventoryObjectInfo);
|
||||
}
|
||||
|
||||
newPersistanceInventoryListByPlayerInfo.inventoryObjectList = newPersistanceInventoryObjectInfoList;
|
||||
|
||||
return newPersistanceInventoryListByPlayerInfo;
|
||||
}
|
||||
|
||||
|
||||
void loadInfoOnMainComponent ()
|
||||
{
|
||||
if (persistanceInfoList != null && persistanceInfoList.Count > 0) {
|
||||
mainVendorSystem.setNewInventoryListManagerList (persistanceInfoList);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void getMainManager ()
|
||||
{
|
||||
if (mainVendorSystem == null) {
|
||||
mainVendorSystem = FindObjectOfType<vendorSystem> ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void saveGameContentFromEditor (int currentSaveNumber, int playerID, string currentSaveDataPath, bool showDebugInfo)
|
||||
{
|
||||
getMainManager ();
|
||||
|
||||
if (mainVendorSystem == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
bool saveLocated = false;
|
||||
bool vendorLocated = false;
|
||||
|
||||
int saveSlotIndex = -1;
|
||||
int listIndex = -1;
|
||||
|
||||
BinaryFormatter bf = new BinaryFormatter ();
|
||||
FileStream file;
|
||||
|
||||
persistanceInventoryListByPlayerInfo vendorToSave = getPersistanceVendorListElement (playerID, showDebugInfo);
|
||||
|
||||
persistanceInventoryListBySaveSlotInfo newPersistanceInventoryListBySaveSlotInfo = new persistanceInventoryListBySaveSlotInfo ();
|
||||
|
||||
List<persistanceInventoryListBySaveSlotInfo> infoListToSave = new List<persistanceInventoryListBySaveSlotInfo> ();
|
||||
|
||||
if (File.Exists (currentSaveDataPath)) {
|
||||
bf = new BinaryFormatter ();
|
||||
file = File.Open (currentSaveDataPath, FileMode.Open);
|
||||
object currentData = bf.Deserialize (file);
|
||||
infoListToSave = currentData as List<persistanceInventoryListBySaveSlotInfo>;
|
||||
|
||||
file.Close ();
|
||||
}
|
||||
|
||||
int infoListToSaveCount = infoListToSave.Count;
|
||||
|
||||
for (int j = 0; j < infoListToSaveCount; j++) {
|
||||
if (saveSlotIndex == -1) {
|
||||
persistanceInventoryListBySaveSlotInfo currentSlot = infoListToSave [j];
|
||||
|
||||
if (currentSlot.saveNumber == currentSaveNumber) {
|
||||
newPersistanceInventoryListBySaveSlotInfo = currentSlot;
|
||||
saveLocated = true;
|
||||
saveSlotIndex = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (showDebugInfo) {
|
||||
print ("VENDOR SYSTEM");
|
||||
|
||||
print ("Number of objects: " + vendorToSave.inventoryObjectList.Count);
|
||||
print ("Current Save Number " + currentSaveNumber);
|
||||
print ("Save Located " + saveLocated);
|
||||
}
|
||||
|
||||
if (saveLocated) {
|
||||
if (newPersistanceInventoryListBySaveSlotInfo.playerInventoryList.Count > 0) {
|
||||
vendorLocated = true;
|
||||
listIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//if the save is located, check if the vendor exists
|
||||
if (saveLocated) {
|
||||
//if player id exists, overwrite it
|
||||
if (vendorLocated) {
|
||||
infoListToSave [saveSlotIndex].playerInventoryList [listIndex].inventoryObjectList = vendorToSave.inventoryObjectList;
|
||||
} else {
|
||||
infoListToSave [saveSlotIndex].playerInventoryList.Add (vendorToSave);
|
||||
}
|
||||
} else {
|
||||
newPersistanceInventoryListBySaveSlotInfo.saveNumber = currentSaveNumber;
|
||||
newPersistanceInventoryListBySaveSlotInfo.playerInventoryList.Add (vendorToSave);
|
||||
infoListToSave.Add (newPersistanceInventoryListBySaveSlotInfo);
|
||||
}
|
||||
|
||||
bf = new BinaryFormatter ();
|
||||
file = File.Create (currentSaveDataPath);
|
||||
bf.Serialize (file, infoListToSave);
|
||||
file.Close ();
|
||||
}
|
||||
|
||||
public persistanceInventoryListByPlayerInfo getPersistanceVendorListElement (int playerID, bool showDebugInfo)
|
||||
{
|
||||
persistanceInventoryListByPlayerInfo newPersistanceInventoryListByPlayerInfo = new persistanceInventoryListByPlayerInfo ();
|
||||
|
||||
newPersistanceInventoryListByPlayerInfo.playerID = playerID;
|
||||
|
||||
List<persistanceInventoryObjectInfo> newPersistanceInventoryObjectInfoList = new List<persistanceInventoryObjectInfo> ();
|
||||
|
||||
List<inventoryListElement> inventoryListManagerList = mainVendorSystem.inventoryListManagerList;
|
||||
|
||||
int inventoryListManagerListCount = inventoryListManagerList.Count;
|
||||
|
||||
for (int k = 0; k < inventoryListManagerListCount; k++) {
|
||||
persistanceInventoryObjectInfo newPersistanceInventoryObjectInfo = new persistanceInventoryObjectInfo ();
|
||||
|
||||
inventoryListElement currentElement = inventoryListManagerList [k];
|
||||
|
||||
newPersistanceInventoryObjectInfo.Name = currentElement.Name;
|
||||
newPersistanceInventoryObjectInfo.amount = currentElement.amount;
|
||||
newPersistanceInventoryObjectInfo.infiniteAmount = currentElement.infiniteAmount;
|
||||
newPersistanceInventoryObjectInfo.inventoryObjectName = currentElement.inventoryObjectName;
|
||||
|
||||
newPersistanceInventoryObjectInfo.elementIndex = currentElement.elementIndex;
|
||||
newPersistanceInventoryObjectInfo.categoryIndex = currentElement.categoryIndex;
|
||||
|
||||
newPersistanceInventoryObjectInfo.vendorPrice = currentElement.vendorPrice;
|
||||
newPersistanceInventoryObjectInfo.infiniteVendorAmountAvailable = currentElement.infiniteVendorAmountAvailable;
|
||||
|
||||
newPersistanceInventoryObjectInfo.sellPrice = currentElement.sellPrice;
|
||||
|
||||
newPersistanceInventoryObjectInfo.useMinLevelToBuy = currentElement.useMinLevelToBuy;
|
||||
newPersistanceInventoryObjectInfo.minLevelToBuy = currentElement.minLevelToBuy;
|
||||
|
||||
newPersistanceInventoryObjectInfo.spawnObject = currentElement.spawnObject;
|
||||
|
||||
if (showDebugInfo) {
|
||||
print (newPersistanceInventoryObjectInfo.Name + " " + newPersistanceInventoryObjectInfo.amount);
|
||||
}
|
||||
|
||||
newPersistanceInventoryObjectInfoList.Add (newPersistanceInventoryObjectInfo);
|
||||
}
|
||||
|
||||
newPersistanceInventoryListByPlayerInfo.inventoryObjectList = newPersistanceInventoryObjectInfoList;
|
||||
|
||||
return newPersistanceInventoryListByPlayerInfo;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: eb6b14312d71d0a438ad41479cd98773
|
||||
timeCreated: 1602215815
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Save System/Custom Class To Save/saveVendorInfo.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 702c41d96af40b04ca4d6400ac052d55
|
||||
folderAsset: yes
|
||||
timeCreated: 1651729482
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,503 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
|
||||
public class elementOnScene : MonoBehaviour
|
||||
{
|
||||
[Header ("Main Settings")]
|
||||
[Space]
|
||||
|
||||
public bool saveElementEnabled = true;
|
||||
|
||||
public int elementScene;
|
||||
public int elementID;
|
||||
|
||||
public bool elementActiveState = true;
|
||||
|
||||
[Space]
|
||||
[Header ("Transform Settings")]
|
||||
[Space]
|
||||
|
||||
public bool savePositionValues;
|
||||
|
||||
public bool saveRotationValues;
|
||||
|
||||
[Space]
|
||||
[Space]
|
||||
|
||||
public bool useCustomTransform;
|
||||
|
||||
public Transform customTransform;
|
||||
|
||||
[Space]
|
||||
[Header ("Element Prefab Settings")]
|
||||
[Space]
|
||||
|
||||
public int elementPrefabID = -1;
|
||||
|
||||
[Space]
|
||||
[Header ("Element Stats Settings")]
|
||||
[Space]
|
||||
|
||||
public bool useStats;
|
||||
|
||||
public float loadStatsDelay;
|
||||
|
||||
public List<statInfo> statInfoList = new List<statInfo> ();
|
||||
|
||||
[Space]
|
||||
[Header ("Events Settings")]
|
||||
[Space]
|
||||
|
||||
public bool useEventOnObjectActive;
|
||||
public UnityEvent eventOnObjectActive;
|
||||
|
||||
public bool useEventOnObjectInactive = true;
|
||||
public UnityEvent eventOnObjectInactive;
|
||||
|
||||
public bool useDelayForEvent;
|
||||
public float delayForEvent;
|
||||
|
||||
[Space]
|
||||
[Space]
|
||||
|
||||
public bool useEventObjectObjectActiveWithoutDelay;
|
||||
public UnityEvent eventObjectObjectActiveWithoutDelay;
|
||||
|
||||
public bool useEventObjectObjectInactiveWithoutDelay;
|
||||
public UnityEvent eventObjectObjectInactiveWithoutDelay;
|
||||
|
||||
[Space]
|
||||
[Header ("Debug")]
|
||||
[Space]
|
||||
|
||||
public bool showDebugPrint;
|
||||
public bool useElementPrefabID;
|
||||
public bool objectOriginallyOnScene;
|
||||
|
||||
Vector3 newPosition;
|
||||
Vector3 newRotation;
|
||||
|
||||
string currentStatNameToCheck;
|
||||
|
||||
elementOnSceneManager mainElementOnSceneManager;
|
||||
|
||||
bool mainElementOnSceneManagerLocated;
|
||||
|
||||
|
||||
public void setElementScene (int newValue)
|
||||
{
|
||||
elementScene = newValue;
|
||||
}
|
||||
|
||||
public void setElementID (int newValue)
|
||||
{
|
||||
elementID = newValue;
|
||||
}
|
||||
|
||||
public void setNewPositionValues (Vector3 newValue)
|
||||
{
|
||||
newPosition = newValue;
|
||||
}
|
||||
|
||||
public void setNewRotationValues (Vector3 newValue)
|
||||
{
|
||||
newRotation = newValue;
|
||||
}
|
||||
|
||||
public void setUseEventOnObjectActiveState (bool state)
|
||||
{
|
||||
useEventOnObjectActive = state;
|
||||
}
|
||||
|
||||
public void setUseEventOnObjectInactive (bool state)
|
||||
{
|
||||
useEventOnObjectInactive = state;
|
||||
}
|
||||
|
||||
public void setElementActiveState (bool state)
|
||||
{
|
||||
elementActiveState = state;
|
||||
|
||||
if (showDebugPrint) {
|
||||
print ("\n");
|
||||
print ("SETTING ELEMENT STATE ON " + gameObject.name + " as " + state);
|
||||
|
||||
print ("\n");
|
||||
}
|
||||
}
|
||||
|
||||
public void setElementPrefabIDValue (int newValue)
|
||||
{
|
||||
elementPrefabID = newValue;
|
||||
}
|
||||
|
||||
public void setNewInstantiatedElementOnSceneManagerIngame ()
|
||||
{
|
||||
if (!saveElementEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
setElementActiveState (true);
|
||||
|
||||
if (!mainElementOnSceneManagerLocated) {
|
||||
getMainElementOnSceneManager ();
|
||||
}
|
||||
|
||||
if (mainElementOnSceneManagerLocated) {
|
||||
mainElementOnSceneManager.setNewInstantiatedElementOnSceneManagerIngame (this);
|
||||
}
|
||||
}
|
||||
|
||||
public void setElementActiveStateToMainElementOnSceneManager (bool state)
|
||||
{
|
||||
if (!saveElementEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
setElementActiveState (state);
|
||||
|
||||
if (!mainElementOnSceneManagerLocated) {
|
||||
getMainElementOnSceneManager ();
|
||||
}
|
||||
|
||||
if (mainElementOnSceneManagerLocated) {
|
||||
if (objectOriginallyOnScene) {
|
||||
mainElementOnSceneManager.setTemporalElementActiveState (elementID, elementScene, elementActiveState);
|
||||
} else {
|
||||
mainElementOnSceneManager.removeElementFromSceneList (this);
|
||||
|
||||
Destroy (this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setNewInstantiatedElementOnSceneManagerIngameWithInfo ()
|
||||
{
|
||||
if (!mainElementOnSceneManagerLocated) {
|
||||
getMainElementOnSceneManager ();
|
||||
}
|
||||
|
||||
if (mainElementOnSceneManagerLocated) {
|
||||
mainElementOnSceneManager.setNewInstantiatedElementOnSceneManagerIngameWithInfo (this);
|
||||
}
|
||||
}
|
||||
|
||||
public void addNewElementOnSceneManager ()
|
||||
{
|
||||
if (!saveElementEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mainElementOnSceneManagerLocated) {
|
||||
getMainElementOnSceneManager ();
|
||||
}
|
||||
|
||||
if (mainElementOnSceneManagerLocated) {
|
||||
mainElementOnSceneManager.addNewElementOnScene (this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void checkStateOnLoad ()
|
||||
{
|
||||
if (!saveElementEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (useDelayForEvent) {
|
||||
activateStateOnLoadWithDelay ();
|
||||
} else {
|
||||
activateStateOnLoad ();
|
||||
}
|
||||
|
||||
checkActivateStateOnLoadWithoutDelay ();
|
||||
}
|
||||
|
||||
void checkActivateStateOnLoadWithoutDelay ()
|
||||
{
|
||||
if (saveElementEnabled) {
|
||||
if (elementActiveState) {
|
||||
if (useEventObjectObjectActiveWithoutDelay) {
|
||||
eventObjectObjectActiveWithoutDelay.Invoke ();
|
||||
}
|
||||
} else {
|
||||
if (useEventObjectObjectInactiveWithoutDelay) {
|
||||
eventObjectObjectInactiveWithoutDelay.Invoke ();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void activateStateOnLoadWithDelay ()
|
||||
{
|
||||
StartCoroutine (activateStateOnLoadCoroutine ());
|
||||
}
|
||||
|
||||
IEnumerator activateStateOnLoadCoroutine ()
|
||||
{
|
||||
WaitForSeconds delay = new WaitForSeconds (delayForEvent);
|
||||
|
||||
yield return delay;
|
||||
|
||||
activateStateOnLoad ();
|
||||
}
|
||||
|
||||
public void activateStateOnLoad ()
|
||||
{
|
||||
if (saveElementEnabled) {
|
||||
if (elementActiveState) {
|
||||
if (useEventOnObjectActive) {
|
||||
eventOnObjectActive.Invoke ();
|
||||
}
|
||||
|
||||
if (savePositionValues) {
|
||||
if (useCustomTransform) {
|
||||
customTransform.position = newPosition;
|
||||
} else {
|
||||
transform.position = newPosition;
|
||||
}
|
||||
}
|
||||
|
||||
if (saveRotationValues) {
|
||||
if (useCustomTransform) {
|
||||
customTransform.eulerAngles = newRotation;
|
||||
} else {
|
||||
transform.eulerAngles = newRotation;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (useEventOnObjectInactive) {
|
||||
eventOnObjectInactive.Invoke ();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Vector3 getElementPosition ()
|
||||
{
|
||||
if (useCustomTransform) {
|
||||
return customTransform.position;
|
||||
} else {
|
||||
return transform.position;
|
||||
}
|
||||
}
|
||||
|
||||
public Vector3 getElementRotation ()
|
||||
{
|
||||
if (useCustomTransform) {
|
||||
return customTransform.eulerAngles;
|
||||
} else {
|
||||
return transform.eulerAngles;
|
||||
}
|
||||
}
|
||||
|
||||
public bool isSaveElementEnabled ()
|
||||
{
|
||||
return saveElementEnabled;
|
||||
}
|
||||
|
||||
public void setSaveElementEnabledState (bool state)
|
||||
{
|
||||
saveElementEnabled = state;
|
||||
}
|
||||
|
||||
public void setObjectOriginallyOnSceneState (bool state)
|
||||
{
|
||||
objectOriginallyOnScene = state;
|
||||
}
|
||||
|
||||
|
||||
//STATS FUNCTIONS
|
||||
public void setStatsSearchingByInfo (int currentElementScene, int currentElementID)
|
||||
{
|
||||
if (!mainElementOnSceneManagerLocated) {
|
||||
getMainElementOnSceneManager ();
|
||||
}
|
||||
|
||||
if (mainElementOnSceneManagerLocated) {
|
||||
mainElementOnSceneManager.setStatsSearchingByInfo (currentElementScene, currentElementID, this);
|
||||
}
|
||||
}
|
||||
|
||||
public void checkStatsStateOnLoad ()
|
||||
{
|
||||
if (!saveElementEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (useStats) {
|
||||
if (loadStatsDelay > 0) {
|
||||
setStatsOnLoadWithDelay ();
|
||||
} else {
|
||||
setStatsOnLoad ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setStatsOnLoadWithDelay ()
|
||||
{
|
||||
StartCoroutine (setStatsOnLoadCoroutine ());
|
||||
}
|
||||
|
||||
IEnumerator setStatsOnLoadCoroutine ()
|
||||
{
|
||||
WaitForSeconds delay = new WaitForSeconds (loadStatsDelay);
|
||||
|
||||
yield return delay;
|
||||
|
||||
setStatsOnLoad ();
|
||||
}
|
||||
|
||||
public void setStatsOnLoad ()
|
||||
{
|
||||
if (saveElementEnabled) {
|
||||
if (elementActiveState) {
|
||||
if (useStats) {
|
||||
if (showDebugPrint) {
|
||||
print ("\n");
|
||||
print ("SETTING STATS INFO ON " + gameObject.name);
|
||||
|
||||
print ("\n");
|
||||
}
|
||||
|
||||
for (int i = 0; i < statInfoList.Count; i++) {
|
||||
statInfo currentStatInfo = statInfoList [i];
|
||||
|
||||
if (currentStatInfo.statIsAmount) {
|
||||
currentStatInfo.eventToInitializeFloatStat.Invoke (currentStatInfo.currentFloatValue);
|
||||
} else {
|
||||
currentStatInfo.eventToInitializeBoolStat.Invoke (currentStatInfo.currentBoolState);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setCurrentStatNameToSave (string newValue)
|
||||
{
|
||||
currentStatNameToCheck = newValue;
|
||||
}
|
||||
|
||||
public void setCurrentFloatValueToSave (float newValue)
|
||||
{
|
||||
if (saveElementEnabled) {
|
||||
if (useStats) {
|
||||
for (int i = 0; i < statInfoList.Count; i++) {
|
||||
statInfo currentStatInfo = statInfoList [i];
|
||||
|
||||
if (currentStatInfo.Name.Equals (currentStatNameToCheck)) {
|
||||
currentStatInfo.currentFloatValue = newValue;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setCurrentBoolValueToSave (bool newValue)
|
||||
{
|
||||
if (saveElementEnabled) {
|
||||
if (useStats) {
|
||||
for (int i = 0; i < statInfoList.Count; i++) {
|
||||
statInfo currentStatInfo = statInfoList [i];
|
||||
|
||||
if (currentStatInfo.Name.Equals (currentStatNameToCheck)) {
|
||||
currentStatInfo.currentBoolState = newValue;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void checkEventOnStatsSave ()
|
||||
{
|
||||
if (saveElementEnabled) {
|
||||
if (useStats) {
|
||||
for (int i = 0; i < statInfoList.Count; i++) {
|
||||
statInfo currentStatInfo = statInfoList [i];
|
||||
|
||||
currentStatNameToCheck = currentStatInfo.Name;
|
||||
|
||||
if (currentStatInfo.statIsAmount) {
|
||||
currentStatInfo.eventToGetFloatStat.Invoke ();
|
||||
} else {
|
||||
currentStatInfo.eventToGetBoolStat.Invoke ();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setUseElementPrefabIDState (bool state)
|
||||
{
|
||||
useElementPrefabID = state;
|
||||
}
|
||||
|
||||
public void addSingleElementOnSceneToManager ()
|
||||
{
|
||||
if (!mainElementOnSceneManagerLocated) {
|
||||
getMainElementOnSceneManager ();
|
||||
}
|
||||
|
||||
if (mainElementOnSceneManagerLocated) {
|
||||
mainElementOnSceneManager.addSingleElementOnSceneToManager (this);
|
||||
}
|
||||
}
|
||||
|
||||
void getMainElementOnSceneManager ()
|
||||
{
|
||||
mainElementOnSceneManagerLocated = mainElementOnSceneManager != null;
|
||||
|
||||
if (!mainElementOnSceneManagerLocated) {
|
||||
mainElementOnSceneManager = elementOnSceneManager.Instance;
|
||||
|
||||
mainElementOnSceneManagerLocated = mainElementOnSceneManager != null;
|
||||
}
|
||||
|
||||
if (!mainElementOnSceneManagerLocated) {
|
||||
GKC_Utils.instantiateMainManagerOnSceneWithTypeOnApplicationPlaying (elementOnSceneManager.getMainManagerName (), typeof(elementOnSceneManager), true);
|
||||
|
||||
mainElementOnSceneManager = elementOnSceneManager.Instance;
|
||||
|
||||
mainElementOnSceneManagerLocated = mainElementOnSceneManager != null;
|
||||
}
|
||||
|
||||
if (!mainElementOnSceneManagerLocated) {
|
||||
|
||||
mainElementOnSceneManager = FindObjectOfType<elementOnSceneManager> ();
|
||||
|
||||
mainElementOnSceneManagerLocated = mainElementOnSceneManager != null;
|
||||
}
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class statInfo
|
||||
{
|
||||
public string Name;
|
||||
|
||||
public bool statIsAmount = true;
|
||||
|
||||
[Space]
|
||||
|
||||
public float currentFloatValue;
|
||||
|
||||
public eventParameters.eventToCallWithAmount eventToInitializeFloatStat;
|
||||
|
||||
public UnityEvent eventToGetFloatStat;
|
||||
|
||||
[Space]
|
||||
[Space]
|
||||
|
||||
public bool currentBoolState;
|
||||
|
||||
public eventParameters.eventToCallWithBool eventToInitializeBoolStat;
|
||||
|
||||
public UnityEvent eventToGetBoolStat;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 703bee9dfca61354fa8809e52e0ce318
|
||||
timeCreated: 1650495024
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Save System/Elements On Scene/elementOnScene.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,74 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class elementOnSceneHelper : MonoBehaviour
|
||||
{
|
||||
[Header ("Main Settings")]
|
||||
[Space]
|
||||
|
||||
public bool checkElementOnSceneEnabled = true;
|
||||
|
||||
public elementOnScene mainElementOnScene;
|
||||
|
||||
|
||||
public void setElementActiveStateToMainElementOnSceneManager (bool state)
|
||||
{
|
||||
if (!checkElementOnSceneEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mainElementOnScene != null) {
|
||||
mainElementOnScene.setElementActiveStateToMainElementOnSceneManager (state);
|
||||
}
|
||||
}
|
||||
|
||||
public void setNewInstantiatedElementOnSceneManagerIngameWithInfo ()
|
||||
{
|
||||
if (!checkElementOnSceneEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mainElementOnScene != null) {
|
||||
mainElementOnScene.setNewInstantiatedElementOnSceneManagerIngameWithInfo ();
|
||||
}
|
||||
}
|
||||
|
||||
public void setElementActiveState (bool state)
|
||||
{
|
||||
if (!checkElementOnSceneEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mainElementOnScene != null) {
|
||||
mainElementOnScene.setElementActiveState (state);
|
||||
}
|
||||
}
|
||||
|
||||
public int getElementScene ()
|
||||
{
|
||||
if (!checkElementOnSceneEnabled) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return mainElementOnScene.elementScene;
|
||||
}
|
||||
|
||||
public int getElementID ()
|
||||
{
|
||||
if (!checkElementOnSceneEnabled) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return mainElementOnScene.elementID;
|
||||
}
|
||||
|
||||
public void setStatsSearchingByInfo (int currentElementScene, int currentElementID)
|
||||
{
|
||||
if (!checkElementOnSceneEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
mainElementOnScene.setStatsSearchingByInfo (currentElementScene, currentElementID);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0a4dea7e35424d648a1831b24c81ffdc
|
||||
timeCreated: 1651306761
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Save System/Elements On Scene/elementOnSceneHelper.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,18 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[System.Serializable]
|
||||
public class elementsOnSceneInfo
|
||||
{
|
||||
public string elementOnSceneCategoryName;
|
||||
public List<elementOnSceneInfo> elementOnSceneInfoList = new List<elementOnSceneInfo> ();
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class elementOnSceneInfo
|
||||
{
|
||||
public int elementPrefabID;
|
||||
|
||||
public GameObject elementPrefab;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2b0cfeca9fba56940ad1466fb5759474
|
||||
timeCreated: 1650818321
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Save System/Elements On Scene/elementOnSceneInfo.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,445 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class elementOnSceneManager : MonoBehaviour
|
||||
{
|
||||
[Header ("Main Settings")]
|
||||
[Space]
|
||||
|
||||
public bool saveCurrentPlayerElementsOnSceneToSaveFile = true;
|
||||
|
||||
public int elementsScene;
|
||||
|
||||
public bool findDisabledElementsOnSceneGameObjects;
|
||||
|
||||
[Space]
|
||||
[Header ("Elements On Scene Prefabs Settings")]
|
||||
[Space]
|
||||
|
||||
public bool useElementsOnSceneData;
|
||||
|
||||
public elementsOnSceneData mainElementsOnSceneData;
|
||||
|
||||
[Space]
|
||||
[Header ("Elements On Scene Prefabs Settings")]
|
||||
[Space]
|
||||
|
||||
public bool ignoreLoadStatsOnObjectIDList;
|
||||
public List<int> ignoreLoadStatsOnObjectIDListInfo = new List<int> ();
|
||||
|
||||
[Space]
|
||||
|
||||
public bool ignoreLoadStatsOnObjectPrefabIDList;
|
||||
public List<int> ignoreLoadStatsOnObjectPrefabIDListInfo = new List<int> ();
|
||||
|
||||
[Space]
|
||||
[Header ("Debug")]
|
||||
[Space]
|
||||
|
||||
public int currentElementID = 0;
|
||||
|
||||
public List<elementOnScene> elementOnSceneList = new List<elementOnScene> ();
|
||||
|
||||
[Space]
|
||||
[Space]
|
||||
|
||||
public List<temporalElementOnSceneInfo> temporalElementOnSceneInfoList = new List<temporalElementOnSceneInfo> ();
|
||||
|
||||
|
||||
//Possible cases of objects on scene to save its info:
|
||||
//-Pickups:
|
||||
//When placed on scene, the regular scene manager will get its info on the editor
|
||||
//When picked, they send a signal to be removed, by setting its info on a temporal list, as the original object is destroyed
|
||||
//the system should check if the object picked was an original element on the scene or it was instantiated as a new object from a previous save
|
||||
//so in that case, that element info is removed from the list, as it is not needed to be loaded or taken into account in next load/save
|
||||
//When spawned, they are stored as regular object info when the game is saved, increasing the ID value and adding them as new info elements on the
|
||||
//main list, so when the game loads, it searches their prefab ID to instantiate a copy of each one, adding them as new objects info on the list
|
||||
|
||||
//-Vehicles:
|
||||
//When placed on scene, the regular scene manager will get its info on the editor
|
||||
//When moving to new scenes, they are disabled from the main list, so the original vehicle is disabled from scene in that case
|
||||
//in that case, the vehicle is checked on the new scene, instantiated and added on the main info list
|
||||
//When destroyed, they are disabled from the main list, so the original vehicle is disabled from scene in that case
|
||||
//When spawned, they are stored as regular object info when the game is saved, increasing the ID value and adding them as new info elements on the
|
||||
//main list, so when the game loads, it searches their prefab ID to instantiate a copy of each one, adding them as new objects info on the list
|
||||
|
||||
//-AI:
|
||||
//When placed on scene, the regular scene manager will get its info on the editor
|
||||
//When destroyed, they are disabled from the main list, so the original AI is disabled from scene in that case
|
||||
//When spawned, they are stored as regular object info when the game is saved, increasing the ID value and adding them as new info elements on the
|
||||
//main list, so when the game loads, it searches their prefab ID to instantiate a copy of each one, adding them as new objects info on the list
|
||||
|
||||
public const string mainManagerName = "Elements On Scene Manager";
|
||||
|
||||
public static string getMainManagerName ()
|
||||
{
|
||||
return mainManagerName;
|
||||
}
|
||||
|
||||
private static elementOnSceneManager _elementOnSceneManagerInstance;
|
||||
|
||||
public static elementOnSceneManager Instance { get { return _elementOnSceneManagerInstance; } }
|
||||
|
||||
bool instanceInitialized;
|
||||
|
||||
|
||||
public void getComponentInstance ()
|
||||
{
|
||||
if (instanceInitialized) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (_elementOnSceneManagerInstance != null && _elementOnSceneManagerInstance != this) {
|
||||
Destroy (this.gameObject);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
_elementOnSceneManagerInstance = this;
|
||||
|
||||
instanceInitialized = true;
|
||||
}
|
||||
|
||||
void Awake ()
|
||||
{
|
||||
getComponentInstance ();
|
||||
}
|
||||
|
||||
public void initializeValues ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void checkForInstantiatedElementsOnSceneOnSave ()
|
||||
{
|
||||
if (findDisabledElementsOnSceneGameObjects) {
|
||||
List<elementOnScene> newElementOnSceneList = GKC_Utils.FindObjectsOfTypeAll<elementOnScene> ();
|
||||
|
||||
if (newElementOnSceneList != null) {
|
||||
for (var i = 0; i < newElementOnSceneList.Count; i++) {
|
||||
if (!elementOnSceneList.Contains (newElementOnSceneList [i])) {
|
||||
setNewInstantiatedElementOnSceneManagerIngameWithInfo (newElementOnSceneList [i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
elementOnScene[] newElementOnSceneList = FindObjectsOfType<elementOnScene> ();
|
||||
|
||||
foreach (elementOnScene currentElementOnScene in newElementOnSceneList) {
|
||||
if (!elementOnSceneList.Contains (currentElementOnScene)) {
|
||||
setNewInstantiatedElementOnSceneManagerIngameWithInfo (currentElementOnScene);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setNewInstantiatedElementOnSceneManagerIngame (elementOnScene newElementOnScene)
|
||||
{
|
||||
currentElementID++;
|
||||
|
||||
newElementOnScene.setSaveElementEnabledState (true);
|
||||
|
||||
newElementOnScene.setElementID (currentElementID);
|
||||
|
||||
newElementOnScene.setElementScene (elementsScene);
|
||||
|
||||
newElementOnScene.setUseElementPrefabIDState (true);
|
||||
|
||||
elementOnSceneList.Add (newElementOnScene);
|
||||
}
|
||||
|
||||
public void setNewInstantiatedElementOnSceneManagerIngameWithInfo (elementOnScene newElementOnScene)
|
||||
{
|
||||
currentElementID++;
|
||||
|
||||
newElementOnScene.setSaveElementEnabledState (true);
|
||||
|
||||
newElementOnScene.setElementActiveState (true);
|
||||
|
||||
newElementOnScene.setElementID (currentElementID);
|
||||
|
||||
newElementOnScene.setElementScene (elementsScene);
|
||||
|
||||
if (useElementsOnSceneData) {
|
||||
int elementPrefabID = mainElementsOnSceneData.getElementScenePrefabIDByName (newElementOnScene.gameObject.name);
|
||||
|
||||
if (elementPrefabID > -1) {
|
||||
newElementOnScene.setElementPrefabIDValue (elementPrefabID);
|
||||
|
||||
newElementOnScene.setUseElementPrefabIDState (true);
|
||||
}
|
||||
}
|
||||
|
||||
elementOnSceneList.Add (newElementOnScene);
|
||||
}
|
||||
|
||||
public void setTemporalElementActiveState (int elementID, int elementScene, bool elementActiveState)
|
||||
{
|
||||
temporalElementOnSceneInfo newTemporalElementOnSceneInfo = new temporalElementOnSceneInfo ();
|
||||
|
||||
newTemporalElementOnSceneInfo.elementID = elementID;
|
||||
|
||||
newTemporalElementOnSceneInfo.elementScene = elementScene;
|
||||
|
||||
newTemporalElementOnSceneInfo.elementActiveState = elementActiveState;
|
||||
|
||||
temporalElementOnSceneInfoList.Add (newTemporalElementOnSceneInfo);
|
||||
}
|
||||
|
||||
public void removeElementFromSceneList (elementOnScene newElementOnScene)
|
||||
{
|
||||
if (elementOnSceneList.Contains (newElementOnScene)) {
|
||||
elementOnSceneList.Remove (newElementOnScene);
|
||||
}
|
||||
}
|
||||
|
||||
public elementOnScene getElementOnSceneInfo (int elementID, int elementScene)
|
||||
{
|
||||
//Get each elemento on scene configured,searching by ID
|
||||
if (elementOnSceneList.Count == 0) {
|
||||
getAllElementsOnSceneOnLevel ();
|
||||
}
|
||||
|
||||
int elementOnSceneListCount = elementOnSceneList.Count;
|
||||
|
||||
//Return the element on scene currently found by ID
|
||||
for (int i = 0; i < elementOnSceneListCount; i++) {
|
||||
elementOnScene currentElementOnScene = elementOnSceneList [i];
|
||||
|
||||
if (currentElementOnScene != null && currentElementOnScene.isSaveElementEnabled ()) {
|
||||
if (currentElementOnScene.elementScene == elementScene && currentElementOnScene.elementID == elementID) {
|
||||
|
||||
return currentElementOnScene;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void addNewElementOnScene (elementOnScene newElementOnScene)
|
||||
{
|
||||
currentElementID++;
|
||||
|
||||
newElementOnScene.setElementID (currentElementID);
|
||||
|
||||
newElementOnScene.setElementScene (elementsScene);
|
||||
|
||||
elementOnSceneList.Add (newElementOnScene);
|
||||
}
|
||||
|
||||
public void getAllElementsOnSceneOnLevel ()
|
||||
{
|
||||
//Search all the station systems on the level, so they can be managed here
|
||||
elementOnSceneList.Clear ();
|
||||
|
||||
if (findDisabledElementsOnSceneGameObjects) {
|
||||
List<elementOnScene> newElementOnSceneList = GKC_Utils.FindObjectsOfTypeAll<elementOnScene> ();
|
||||
|
||||
if (newElementOnSceneList != null) {
|
||||
for (var i = 0; i < newElementOnSceneList.Count; i++) {
|
||||
if (!elementOnSceneList.Contains (newElementOnSceneList [i])) {
|
||||
elementOnSceneList.Add (newElementOnSceneList [i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
elementOnScene[] newElementOnSceneList = FindObjectsOfType<elementOnScene> ();
|
||||
|
||||
foreach (elementOnScene currentElementOnScene in newElementOnSceneList) {
|
||||
if (!elementOnSceneList.Contains (currentElementOnScene)) {
|
||||
elementOnSceneList.Add (currentElementOnScene);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setStatsSearchingByInfo (int currentElementScene, int currentElementID, elementOnScene currentElementOnScene)
|
||||
{
|
||||
saveElementsOnSceneInfo mainSaveElementsOnSceneInfo = FindObjectOfType<saveElementsOnSceneInfo> ();
|
||||
|
||||
if (mainSaveElementsOnSceneInfo != null) {
|
||||
|
||||
mainSaveElementsOnSceneInfo.setStatsSearchingByInfo (currentElementScene, currentElementID, currentElementOnScene);
|
||||
}
|
||||
}
|
||||
|
||||
public bool isSaveCurrentPlayerElementsOnSceneToSaveFile ()
|
||||
{
|
||||
return saveCurrentPlayerElementsOnSceneToSaveFile;
|
||||
}
|
||||
|
||||
public void setSaveCurrentPlayerElementsOnSceneToSaveFileState (bool state)
|
||||
{
|
||||
saveCurrentPlayerElementsOnSceneToSaveFile = state;
|
||||
}
|
||||
|
||||
//EDITOR FUNCTIONS
|
||||
public void getAllElementsOnSceneOnLevelAndAssignInfoToAllElements ()
|
||||
{
|
||||
//Seach all station systems on the level and assign an ID to each one
|
||||
getAllElementsOnSceneOnLevel ();
|
||||
|
||||
currentElementID = 0;
|
||||
|
||||
int elementOnSceneListCount = elementOnSceneList.Count;
|
||||
|
||||
for (int i = 0; i < elementOnSceneListCount; i++) {
|
||||
|
||||
if (elementOnSceneList [i] != null) {
|
||||
elementOnSceneList [i].setElementActiveState (elementOnSceneList [i].gameObject.activeSelf);
|
||||
|
||||
elementOnSceneList [i].setElementID (currentElementID);
|
||||
|
||||
elementOnSceneList [i].setElementScene (elementsScene);
|
||||
|
||||
elementOnSceneList [i].setObjectOriginallyOnSceneState (true);
|
||||
|
||||
GKC_Utils.updateComponent (elementOnSceneList [i]);
|
||||
|
||||
currentElementID++;
|
||||
}
|
||||
}
|
||||
|
||||
updateComponent ();
|
||||
}
|
||||
|
||||
public void setEnableStateOnAllElementsOnScene (bool state)
|
||||
{
|
||||
//Seach all station systems on the level and assign an ID to each one
|
||||
getAllElementsOnSceneOnLevel ();
|
||||
|
||||
int elementOnSceneListCount = elementOnSceneList.Count;
|
||||
|
||||
for (int i = 0; i < elementOnSceneListCount; i++) {
|
||||
|
||||
if (elementOnSceneList [i] != null) {
|
||||
elementOnSceneList [i].setSaveElementEnabledState (state);
|
||||
|
||||
GKC_Utils.updateComponent (elementOnSceneList [i]);
|
||||
}
|
||||
}
|
||||
|
||||
updateComponent ();
|
||||
}
|
||||
|
||||
public void setIDOnElementsOnScenePrefabs ()
|
||||
{
|
||||
if (useElementsOnSceneData) {
|
||||
int elementPrefabIDCount = 0;
|
||||
|
||||
for (int i = 0; i < mainElementsOnSceneData.elementsOnSceneInfoList.Count; i++) {
|
||||
for (int j = 0; j < mainElementsOnSceneData.elementsOnSceneInfoList [i].elementOnSceneInfoList.Count; j++) {
|
||||
mainElementsOnSceneData.elementsOnSceneInfoList [i].elementOnSceneInfoList [j].elementPrefabID = elementPrefabIDCount;
|
||||
|
||||
GameObject elementPrefab = mainElementsOnSceneData.elementsOnSceneInfoList [i].elementOnSceneInfoList [j].elementPrefab;
|
||||
|
||||
if (elementPrefab != null) {
|
||||
elementOnScene currentElementOnScene = elementPrefab.GetComponentInChildren<elementOnScene> ();
|
||||
|
||||
if (currentElementOnScene != null) {
|
||||
currentElementOnScene.setElementPrefabIDValue (elementPrefabIDCount);
|
||||
}
|
||||
}
|
||||
|
||||
elementPrefabIDCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
updateComponent ();
|
||||
|
||||
GKC_Utils.refreshAssetDatabase ();
|
||||
}
|
||||
|
||||
public void setIDOnElementsOnScenePrefabsLocatedOnScene ()
|
||||
{
|
||||
if (!useElementsOnSceneData) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (findDisabledElementsOnSceneGameObjects) {
|
||||
List<elementOnScene> newElementOnSceneList = GKC_Utils.FindObjectsOfTypeAll<elementOnScene> ();
|
||||
|
||||
if (newElementOnSceneList != null) {
|
||||
for (var i = 0; i < newElementOnSceneList.Count; i++) {
|
||||
int elementPrefabID = mainElementsOnSceneData.getElementScenePrefabIDByName (newElementOnSceneList [i].gameObject.name);
|
||||
|
||||
if (elementPrefabID > -1) {
|
||||
newElementOnSceneList [i].setElementPrefabIDValue (elementPrefabID);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
elementOnScene[] newElementOnSceneList = FindObjectsOfType<elementOnScene> ();
|
||||
|
||||
foreach (elementOnScene currentElementOnScene in newElementOnSceneList) {
|
||||
|
||||
int elementPrefabID = mainElementsOnSceneData.getElementScenePrefabIDByName (currentElementOnScene.gameObject.name);
|
||||
|
||||
if (elementPrefabID > -1) {
|
||||
currentElementOnScene.setElementPrefabIDValue (elementPrefabID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
updateComponent ();
|
||||
}
|
||||
|
||||
public void getAllElementsOnSceneOnLevelByEditor ()
|
||||
{
|
||||
//Search all station systems on the level and assign them here by the editor
|
||||
getAllElementsOnSceneOnLevel ();
|
||||
|
||||
updateComponent ();
|
||||
}
|
||||
|
||||
public void clearElementsOnSceneList ()
|
||||
{
|
||||
elementOnSceneList.Clear ();
|
||||
|
||||
updateComponent ();
|
||||
}
|
||||
|
||||
public void addSingleElementOnSceneToManager (elementOnScene newElementOnScene)
|
||||
{
|
||||
if (!elementOnSceneList.Contains (newElementOnScene)) {
|
||||
newElementOnScene.setElementActiveState (newElementOnScene.gameObject.activeSelf);
|
||||
|
||||
newElementOnScene.setElementID (currentElementID);
|
||||
|
||||
newElementOnScene.setElementScene (elementsScene);
|
||||
|
||||
newElementOnScene.setObjectOriginallyOnSceneState (true);
|
||||
|
||||
GKC_Utils.updateComponent (newElementOnScene);
|
||||
|
||||
currentElementID++;
|
||||
|
||||
elementOnSceneList.Add (newElementOnScene);
|
||||
|
||||
updateComponent ();
|
||||
}
|
||||
}
|
||||
|
||||
public void updateComponent ()
|
||||
{
|
||||
GKC_Utils.updateComponent (this);
|
||||
|
||||
GKC_Utils.updateDirtyScene ("Update Main Elements On Scene Manager info", gameObject);
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class temporalElementOnSceneInfo
|
||||
{
|
||||
public int elementScene;
|
||||
public int elementID;
|
||||
|
||||
public bool elementActiveState;
|
||||
|
||||
public bool useElementPrefabID;
|
||||
|
||||
public int elementPrefabID;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6b4701a2ee3024c42b47758b675b4d84
|
||||
timeCreated: 1650494901
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Save System/Elements On Scene/elementOnSceneManager.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,53 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[CreateAssetMenu (fileName = "Element On Scene Data", menuName = "GKC/Create Element On Scene Data", order = 51)]
|
||||
public class elementsOnSceneData : ScriptableObject
|
||||
{
|
||||
public List<elementsOnSceneInfo> elementsOnSceneInfoList = new List<elementsOnSceneInfo> ();
|
||||
|
||||
|
||||
public GameObject getElementScenePrefabById (int prefabID)
|
||||
{
|
||||
if (prefabID <= -1) {
|
||||
return null;
|
||||
}
|
||||
|
||||
int elementsOnSceneInfoListCount = elementsOnSceneInfoList.Count;
|
||||
|
||||
for (int i = 0; i < elementsOnSceneInfoListCount; i++) {
|
||||
|
||||
int elementOnSceneInfoListCount = elementsOnSceneInfoList [i].elementOnSceneInfoList.Count;
|
||||
|
||||
for (int j = 0; j < elementOnSceneInfoListCount; j++) {
|
||||
if (elementsOnSceneInfoList [i].elementOnSceneInfoList [j].elementPrefabID == prefabID) {
|
||||
return elementsOnSceneInfoList [i].elementOnSceneInfoList [j].elementPrefab;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public int getElementScenePrefabIDByName (string prefabName)
|
||||
{
|
||||
int elementsOnSceneInfoListCount = elementsOnSceneInfoList.Count;
|
||||
|
||||
for (int i = 0; i < elementsOnSceneInfoListCount; i++) {
|
||||
int elementOnSceneInfoListCount = elementsOnSceneInfoList [i].elementOnSceneInfoList.Count;
|
||||
|
||||
for (int j = 0; j < elementOnSceneInfoListCount; j++) {
|
||||
if (elementsOnSceneInfoList [i].elementOnSceneInfoList [j].elementPrefab != null) {
|
||||
string currentName = elementsOnSceneInfoList [i].elementOnSceneInfoList [j].elementPrefab.name;
|
||||
|
||||
if (currentName.Equals (prefabName) || prefabName.Contains (currentName)) {
|
||||
return elementsOnSceneInfoList [i].elementOnSceneInfoList [j].elementPrefabID;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 290f8efc18bc7eb46a5cac8425f88652
|
||||
timeCreated: 1650818425
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Save System/Elements On Scene/elementsOnSceneData.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fd45f34111916fc458759b58652b2961
|
||||
folderAsset: yes
|
||||
timeCreated: 1602570417
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,33 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[System.Serializable]
|
||||
public class persistanceBlendshapesListBySaveSlotInfo
|
||||
{
|
||||
public int saveNumber;
|
||||
public List<persistancePlayerBlendshapesInfo> playerBlendshapesList = new List<persistancePlayerBlendshapesInfo> ();
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class persistancePlayerBlendshapesInfo
|
||||
{
|
||||
public int playerID;
|
||||
|
||||
public List<string> accessoriesList = new List<string> ();
|
||||
|
||||
public List<persistanceBlendshapesInfo> blendshapesList = new List<persistanceBlendshapesInfo> ();
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class persistanceBlendshapesInfo
|
||||
{
|
||||
public string Name;
|
||||
|
||||
public float blendShapeValue;
|
||||
|
||||
public persistanceBlendshapesInfo ()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 427e1bad5284146449640d5f2197cd2c
|
||||
timeCreated: 1640421875
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Save System/Persistance Classes/persistanceBlendshapesListBySaveSlotInfo.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,31 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[System.Serializable]
|
||||
public class persistanceDialogContentListBySaveSlotInfo
|
||||
{
|
||||
public int saveNumber;
|
||||
public List<persistancePlayerDialogContentInfo> playerDialogContentList = new List<persistancePlayerDialogContentInfo> ();
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class persistancePlayerDialogContentInfo
|
||||
{
|
||||
public int playerID;
|
||||
public List<persistanceDialogContentInfo> dialogContentList = new List<persistanceDialogContentInfo> ();
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class persistanceDialogContentInfo
|
||||
{
|
||||
public int dialogContentID;
|
||||
|
||||
public int dialogContentScene;
|
||||
public int currentDialogIndex;
|
||||
|
||||
public persistanceDialogContentInfo ()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9c49da9920f4c6d4c8ca0294b5afb813
|
||||
timeCreated: 1573363011
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Save System/Persistance Classes/persistanceDialogContentListBySaveSlotInfo.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,53 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[System.Serializable]
|
||||
public class persistanceElementsOnSceneBySaveSlotInfo
|
||||
{
|
||||
public int saveNumber;
|
||||
|
||||
public List<persistancePlayerElementOnSceneInfo> playerElementsOnSceneList = new List<persistancePlayerElementOnSceneInfo> ();
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class persistancePlayerElementOnSceneInfo
|
||||
{
|
||||
public int playerID;
|
||||
public List<persistanceElementOnSceneInfo> elementOnSceneList = new List<persistanceElementOnSceneInfo> ();
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class persistanceElementOnSceneInfo
|
||||
{
|
||||
public int elementScene;
|
||||
public int elementID;
|
||||
|
||||
public bool elementActiveState;
|
||||
|
||||
public bool savePositionValues;
|
||||
|
||||
public float positionX;
|
||||
public float positionY;
|
||||
public float positionZ;
|
||||
|
||||
public bool saveRotationValues;
|
||||
|
||||
public float rotationX;
|
||||
public float rotationY;
|
||||
public float rotationZ;
|
||||
|
||||
public int elementPrefabID;
|
||||
|
||||
public bool useElementPrefabID;
|
||||
|
||||
public bool useStats;
|
||||
|
||||
public List<float> floatValueStatList = new List<float> ();
|
||||
public List<bool> boolValueStatList = new List<bool> ();
|
||||
|
||||
public persistanceElementOnSceneInfo ()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6571d0693cdc00f44b70734864c35268
|
||||
timeCreated: 1650495148
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Save System/Persistance Classes/persistanceElementsOnSceneBySaveSlotInfo.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,127 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[System.Serializable]
|
||||
public class persistanceInventoryListBySaveSlotInfo
|
||||
{
|
||||
public int saveNumber;
|
||||
public bool gameSavedOnHomeMenu;
|
||||
public List<persistanceInventoryListByPlayerInfo> playerInventoryList = new List<persistanceInventoryListByPlayerInfo> ();
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class persistanceInventoryListByPlayerInfo
|
||||
{
|
||||
public int playerID;
|
||||
|
||||
public int inventorySlotAmount;
|
||||
public bool infiniteSlots;
|
||||
public bool inventoryWasEmptyWhenSaved;
|
||||
|
||||
public List<persistanceInventoryObjectInfo> inventoryObjectList = new List<persistanceInventoryObjectInfo> ();
|
||||
|
||||
//Crafting info
|
||||
public bool useOnlyBlueprintsUnlocked;
|
||||
public List<string> blueprintsUnlockedList = new List<string> ();
|
||||
|
||||
public bool anyObjectToCraftInTimeActive;
|
||||
public List<craftObjectInTimeSimpleInfo> craftObjectInTimeSimpleInfoList = new List<craftObjectInTimeSimpleInfo> ();
|
||||
|
||||
public List<string> objectCategoriesToCraftAvailableAtAnyMoment = new List<string> ();
|
||||
|
||||
public string lastWeaponCarriedOnHandsName = "";
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class persistanceInventoryObjectInfo
|
||||
{
|
||||
public string Name;
|
||||
public int amount;
|
||||
public bool infiniteAmount;
|
||||
public string inventoryObjectName;
|
||||
|
||||
public int categoryIndex;
|
||||
public int elementIndex;
|
||||
|
||||
public bool isEquipped;
|
||||
|
||||
public int quickAccessSlotIndex = -1;
|
||||
|
||||
public float vendorPrice;
|
||||
public float sellPrice;
|
||||
|
||||
public bool infiniteVendorAmountAvailable;
|
||||
|
||||
public bool useMinLevelToBuy;
|
||||
public float minLevelToBuy;
|
||||
|
||||
public bool spawnObject;
|
||||
|
||||
public bool useDurability;
|
||||
public float durabilityAmount;
|
||||
|
||||
public float maxDurabilityAmount;
|
||||
|
||||
public bool objectIsBroken;
|
||||
|
||||
public bool isWeapon;
|
||||
public bool isMeleeWeapon;
|
||||
public int projectilesInMagazine = -1;
|
||||
|
||||
public persistanceInventoryObjectInfo (persistanceInventoryObjectInfo obj)
|
||||
{
|
||||
Name = obj.Name;
|
||||
amount = obj.amount;
|
||||
infiniteAmount = obj.infiniteAmount;
|
||||
inventoryObjectName = obj.inventoryObjectName;
|
||||
|
||||
categoryIndex = obj.categoryIndex;
|
||||
elementIndex = obj.elementIndex;
|
||||
|
||||
isEquipped = obj.isEquipped;
|
||||
|
||||
quickAccessSlotIndex = obj.quickAccessSlotIndex;
|
||||
|
||||
vendorPrice = obj.vendorPrice;
|
||||
infiniteVendorAmountAvailable = obj.infiniteVendorAmountAvailable;
|
||||
|
||||
sellPrice = obj.sellPrice;
|
||||
|
||||
useMinLevelToBuy = obj.useMinLevelToBuy;
|
||||
minLevelToBuy = obj.minLevelToBuy;
|
||||
|
||||
spawnObject = obj.spawnObject;
|
||||
|
||||
useDurability = obj.useDurability;
|
||||
durabilityAmount = obj.durabilityAmount;
|
||||
|
||||
maxDurabilityAmount = obj.maxDurabilityAmount;
|
||||
|
||||
objectIsBroken = obj.objectIsBroken;
|
||||
|
||||
isWeapon = obj.isWeapon;
|
||||
isMeleeWeapon = obj.isWeapon;
|
||||
projectilesInMagazine = obj.projectilesInMagazine;
|
||||
}
|
||||
|
||||
public persistanceInventoryObjectInfo ()
|
||||
{
|
||||
Name = "New Object";
|
||||
}
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class craftObjectInTimeSimpleInfo
|
||||
{
|
||||
public string objectName;
|
||||
|
||||
public string objectCategoryName;
|
||||
|
||||
public int amount;
|
||||
|
||||
public float timeToCraftObject;
|
||||
|
||||
public bool objectCreatedOnWorkbench;
|
||||
public int workbenchID;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fe0531e208f8c8b48a72e7f97e60cec6
|
||||
timeCreated: 1525835183
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Save System/Persistance Classes/persistanceInventoryListBySaveSlotInfo.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,24 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[System.Serializable]
|
||||
public class persistanceMeleeWeaponListBySaveSlotInfo
|
||||
{
|
||||
public int saveNumber;
|
||||
public List<persistanceMeleeWeaponInfo> meleeWeaponList = new List<persistanceMeleeWeaponInfo> ();
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class persistanceMeleeWeaponInfo
|
||||
{
|
||||
public int playerID;
|
||||
public List<persistanceMeleeInfo> meleeList = new List<persistanceMeleeInfo> ();
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class persistanceMeleeInfo
|
||||
{
|
||||
public int weaponActiveIndex;
|
||||
public bool isCurrentWeapon;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 806b56f2511ce774c8b67bdfcd275868
|
||||
timeCreated: 1602095157
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Save System/Persistance Classes/persistanceMeleeWeaponListBySaveSlotInfo.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,46 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[System.Serializable]
|
||||
public class persistancePlayerMissionsListBySaveSlotInfo
|
||||
{
|
||||
public int saveNumber;
|
||||
public List<persistancePlayerMissionInfo> playerMissionsList = new List<persistancePlayerMissionInfo> ();
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class persistancePlayerMissionInfo
|
||||
{
|
||||
public int playerID;
|
||||
public List<persistanceMissionInfo> missionsList = new List<persistanceMissionInfo> ();
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class persistanceMissionInfo
|
||||
{
|
||||
public int missionScene;
|
||||
public int missionID;
|
||||
|
||||
public bool disableObjectivePanelOnMissionComplete;
|
||||
|
||||
public bool addObjectiveToPlayerLogSystem;
|
||||
|
||||
public bool missionComplete;
|
||||
public bool missionInProcess;
|
||||
public bool rewardObtained;
|
||||
public bool missionAccepted;
|
||||
|
||||
public string objectiveName;
|
||||
public string objectiveDescription;
|
||||
public string objectiveFullDescription;
|
||||
public string objectiveLocation;
|
||||
public string objectiveRewards;
|
||||
|
||||
public List<bool> subObjectiveCompleteList = new List<bool> ();
|
||||
|
||||
public persistanceMissionInfo ()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fabc10bb0a32b764baa117128aa79900
|
||||
timeCreated: 1568266913
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Save System/Persistance Classes/persistancePlayerMissionsListBySaveSlotInfo.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,33 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[System.Serializable]
|
||||
public class persistancePlayerOptionsListBySaveSlotInfo
|
||||
{
|
||||
public int saveNumber;
|
||||
public List<persistancePlayerOptionsInfo> playerOptionsList = new List<persistancePlayerOptionsInfo> ();
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class persistancePlayerOptionsInfo
|
||||
{
|
||||
public int playerID;
|
||||
public List<persistanceOptionsInfo> optionsList = new List<persistanceOptionsInfo> ();
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class persistanceOptionsInfo
|
||||
{
|
||||
public string optionName;
|
||||
|
||||
public bool currentScrollBarValue;
|
||||
public float currentSliderValue;
|
||||
public bool currentToggleValue;
|
||||
public int currentDropDownValue;
|
||||
|
||||
public persistanceOptionsInfo ()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f6d97a49ceeacb94bbf6cc9a70ef87a5
|
||||
timeCreated: 1585662712
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Save System/Persistance Classes/persistancePlayerOptionsListBySaveSlotInfo.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,57 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[System.Serializable]
|
||||
public class persistancePlayerSkillsListBySaveSlotInfo
|
||||
{
|
||||
public int saveNumber;
|
||||
public List<persistancePlayerCategorySkillInfo> playerSkillsList = new List<persistancePlayerCategorySkillInfo> ();
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class persistancePlayerCategorySkillInfo
|
||||
{
|
||||
public int playerID;
|
||||
public List<persistanceCategorySkillInfo> categorySkillsList = new List<persistanceCategorySkillInfo> ();
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class persistanceCategorySkillInfo
|
||||
{
|
||||
public List<persistanceSkillInfo> skillsList = new List<persistanceSkillInfo> ();
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class persistanceSkillInfo
|
||||
{
|
||||
public bool skillUnlocked;
|
||||
|
||||
public bool skillActive;
|
||||
|
||||
public bool skillComplete;
|
||||
|
||||
public float currentValue;
|
||||
public bool currentBoolState;
|
||||
|
||||
public int currentSkillLevel;
|
||||
|
||||
public persistanceSkillInfo (persistanceSkillInfo obj)
|
||||
{
|
||||
skillUnlocked = obj.skillUnlocked;
|
||||
|
||||
skillActive = obj.skillActive;
|
||||
|
||||
skillComplete = obj.skillComplete;
|
||||
|
||||
currentValue = obj.currentValue;
|
||||
currentBoolState = obj.currentBoolState;
|
||||
|
||||
currentSkillLevel = obj.currentSkillLevel;
|
||||
}
|
||||
|
||||
public persistanceSkillInfo ()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6ab76a8c9c4a4ce4ba99b850ad116b48
|
||||
timeCreated: 1568428254
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Save System/Persistance Classes/persistancePlayerSkillsListBySaveSlotInfo.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,41 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[System.Serializable]
|
||||
public class persistancePlayerStatsListBySaveSlotInfo
|
||||
{
|
||||
public int saveNumber;
|
||||
public List<persistancePlayerStatInfo> playerStatsList = new List<persistancePlayerStatInfo> ();
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class persistancePlayerStatInfo
|
||||
{
|
||||
public int playerID;
|
||||
public List<persistanceStatInfo> statsList = new List<persistanceStatInfo> ();
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class persistanceStatInfo
|
||||
{
|
||||
public float currentValue;
|
||||
|
||||
public float extraCurrentValue;
|
||||
|
||||
public bool currentBoolState;
|
||||
|
||||
public persistanceStatInfo (persistanceStatInfo obj)
|
||||
{
|
||||
currentValue = obj.currentValue;
|
||||
|
||||
currentValue = obj.extraCurrentValue;
|
||||
|
||||
currentBoolState = obj.currentBoolState;
|
||||
}
|
||||
|
||||
public persistanceStatInfo ()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 851149c7760019b4987d2bc42a5f3ced
|
||||
timeCreated: 1568164225
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Save System/Persistance Classes/persistancePlayerStatsListBySaveSlotInfo.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,30 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[System.Serializable]
|
||||
public class persistanceTravelStationListBySaveSlotInfo
|
||||
{
|
||||
public int saveNumber;
|
||||
public List<persistancePlayerTravelStationInfo> playerTravelStationList = new List<persistancePlayerTravelStationInfo> ();
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class persistancePlayerTravelStationInfo
|
||||
{
|
||||
public int playerID;
|
||||
public List<persistanceTravelStationInfo> travelStationList = new List<persistanceTravelStationInfo> ();
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class persistanceTravelStationInfo
|
||||
{
|
||||
public int sceneNumberToLoad;
|
||||
|
||||
public int levelManagerIDToLoad;
|
||||
|
||||
public persistanceTravelStationInfo ()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 72042cd0c7820734c9a8461db8380deb
|
||||
timeCreated: 1573890390
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Save System/Persistance Classes/persistanceTravelStationListBySaveSlotInfo.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,31 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[System.Serializable]
|
||||
public class persistanceWeaponAttachmentListBySaveSlotInfo
|
||||
{
|
||||
public int saveNumber;
|
||||
public List<persistanceAttachmentWeaponListByPlayerInfo> playerAttachmentWeaponList = new List<persistanceAttachmentWeaponListByPlayerInfo> ();
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class persistanceAttachmentWeaponListByPlayerInfo
|
||||
{
|
||||
public int playerID;
|
||||
public List<persistanceAttachmentWeaponPlaceInfo> attachmentWeaponPlaceList = new List<persistanceAttachmentWeaponPlaceInfo> ();
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class persistanceAttachmentWeaponPlaceInfo
|
||||
{
|
||||
public bool attachmentPlaceEnabled;
|
||||
public List<persistanceAttachmentWeaponInfo> attachmentWeaponList = new List<persistanceAttachmentWeaponInfo> ();
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class persistanceAttachmentWeaponInfo
|
||||
{
|
||||
public bool attachmentEnabled;
|
||||
public bool attachmentActive;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 54f4ab66d4f1fe147a3a413dc1c9b190
|
||||
timeCreated: 1597629781
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Save System/Persistance Classes/persistanceWeaponAttachmentListBySaveSlotInfo.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,45 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[System.Serializable]
|
||||
public class persistanceWeaponListBySaveSlotInfo
|
||||
{
|
||||
public int saveNumber;
|
||||
public List<persistanceWeaponListByPlayerInfo> playerWeaponList = new List<persistanceWeaponListByPlayerInfo> ();
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class persistanceWeaponListByPlayerInfo
|
||||
{
|
||||
public int playerID;
|
||||
public List<persistanceWeaponInfo> weaponList = new List<persistanceWeaponInfo> ();
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class persistanceWeaponInfo
|
||||
{
|
||||
public string Name;
|
||||
public int index;
|
||||
public bool isWeaponEnabled;
|
||||
public bool isCurrentWeapon;
|
||||
public int remainingAmmo;
|
||||
|
||||
public bool weaponUsesAttachment;
|
||||
public List<persistanceWeaponAttachmentPlaceInfo> weaponAttachmentPlaceList = new List<persistanceWeaponAttachmentPlaceInfo> ();
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class persistanceWeaponAttachmentPlaceInfo
|
||||
{
|
||||
public bool attachmentPlaceEnabled;
|
||||
public List<persistanceAttachmentInfo> attachmentList = new List<persistanceAttachmentInfo> ();
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class persistanceAttachmentInfo
|
||||
{
|
||||
public bool attachmentEnabled;
|
||||
public bool attachmentActive;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c9d29a847ac8b474fa0b53c6a8663dce
|
||||
timeCreated: 1525909887
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Save System/Persistance Classes/persistanceWeaponListBySaveSlotInfo.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,10 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[CreateAssetMenu (fileName = "Player Prefs Custom Data", menuName = "GKC/Create Player Prefs Custom Data", order = 51)]
|
||||
public class playerPrefsCustomData : ScriptableObject
|
||||
{
|
||||
public List<playerPrefsCustomInfo> playerPrefsCustomInfoList = new List<playerPrefsCustomInfo> ();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f1f4998766d8c1f43b515f170b36636b
|
||||
timeCreated: 1626929301
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Save System/playerPrefsCustomData.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,12 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[System.Serializable]
|
||||
public class playerPrefsCustomInfo
|
||||
{
|
||||
public string Name;
|
||||
public bool valueIsFloat;
|
||||
public float floatValue;
|
||||
public bool boolValue;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 15cb7ffd9a8c92f4b9b4010b4a22d165
|
||||
timeCreated: 1626928982
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Save System/playerPrefsCustomInfo.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,77 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
|
||||
public class saveGameInfoHelper : MonoBehaviour
|
||||
{
|
||||
[Header ("Main Settings")]
|
||||
[Space]
|
||||
|
||||
public bool checkSaveStateOnStartEnabled = true;
|
||||
|
||||
[Space]
|
||||
[Header ("Components Settings")]
|
||||
[Space]
|
||||
|
||||
public saveGameSystem mainSaveGameSystem;
|
||||
|
||||
[Space]
|
||||
[Header ("Events Settings")]
|
||||
[Space]
|
||||
|
||||
public UnityEvent eventOnHomeMenuOpened;
|
||||
|
||||
public UnityEvent eventOnGameSavesLocated;
|
||||
public UnityEvent eventOnGameSavesNotLocated;
|
||||
|
||||
|
||||
int currentSaveNumberOnPlayerPrefs = -1;
|
||||
|
||||
void Start ()
|
||||
{
|
||||
if (!checkSaveStateOnStartEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
checkIfGameCanContinue ();
|
||||
}
|
||||
|
||||
public void checkIfGameCanContinue ()
|
||||
{
|
||||
eventOnHomeMenuOpened.Invoke ();
|
||||
|
||||
mainSaveGameSystem.startGameSystem ();
|
||||
|
||||
if (mainSaveGameSystem.isThereSaveSlotsLoaded ()) {
|
||||
eventOnGameSavesLocated.Invoke ();
|
||||
} else {
|
||||
eventOnGameSavesNotLocated.Invoke ();
|
||||
}
|
||||
}
|
||||
|
||||
public void storeSaveNumberOnPlayerPrefs (int newValue)
|
||||
{
|
||||
PlayerPrefs.SetInt ("saveNumber", newValue);
|
||||
|
||||
currentSaveNumberOnPlayerPrefs = newValue;
|
||||
|
||||
PlayerPrefs.SetInt ("Delete Player Prefs Active", 1);
|
||||
}
|
||||
|
||||
public void removeSaveNumberOnPlayerPrefs ()
|
||||
{
|
||||
if (PlayerPrefs.HasKey ("saveNumber") && currentSaveNumberOnPlayerPrefs != -1) {
|
||||
|
||||
if (currentSaveNumberOnPlayerPrefs == PlayerPrefs.GetInt ("saveNumber")) {
|
||||
|
||||
PlayerPrefs.DeleteKey ("saveNumber");
|
||||
|
||||
currentSaveNumberOnPlayerPrefs = -1;
|
||||
|
||||
|
||||
PlayerPrefs.DeleteKey ("Delete Player Prefs Active");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b403d3c4b8eaec84696ae235b092e327
|
||||
timeCreated: 1617724049
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Save System/saveGameInfoHelper.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,7 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
public class saveGameSlot : MonoBehaviour
|
||||
{
|
||||
public saveGameSystem.buttonInfo buttonInfo;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6cd0c14f232d3f34db61fb697c88b257
|
||||
timeCreated: 1487177056
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Save System/saveGameSlot.cs
|
||||
uploadId: 814740
|
||||
1834
Assets/Game Kit Controller/Scripts/Save System/saveGameSystem.cs
Normal file
1834
Assets/Game Kit Controller/Scripts/Save System/saveGameSystem.cs
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 612dae776bd0820409d80aecbd706ee5
|
||||
timeCreated: 1467224395
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Save System/saveGameSystem.cs
|
||||
uploadId: 814740
|
||||
Reference in New Issue
Block a user