private void InitItemsCount() { // 清空当前显示 for (int i = 0; i < _itemList.Count; i++) { _itemList[i].valueText.text = ""; } string attrValueStr = _nodeAttr.GetValueString(); // 获取掉落道具的列表 List <string> paraList; if (attrValueStr == "") { paraList = new List <string>(); } else { paraList = new List <string>(attrValueStr.Split(',')); } for (int i = 0; i < paraList.Count; i += 2) { eDropItemType curType = (eDropItemType)int.Parse(paraList[i]); EditItem editItem = GetEditItemByType(curType); editItem.valueText.text = paraList[i + 1]; } }
private EditItem GetEditItemByType(eDropItemType type) { for (int i = 0; i < _itemList.Count; i++) { if (_itemList[i].type == type) { return(_itemList[i]); } } throw new Exception("Cannot find edit item of type " + type); }