diff --git a/Assets/Prefabs/GameCanvas.prefab b/Assets/Prefabs/GameCanvas.prefab index 250bd09..15f8151 100644 --- a/Assets/Prefabs/GameCanvas.prefab +++ b/Assets/Prefabs/GameCanvas.prefab @@ -723,6 +723,7 @@ RectTransform: - {fileID: 3966045174432275478} - {fileID: 1680159658511062866} - {fileID: 1389147469433647468} + - {fileID: 3829510704376804164} m_Father: {fileID: 3614641596273148411} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} @@ -742,7 +743,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: e090ce5928c145c0b2e514412bc9cdb2, type: 3} m_Name: m_EditorClassIdentifier: - k__BackingField: {fileID: 834552907522022778} + k__BackingField: {fileID: 3829510704376804164} k__BackingField: {fileID: 7700643890201660349} --- !u!223 &7700643890201660349 Canvas: @@ -784,7 +785,7 @@ MonoBehaviour: m_ScaleFactor: 1 m_ReferenceResolution: {x: 1920, y: 1080} m_ScreenMatchMode: 0 - m_MatchWidthOrHeight: 0.5 + m_MatchWidthOrHeight: 1 m_PhysicalUnit: 3 m_FallbackScreenDPI: 96 m_DefaultSpriteDPI: 96 @@ -1992,3 +1993,38 @@ MonoBehaviour: m_EffectColor: {r: 0, g: 0, b: 0, a: 1} m_EffectDistance: {x: 2, y: -2} m_UseGraphicAlpha: 1 +--- !u!1 &8871975742299861017 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3829510704376804164} + m_Layer: 5 + m_Name: Bounds + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &3829510704376804164 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8871975742299861017} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 834552907522022778} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 1920, y: 1080} + m_Pivot: {x: 0.5, y: 0.5} diff --git a/Assets/Prefabs/PlayerReplayer.prefab b/Assets/Prefabs/PlayerReplayer.prefab index 717bbb6..13a0bef 100644 --- a/Assets/Prefabs/PlayerReplayer.prefab +++ b/Assets/Prefabs/PlayerReplayer.prefab @@ -79,6 +79,7 @@ GameObject: - component: {fileID: 5849392838882679854} - component: {fileID: 582799264655932961} - component: {fileID: 3380663186425371797} + - component: {fileID: 1783748808844086845} m_Layer: 0 m_Name: PlayerReplayer m_TagString: Untagged @@ -403,6 +404,19 @@ AudioSource: m_PreInfinity: 2 m_PostInfinity: 2 m_RotationOrder: 4 +--- !u!114 &1783748808844086845 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5082956827802089079} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ab982c94ab064b944947c4792e623299, type: 3} + m_Name: + m_EditorClassIdentifier: + cam: {fileID: 7220179918976106526} --- !u!1 &6013909295272487250 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/FakeCursor.cs b/Assets/Scripts/FakeCursor.cs index 1da1fb5..308ab47 100644 --- a/Assets/Scripts/FakeCursor.cs +++ b/Assets/Scripts/FakeCursor.cs @@ -2,22 +2,22 @@ using UnityEngine; public class FakeCursor : MonoBehaviour { + public RectTransform RectBounds; public Camera AttachedCamera; private void Start() { - Cursor.visible = false; + //Cursor.visible = false; } private void Update() { - Vector3 absolutePosition = new() - { - x = Input.mousePosition.x / Screen.width * 1920, - y = Input.mousePosition.y / Screen.height * 1080, - z = 5f - }; - transform.position = AttachedCamera.ScreenToWorldPoint(absolutePosition); + Vector2 size = new(Screen.width, Screen.height); + Vector2 hSize = new Vector2(AttachedCamera.pixelRect.width, AttachedCamera.pixelRect.height) / 2f; + Debug.Log(hSize); + + Vector2 positionRelativeToMiddle = (size - hSize) + (Vector2)Input.mousePosition; + transform.position = AttachedCamera.ScreenToWorldPoint(new Vector3(positionRelativeToMiddle.x, positionRelativeToMiddle.y, 5f)); } private void OnDestroy() diff --git a/Assets/Scripts/SceneController.cs b/Assets/Scripts/SceneController.cs index 6333cd5..3b0b393 100644 --- a/Assets/Scripts/SceneController.cs +++ b/Assets/Scripts/SceneController.cs @@ -46,7 +46,7 @@ namespace InterfaceOff private IEnumerator Load(Action loadAction) { - Vector2 maxSize = new(2000f, 2000f); + Vector2 maxSize = new(5000f, 5000f); Vector2 minSize = Vector2.zero; float startRotation = ImageRectOverlay.eulerAngles.z; diff --git a/Assets/tmp.cs b/Assets/tmp.cs new file mode 100644 index 0000000..575abda --- /dev/null +++ b/Assets/tmp.cs @@ -0,0 +1,35 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class tmp : MonoBehaviour +{ + public Camera cam; + + void Update() + { + float targetAspect = 16f / 9f; + float windowAspect = (float)Screen.width / Screen.height; + float scale = windowAspect / targetAspect; + + if (scale < 1f) + { + cam.rect = new Rect( + 0, + (1f - scale) / 2f, + 1f, + scale + ); + } + else + { + float width = 1f / scale; + cam.rect = new Rect( + (1f - width) / 2f, + 0, + width, + 1f + ); + } + } +} diff --git a/Assets/tmp.cs.meta b/Assets/tmp.cs.meta new file mode 100644 index 0000000..8190d46 --- /dev/null +++ b/Assets/tmp.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ab982c94ab064b944947c4792e623299 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: