コード例 #1
0
ファイル: MainMenu.cs プロジェクト: monikasama/Proj-Thalia
    public void _clearPrefs()
    {
        PlayerPrefs.DeleteAll();
        ZPlayerPrefs.DeleteAll();

        SetPlayerPrefs.I._setPlayerPrefs();
    }
コード例 #2
0
    public void CreatePlayerInfo(string playerName)
    {
        LocalDBController
        .DataService
        .Connection
        .DeleteAll <PlayerInfo>();
        LocalDBController
        .DataService
        .Connection
        .DeleteAll <PlayPuzzles>();
        LocalDBController
        .DataService
        .Connection
        .DeleteAll <UserPuzzle>();
        LocalDBController
        .DataService
        .Connection
        .DeleteAll <Purchases>();

        ZPlayerPrefs.DeleteAll();

        LocalDBController
        .InsertOrReplace(new PlayerInfo
        {
            Name = playerName,
        });
    }
コード例 #3
0
    public IEnumerator ConnectToAccount()
    {
        AccountInfo accountInfo = null;

        // Ask command center to connect to account
        yield return(ServerController.Post <AccountInfo>(
                         $@"Account/ConnectToAccount?phoneNumber={_phoneNumber}",
                         null,
                         // On Successfully connect to the account
                         info => { accountInfo = info; },
                         // On Error
                         request =>
        {
            // Network Error !!!!!
            if (request.isNetworkError)
            {
                FollowMachine.SetOutput("Network Error");
            }

            // Account recovery Error !!!!
            else if (request.isHttpError)
            {
                FollowMachine.SetOutput("Account Error");
            }
        }));

        if (accountInfo != null)
        {
            // Restore player info
            Singleton.Instance.PlayerController
            .SetPlayerInfoAndSaveTolocalDB(accountInfo.PlayerInfo);

            // Restore play history
            PlayPuzzleController.Instance.RestorePlayHistory(accountInfo.PlayPuzzleses);

            // Restore purchases
            PurchaseController.Instance.RestorePurchase(accountInfo.Purchaseses);

            // Restore user puzzles
            UserPuzzleSynchronizer.Instance.RestoreUserPuzzles(accountInfo.UserPuzzles);

            // Set connection result to success


            ZPlayerPrefs.DeleteAll();

            StoreInventory.GiveItem("charsoo_coin", accountInfo.PlayerInfo.CoinCount);

            FollowMachine.SetOutput("Success");

            _phoneNumber = " ";
        }
    }
コード例 #4
0
 public void Clear()
 {
     ZPlayerPrefs.DeleteAll();
 }
コード例 #5
0
ファイル: Preferences.cs プロジェクト: HoseinNajafi/Charsoo
    void OnGUI()
    {
        GUILayout.Label("Player Preferences", EditorStyles.boldLabel);

        _key      = EditorGUILayout.TextField("Key", _key);
        _prefType = (KeyType)EditorGUILayout.EnumPopup("Type :", _prefType);
        string keyPrefix = _prefType == KeyType.Int ? "i_" : _prefType == KeyType.Float ? "f_" : "s_";

        _value = EditorGUILayout.TextField("Value", _value);
        if (ZPlayerPrefs.HasKey(keyPrefix + _key))
        {
            switch (_prefType)
            {
            case KeyType.Int:
                _currentValue = ZPlayerPrefs.GetInt(_key).ToString();
                break;

            case KeyType.Float:
                _currentValue = ZPlayerPrefs.GetFloat(_key).ToString("##.###");
                break;

            case KeyType.String:
                _currentValue = ZPlayerPrefs.GetString(_key);
                break;
            }
        }
        else
        {
            _currentValue = "Don't Find This Key";
        }

        EditorGUILayout.LabelField("Current Value : ", _currentValue);

        EditorGUILayout.BeginHorizontal();

        if (GUILayout.Button("Set Key"))
        {
            switch (_prefType)
            {
            case KeyType.Int:
                ZPlayerPrefs.SetInt(_key, int.Parse(_value));
                break;

            case KeyType.Float:
                ZPlayerPrefs.SetFloat(_key, float.Parse(_value));
                break;

            case KeyType.String:
                ZPlayerPrefs.SetString(_key, _value);
                break;
            }
        }
        if (GUILayout.Button("Delete Key"))
        {
            ZPlayerPrefs.DeleteKey(keyPrefix + _key);
            Debug.Log(keyPrefix);
        }

        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginHorizontal();

        EditorGUILayout.LabelField("Delete All Data", "");

        if (GUILayout.Button("Delete All"))
        {
            if (EditorUtility.DisplayDialog("Delete All Player Preferences", "Are you sure?\nThis is NOT Reversible.", "Delet All", "Cancel"))
            {
                ZPlayerPrefs.DeleteAll();
            }
        }
        EditorGUILayout.EndHorizontal();
    }