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));
        }
    }
    // Use this for initialization
    void Start()
    {
        Data_Rloe role_JianMo    = GetRoleJson("JianMo");
        Data_Rloe role_WuNiang   = GetRoleJson("WuNiang");
        Data_Rloe role_XiaoYaoZi = GetRoleJson("XiaoYaoZi");
        Data_Rloe role_YangJian  = GetRoleJson("YangJian");
        Data_Rloe role_ChangE    = GetRoleJson("ChangE");
        Data_Rloe role_Ahri      = GetRoleJson("Ahri");

        ChangeRoleData(ref role_JianMo, 5);
        ChangeRoleData(ref role_WuNiang, 5);
        ChangeRoleData(ref role_XiaoYaoZi, 3);
        ChangeRoleData(ref role_YangJian, 1);
        ChangeRoleData(ref role_ChangE, 5);
        ChangeRoleData(ref role_Ahri, 5);
        SaveJsonData(role_JianMo, "JianMo");
        SaveJsonData(role_WuNiang, "WuNiang");
        SaveJsonData(role_XiaoYaoZi, "XiaoYaoZi");
        SaveJsonData(role_YangJian, "YangJian");
        SaveJsonData(role_ChangE, "ChangE");
        SaveJsonData(role_Ahri, "Ahri");
    }
    public void IntializeDataRole(GameObject role, Enum_Role enumRole)
    {
        Data_Rloe data       = ChoiceDataRole(enumRole);
        Role_Main playerData = role.GetComponent <Role_Main> ();

        playerData.skinNum         = data.skinNum;
        playerData.type_Allrole    = data.RorS;
        playerData.HpMax           = data.HpMax;
        playerData.MpMax           = data.MpMax;
        playerData.DefensePhysical = data.DefensePhysical;
        playerData.DefenseMagic    = data.DefenseMagic;
        playerData.attack_Physical = data.attack_Physical;
        playerData.attack_Magic    = data.attack_Magic;
        playerData.moveSpeed       = data.moveSpeed;
        playerData.attack_Radius   = data.attack_Radius;
        playerData.attack_Speed    = data.attack_Speed;
        playerData.Level           = data.Level;
        playerData.Level_exp       = data.Levl_exp;
        if (role.GetComponent <RoleInfo>().type_Range == Type_Range.Long)                                //初始化子弹层
        {
            role.transform.FindChild("weapon/WEAPON_1").gameObject.layer = LayerMask.NameToLayer("Bullet");
        }
    }
    void SaveJsonData(Data_Rloe role, string name)
    {
        string path = Application.dataPath + "/InitializeInfo/HeroData/" + name + ".text";

        JsonUti.ObjectToJsonStream <Data_Rloe> (path, role);
    }
    Data_Rloe GetRoleJson(string name)
    {
        Data_Rloe hero = JsonUti.JsonstreamToObject <Data_Rloe>(Application.dataPath + "/InitializeInfo/HeroData/" + name + ".text");

        return(hero);
    }
 void ChangeRoleData(ref Data_Rloe name, int atk_r)
 {
     name.moveSpeed     = 3;
     name.HpMax         = 550;
     name.attack_Radius = atk_r;
 }