Xishu GetXishu(List <string[]> r) { Xishu xishu = new Xishu(); int i = 0; float num = 0; while (i < r.Count) { num = float.Parse(r[i][2]) / 100; switch (i) { case 0: xishu.powerMax = num; break; case 1: xishu.curPower = num; break; case 2: xishu.def = num; break; case 3: xishu.crit = num; break; case 4: xishu.critMin = num; break; case 5: xishu.skill = num; break; case 6: xishu.skillMin = num; break; case 7: xishu.critMul = num; break; case 8: xishu.combo = num; break; } i++; } return(xishu); }
// Use this for initialization public void InitRoleData() { //curLevel = 0; //roleData = this.GetRoleById(1); //roleData.starData = this.GetRoleStarById(1001); //emenyData = this.GetRoleById(1); //emenyData.starData = this.GetRoleStarById(1001); //string path1 = Application.dataPath + "\\Resources\\DataTest\\staticBox.csv"; //string path2 = Application.dataPath + "\\Resources\\DataTest\\moveBox.csv"; //string path3 = Application.dataPath + "\\Resources\\DataTest\\cursor.csv"; //string path4 = Application.dataPath + "\\Resources\\DataTest\\staticBoxRule.csv"; //string path5 = Application.dataPath + "\\Resources\\DataTest\\battle.csv"; //string path6 = Application.dataPath + "\\Resources\\DataTest\\shuaijian.csv"; //string path7 = Application.dataPath + "\\Resources\\DataTest\\xishu.csv"; //string path8 = Application.dataPath + "\\Resources\\DataTest\\level.csv"; TextAsset binAsset = Resources.Load("DataTest/staticBox", typeof(TextAsset)) as TextAsset; string path1 = binAsset.text; binAsset = Resources.Load("DataTest/moveBox", typeof(TextAsset)) as TextAsset; string path2 = binAsset.text; binAsset = Resources.Load("DataTest/cursor", typeof(TextAsset)) as TextAsset; string path3 = binAsset.text; binAsset = Resources.Load("DataTest/staticBoxRule", typeof(TextAsset)) as TextAsset; string path4 = binAsset.text; binAsset = Resources.Load("DataTest/battle", typeof(TextAsset)) as TextAsset; string path5 = binAsset.text; binAsset = Resources.Load("DataTest/shuaijian", typeof(TextAsset)) as TextAsset; string path6 = binAsset.text; binAsset = Resources.Load("DataTest/xishu", typeof(TextAsset)) as TextAsset; string path7 = binAsset.text; binAsset = Resources.Load("DataTest/level", typeof(TextAsset)) as TextAsset; string path8 = binAsset.text; List <string[]> staticStr = GetString(path1); List <string[]> moveStr = GetString(path2); List <string[]> cursorStr = GetString(path3); List <string[]> staticRuleStr = GetString(path4); List <string[]> battle = GetString(path5); List <string[]> shuaijian = GetString(path6); List <string[]> x = GetString(path7); List <string[]> level = GetString(path8); //块 roleData = new RoleData(); staticStr.RemoveAt(0); moveStr.RemoveAt(0); cursorStr.RemoveAt(0); staticRuleStr.RemoveAt(0); battle.RemoveAt(0); shuaijian.RemoveAt(0); x.RemoveAt(0); level.RemoveAt(0); emenyData = new RoleData(); RoleData.CycleAttr[] staticCycleList = new RoleData.CycleAttr[staticStr.Count]; RoleData.CycleAttr[] moveCycleList = new RoleData.CycleAttr[moveStr.Count]; //填充数据 roleData.staticCycleList = new List <RoleData.CycleAttr>(); emenyData.staticCycleList = new List <RoleData.CycleAttr>(); for (int i = 0; i < staticStr.Count; i++) { roleData.staticCycleList.Add(getCycleData(staticStr[i])); emenyData.staticCycleList.Add(getCycleData(staticStr[i])); } roleData.moveCycleList = new List <RoleData.CycleAttr>(); emenyData.moveCycleList = new List <RoleData.CycleAttr>(); for (int i = 0; i < moveStr.Count; i++) { roleData.moveCycleList.Add(getCycleData(moveStr[i])); emenyData.moveCycleList.Add(getCycleData(moveStr[i])); } //游标 cursorSpeedList = getCursorData(cursorStr); //规则 staticRule = getStaticRule(staticRuleStr); //战斗 //roleData.wakeLevelAttrList = DBManager.Instance.QueryWakeAttrList(1); //emenyData.wakeLevelAttrList = DBManager.Instance.QueryWakeAttrList(2); //emenyData.wakeLevelAttrList.RemoveRange(0, 5); //固定 //衰减 attenuationList = getShuaijian(shuaijian); xishu = GetXishu(x); //Role.GetComponent<MonsterMgr>().data = roleData; //Emeny.GetComponent<MonsterMgr>().data = emenyData; }