From e644f1de7cec0a340ece0ccad4d6b7a768c10c54 Mon Sep 17 00:00:00 2001 From: playmaker1210 Date: Fri, 24 Mar 2023 14:25:10 +0100 Subject: [PATCH] aspect ratio handler --- Assets/Scenes/Jatek.unity | 17 ++- Assets/Scripts/AspectRatioHandler.cs | 28 ++++ Assets/Scripts/AspectRatioHandler.cs.meta | 11 ++ Assets/Scripts/Source.cs | 6 + UserSettings/Layouts/default-2021.dwlt | 170 +++++++++++----------- 5 files changed, 146 insertions(+), 86 deletions(-) create mode 100644 Assets/Scripts/AspectRatioHandler.cs create mode 100644 Assets/Scripts/AspectRatioHandler.cs.meta diff --git a/Assets/Scenes/Jatek.unity b/Assets/Scenes/Jatek.unity index b52b75d..462c58c 100644 --- a/Assets/Scenes/Jatek.unity +++ b/Assets/Scenes/Jatek.unity @@ -4052,6 +4052,7 @@ GameObject: - component: {fileID: 197904235} - component: {fileID: 197904237} - component: {fileID: 197904238} + - component: {fileID: 197904239} m_Layer: 0 m_Name: Mangager m_TagString: Untagged @@ -4134,6 +4135,7 @@ MonoBehaviour: - {fileID: 255844036} dobott: 0 dobottEgyszer: 0 + ujradobasszamlalo: 0 --- !u!114 &197904222 MonoBehaviour: m_ObjectHideFlags: 0 @@ -4675,6 +4677,19 @@ MonoBehaviour: threefourText: - {fileID: 663535674} - {fileID: 1583842800} +--- !u!114 &197904239 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 197904216} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f1646c9ba4620a0e7861327e11e40849, type: 3} + m_Name: + m_EditorClassIdentifier: + mainCamera: {fileID: 519420031} --- !u!1 &229807670 GameObject: m_ObjectHideFlags: 0 @@ -11098,7 +11113,7 @@ Camera: far clip plane: 10 field of view: 60 orthographic: 1 - orthographic size: 10.409236 + orthographic size: 10.4 m_Depth: -1 m_CullingMask: serializedVersion: 2 diff --git a/Assets/Scripts/AspectRatioHandler.cs b/Assets/Scripts/AspectRatioHandler.cs new file mode 100644 index 0000000..fec30cd --- /dev/null +++ b/Assets/Scripts/AspectRatioHandler.cs @@ -0,0 +1,28 @@ +using System.Collections; +using System.Collections.Generic; +using System; +using UnityEngine; + +public class AspectRatioHandler : MonoBehaviour +{ + public Camera mainCamera; + + private void Awake() { + double aspectRatio = (double)Screen.width / (double)Screen.height; + aspectRatio = Math.Round(aspectRatio, 2); + Debug.Log("aspectratio: " + aspectRatio); + + //5:4 1,25, 4:3 1,33, 16:9 1,77, 16:10 1,6, 21:9 2,33 + + if(aspectRatio == 1.78 || aspectRatio == 2.33){ + mainCamera.orthographicSize = 10.4f; //16:9, 21:9 + }else if(aspectRatio == 1.6){ + mainCamera.orthographicSize = 11.43f; //16:10 + }else if(aspectRatio == 1.33){ + mainCamera.orthographicSize = 13.72f; //4:3 + }else if(aspectRatio == 1.25){ + mainCamera.orthographicSize = 14.68f; + } + + } +} diff --git a/Assets/Scripts/AspectRatioHandler.cs.meta b/Assets/Scripts/AspectRatioHandler.cs.meta new file mode 100644 index 0000000..bc67f36 --- /dev/null +++ b/Assets/Scripts/AspectRatioHandler.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f1646c9ba4620a0e7861327e11e40849 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Source.cs b/Assets/Scripts/Source.cs index ab3229b..0db365a 100644 --- a/Assets/Scripts/Source.cs +++ b/Assets/Scripts/Source.cs @@ -10,11 +10,13 @@ public class Source : MonoBehaviour private movement movement; public GameObject sourceSprite; + private Ugynok ugynok; private bool oneTime = false; private void Awake() { movement = FindObjectOfType(); + ugynok = FindObjectOfType(); } private void Start() { @@ -28,6 +30,10 @@ public class Source : MonoBehaviour if(isNyitva && oszlop != -1 && sor.Count == 1) { sourceRender(oszlop, sor[0]); if (!oneTime) { + for (int i = 0; i < 3; i++) + { + ugynok.UgynokSorsolas(sor[0], oszlop); + } printSourceLocation(); oneTime = true; } diff --git a/UserSettings/Layouts/default-2021.dwlt b/UserSettings/Layouts/default-2021.dwlt index 861cd92..683072b 100644 --- a/UserSettings/Layouts/default-2021.dwlt +++ b/UserSettings/Layouts/default-2021.dwlt @@ -15,9 +15,9 @@ MonoBehaviour: m_PixelRect: serializedVersion: 2 x: 0 - y: 65 - width: 1470 - height: 806 + y: 28 + width: 1366 + height: 673 m_ShowMode: 4 m_Title: Project m_RootView: {fileID: 2} @@ -44,8 +44,8 @@ MonoBehaviour: serializedVersion: 2 x: 0 y: 0 - width: 1470 - height: 806 + width: 1366 + height: 673 m_MinSize: {x: 875, y: 300} m_MaxSize: {x: 10000, y: 10000} m_UseTopView: 1 @@ -69,7 +69,7 @@ MonoBehaviour: serializedVersion: 2 x: 0 y: 0 - width: 1470 + width: 1366 height: 30 m_MinSize: {x: 0, y: 0} m_MaxSize: {x: 0, y: 0} @@ -90,8 +90,8 @@ MonoBehaviour: m_Position: serializedVersion: 2 x: 0 - y: 786 - width: 1470 + y: 653 + width: 1366 height: 20 m_MinSize: {x: 0, y: 0} m_MaxSize: {x: 0, y: 0} @@ -114,12 +114,12 @@ MonoBehaviour: serializedVersion: 2 x: 0 y: 30 - width: 1470 - height: 756 + width: 1366 + height: 623 m_MinSize: {x: 300, y: 200} m_MaxSize: {x: 24288, y: 16192} vertical: 0 - controlID: 15 + controlID: 74 --- !u!114 &6 MonoBehaviour: m_ObjectHideFlags: 52 @@ -139,12 +139,12 @@ MonoBehaviour: serializedVersion: 2 x: 0 y: 0 - width: 1092.5 - height: 756 + width: 1034 + height: 623 m_MinSize: {x: 200, y: 200} m_MaxSize: {x: 16192, y: 16192} vertical: 1 - controlID: 16 + controlID: 75 --- !u!114 &7 MonoBehaviour: m_ObjectHideFlags: 52 @@ -164,12 +164,12 @@ MonoBehaviour: serializedVersion: 2 x: 0 y: 0 - width: 1092.5 - height: 511.5 + width: 1034 + height: 387 m_MinSize: {x: 200, y: 100} m_MaxSize: {x: 16192, y: 8096} vertical: 0 - controlID: 17 + controlID: 119 --- !u!114 &8 MonoBehaviour: m_ObjectHideFlags: 52 @@ -187,8 +187,8 @@ MonoBehaviour: serializedVersion: 2 x: 0 y: 0 - width: 157.5 - height: 511.5 + width: 187 + height: 387 m_MinSize: {x: 201, y: 221} m_MaxSize: {x: 4001, y: 4021} m_ActualView: {fileID: 13} @@ -206,23 +206,23 @@ MonoBehaviour: m_Enabled: 1 m_EditorHideFlags: 1 m_Script: {fileID: 12006, guid: 0000000000000000e000000000000000, type: 0} - m_Name: SceneView + m_Name: GameView m_EditorClassIdentifier: m_Children: [] m_Position: serializedVersion: 2 - x: 157.5 + x: 187 y: 0 - width: 935 - height: 511.5 + width: 847 + height: 387 m_MinSize: {x: 202, y: 221} m_MaxSize: {x: 4002, y: 4021} - m_ActualView: {fileID: 14} + m_ActualView: {fileID: 12} m_Panes: - {fileID: 14} - {fileID: 12} - m_Selected: 0 - m_LastSelected: 1 + m_Selected: 1 + m_LastSelected: 0 --- !u!114 &10 MonoBehaviour: m_ObjectHideFlags: 52 @@ -239,9 +239,9 @@ MonoBehaviour: m_Position: serializedVersion: 2 x: 0 - y: 511.5 - width: 1092.5 - height: 244.5 + y: 387 + width: 1034 + height: 236 m_MinSize: {x: 231, y: 271} m_MaxSize: {x: 10001, y: 10021} m_ActualView: {fileID: 15} @@ -264,11 +264,11 @@ MonoBehaviour: m_Children: [] m_Position: serializedVersion: 2 - x: 1092.5 + x: 1034 y: 0 - width: 377.5 - height: 756 - m_MinSize: {x: 276, y: 71} + width: 332 + height: 623 + m_MinSize: {x: 101, y: 121} m_MaxSize: {x: 4001, y: 4021} m_ActualView: {fileID: 16} m_Panes: @@ -296,10 +296,10 @@ MonoBehaviour: m_Tooltip: m_Pos: serializedVersion: 2 - x: 201 + x: 187 y: 86 - width: 815 - height: 453 + width: 845 + height: 366 m_ViewDataDictionary: {fileID: 0} m_OverlayCanvas: m_LastAppliedPresetName: Default @@ -310,7 +310,7 @@ MonoBehaviour: m_ShowGizmos: 0 m_TargetDisplay: 0 m_ClearColor: {r: 0, g: 0, b: 0, a: 0} - m_TargetSize: {x: 768, y: 432} + m_TargetSize: {x: 613, y: 345} m_TextureFilterMode: 0 m_TextureHideFlags: 61 m_RenderIMGUI: 1 @@ -325,10 +325,10 @@ MonoBehaviour: m_VRangeLocked: 0 hZoomLockedByDefault: 0 vZoomLockedByDefault: 0 - m_HBaseRangeMin: -169 - m_HBaseRangeMax: 169 - m_VBaseRangeMin: -95 - m_VBaseRangeMax: 95 + m_HBaseRangeMin: -306.5 + m_HBaseRangeMax: 306.5 + m_VBaseRangeMin: -172.5 + m_VBaseRangeMax: 172.5 m_HAllowExceedBaseRangeMin: 1 m_HAllowExceedBaseRangeMax: 1 m_VAllowExceedBaseRangeMin: 1 @@ -337,7 +337,7 @@ MonoBehaviour: m_HSlider: 0 m_VSlider: 0 m_IgnoreScrollWheelUntilClicked: 0 - m_EnableMouseInput: 0 + m_EnableMouseInput: 1 m_EnableSliderZoomHorizontal: 0 m_EnableSliderZoomVertical: 0 m_UniformScale: 1 @@ -346,23 +346,23 @@ MonoBehaviour: serializedVersion: 2 x: 0 y: 21 - width: 860 - height: 380 - m_Scale: {x: 2, y: 2} - m_Translation: {x: 430, y: 190} + width: 845 + height: 345 + m_Scale: {x: 1, y: 1} + m_Translation: {x: 422.5, y: 172.5} m_MarginLeft: 0 m_MarginRight: 0 m_MarginTop: 0 m_MarginBottom: 0 m_LastShownAreaInsideMargins: serializedVersion: 2 - x: -215 - y: -95 - width: 430 - height: 190 + x: -422.5 + y: -172.5 + width: 845 + height: 345 m_MinimalGUI: 1 - m_defaultScale: 2 - m_LastWindowPixelSize: {x: 1720, y: 802} + m_defaultScale: 1 + m_LastWindowPixelSize: {x: 845, y: 366} m_ClearInEditMode: 1 m_NoCameraWarning: 1 m_LowResolutionForAspectRatios: 01000000000000000000 @@ -389,9 +389,9 @@ MonoBehaviour: m_Pos: serializedVersion: 2 x: 0 - y: 95 - width: 156.5 - height: 490.5 + y: 86 + width: 186 + height: 366 m_ViewDataDictionary: {fileID: 0} m_OverlayCanvas: m_LastAppliedPresetName: Default @@ -399,9 +399,9 @@ MonoBehaviour: m_SceneHierarchy: m_TreeViewState: scrollPos: {x: 0, y: 0} - m_SelectedIDs: 021c0000 + m_SelectedIDs: ce240000 m_LastClickedID: 0 - m_ExpandedIDs: 20fbffff + m_ExpandedIDs: ee83ffff6684ffff3e86ffff4686ffff0e88ffff2c88ffffb6f2ffff32f5ffff28fbffff m_RenameOverlay: m_UserAcceptedRename: 0 m_Name: @@ -445,10 +445,10 @@ MonoBehaviour: m_Tooltip: m_Pos: serializedVersion: 2 - x: 157.5 - y: 95 - width: 933 - height: 490.5 + x: 187 + y: 86 + width: 845 + height: 445 m_ViewDataDictionary: {fileID: 0} m_OverlayCanvas: m_LastAppliedPresetName: Default @@ -459,7 +459,7 @@ MonoBehaviour: collapsed: 0 displayed: 1 snapOffset: {x: 0, y: 0} - snapOffsetDelta: {x: -98, y: -26} + snapOffsetDelta: {x: -101, y: -26} snapCorner: 3 id: Tool Settings index: 0 @@ -705,9 +705,9 @@ MonoBehaviour: m_PlayAudio: 0 m_AudioPlay: 0 m_Position: - m_Target: {x: -8.265478, y: -1.4837648, z: -0.07635053} + m_Target: {x: -3.55626, y: 0.6707144, z: -0.018837877} speed: 2 - m_Value: {x: -8.265478, y: -1.4837648, z: -0.07635053} + m_Value: {x: -3.55626, y: 0.6707144, z: -0.018837877} m_RenderMode: 0 m_CameraMode: drawMode: 0 @@ -758,9 +758,9 @@ MonoBehaviour: speed: 2 m_Value: {x: 0, y: 0, z: 0, w: 1} m_Size: - m_Target: 14.660233 + m_Target: 12.090613 speed: 2 - m_Value: 14.660233 + m_Value: 12.090613 m_Ortho: m_Target: 1 speed: 2 @@ -806,9 +806,9 @@ MonoBehaviour: m_Pos: serializedVersion: 2 x: 0 - y: 606.5 - width: 1091.5 - height: 223.5 + y: 473 + width: 1033 + height: 215 m_ViewDataDictionary: {fileID: 0} m_OverlayCanvas: m_LastAppliedPresetName: Default @@ -834,14 +834,14 @@ MonoBehaviour: m_LastFolders: - Assets/Scripts m_LastFoldersGridSize: 66 - m_LastProjectPath: /Users/bance/Documents/GitHub/findthesource + m_LastProjectPath: /home/tom/Documents/dev/find the source m_LockTracker: m_IsLocked: 0 m_FolderTreeState: - scrollPos: {x: 0, y: 0} - m_SelectedIDs: 267a0000 - m_LastClickedID: 31270 - m_ExpandedIDs: 00000000047a000000ca9a3bffffff7f + scrollPos: {x: 0, y: 1} + m_SelectedIDs: 087a0000 + m_LastClickedID: 31240 + m_ExpandedIDs: 00000000f279000000ca9a3b m_RenameOverlay: m_UserAcceptedRename: 0 m_Name: @@ -869,7 +869,7 @@ MonoBehaviour: scrollPos: {x: 0, y: 0} m_SelectedIDs: m_LastClickedID: 0 - m_ExpandedIDs: 00000000047a0000 + m_ExpandedIDs: 00000000f2790000 m_RenameOverlay: m_UserAcceptedRename: 0 m_Name: @@ -913,7 +913,7 @@ MonoBehaviour: m_IsRenaming: 0 m_OriginalEventType: 11 m_IsRenamingFilename: 1 - m_ClientGUIView: {fileID: 10} + m_ClientGUIView: {fileID: 0} m_CreateAssetUtility: m_EndAction: {fileID: 0} m_InstanceID: 0 @@ -921,7 +921,7 @@ MonoBehaviour: m_Icon: {fileID: 0} m_ResourceFile: m_NewAssetIndexInList: -1 - m_ScrollPosition: {x: 0, y: 0} + m_ScrollPosition: {x: 0, y: 43} m_GridSize: 66 m_SkipHiddenPackages: 0 m_DirectoriesAreaWidth: 193 @@ -945,9 +945,9 @@ MonoBehaviour: m_Tooltip: m_Pos: serializedVersion: 2 - x: 1018 + x: 1034 y: 86 - width: 347 + width: 331 height: 602 m_ViewDataDictionary: {fileID: 0} m_OverlayCanvas: @@ -969,14 +969,14 @@ MonoBehaviour: m_MaxSize: {x: 4000, y: 4000} m_TitleContent: m_Text: Inspector - m_Image: {fileID: -440750813802333266, guid: 0000000000000000d000000000000000, type: 0} + m_Image: {fileID: -2667387946076563598, guid: 0000000000000000d000000000000000, type: 0} m_Tooltip: m_Pos: serializedVersion: 2 - x: 1092.5 - y: 95 - width: 376.5 - height: 735 + x: 1034 + y: 86 + width: 331 + height: 602 m_ViewDataDictionary: {fileID: 0} m_OverlayCanvas: m_LastAppliedPresetName: Default @@ -987,7 +987,7 @@ MonoBehaviour: m_CachedPref: -160 m_ControlHash: -371814159 m_PrefName: Preview_InspectorPreview - m_LastInspectedObjectInstanceID: 29606 + m_LastInspectedObjectInstanceID: 9422 m_LastVerticalScrollValue: 0 m_GlobalObjectId: m_InspectorMode: 0