public void InitData() { //todo 手动块生成规则 需要改 this.staticCycleList = GameShared.Instance.roleData.staticCycleList; this.moveCycleList = GameShared.Instance.emenyData.moveCycleList; staticMakeData = GameShared.Instance.staticRule; createTimer = new TimerThearData[3]; ChangeLevel(0); }
// 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; }
RoleData.StaticBoxRule getStaticRule(List <string[]> r) { RoleData.StaticBoxRule rule = new RoleData.StaticBoxRule(); rule.makeBoxCountRate = new List <float>(); int i = 0; float num = 0; while (i < r.Count) { num = float.Parse(r[i][2]); switch (i) { case 0: rule.countMin = (int)num; break; case 1: rule.countMax = (int)num; break; case 2: rule.eventABRate[0] = (int)num; break; case 3: rule.eventABRate[1] = (int)num; break; case 4: rule.eventATime = (int)num; break; case 5: rule.eventBRate = (int)num; break; case 6: rule.minTime = (int)num; break; case 7: rule.maxTime = (int)num; break; case 8: rule.makeBoxCountRate.Add(num); break; case 9: rule.makeBoxCountRate.Add(num); break; case 10: rule.makeBoxCountRate.Add(num); break; case 11: rule.yellowRate = (int)num; break; case 12: rule.fastMaxSpeed = num; break; case 13: rule.skillMin = num; break; case 14: rule.skillMax = num; break; } i++; } return(rule); }