diff --git a/Convention/Resources/WindowsPlugins/BaseWindow.prefab b/Convention/Resources/WindowsPlugins/BaseWindow.prefab index 0840d37..f95b051 100644 --- a/Convention/Resources/WindowsPlugins/BaseWindow.prefab +++ b/Convention/Resources/WindowsPlugins/BaseWindow.prefab @@ -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 diff --git a/Convention/Resources/WindowsPlugins/Hierarchy Variant.prefab b/Convention/Resources/WindowsPlugins/Hierarchy Variant.prefab index 3086694..3248318 100644 --- a/Convention/Resources/WindowsPlugins/Hierarchy Variant.prefab +++ b/Convention/Resources/WindowsPlugins/Hierarchy Variant.prefab @@ -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 diff --git a/Convention/[Runtime]/AudioSystem.cs b/Convention/[Runtime]/AudioSystem.cs index 06fa0da..7e59a89 100644 --- a/Convention/[Runtime]/AudioSystem.cs +++ b/Convention/[Runtime]/AudioSystem.cs @@ -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; diff --git a/Convention/[Runtime]/Camera/FreeSceneCamera.cs b/Convention/[Runtime]/Camera/FreeSceneCamera.cs index 4ab5142..b81b24c 100644 --- a/Convention/[Runtime]/Camera/FreeSceneCamera.cs +++ b/Convention/[Runtime]/Camera/FreeSceneCamera.cs @@ -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; diff --git a/Convention/[Runtime]/Config.cs b/Convention/[Runtime]/Config.cs index ac1e454..d7bb721 100644 --- a/Convention/[Runtime]/Config.cs +++ b/Convention/[Runtime]/Config.cs @@ -1267,35 +1267,47 @@ namespace Convention return false; } + public static List SeekMemberInfoFromType( + [In] Type targetType, + [In, Opt] IEnumerable attrs, [In, Opt] IEnumerable types, + [In, Opt] Type untilBase = null + ) + { + List 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 SeekMemberInfo( [In] object target, [In, Opt] IEnumerable attrs, [In, Opt] IEnumerable types, [In, Opt] Type untilBase = null ) { - Type _CurType = target.GetType(); - List 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 SeekMemberInfo([In] object target, IEnumerable names, BindingFlags flags = BindingFlags.Public | BindingFlags.Instance) + public static List SeekMemberInfoFromType([In] Type target, IEnumerable names, + BindingFlags flags = BindingFlags.Public | BindingFlags.Instance) { - Type _CurType = target.GetType(); - List result = _CurType.GetMembers(flags).ToList(); + List result = target.GetMembers(flags).ToList(); HashSet nameSet = names.ToHashSet(); result.RemoveAll(x => nameSet.Contains(x.Name) == false); return result; } + public static List SeekMemberInfo([In] object target, IEnumerable 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) diff --git a/Convention/[Runtime]/File.cs b/Convention/[Runtime]/File.cs index 1b51c13..cc3f868 100644 --- a/Convention/[Runtime]/File.cs +++ b/Convention/[Runtime]/File.cs @@ -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(); } diff --git a/Convention/[Runtime]/GlobalConfig.cs b/Convention/[Runtime]/GlobalConfig.cs index 59df067..db1e953 100644 --- a/Convention/[Runtime]/GlobalConfig.cs +++ b/Convention/[Runtime]/GlobalConfig.cs @@ -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(); diff --git a/Convention/[Visual]/UIComponent/Variant/PropertiesWindow.cs b/Convention/[Visual]/UIComponent/Variant/PropertiesWindow.cs index 0101d5c..7cf18cb 100644 --- a/Convention/[Visual]/UIComponent/Variant/PropertiesWindow.cs +++ b/Convention/[Visual]/UIComponent/Variant/PropertiesWindow.cs @@ -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));