73 lines
1.4 KiB
C#
73 lines
1.4 KiB
C#
using TMPro;
|
|
using UnityEngine;
|
|
|
|
public class SaveFileUISlot : MonoBehaviour
|
|
{
|
|
public Animator buttonAnimator;
|
|
|
|
public TextMeshProUGUI fileStatsText;
|
|
|
|
public int fileNum;
|
|
|
|
private string fileString;
|
|
|
|
public TextMeshProUGUI fileNotCompatibleAlert;
|
|
|
|
private void Awake()
|
|
{
|
|
switch (fileNum)
|
|
{
|
|
case 0:
|
|
fileString = "LCSaveFile1";
|
|
break;
|
|
case 1:
|
|
fileString = "LCSaveFile2";
|
|
break;
|
|
case 2:
|
|
fileString = "LCSaveFile3";
|
|
break;
|
|
default:
|
|
fileString = "LCSaveFile1";
|
|
break;
|
|
}
|
|
}
|
|
|
|
private void OnEnable()
|
|
{
|
|
if (ES3.FileExists(fileString))
|
|
{
|
|
int num = ES3.Load("GroupCredits", fileString, 30);
|
|
int num2 = ES3.Load("Stats_DaysSpent", fileString, 0);
|
|
fileStatsText.text = $"${num}\nDays: {num2}";
|
|
}
|
|
else
|
|
{
|
|
fileStatsText.text = "";
|
|
}
|
|
if (!Object.FindObjectOfType<MenuManager>().filesCompatible[fileNum])
|
|
{
|
|
fileNotCompatibleAlert.enabled = true;
|
|
}
|
|
}
|
|
|
|
public void SetButtonColor()
|
|
{
|
|
buttonAnimator.SetBool("isPressed", GameNetworkManager.Instance.currentSaveFileName == fileString);
|
|
}
|
|
|
|
public void SetFileToThis()
|
|
{
|
|
GameNetworkManager.Instance.currentSaveFileName = fileString;
|
|
GameNetworkManager.Instance.saveFileNum = fileNum;
|
|
SetButtonColorForAllFileSlots();
|
|
}
|
|
|
|
public void SetButtonColorForAllFileSlots()
|
|
{
|
|
SaveFileUISlot[] array = Object.FindObjectsOfType<SaveFileUISlot>();
|
|
for (int i = 0; i < array.Length; i++)
|
|
{
|
|
array[i].SetButtonColor();
|
|
}
|
|
}
|
|
}
|