public void IntializeDataUser(GameObject role, string pathTemp) { Debug.Log("IntializeDataUser:" + role + pathTemp); DataOfUser data = JsonUti.JsonstreamToObject <DataOfUser> (pathTemp); role.GetComponent <Role_Main> ().playerName = data.username; }
public Data_Rloe ChoiceDataRole(Enum_Role role) { string path = Application.dataPath + "/InitializeInfo/HeroData/"; switch (role) { case Enum_Role.ChangE: path += "ChangE.text"; Data_Rloe roleData = JsonUti.JsonstreamToObject <Data_Rloe> (path); return(roleData); case Enum_Role.YangJian: path += "YangJian.text"; return(JsonUti.JsonstreamToObject <Data_Rloe> (path)); case Enum_Role.JianMo: path += "JianMo.text"; return(JsonUti.JsonstreamToObject <Data_Rloe> (path)); case Enum_Role.WuNiang: path += "WuNiang.text"; return(JsonUti.JsonstreamToObject <Data_Rloe> (path)); case Enum_Role.XiaoYaoZi: path += "XiaoYaoZi.text"; return(JsonUti.JsonstreamToObject <Data_Rloe> (path)); case Enum_Role.Ahri: path += "Ahri.text"; return(JsonUti.JsonstreamToObject <Data_Rloe> (path)); default: return(JsonUti.JsonstreamToObject <Data_Rloe> (path)); } }
public void IntializeRoleType(string pathTemp) { // Debug.Log ("IntializeRoleType_Path:" + pathTemp); HeroChooseInfoS chioce = JsonUti.JsonstreamToObject <HeroChooseInfoS> (pathTemp); // Debug.Log ("IntializeRoleType_Chioce:" + chioce); kindOfPlayer = chioce.hero [0].hero; kindOfAI = chioce.hero [3].hero; }
public void IntializeOtherkill(string pathTemp) { HeroChooseInfoS chioce = JsonUti.JsonstreamToObject <HeroChooseInfoS> (pathTemp); Role_Main player = role_Player.GetComponent <Role_Main> (); Role_Main AIPlayer = role_AI.GetComponent <Role_Main> (); player.skill_D.skillName = chioce.hero [0].Skill_D; player.skill_F.skillName = chioce.hero [0].Skill_F; AIPlayer.skill_D.skillName = chioce.hero [3].Skill_D; AIPlayer.skill_F.skillName = chioce.hero [3].Skill_F; }
public void IntializeRoleType(string pathTemp) { // Debug.Log ("IntializeRoleType_Path:" + pathTemp); HeroChooseInfoS chioce = JsonUti.JsonstreamToObject <HeroChooseInfoS> (pathTemp); // Debug.Log ("IntializeRoleType_Chioce:" + chioce); for (int i = 0; i < 3; i++) { kindOfPlayers [i] = chioce.hero[i].hero; kindOfAIs[i] = chioce.hero [i + 3].hero; } }
public void IntializeOtherkill(string pathTemp) { HeroChooseInfoS chioce = JsonUti.JsonstreamToObject <HeroChooseInfoS> (pathTemp); for (int i = 0; i < 3; i++) { role_Players[i].GetComponent <Role_Main> ().skill_D.skillName = chioce.hero [i].Skill_D; role_Players[i].GetComponent <Role_Main> ().skill_F.skillName = chioce.hero [i].Skill_F; role_AIs[i].GetComponent <Role_Main> ().skill_D.skillName = chioce.hero [i + 3].Skill_D; role_AIs[i].GetComponent <Role_Main> ().skill_F.skillName = chioce.hero [i + 3].Skill_F; } }
public void ZhuceGame() { string path = Application.dataPath + "/InitializeInfo/"; path += "Login.text"; UserDataS userdata = JsonUti.JsonstreamToObject <UserDataS> (path); bool isContain = false; for (int i = 0; i < userdata.userdatas.Count; i++) { if (userName.text == userdata.userdatas[i].username) { isContain = true; break; } } if (!isContain) { data.username = userName.text; data.password = passWord.text; dataS.userdatas.Add(data); string path2 = Application.dataPath + "/InitializeInfo/Login.text"; dataofuser.username = userName.text; string pathUser = Application.dataPath + "/InitializeInfo/DataOfUser/"; pathUser += data.username + ".text"; JsonUti.ObjectToJsonStream <UserDataS> (path2, dataS); JsonUti.ObjectToJsonStream <DataOfUser> (pathUser, dataofuser); } else { tips.transform.Find("Text").GetComponent <Text> ().text = "用户名已\n存在"; tips.SetActive(true); Debug.Log("用户名已存在"); } ClearInput(); }
public void LoginGame() { string path = Application.dataPath + "/InitializeInfo/"; path += "Login.text"; UserDataS userdata = JsonUti.JsonstreamToObject <UserDataS> (path); bool canLod = false; Debug.Log("登陆时,所填写:" + userName.text + passWord.text); for (int i = 0; i < userdata.userdatas.Count; i++) { if (userName.text == userdata.userdatas [i].username) { if (passWord.text == userdata.userdatas [i].password) { canLod = true; break; } else { //密码错误 tips.SetActive(true); Debug.Log("密码错误"); break; } } else { continue; } } if (!canLod) { //用户不存在,请注册 tips.transform.Find("Text").GetComponent <Text> ().text = "用户不存在\n请注册"; tips.SetActive(true); } if (canLod) { string pathUser = Application.dataPath + "/InitializeInfo/DataOfUser/"; pathUser = pathUser + userName.text + ".text"; Debug.Log("登录的用户" + userName.text + pathUser); DataOfUser dataOfUser = JsonUti.JsonstreamToObject <DataOfUser> (pathUser); Debug.Log("登录的用户" + dataOfUser.username); string curLoadPlayer = Application.dataPath + "/InitializeInfo/CurLoadPlayer.text"; JsonUti.ObjectToJsonStream <DataOfUser> (curLoadPlayer, dataOfUser); Debug.Log("登录的用户" + dataOfUser.Level); Debug.Log("进入游戏"); // StartCoroutine (LoadScene ()); //异步加载场景 canvas03.SetActive(false); canvas01.SetActive(false); canvas02.SetActive(true); cameraShow.SetActive(false); Debug.Log(dataOfUser.Money); ClearInput(); // Debug.Log (dataOfUser.OwnHero); } ClearInput(); }
Data_Rloe GetRoleJson(string name) { Data_Rloe hero = JsonUti.JsonstreamToObject <Data_Rloe>(Application.dataPath + "/InitializeInfo/HeroData/" + name + ".text"); return(hero); }