Merge branch 'Test-for-windowdance'

This commit is contained in:
Firerise9402 2023-10-09 15:20:37 -04:00
commit b7b9de7b32
8 changed files with 104 additions and 91 deletions

View file

@ -455,6 +455,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: a063196b0fe162045b5e345c3f220fcf, type: 3}
m_Name:
m_EditorClassIdentifier:
UniController: {fileID: 0}
--- !u!1 &3741076794236313655
GameObject:
m_ObjectHideFlags: 0

View file

@ -2470,7 +2470,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
@ -13803,6 +13803,10 @@ PrefabInstance:
propertyPath: m_ConstrainProportionsScale
value: 0
objectReference: {fileID: 0}
- 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
@ -13869,7 +13873,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
@ -16079,6 +16083,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

View file

@ -1,8 +1,8 @@
using System;
public static class AppInfo {
public const string Version = "0.0.1049";
public static readonly DateTime Date = new DateTime(2023, 08, 24, 16, 15, 20, 951, 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);
}

View file

@ -749,10 +749,10 @@ namespace HeavenStudio
),
new GameAction("pan window", "Move Window", 1f, true, new List<Param>()
{
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")
}
),

View file

@ -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));
}
}
}

View file

@ -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",

View file

@ -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,

View file

@ -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.1049
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: 1049
Standalone: 1051
iPhone: 0
tvOS: 0
overrideDefaultApplicationIdentifier: 0
AndroidBundleVersionCode: 1049
AndroidBundleVersionCode: 1051
AndroidMinSdkVersion: 22
AndroidTargetSdkVersion: 0
AndroidPreferredInstallLocation: 1