From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- Client/Assets/Scripts/XMainClient/XLevelWave.cs | 249 ++++++++++++++++++++++++ 1 file changed, 249 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/XLevelWave.cs (limited to 'Client/Assets/Scripts/XMainClient/XLevelWave.cs') diff --git a/Client/Assets/Scripts/XMainClient/XLevelWave.cs b/Client/Assets/Scripts/XMainClient/XLevelWave.cs new file mode 100644 index 00000000..303429e0 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/XLevelWave.cs @@ -0,0 +1,249 @@ +using System; +using System.Collections.Generic; +using System.IO; +using UnityEngine; + +namespace XMainClient +{ + internal class XLevelWave + { + public int _id; + + public LevelSpawnType _spawnType; + + public float _time; + + public int _loopInterval; + + public uint _EnemyID; + + public int _randomID; + + public int _yRotate; + + public bool _repeat; + + public string _exString; + + public List _preWave = new List(); + + public float _preWavePercent; + + public Dictionary _monsterPos = new Dictionary(); + + public Dictionary _monsterRot = new Dictionary(); + + public float _roundRidus; + + public int _roundCount; + + public string _levelscript; + + protected void ParseInfo(string data) + { + InfoType infoType = InfoType.TypeNone; + bool flag = data.StartsWith("id"); + if (flag) + { + infoType = InfoType.TypeId; + } + else + { + bool flag2 = data.StartsWith("bi"); + if (flag2) + { + infoType = InfoType.TypeBaseInfo; + } + else + { + bool flag3 = data.StartsWith("pw"); + if (flag3) + { + infoType = InfoType.TypePreWave; + } + else + { + bool flag4 = data.StartsWith("ei"); + if (flag4) + { + infoType = InfoType.TypeEditor; + } + else + { + bool flag5 = data.StartsWith("mi"); + if (flag5) + { + infoType = InfoType.TypeMonsterInfo; + } + else + { + bool flag6 = data.StartsWith("si"); + if (flag6) + { + infoType = InfoType.TypeScript; + } + else + { + bool flag7 = data.StartsWith("es"); + if (flag7) + { + infoType = InfoType.TypeExString; + } + else + { + bool flag8 = data.StartsWith("st"); + if (flag8) + { + infoType = InfoType.TypeSpawnType; + } + } + } + } + } + } + } + } + string text = data.Substring(3); + switch (infoType) + { + case InfoType.TypeId: + this._id = int.Parse(text); + break; + case InfoType.TypeBaseInfo: + { + string[] array = text.Split(new char[] + { + ',' + }); + this._time = float.Parse(array[0]); + this._loopInterval = int.Parse(array[1]); + this._EnemyID = uint.Parse(array[2]); + this._yRotate = int.Parse(array[5]); + bool flag9 = array.Length > 6; + if (flag9) + { + this._roundRidus = float.Parse(array[6]); + } + bool flag10 = array.Length > 7; + if (flag10) + { + this._roundCount = int.Parse(array[7]); + } + bool flag11 = array.Length > 8; + if (flag11) + { + this._randomID = int.Parse(array[8]); + } + bool flag12 = array.Length > 11; + if (flag12) + { + this._repeat = bool.Parse(array[11]); + } + break; + } + case InfoType.TypePreWave: + { + string[] array2 = text.Split(new char[] + { + '|' + }); + bool flag13 = array2.Length != 0; + if (flag13) + { + string text2 = array2[0]; + bool flag14 = text2.Length > 0; + if (flag14) + { + string[] array3 = text2.Split(new char[] + { + ',' + }); + for (int i = 0; i < array3.Length; i++) + { + int item = 0; + bool flag15 = int.TryParse(array3[i], out item); + if (flag15) + { + this._preWave.Add(item); + } + } + } + } + bool flag16 = array2.Length > 1; + if (flag16) + { + int num = int.Parse(array2[1]); + this._preWavePercent = (float)num / 100f; + } + break; + } + case InfoType.TypeMonsterInfo: + { + string[] array4 = text.Split(new char[] + { + ',' + }); + int key = int.Parse(array4[0]); + float num2 = float.Parse(array4[1]); + float num3 = float.Parse(array4[2]); + float num4 = float.Parse(array4[3]); + Vector3 value; + value= new Vector3(num2, num3, num4); + this._monsterPos.Add(key, value); + Vector3 value2; + value2= new Vector3(0f, 0f, 0f); + bool flag17 = array4.Length > 4; + if (flag17) + { + value2.y = float.Parse(array4[4]); + } + this._monsterRot.Add(key, value2); + break; + } + case InfoType.TypeScript: + { + string[] array5 = text.Split(new char[] + { + ',' + }); + bool flag18 = array5.Length != 0; + if (flag18) + { + this._levelscript = array5[0]; + } + break; + } + case InfoType.TypeExString: + this._exString = text; + break; + case InfoType.TypeSpawnType: + this._spawnType = (LevelSpawnType)int.Parse(text); + break; + } + } + + public void ReadFromFile(StreamReader sr) + { + string text = sr.ReadLine(); + bool flag = text != "bw"; + if (!flag) + { + for (;;) + { + text = sr.ReadLine(); + bool flag2 = text == "ew"; + if (flag2) + { + break; + } + this.ParseInfo(text); + } + } + } + + public bool IsScriptWave() + { + return this._levelscript != null && this._levelscript.Length > 0; + } + } +} -- cgit v1.1-26-g67d0