void RestSkill() { RoleData.BoxAttr box = new RoleData.BoxAttr(); box.makeCount = 1; box.timeMin = staticMakeData.skillMin; box.timeMax = staticMakeData.skillMax; List <RoleData.BoxAttr> list = new List <RoleData.BoxAttr>(); list.Add(box); RoleData.CycleAttr cycle = new RoleData.CycleAttr(); cycle.countMax = staticMakeData.countMax; cycle.intervalMin = 1; cycle.boxList = list; staticAttr = cycle; TimerThearData a = new TimerThearData(); a.Reset(list); a.isRun[0] = true; a.curMakeCount[0] = 1; a.totalCreateTime[0] = staticMakeData.skillMax; a.type = CycleType.Loop; createTimer[SkillList] = a; }
void ChangeMoveCycle(int i) { if (i < moveCycleList.Count) { moveAttr = moveCycleList[i]; RestMoveCycle(); } }
void ChangeStaticCycle(int i) { if (i < staticCycleList.Count) { staticAttr = staticCycleList[i]; //RestStaticCycle(); } }
//生成一个固定的 静态块生成线程 public void RestOnceStaticThread() { int rand = UnityEngine.Random.Range(0, 100); int count = 0; if (rand < staticMakeData.makeBoxCountRate[2]) { count = 3; } else if (rand < staticMakeData.makeBoxCountRate[1]) { count = 2; } else if (rand < staticMakeData.makeBoxCountRate[0]) { count = 1; } //生成一个 块生成线程 RoleData.BoxAttr box = new RoleData.BoxAttr(); box.makeCount = count; box.timeMax = staticMakeData.maxTime; box.timeMin = staticMakeData.minTime; List <RoleData.BoxAttr> list = new List <RoleData.BoxAttr>(); list.Add(box); RoleData.CycleAttr cycle = new RoleData.CycleAttr(); cycle.countMax = staticMakeData.countMax; cycle.intervalMin = 0; cycle.boxList = list; staticAttr = cycle; TimerThearData a = new TimerThearData(); a.Reset(list); a.isRun[0] = true; a.curMakeCount[0] = count; a.curMakeBoxCount[0] = count; a.totalCreateTime[0] = staticMakeData.countMax; a.type = CycleType.Loop; createTimer[StaticList] = a; }
// 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.CycleAttr getCycleData(string[] r) { List <string> str = new List <string>(); for (int i = 0; i < r.Length; i++) { if (!r[i].Equals("")) { str.Add(r[i]); } } int arrylenght = (str.Count - 3) / 6; RoleData.CycleAttr cycle = new RoleData.CycleAttr(); RoleData.BoxAttr[] boxList = new RoleData.BoxAttr[arrylenght]; for (int i = 0; i < boxList.Length; i++) { boxList[i] = new RoleData.BoxAttr(); } for (int i = 0; i < str.Count; i++) { float num = 0; if (float.TryParse(str[i], out num)) { } else { //转换失败, 字符串不是只是数字 Debug.Log("这个不是数字 " + i); } if (i - 2 > 0) { int temp = i - 3; int arrIndex = temp / 6; int index = temp - (arrIndex * 6); if (arrIndex >= 5) { Debug.Log(arrIndex + "/" + i); } if (arrIndex < arrylenght) { switch (index) { case 0: boxList[arrIndex].type = (int)num; break; case 1: boxList[arrIndex].timeMin = num; break; case 2: boxList[arrIndex].timeMax = num; break; case 3: boxList[arrIndex].makeCount = (int)num; break; case 4: boxList[arrIndex].width = num; break; case 5: boxList[arrIndex].moveSpeed = num; break; } } } else { switch (i) { case 1: cycle.countMax = (int)num; break; case 2: cycle.intervalMin = num; break; } } } cycle.boxList = new List <RoleData.BoxAttr>(boxList); return(cycle); }