@@ -228,7 +228,7 @@ public static JsonSetting[] invoke(object map, Type type,Dictionary<string,strin
228
228
{
229
229
if ( mapper . ContainsKey ( "field" ) ) //field
230
230
{
231
- PropertyInfo info = type . GetProperty ( "field" ) ;
231
+ PropertyInfo info = type . GetProperty ( mapper [ "field" ] ) ;
232
232
if ( info != null )
233
233
{
234
234
//两种情况 读写
@@ -241,9 +241,9 @@ public static JsonSetting[] invoke(object map, Type type,Dictionary<string,strin
241
241
}
242
242
else
243
243
{
244
- if ( Utils . isCommon ( info . PropertyType ) )
244
+ if ( isCommon ( info . PropertyType ) )
245
245
{
246
- info . SetValue ( map , Utils . getTypeValue ( mapper [ "value" ] ) ) ;
246
+ info . SetValue ( map , getTypeValue ( mapper [ "value" ] ) ) ;
247
247
}
248
248
249
249
}
@@ -255,13 +255,17 @@ public static JsonSetting[] invoke(object map, Type type,Dictionary<string,strin
255
255
//获得值
256
256
//字段只支持普通值
257
257
object obj = info . GetValue ( map ) ;
258
- if ( Utils . isCommon ( obj . GetType ( ) ) )
258
+ if ( isCommon ( obj . GetType ( ) ) )
259
259
{
260
- return Utils . getOne ( mapper [ "id" ] , obj , null ) ;
260
+ return getOne ( mapper [ "id" ] , obj , null ) ;
261
261
}
262
262
else
263
263
{
264
- return Utils . getOne ( mapper [ "id" ] , obj , null ) ;
264
+ //这地方不支持其他值
265
+ if ( obj . GetType ( ) . IsSubclassOf ( typeof ( Enum ) ) )
266
+ return getOne ( mapper [ "id" ] , obj , null ) ;
267
+ else
268
+ return getOne ( mapper [ "id" ] , obj , null ) ;
265
269
}
266
270
}
267
271
}
@@ -280,13 +284,14 @@ public static JsonSetting[] invoke(object map, Type type,Dictionary<string,strin
280
284
ParameterInfo [ ] infos = info . GetParameters ( ) ;
281
285
for ( int i = 0 ; i < args . Length ; i ++ )
282
286
{
283
- if ( Utils . isCommon ( infos [ i ] . ParameterType ) )
287
+ if ( isCommon ( infos [ i ] . ParameterType ) )
284
288
{
285
- objs [ i ] = Utils . getTypeValue ( args [ i ] ) ; //针对于普通值
289
+ objs [ i ] = getTypeValue ( args [ i ] ) ; //针对于普通值
286
290
}
287
291
else
288
292
{
289
- if ( infos [ i ] . ParameterType == typeof ( Player ) )
293
+ //如果不是enum的子类,那么就是api类型
294
+ if ( ! infos [ i ] . ParameterType . IsSubclassOf ( typeof ( Enum ) ) )
290
295
{
291
296
objs [ i ] = ProxyHandler . handler . apiMapping [ args [ i ] ] ; //转换玩家对象
292
297
}
@@ -306,14 +311,14 @@ public static JsonSetting[] invoke(object map, Type type,Dictionary<string,strin
306
311
//有返回值
307
312
if ( mapper . ContainsKey ( "read" ) )
308
313
{
309
- if ( Utils . isCommon ( info . ReturnType ) )
314
+ if ( isCommon ( info . ReturnType ) )
310
315
{
311
- return Utils . getOne ( mapper [ "id" ] , obj , null ) ; //普通值
316
+ return getOne ( mapper [ "id" ] , obj , null ) ; //普通值
312
317
}
313
318
314
319
if ( obj is Enum )
315
320
{
316
- return Utils . getOne ( mapper [ "id" ] , obj , null ) ; //枚举值
321
+ return getOne ( mapper [ "id" ] , obj , null ) ; //枚举值
317
322
}
318
323
//特殊对象
319
324
if ( obj is List < Item > )
@@ -330,7 +335,7 @@ public static JsonSetting[] invoke(object map, Type type,Dictionary<string,strin
330
335
if ( obj is List < Vector > || obj is Dictionary < Vector , Vector > )
331
336
{
332
337
333
- return Utils . getOne ( mapper [ "id" ] , obj , null ) ;
338
+ return getOne ( mapper [ "id" ] , obj , null ) ;
334
339
}
335
340
336
341
if ( obj is List < Door > )
0 commit comments