Ejemplo n.º 1
0
    public static void SetUp()
    {
        string Accountstr = PlayerPrefs.GetString("Account", "0");

        if (Accountstr != "0")
        {
            AccountDataList = JsonUtility.FromJson <AccountDataList> (Accountstr);
        }
    }
Ejemplo n.º 2
0
    public bool Make(string name, string password)
    {
        string Accountstr = PlayerPrefs.GetString("Account", "0");
        bool   newPlayerp = true;

        if (!(Accountstr == "0"))////////アカウントデータ有り
        {
            AccountDataList AccountDataList = AccountData.AccountDataList;
            foreach (string PlayingName in AccountDataList.Account)
            {
                if (PlayingName == name)
                {
                    newPlayerp = false;
                }
            }
            if (newPlayerp)
            {
                AccountDataList.Account.Add(name);
                AccountDataList.SaveData.Add("");
                Accountstr = JsonUtility.ToJson(AccountDataList);
                PlayerPrefs.SetString("Account", Accountstr);
                PlayerPrefs.SetString(name, password);
                PlayerPrefs.Save();
                AccountData.SetName(name);
                AccountData.SetPassWord(password);
                return(true);
            }
            else
            {
                return(false);
            }
        }
        else /////////アカウントデータ無し
        {
            AccountDataList AccountDataList = AccountData.AccountDataList;
            AccountDataList.Account.Add(name);
            AccountDataList.SaveData.Add("");
            Accountstr = JsonUtility.ToJson(AccountDataList);
            PlayerPrefs.SetString("Account", Accountstr);
            PlayerPrefs.SetString(name, password);
            PlayerPrefs.Save();
            AccountData.SetName(name);
            AccountData.SetPassWord(password);
            return(true);
        }
    }
Ejemplo n.º 3
0
    public bool LoadGame(string name, string password)
    {
        bool   PlayingPlayerp = false;
        string AccountName    = "";

        AccountDataList AccountDataList = AccountData.AccountDataList;

        int count = 0;

        foreach (string accountname in AccountDataList.Account)
        {
            if (accountname == name)
            {
                AccountName    = accountname;
                PlayingPlayerp = true;
                break;
            }
            count++;
        }
        if (PlayingPlayerp)
        {
            if (PlayerPrefs.GetString(AccountName) == password)
            {
                string savedatastr = AccountDataList.SaveData[count];
                AccountData.SetLoadData(JsonUtility.FromJson <SaveData> (savedatastr));
                AccountData.SetName(name);
                AccountData.SetPassWord(password);
                return(true);
            }
            else
            {
                return(false);
            }
        }
        return(false);
    }