private void Start() { Instance = this; ditry = false; path = Application.persistentDataPath + "/PlayerData.txt"; context = "{ \"Index\":\"1\",\"Audio\":\"0\",\"StarNum\":\"50\",\"Control\":\"1\",\"SkillCD\":\"0\",\"SkillTime\":\"0\",\"HardDegree\":\"0\"}"; InitData(); }
public void SetAllData(JsonPlayerData _PlayerData, Animator _Animator) { JsonSavedPlayerData = _PlayerData; nameText.text = JsonSavedPlayerData.NickName; Name = JsonSavedPlayerData.NickName; anim = _Animator; //뭔가 데이터를 넣으면 isEmpty = false; IsEmpty = false; }
public void SetAllDataInfo(JsonPlayerData _PlayerData) { characterInfoName.text = _PlayerData.NickName; characterInfoLevel.text = _PlayerData.Level.ToString(); characterInfoHpMax.text = _PlayerData.HpMax.ToString(); characterInfoHp.text = _PlayerData.Hp.ToString(); characterInfoExp.text = _PlayerData.Exp.ToString(); characterInfoMpMax.text = _PlayerData.MpMax.ToString(); characterInfoMp.text = _PlayerData.Mp.ToString(); characterInfoArmor.text = _PlayerData.Armor.ToString(); }
public void SetAllDataToPlay(JsonPlayerData _PlayerData) { StatPoint = _PlayerData.StatPoint; HpStat = _PlayerData.HpStat; MpStat = _PlayerData.MpStat; ArmorStat = _PlayerData.ArmorStat; NickName = _PlayerData.NickName; Level = _PlayerData.Level; PlayerJob = _PlayerData.job; hpMax = _PlayerData.HpMax; Hp = _PlayerData.Hp; mpMax = _PlayerData.MpMax; Mp = _PlayerData.Mp; Exp = _PlayerData.Exp; armor = _PlayerData.Armor; MoveSpeed = _PlayerData.MoveSpeed; AttackSpeed = _PlayerData.AttackSpeed; }
//현재 아이디, 닉네임으로 플레이어 데이터 저장함 public void SavePlayerData(string _NickName) { JsonPlayerData jsonPlayerData = new JsonPlayerData(); PlayerData playerData = DataManager.Instance.PlayerData; jsonPlayerData.StatPoint = playerData.StatPoint; jsonPlayerData.HpStat = playerData.HpStat; jsonPlayerData.MpStat = playerData.MpStat; jsonPlayerData.ArmorStat = playerData.ArmorStat; jsonPlayerData.NickName = playerData.NickName; jsonPlayerData.job = playerData.PlayerJob; jsonPlayerData.Level = playerData.Level; jsonPlayerData.HpMax = playerData.hpMax; jsonPlayerData.Hp = playerData.Hp; jsonPlayerData.MpMax = playerData.mpMax; jsonPlayerData.Mp = playerData.Mp; jsonPlayerData.Armor = playerData.armor; jsonPlayerData.Exp = playerData.Exp; jsonPlayerData.AttackSpeed = playerData.AttackSpeed; jsonPlayerData.MoveSpeed = playerData.MoveSpeed; string playerDataPath = Application.persistentDataPath + "/" + DataManager.Instance.CurLoginID + "_" + _NickName + ".json"; if (File.Exists(playerDataPath)) { File.Delete(playerDataPath); } string data = JsonUtility.ToJson(jsonPlayerData); FileStream fileStream = new FileStream(playerDataPath, FileMode.OpenOrCreate, FileAccess.Write); byte[] bytes = Encoding.UTF8.GetBytes(data); fileStream.Write(bytes, 0, bytes.Length); fileStream.Close(); }
void Awake() { image = GetComponent <Image>(); JsonSavedPlayerData = null; }