终于修复了PropertyItem多层预制体的收纳/展开rect错误

This commit is contained in:
2025-09-07 17:50:20 +08:00
parent 427b916dd2
commit 6de8b3ebc5
8 changed files with 58 additions and 27 deletions

View File

@@ -1106,7 +1106,7 @@ MonoBehaviour:
m_ChildAlignment: 0
m_Spacing: 2
m_ChildForceExpandWidth: 1
m_ChildForceExpandHeight: 1
m_ChildForceExpandHeight: 0
m_ChildControlWidth: 0
m_ChildControlHeight: 0
m_ChildScaleWidth: 0

View File

@@ -58,7 +58,7 @@ MonoBehaviour:
m_ChildAlignment: 0
m_Spacing: 0
m_ChildForceExpandWidth: 1
m_ChildForceExpandHeight: 1
m_ChildForceExpandHeight: 0
m_ChildControlWidth: 0
m_ChildControlHeight: 0
m_ChildScaleWidth: 0

View File

@@ -14,13 +14,18 @@ namespace Convention
public abstract void LoadAudioClip(AudioClip clip);
public abstract AudioClip GetAudioClip();
public abstract float GetClockTime();
public abstract void SetClockTime(float value);
public AudioClip CurrentClip
{
get => GetAudioClip();
set => LoadAudioClip(value);
}
public float CurrentTime => GetClockTime();
public float CurrentTime
{
get => GetClockTime();
set => SetClockTime(value);
}
public abstract bool IsPlaying();
@@ -207,9 +212,16 @@ namespace Convention
}
public override float GetClockTime()
{
if (Source.clip == null)
return 0;
return (float)Source.timeSamples / (float)Source.clip.frequency;
}
public override void SetClockTime(float value)
{
Source.time = value;
}
public override bool IsPlaying()
{
return Source.isPlaying;

View File

@@ -64,7 +64,11 @@ namespace Convention
}
if (Keyboard.current[Key.Space].isPressed)
dxyz += Vector3.up;
#if !UNITY_EDITOR
if (Keyboard.current[Key.LeftShift].isPressed)
#else
if (Keyboard.current[Key.Q].isPressed)
#endif
dxyz -= Vector3.up;
var drotation = Vector3.zero;

View File

@@ -1267,35 +1267,47 @@ namespace Convention
return false;
}
public static List<MemberInfo> SeekMemberInfoFromType(
[In] Type targetType,
[In, Opt] IEnumerable<Type> attrs, [In, Opt] IEnumerable<Type> types,
[In, Opt] Type untilBase = null
)
{
List<MemberInfo> result = new();
result.AddRange(targetType.GetMembers(BindingFlags.Public | BindingFlags.Instance));
while (targetType != null && targetType != typeof(object) && targetType != untilBase)
{
result.AddRange(
from info in targetType.GetMembers(BindingFlags.NonPublic | BindingFlags.Instance)
where attrs == null || HasCustomAttribute(info, attrs)
where types == null || (GetMemberValueType(info, out var type) && types.Contains(type))
select info
);
targetType = targetType.BaseType;
}
return result;
}
public static List<MemberInfo> SeekMemberInfo(
[In] object target,
[In, Opt] IEnumerable<Type> attrs, [In, Opt] IEnumerable<Type> types,
[In, Opt] Type untilBase = null
)
{
Type _CurType = target.GetType();
List<MemberInfo> result = new();
result.AddRange(_CurType.GetMembers(BindingFlags.Public | BindingFlags.Instance));
while (_CurType != null && _CurType != typeof(object) && _CurType != untilBase)
{
result.AddRange(
from info in _CurType.GetMembers(BindingFlags.NonPublic | BindingFlags.Instance)
where attrs == null || HasCustomAttribute(info, attrs)
where types == null || (GetMemberValueType(info, out var type) && types.Contains(type))
select info
);
_CurType = _CurType.BaseType;
}
return result;
return SeekMemberInfoFromType(target.GetType(), attrs, types, untilBase);
}
public static List<MemberInfo> SeekMemberInfo([In] object target, IEnumerable<string> names, BindingFlags flags = BindingFlags.Public | BindingFlags.Instance)
public static List<MemberInfo> SeekMemberInfoFromType([In] Type target, IEnumerable<string> names,
BindingFlags flags = BindingFlags.Public | BindingFlags.Instance)
{
Type _CurType = target.GetType();
List<MemberInfo> result = _CurType.GetMembers(flags).ToList();
List<MemberInfo> result = target.GetMembers(flags).ToList();
HashSet<string> nameSet = names.ToHashSet();
result.RemoveAll(x => nameSet.Contains(x.Name) == false);
return result;
}
public static List<MemberInfo> SeekMemberInfo([In] object target, IEnumerable<string> names,
BindingFlags flags = BindingFlags.Public | BindingFlags.Instance)
{
return SeekMemberInfoFromType(target.GetType(), names, flags);
}
public static object InvokeMember([In] MemberInfo member, [In] object target, params object[] parameters)
{
if (member is MethodInfo method)

View File

@@ -188,7 +188,7 @@ namespace Convention
if (IsFile() == false)
throw new InvalidOperationException("Target is not a file");
string result = "";
using (var fs = (this.OriginInfo as FileInfo).OpenText())
using (var fs = new StreamReader((this.OriginInfo as FileInfo).OpenRead()))
{
result = fs.ReadToEnd();
}

View File

@@ -51,12 +51,9 @@ namespace Convention
public ToolFile GetConfigFile() => DataDir | ConstConfigFile;
public ToolFile ConfigFile => GetConfigFile();
public ToolFile GetFile(string path, bool isMustExist = false)
public ToolFile GetFile(string path)
{
var file = DataDir | path;
if (isMustExist)
file.MustExistsPath();
return file;
return DataDir | path;
}
public bool EraseFile(string path)
{
@@ -154,7 +151,7 @@ namespace Convention
public ToolFile GetLogFile()
{
return this.GetFile(ConfigFile.GetName(true) + "_log.txt", true);
return this.GetFile(ConfigFile.GetName(true) + "_log.txt").MustExistsPath();
}
public ToolFile LogFile => GetLogFile();

View File

@@ -287,6 +287,12 @@ namespace Convention.WindowsUI.Variant
private void ForceRebuildLayoutImmediate()
{
// TODO
if(this.parentEntry!=null)
{
}
return;
if (ref_value != null)
{
ConventionUtility.StartCoroutine(Adjuster(ref_value.transform as RectTransform));