public static bool AddSingleDrop(string id, string name, string num) { Drop_Single_Str single = new Drop_Single_Str(); single.name = name; single.num = num; for (int i = 0; i < m_DropList.Count; i++) { if (CFormat.ToSimplified(m_DropList[i].id) == id) { m_DropList[i].list.Add(single); return(true); } } try { //找不到该id Drop_Str drop = new Drop_Str(); drop.list = new List <Drop_Single_Str>(); drop.id = id; drop.list.Add(single); m_DropList.Add(drop); return(true); } catch { return(false); } }
public static bool GetDropAttrById(string id, out Drop_Str drop) { foreach (var item in m_DropList) { if (CFormat.ToSimplified(item.id) == id) { drop = item; return(true); } } drop = new Drop_Str(); drop.list = new List <Drop_Single_Str>(); drop.id = id; return(false); }