- Added Player account data with list of characters - Added character selection scene - Loading and saving characters flow working with account names as filters
42 lines
1.0 KiB
C#
42 lines
1.0 KiB
C#
using Photon.Pun;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class SetCharacterName : SetNickName
|
|
{
|
|
[SerializeField] protected StringSharedField playerAccountName;
|
|
|
|
protected PlayerAccountData accountData;
|
|
|
|
protected override void Start()
|
|
{
|
|
base.Start();
|
|
|
|
accountData = PlayerDataHandler.Instance.LoadPlayerAccountData(playerAccountName.Value);
|
|
}
|
|
|
|
public override void OnInputFieldChanged(string value)
|
|
{
|
|
if(accountData != null)
|
|
{
|
|
if (accountData.PlayerContainsCharacter(value))
|
|
{
|
|
button.interactable = false;
|
|
return;
|
|
}
|
|
}
|
|
|
|
base.OnInputFieldChanged(value);
|
|
}
|
|
|
|
public void SaveCharacterOnAccountData()
|
|
{
|
|
accountData.AddCharacterToPlayerAccount(insertedName.Value);
|
|
|
|
PhotonNetwork.NickName = insertedName.Value;
|
|
|
|
PlayerDataHandler.Instance.SavePlayerAccountData(playerAccountName.Value, accountData);
|
|
}
|
|
}
|