private static void DrawListField(Rect contentRect, SerializedProperty property) { IIdList <TEntity> list = ListFactory <TEntity> .Instance.GetList(); if (list == null) { list = IdList <TEntity> .Instance; } if (list == null) { EditorGUI.LabelField(contentRect, IdList <TEntity> .ListName() + " instance not found!"); } else { List <string> displayedOptions = new List <string>(); List <int> optionValues = new List <int>(); foreach (TEntity obj in list) { IdComponent idComponent = obj.GetComponent <IdComponent>(); displayedOptions.Add(string.Format("{0} - {1}", idComponent.id, IdListDrawerUtil <TEntity> .GetTitleForObject(obj))); optionValues.Add(idComponent.id); } property.intValue = EditorGUI.IntPopup(contentRect, property.intValue, displayedOptions.ToArray(), optionValues.ToArray()); } }
private void CreateMap() { this._map.Clear(); foreach (TEntity entity in this._data) { if (entity == null) { continue; } DTEntityInitializer.Initialize <TEntity>(entity); IdComponent idComponent = entity.GetComponent <IdComponent>(); if (idComponent == null) { Debug.LogError("IdList - entity does not have IdComponent!"); continue; } this._map[idComponent.id] = entity; } }