using DistantLands.Cozy; using DistantLands.Cozy.EditorScripts; using UnityEditor; using UnityEditor.Overlays; using UnityEditor.Toolbars; using UnityEngine; using UnityEngine.UIElements; using PopupWindow = UnityEditor.PopupWindow; namespace DistantLands.Cozy.EditorScripts { public class CozyTimeOverlay : PopupWindowContent { Slider CurrentTime => root.Q("time"); IntegerField CurrentDay => root.Q("day"); IntegerField CurrentYear => root.Q("year"); VisualElement root; public VisualElement CreatePanelContent() { root = new VisualElement(); VisualTreeAsset asset = AssetDatabase.LoadAssetAtPath( "Packages/com.distantlands.cozy.core/Editor/UI/Window/UXML/cozy-time-tools.uxml" ); asset.CloneTree(root); CurrentTime.value = CozyWeather.instance.dayPercentage; CurrentTime.RegisterCallback((ChangeEvent evt) => { CozyWeather.instance.timeModule.currentTime = evt.newValue; }); CurrentDay.value = CozyWeather.instance.timeModule.currentDay; CurrentDay.RegisterCallback((ChangeEvent evt) => { CozyWeather.instance.timeModule.currentDay = evt.newValue; }); CurrentYear.value = CozyWeather.instance.timeModule.currentYear; CurrentYear.RegisterCallback((ChangeEvent evt) => { CozyWeather.instance.timeModule.currentYear = evt.newValue; }); return root; } public override Vector2 GetWindowSize() { return new Vector2(200, 150); } public override void OnGUI(Rect rect) { // Intentionally left empty } public override void OnOpen() { editorWindow.rootVisualElement.Add(CreatePanelContent()); } public override void OnClose() { } } public class CozySceneToolsOverlay : PopupWindowContent { VisualElement root; public VisualElement CreatePanelContent() { root = new VisualElement(); VisualTreeAsset asset = AssetDatabase.LoadAssetAtPath( "Packages/com.distantlands.cozy.core/Editor/UI/Window/UXML/cozy-scene-tools.uxml" ); asset.CloneTree(root); root.Q