private LuaBindingDataBase CheckBinding(LuaClassField field, Type dataBindType) { LuaBindingDataBase matched = null; foreach (var bind in binding.LuaData) { if (bind.FieldName != field.FieldName) { continue; } if (bind.GetType() != dataBindType) { continue; } matched = bind; break; } if (matched == null) { matched = Activator.CreateInstance(dataBindType) as LuaBindingDataBase; matched.FieldName = field.FieldName; ArrayUtility.Add(ref binding.LuaData, matched); } isUsedBinding.Add(matched); matched.FieldType = field.FieldType; return(matched); }
private T CheckBinding <T>(LuaClassField field) where T : LuaBindingDataBase { return(CheckBinding(field, typeof(T)) as T); }