public static bool String2IdLvlList(string str, List <int> idLvlList, char separatorChar = ';') { if (string.IsNullOrEmpty(str)) { return(true); } char[] separator = new char[] { separatorChar }; string[] values = str.Split(separator); try { char[] idLvlSeparator = new char[] { ',' }; foreach (var idLvlValue in values) { string[] idLvlArr = idLvlValue.Split(idLvlSeparator); int id = System.Convert.ToInt32(idLvlArr[0]); byte level = (byte)System.Convert.ToInt32(idLvlArr[1]); idLvlList.Add(CBattleCommonDef.MakeIDLevel(id, level)); } } catch { ggc.Foundation.Log.LogErrorMsg("Wrong Skill Id Lvl in table value: " + str); return(false); } return(true); }
public static int String2IdLvl(string str, char separatorChar = ',') { int id = CBattleCommonDef.INVALID_SKILL_ID; byte lvl = CBattleCommonDef.INVALID_SKILL_LEVEL; char[] separator = new char[] { separatorChar }; string[] values = str.Split(separator); try { id = System.Convert.ToInt32(values[0]); lvl = (byte)System.Convert.ToInt32(values[1]); return(CBattleCommonDef.MakeIDLevel(id, lvl)); } catch { ggc.Foundation.Log.LogErrorMsg("Wrong Id Lvl in table value: " + str); return(0); } }