Beispiel #1
0
        public bool LoadSave(string save_file)
        {
            if (!CheckSave(save_file))
            {
                return(false);
            }

            userData = FileUtility.LoadFile <TokenResult>(save_file);
            GameSaveUtility.username = userData.username;

            // load menu data
            if (userData.username.Length > 10)
            {
                profileTitle.fontSize = 18;
            }
            else if (userData.username.Length > 7)
            {
                profileTitle.fontSize = 24;
            }
            else if (userData.username.Length > 4)
            {
                profileTitle.fontSize = 30;
            }
            profileTitle.SetText("Welcome " + userData.username + "!");
            Debug.Log("Welcome " + userData.username + "!");

            return(true);
        }
Beispiel #2
0
        // Start is called before the first frame update
        void Start()
        {
            Debug.Log("Loading the Load Game Menu");

            gameSaves = new List <GameSave>();

            if (CheckSaves() > 0)
            {
                Debug.Log("Found local saves");
                noSaveFoundMessage.SetActive(false);

                LoadSaves();
                UpdateSaveList();
            }
            else
            {
                if (FileUtility.CheckFile("user"))
                {
                    Debug.Log("Found local user");
                    userData = FileUtility.LoadFile <TokenResult>("user");

                    FetchSaves();
                    if (CheckSaves() > 0)
                    {
                        Debug.Log("Fetched user saves");

                        LoadSaves();
                        UpdateSaveList();
                    }
                }

                noSaveFoundMessage.SetActive(true);
            }

            previousTime = System.DateTime.Now;
        }