IEnumerator CreateUserEnvironment(SV_GameUser _user)
    {
        if (_user == null)
        {
            yield break;
        }

        bool _saveExists = File.Exists(_user.UserSave);

        if (!_saveExists)
        {
            File.WriteAllText(_user.UserSave, SV_BaseData.Base);
            _saveExists = File.Exists(_user.UserSave);

            if (!_saveExists)
            {
                yield break;
            }
        }

        string[] _content = File.ReadAllLines(_user.UserSave);



        if (_content == null || _content.Length == 0)
        {
            File.WriteAllText(_user.UserSave, SV_BaseData.Base);
        }
        loadingStep++;
        OnLoadingProgress?.Invoke(LoadingProgress);
    }
Example #2
0
 private void UpdateProgressEvent(float progress)
 {
     if (OnLoadingProgress != null)
     {
         OnLoadingProgress.Invoke(progress);
     }
 }
    IEnumerator LoadSave(string _currentSave, Transform playerTrnasform)
    {
        if (String.IsNullOrEmpty(_currentSave))
        {
            yield break;
        }
        SV_SaveData _save = new SV_SaveData(_currentSave);

        currentUser.SetCurrentSave(_save, playerTrnasform);
        loadingStep++;
        OnLoadingProgress?.Invoke(LoadingProgress);
    }
    IEnumerator getAllGameUsers(string _gameProfilesFolder)
    {
        string[] _allPath   = Directory.GetDirectories(_gameProfilesFolder);
        string[] _userNames = _allPath.Select(p => Path.GetFileName(p)).ToArray();

        allGameUsers.Clear();
        _userNames.ToList().ForEach(u => allGameUsers.Add(new SV_GameUser(u)));
        yield return(new WaitForEndOfFrame());

        loadingStep++;
        OnLoadingProgress?.Invoke(LoadingProgress);
    }
    IEnumerator CreateGameEnvironment()
    {
        bool _userExis = Directory.Exists(currentUser.UserFolder);

        if (!_userExis)
        {
            Directory.CreateDirectory(currentUser.UserFolder);
            _userExis = Directory.Exists(currentUser.UserFolder);
            if (!_userExis)
            {
                yield break;
            }
        }

        loadingStep++;
        OnLoadingProgress?.Invoke(LoadingProgress);
    }
 protected void InvokeOnLoadingProgressEvent(float progress)
 {
     OnLoadingProgress?.Invoke(progress);
 }