public override void Register(WorldComponent_DefEditingResearchManager comp) { WorldComp = comp; FieldInfo fieldInfo = typeof(BuildingProperties).GetField(fieldName, RSUUtil.universal); LogicFieldEditor logicFieldEditor = new LogicFieldEditor(fieldInfo, fieldInfo.GetValue(def.building), RSUUtil.Parse(fieldInfo, value), def.building); Editor = logicFieldEditor; WorldComp.AddEditor(Editor, false); }
public override void Register(WorldComponent_DefEditingResearchManager comp) { WorldComp = comp; FieldInfo fieldInfo = def.GetType().GetFields(RSUUtil.universal).ToList().Find(field => field.Name == fieldName); if (fieldInfo == null) { Log.Error(string.Format("Cannot find field {0} in Def {1}", fieldName, def.defName)); } LogicFieldEditor logicFieldEditor = new LogicFieldEditor(fieldInfo, fieldInfo.GetValue(def), RSUUtil.Parse(fieldInfo, value), def); Editor = logicFieldEditor; WorldComp.AddEditor(Editor, false); }
public override void Register(WorldComponent_DefEditingResearchManager comp) { WorldComp = comp; FieldInfo fieldInfo = type.GetField(fieldName, RSUUtil.universal); var compProps = def.comps.Find(c => c.GetType() == type || c.GetType().IsSubclassOf(type)); if (compProps == null) { Log.Error("CompProperties type " + type.FullName + " was not found."); return; } LogicFieldEditor logicFieldEditor = new LogicFieldEditor(fieldInfo, fieldInfo.GetValue(compProps), RSUUtil.Parse(fieldInfo, value), compProps); Editor = logicFieldEditor; WorldComp.AddEditor(Editor, false); }