public void LoadXml() { var xmlParser = new OpenXmlParser(); xmlParser.LoadXml(_xml.text); var sheet = xmlParser.SelectSheet("Settings"); _collection = new List <PlayerSettings>(); sheet.SelectRow(2); while (sheet.MoveNext()) { var currentRow = sheet.CurrentRow; var level = currentRow[0].IntValue; var attack = currentRow[1].IntValue; var defense = currentRow[2].IntValue; var life = currentRow[3].IntValue; var crit = currentRow[4].FloatValue; var critHurt = currentRow[5].IntValue; var ignoreAttack = currentRow[6].IntValue; var ignoreDefense = currentRow[7].IntValue; var iconName = currentRow[8].StringValue; var settings = new PlayerSettings(); settings.Level = level; settings.Attack = attack; settings.Defense = defense; settings.Life = life; settings.Crit = crit; settings.CritHurt = critHurt; settings.IgnoreAttack = ignoreAttack; settings.IgnoreDefense = ignoreDefense; settings.Icon = UnityEditor.AssetDatabase.LoadAssetAtPath <Sprite>("Assets/EvolveWar/Texture2D/BattleIcon/" + iconName + ".psd"); _collection.Add(settings); } }
public void LoadXml() { var xmlParser = new OpenXmlParser(); xmlParser.LoadXml(_xml.text); var sheet = xmlParser.SelectSheet("Settings"); _collection = new List <SkillSettings>(); sheet.SelectRow(1); while (sheet.MoveNext()) { var currentRow = sheet.CurrentRow; var id = currentRow[0].StringValue; var iconName = currentRow[1].StringValue; var quality = currentRow[2].IntValue; var level = currentRow[3].IntValue; var displayName = currentRow[4].StringValue; var description = currentRow[5].StringValue; var attack = currentRow[6].IntValue; var defense = currentRow[7].IntValue; var life = currentRow[8].IntValue; var crit = currentRow[9].FloatValue; var critHurt = currentRow[10].IntValue; var ignoreAttack = currentRow[11].IntValue; var ignoreDefense = currentRow[12].IntValue; var triggerProb = currentRow[13].IntValue; var hurt = currentRow[14].IntValue; var settings = new SkillSettings(); settings.ID = id; settings.Icon = UnityEditor.AssetDatabase.LoadAssetAtPath <Sprite>("Assets/EvolveWar/Texture2D/Skill/" + iconName + ".png"); settings.Quality = quality; settings.Level = level; settings.DisplayName = displayName; settings.Description = description; settings.Attack = attack; settings.Defense = defense; settings.Life = life; settings.Crit = crit; settings.CritHurt = critHurt; settings.IgnoreAttack = ignoreAttack; settings.IgnoreDefense = ignoreDefense; settings.TriggerProb = triggerProb; settings.Hurt = hurt; _collection.Add(settings); } }
public void LoadExcel() { _nickNames = new List <string>(); var xml = new OpenXmlParser(); xml.LoadXml(_excel.text); var sheet = xml.SelectSheet("NickName"); while (sheet.MoveNext()) { var nickName = sheet.CurrentRow[0].StringValue; if (!string.IsNullOrEmpty(nickName)) { _nickNames.Add(nickName); } } }