diff --git a/Assets/Resources/Prefabs/GameView/CamerasEditor.prefab b/Assets/Resources/Prefabs/GameView/CamerasEditor.prefab index 5501d5946..0456bb4ea 100644 --- a/Assets/Resources/Prefabs/GameView/CamerasEditor.prefab +++ b/Assets/Resources/Prefabs/GameView/CamerasEditor.prefab @@ -450,6 +450,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: a063196b0fe162045b5e345c3f220fcf, type: 3} m_Name: m_EditorClassIdentifier: + UniController: {fileID: 0} --- !u!1 &3741076794236313655 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scenes/Editor.unity b/Assets/Scenes/Editor.unity index d42cef826..34bbcadfd 100644 --- a/Assets/Scenes/Editor.unity +++ b/Assets/Scenes/Editor.unity @@ -2465,7 +2465,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 285182280367868644, guid: 81ce52789acca4440804eb938de70425, type: 3} propertyPath: m_RootOrder - value: 9 + value: 10 objectReference: {fileID: 0} - target: {fileID: 285182280367868644, guid: 81ce52789acca4440804eb938de70425, type: 3} propertyPath: m_LocalPosition.x @@ -13774,6 +13774,10 @@ PrefabInstance: m_Modification: m_TransformParent: {fileID: 0} m_Modifications: + - target: {fileID: 176381795900272283, guid: 720073bc7682b1441bece7116681f72c, type: 3} + propertyPath: UniController + value: + objectReference: {fileID: 693146899} - target: {fileID: 3558106557710386107, guid: 720073bc7682b1441bece7116681f72c, type: 3} propertyPath: m_BlockingMask.m_Bits value: 0 @@ -13796,7 +13800,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 6052331674888157612, guid: 720073bc7682b1441bece7116681f72c, type: 3} propertyPath: m_RootOrder - value: 8 + value: 9 objectReference: {fileID: 0} - target: {fileID: 6052331674888157612, guid: 720073bc7682b1441bece7116681f72c, type: 3} propertyPath: m_LocalPosition.x @@ -15983,6 +15987,74 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 692958306} m_CullTransparentMesh: 1 +--- !u!1001 &693146897 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 2416199871598626842, guid: e893aefd93740714b999573b02916984, type: 3} + propertyPath: m_RootOrder + value: 8 + objectReference: {fileID: 0} + - target: {fileID: 2416199871598626842, guid: e893aefd93740714b999573b02916984, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2416199871598626842, guid: e893aefd93740714b999573b02916984, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2416199871598626842, guid: e893aefd93740714b999573b02916984, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2416199871598626842, guid: e893aefd93740714b999573b02916984, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 2416199871598626842, guid: e893aefd93740714b999573b02916984, type: 3} + propertyPath: m_LocalRotation.x + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 2416199871598626842, guid: e893aefd93740714b999573b02916984, type: 3} + propertyPath: m_LocalRotation.y + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 2416199871598626842, guid: e893aefd93740714b999573b02916984, type: 3} + propertyPath: m_LocalRotation.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 2416199871598626842, guid: e893aefd93740714b999573b02916984, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2416199871598626842, guid: e893aefd93740714b999573b02916984, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2416199871598626842, guid: e893aefd93740714b999573b02916984, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2416199871598626844, guid: e893aefd93740714b999573b02916984, type: 3} + propertyPath: m_Name + value: UniWindowController + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: e893aefd93740714b999573b02916984, type: 3} +--- !u!114 &693146899 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 2416199871598626845, guid: e893aefd93740714b999573b02916984, type: 3} + m_PrefabInstance: {fileID: 693146897} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: eb951500192d2430eb3e306480cc2f31, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &703340358 GameObject: m_ObjectHideFlags: 0 @@ -20069,8 +20141,8 @@ MonoBehaviour: m_TargetGraphic: {fileID: 1589389272} m_HandleRect: {fileID: 1589389271} m_Direction: 2 - m_Value: 0 - m_Size: 1 + m_Value: 1 + m_Size: 0.99106413 m_NumberOfSteps: 0 m_OnValueChanged: m_PersistentCalls: @@ -24762,7 +24834,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0.5} m_AnchorMax: {x: 1, y: 0.5} - m_AnchoredPosition: {x: 0, y: 103.926414} + m_AnchoredPosition: {x: 0, y: 118.49958} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 1} --- !u!114 &1154875944 diff --git a/Assets/Scripts/AppInfo.cs b/Assets/Scripts/AppInfo.cs index 21cd91762..bb7aef405 100644 --- a/Assets/Scripts/AppInfo.cs +++ b/Assets/Scripts/AppInfo.cs @@ -1,8 +1,8 @@ using System; public static class AppInfo { - public const string Version = "0.0.1043"; - public static readonly DateTime Date = new DateTime(2023, 08, 16, 15, 30, 08, 305, DateTimeKind.Utc); + public const string Version = "0.0.1051"; + public static readonly DateTime Date = new DateTime(2023, 10, 09, 19, 05, 36, 828, DateTimeKind.Utc); } diff --git a/Assets/Scripts/Minigames.cs b/Assets/Scripts/Minigames.cs index 46574643e..4a6e61e91 100644 --- a/Assets/Scripts/Minigames.cs +++ b/Assets/Scripts/Minigames.cs @@ -717,10 +717,10 @@ namespace HeavenStudio new GameAction("pan window", "Move Window", 1f, true, new List() { - new Param("valA", new EntityTypes.Float(-100, 200, 0), "Window X", "The Window's destination X coordinate. Can go off screen. Measured in percent."), - new Param("valB", new EntityTypes.Float(-100, 200, 0), "Window Y", "The Window's destination Y coordinate. Can go off screen. Measured in percent."), + new Param("valA", new EntityTypes.Float(-100, 200, 0), "Window X", "The Window's destination X coordinate. Can go off screen. Measured in percent from bottom left of screen."), + new Param("valB", new EntityTypes.Float(-100, 200, 0), "Window Y", "The Window's destination Y coordinate. Can go off screen. Measured in percent from bottom left of screen."), new Param("ease", Util.EasingFunction.Ease.Linear, "Ease Type"), - new Param("axis", WindowController.ViewAxis.All, "Axis", "Idk why i would need this") + new Param("axis", WindowController.ViewAxis.All, "Axis") } ), diff --git a/Assets/Scripts/WindowController.cs b/Assets/Scripts/WindowController.cs index b1bca1247..7e941d679 100644 --- a/Assets/Scripts/WindowController.cs +++ b/Assets/Scripts/WindowController.cs @@ -9,16 +9,13 @@ using HeavenStudio.Editor; using Jukebox; using Jukebox.Legacy; using System; - - -using System.Runtime.InteropServices; - - +using Kirurobo; namespace HeavenStudio { public class WindowController : MonoBehaviour { + [SerializeField] UniWindowController UniController; public static WindowController instance { get; private set; } public enum ViewAxis @@ -46,85 +43,24 @@ namespace HeavenStudio private static Vector3 panLast; private static Vector3 scaleLast; - /*For anyone with a mac who knows how to code this stuff: - here's a google doc with helpful sites(i think) for getting this working on mac - https://docs.google.com/document/d/1mvHNNsXC6mo7PV6yZitpKam1fYnud7CXP73YLsebEo8/edit?usp=sharing - good luck i cant figure this out - - update: just some default values for nscontroller or whatever it is: - - windowstyle is closable; resizable; tilted - nsbackthingy's default is buffer - */ - - //Credit to Grizmu on the unity forums for this - //DLL Stuff for windows - #region WinDLLstuff - #if UNITY_STANDALONE_WIN - const int SWP_HIDEWINDOW = 0x80; //idk why you would want this but here you go - const int SWP_SHOWWINDOW = 0x40; //show window flag. - const int SWP_NOMOVE = 0x0002; //don't move the window flag. idk why this either - const int SWP_NOSIZE = 0x0001; //don't resize the window flag. or this - const uint WS_SIZEBOX = 0x00040000; - const int GWL_STYLE = -16; - const int WS_BORDER = 0x00800000; //window with border - const int WS_DLGFRAME = 0x00400000; //window with double border but no title what does this do - const int WS_CAPTION = WS_BORDER | WS_DLGFRAME; //window with a title bar - const int WS_SYSMENU = 0x00080000; //window with no borders etc. - const int WS_MAXIMIZEBOX = 0x00010000; - const int WS_MINIMIZEBOX = 0x00020000; //window with minimizebox - [DllImport("user32.dll")] - static extern System.IntPtr GetActiveWindow(); - - [DllImport("user32.dll")] - static extern int FindWindow(string lpClassName, string lpWindowName); - - [DllImport("user32.dll")] - static extern bool SetWindowPos( - System.IntPtr hWnd, - System.IntPtr hWndInsertAfter, - short X, - short Y, - short cx, - short cy, - uint uFlags - ); - - System.IntPtr hWnd; - System.IntPtr HWND_TOP = new System.IntPtr(0); - System.IntPtr HWND_TOPMOST = new System.IntPtr(-1); - System.IntPtr HWND_NOTOPMOST = new System.IntPtr(-2); - - #endif - - - public void SetPosition(System.IntPtr ptr, short x, short y, short resX, short resY) + public void SetPosition(short x, short y, short resX, short resY) { - if(!Application.isEditor && !Editor.Editor.instance.fullscreen && (pan != defaultPan | scale != defaultScale)) Reset(); - if(Application.isEditor || !Editor.Editor.instance.fullscreen) return; - if(PersistentDataManager.gameSettings.windowDanceEnable) - { - #if UNITY_STANDALONE_WIN - SetWindowPos(ptr, HWND_NOTOPMOST, x, y, resX, resY, SWP_SHOWWINDOW); - #endif - } + #if UNITY_EDITOR + return; + #else + UniController.windowSize = (new Vector2(resX, resY)); + UniController.windowPosition = (new Vector2(x, y)); + #endif } private void Awake() { - #if UNITY_STANDALONE_WIN - hWnd = GetActiveWindow(); - #endif AspectRatioWidth = Screen.mainWindowDisplayInfo.width; AspectRatioHeight = Screen.mainWindowDisplayInfo.height; defaultScale = new Vector3(Screen.width, Screen.height, 0); defaultPan = new Vector3(Screen.mainWindowPosition.x, Screen.mainWindowPosition.y, 0); instance = this; } - - - - #endregion // Start is called before the first frame update void Start() @@ -167,9 +103,7 @@ namespace HeavenStudio //SetShakeIntensity(); if(PersistentDataManager.gameSettings.windowDanceEnable) { - #if UNITY_STANDALONE_WIN - SetPosition(hWnd, Convert.ToInt16(pan.x), Convert.ToInt16(pan.y), Convert.ToInt16(scale.x), Convert.ToInt16(scale.y)); - #endif + SetPosition(Convert.ToInt16(pan.x), Convert.ToInt16(pan.y), Convert.ToInt16(scale.x), Convert.ToInt16(scale.y)); } } @@ -282,9 +216,7 @@ namespace HeavenStudio if(Application.isEditor) return; if(PersistentDataManager.gameSettings.windowDanceEnable) { - #if UNITY_STANDALONE_WIN - SetWindowPos(hWnd, HWND_NOTOPMOST, Convert.ToInt16(pan.x), Convert.ToInt16(pan.y), Convert.ToInt16(scale.x), Convert.ToInt16(scale.y), SWP_SHOWWINDOW); - #endif + SetPosition(Convert.ToInt16(pan.x), Convert.ToInt16(pan.y), Convert.ToInt16(scale.x), Convert.ToInt16(scale.y)); } } } diff --git a/Packages/manifest.json b/Packages/manifest.json index 848024e32..1fec2a9f3 100644 --- a/Packages/manifest.json +++ b/Packages/manifest.json @@ -1,5 +1,6 @@ { "dependencies": { + "com.kirurobo.uniwinc": "https://github.com/kirurobo/UniWindowController.git#upm", "com.rheavenstudio.jukebox": "https://github.com/RHeavenStudio/Jukebox.git?path=/Assets/Scripts/Jukebox", "com.unity.2d.sprite": "1.0.0", "com.unity.assetbundlebrowser": "https://github.com/Unity-Technologies/AssetBundles-Browser.git", diff --git a/Packages/packages-lock.json b/Packages/packages-lock.json index 318b26058..235ad42c3 100644 --- a/Packages/packages-lock.json +++ b/Packages/packages-lock.json @@ -1,5 +1,12 @@ { "dependencies": { + "com.kirurobo.uniwinc": { + "version": "https://github.com/kirurobo/UniWindowController.git#upm", + "depth": 0, + "source": "git", + "dependencies": {}, + "hash": "05c2177703266162eb91efa7e359d4b8207ff4ed" + }, "com.rheavenstudio.jukebox": { "version": "https://github.com/RHeavenStudio/Jukebox.git?path=/Assets/Scripts/Jukebox", "depth": 0, diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index 531db4a1a..666c42da2 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -87,7 +87,7 @@ PlayerSettings: usePlayerLog: 1 bakeCollisionMeshes: 0 forceSingleInstance: 0 - useFlipModelSwapchain: 1 + useFlipModelSwapchain: 0 resizableWindow: 1 useMacAppStoreValidation: 0 macAppStoreCategory: public.app-category.games @@ -98,7 +98,7 @@ PlayerSettings: xboxEnableKinectAutoTracking: 0 xboxEnableFitness: 0 visibleInBackground: 1 - allowFullscreenSwitch: 1 + allowFullscreenSwitch: 0 fullscreenMode: 3 xboxSpeechDB: 0 xboxEnableHeadOrientation: 0 @@ -134,7 +134,7 @@ PlayerSettings: 16:10: 1 16:9: 1 Others: 1 - bundleVersion: 0.0.1043 + bundleVersion: 0.0.1051 preloadedAssets: - {fileID: 102900000, guid: 5348c08b82446e0478cee8bda6c02cfc, type: 3} metroInputSource: 0 @@ -158,11 +158,11 @@ PlayerSettings: applicationIdentifier: Standalone: com.RHeavenStudio.Heaven-Studio buildNumber: - Standalone: 1043 + Standalone: 1051 iPhone: 0 tvOS: 0 overrideDefaultApplicationIdentifier: 0 - AndroidBundleVersionCode: 1043 + AndroidBundleVersionCode: 1051 AndroidMinSdkVersion: 22 AndroidTargetSdkVersion: 0 AndroidPreferredInstallLocation: 1