Update
This commit is contained in:
parent
86237eb31d
commit
98be2c5331
@ -56,9 +56,9 @@ namespace SkinHide
|
|||||||
new PlayerModelViewPatch().Enable();
|
new PlayerModelViewPatch().Enable();
|
||||||
new PlayerPatch().Enable();
|
new PlayerPatch().Enable();
|
||||||
|
|
||||||
ReflectionDatas.RefSlotViews = RefHelp.FieldRef<PlayerBody, object>.Create(new string[] { "SlotViews" });
|
ReflectionDatas.RefSlotViews = RefHelp.FieldRef<PlayerBody, object>.Create("SlotViews");
|
||||||
ReflectionDatas.RefSlotList = RefHelp.FieldRef<object, IEnumerable<object>>.Create(ReflectionDatas.RefSlotViews.FieldType, new string[] { "list_0" });
|
ReflectionDatas.RefSlotList = RefHelp.FieldRef<object, IEnumerable<object>>.Create(ReflectionDatas.RefSlotViews.FieldType, "list_0");
|
||||||
ReflectionDatas.RefDresses = RefHelp.FieldRef<object, Dress[]>.Create(ReflectionDatas.RefSlotList.FieldType.GetGenericArguments()[0], new string[] { "Dresses" });
|
ReflectionDatas.RefDresses = RefHelp.FieldRef<object, Dress[]>.Create(ReflectionDatas.RefSlotList.FieldType.GetGenericArguments()[0], "Dresses");
|
||||||
ReflectionDatas.RefRenderers = RefHelp.FieldRef<Dress, Renderer[]>.Create(new string[] { "Renderers" });
|
ReflectionDatas.RefRenderers = RefHelp.FieldRef<Dress, Renderer[]>.Create(new string[] { "Renderers" });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,6 +147,18 @@ namespace SkinHide.Utils
|
|||||||
Init(propertyinfo, instance);
|
Init(propertyinfo, instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PropertyRef(Type type, string propertyname, object instance = null)
|
||||||
|
{
|
||||||
|
PropertyInfo propertyInfo = type.GetProperty(propertyname, AccessTools.all);
|
||||||
|
|
||||||
|
if (propertyInfo == null)
|
||||||
|
{
|
||||||
|
throw new Exception(propertyname + " is null");
|
||||||
|
}
|
||||||
|
|
||||||
|
Init(propertyInfo, instance);
|
||||||
|
}
|
||||||
|
|
||||||
public PropertyRef(Type type, string[] propertynames, object instance = null)
|
public PropertyRef(Type type, string[] propertynames, object instance = null)
|
||||||
{
|
{
|
||||||
PropertyInfo propertyInfo = propertynames.Select(x => type.GetProperty(x, AccessTools.all)).FirstOrDefault(x => x != null);
|
PropertyInfo propertyInfo = propertynames.Select(x => type.GetProperty(x, AccessTools.all)).FirstOrDefault(x => x != null);
|
||||||
@ -191,11 +203,21 @@ namespace SkinHide.Utils
|
|||||||
return new PropertyRef<T, F>(propertyinfo, instance);
|
return new PropertyRef<T, F>(propertyinfo, instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static PropertyRef<T, F> Create(string propertyname, object instance = null)
|
||||||
|
{
|
||||||
|
return new PropertyRef<T, F>(typeof(T), propertyname, instance);
|
||||||
|
}
|
||||||
|
|
||||||
public static PropertyRef<T, F> Create(string[] propertynames, object instance = null)
|
public static PropertyRef<T, F> Create(string[] propertynames, object instance = null)
|
||||||
{
|
{
|
||||||
return new PropertyRef<T, F>(typeof(T), propertynames, instance);
|
return new PropertyRef<T, F>(typeof(T), propertynames, instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static PropertyRef<T, F> Create(Type type, string propertyname, object instance = null)
|
||||||
|
{
|
||||||
|
return new PropertyRef<T, F>(type, propertyname, instance);
|
||||||
|
}
|
||||||
|
|
||||||
public static PropertyRef<T, F> Create(Type type, string[] propertynames, object instance = null)
|
public static PropertyRef<T, F> Create(Type type, string[] propertynames, object instance = null)
|
||||||
{
|
{
|
||||||
return new PropertyRef<T, F>(type, propertynames, instance);
|
return new PropertyRef<T, F>(type, propertynames, instance);
|
||||||
@ -264,6 +286,18 @@ namespace SkinHide.Utils
|
|||||||
Init(fieldinfo, instance);
|
Init(fieldinfo, instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public FieldRef(Type type, string fieldname, object instance = null)
|
||||||
|
{
|
||||||
|
FieldInfo fieldInfo = type.GetField(fieldname, AccessTools.all);
|
||||||
|
|
||||||
|
if (fieldInfo == null)
|
||||||
|
{
|
||||||
|
throw new Exception(fieldInfo + " is null");
|
||||||
|
}
|
||||||
|
|
||||||
|
Init(fieldInfo, instance);
|
||||||
|
}
|
||||||
|
|
||||||
public FieldRef(Type type, string[] fieldnames, object instance = null)
|
public FieldRef(Type type, string[] fieldnames, object instance = null)
|
||||||
{
|
{
|
||||||
FieldInfo fieldInfo = fieldnames.Select(x => type.GetField(x, AccessTools.all)).FirstOrDefault(x => x != null);
|
FieldInfo fieldInfo = fieldnames.Select(x => type.GetField(x, AccessTools.all)).FirstOrDefault(x => x != null);
|
||||||
@ -281,11 +315,21 @@ namespace SkinHide.Utils
|
|||||||
return new FieldRef<T, F>(fieldinfo, instance);
|
return new FieldRef<T, F>(fieldinfo, instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static FieldRef<T, F> Create(string fieldname, object instance = null)
|
||||||
|
{
|
||||||
|
return new FieldRef<T, F>(typeof(T), fieldname, instance);
|
||||||
|
}
|
||||||
|
|
||||||
public static FieldRef<T, F> Create(string[] fieldnames, object instance = null)
|
public static FieldRef<T, F> Create(string[] fieldnames, object instance = null)
|
||||||
{
|
{
|
||||||
return new FieldRef<T, F>(typeof(T), fieldnames, instance);
|
return new FieldRef<T, F>(typeof(T), fieldnames, instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static FieldRef<T, F> Create(Type type, string fieldname, object instance = null)
|
||||||
|
{
|
||||||
|
return new FieldRef<T, F>(type, fieldname, instance);
|
||||||
|
}
|
||||||
|
|
||||||
public static FieldRef<T, F> Create(Type type, string[] fieldnames, object instance = null)
|
public static FieldRef<T, F> Create(Type type, string[] fieldnames, object instance = null)
|
||||||
{
|
{
|
||||||
return new FieldRef<T, F>(type, fieldnames, instance);
|
return new FieldRef<T, F>(type, fieldnames, instance);
|
||||||
@ -361,4 +405,5 @@ namespace SkinHide.Utils
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user