diff --git a/Assets/Resources/UI/Components/FileListItem.prefab b/Assets/Resources/UI/Components/FileListItem.prefab index 1d6c2382d..7242bab6c 100644 --- a/Assets/Resources/UI/Components/FileListItem.prefab +++ b/Assets/Resources/UI/Components/FileListItem.prefab @@ -11,6 +11,7 @@ GameObject: - 114: {fileID: 11478130} - 222: {fileID: 222000013378982534} - 114: {fileID: 114000010318403776} + - 114: {fileID: 114000012690282044} m_Layer: 5 m_Name: FileListItem m_TagString: Untagged @@ -163,6 +164,17 @@ MonoBehaviour: m_FillAmount: 1 m_FillClockwise: 1 m_FillOrigin: 0 +--- !u!114 &114000012690282044 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 117544} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5d9d9b4ba7df5664b97950a2c6fbf394, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!222 &222000013378982534 CanvasRenderer: m_ObjectHideFlags: 1 diff --git a/Assets/Resources/UI/Components/JobListItem.prefab b/Assets/Resources/UI/Components/JobListItem.prefab index 35da9030d..f6e3520cb 100644 --- a/Assets/Resources/UI/Components/JobListItem.prefab +++ b/Assets/Resources/UI/Components/JobListItem.prefab @@ -11,6 +11,7 @@ GameObject: - 114: {fileID: 114000011180822494} - 222: {fileID: 222000013378982534} - 114: {fileID: 114000010318403776} + - 114: {fileID: 114000012657899036} m_Layer: 5 m_Name: JobListItem m_TagString: Untagged @@ -196,6 +197,17 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: currentColor: {r: 0, g: 0, b: 0, a: 0} +--- !u!114 &114000012657899036 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 117544} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5d9d9b4ba7df5664b97950a2c6fbf394, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!114 &114000013548480896 MonoBehaviour: m_ObjectHideFlags: 1 diff --git a/Assets/Resources/UI/Components/QuestItem.prefab b/Assets/Resources/UI/Components/QuestItem.prefab index b76ca91e2..4aef3217d 100644 --- a/Assets/Resources/UI/Components/QuestItem.prefab +++ b/Assets/Resources/UI/Components/QuestItem.prefab @@ -58,6 +58,8 @@ GameObject: - 114: {fileID: 114000012546263802} - 114: {fileID: 114000012203566418} - 114: {fileID: 114000010617629678} + - 114: {fileID: 114000013935797010} + - 114: {fileID: 114000012354133912} m_Layer: 5 m_Name: QuestItem m_TagString: Untagged @@ -290,6 +292,17 @@ MonoBehaviour: m_BlockingMask: serializedVersion: 2 m_Bits: 4294967295 +--- !u!114 &114000012354133912 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1000011337798844} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5d9d9b4ba7df5664b97950a2c6fbf394, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!114 &114000012414203538 MonoBehaviour: m_ObjectHideFlags: 1 @@ -410,6 +423,17 @@ MonoBehaviour: m_VerticalOverflow: 0 m_LineSpacing: 1 m_Text: Tile +--- !u!114 &114000013935797010 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1000011337798844} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5d9d9b4ba7df5664b97950a2c6fbf394, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!114 &114000014074064690 MonoBehaviour: m_ObjectHideFlags: 1 diff --git a/Assets/Resources/UI/MenuLeft/ConstructionMenu.prefab b/Assets/Resources/UI/MenuLeft/ConstructionMenu.prefab index 52018560f..ba174cf8d 100644 --- a/Assets/Resources/UI/MenuLeft/ConstructionMenu.prefab +++ b/Assets/Resources/UI/MenuLeft/ConstructionMenu.prefab @@ -671,7 +671,7 @@ MonoBehaviour: m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} m_FontSize: 18 m_FontStyle: 1 - m_BestFit: 0 + m_BestFit: 1 m_MinSize: 10 m_MaxSize: 40 m_Alignment: 4 diff --git a/Assets/Resources/UI/MenuLeft/ConstructionMenu/Button.prefab b/Assets/Resources/UI/MenuLeft/ConstructionMenu/Button.prefab index d2d7e6063..dc401ffd7 100644 --- a/Assets/Resources/UI/MenuLeft/ConstructionMenu/Button.prefab +++ b/Assets/Resources/UI/MenuLeft/ConstructionMenu/Button.prefab @@ -57,6 +57,7 @@ GameObject: - 222: {fileID: 222000012738706156} - 114: {fileID: 114000011913635658} - 114: {fileID: 114000010141881724} + - 114: {fileID: 114000011250756422} m_Layer: 5 m_Name: Button m_TagString: Untagged @@ -120,6 +121,17 @@ MonoBehaviour: localizeInStart: 1 text: {fileID: 0} defaultText: +--- !u!114 &114000011250756422 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1000013691832882} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5d9d9b4ba7df5664b97950a2c6fbf394, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!114 &114000011913635658 MonoBehaviour: m_ObjectHideFlags: 1 diff --git a/Assets/Resources/UI/SettingsMenu/Heading Section.prefab b/Assets/Resources/UI/SettingsMenu/Heading Section.prefab index 4ba3c1a4f..f2a84aded 100644 --- a/Assets/Resources/UI/SettingsMenu/Heading Section.prefab +++ b/Assets/Resources/UI/SettingsMenu/Heading Section.prefab @@ -57,6 +57,7 @@ GameObject: - 114: {fileID: 114000010065151278} - 114: {fileID: 114000012681863884} - 114: {fileID: 114000012764975788} + - 114: {fileID: 114000010269573494} m_Layer: 5 m_Name: Heading Section m_TagString: Untagged @@ -77,6 +78,17 @@ MonoBehaviour: m_EditorClassIdentifier: root: {fileID: 1000011375798180} headingText: {fileID: 114000013773110676} +--- !u!114 &114000010269573494 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1000014122894870} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5d9d9b4ba7df5664b97950a2c6fbf394, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!114 &114000010326162276 MonoBehaviour: m_ObjectHideFlags: 1 diff --git a/Assets/Resources/UI/SettingsMenu/SettingsButton.prefab b/Assets/Resources/UI/SettingsMenu/SettingsButton.prefab index a85ad0e84..05ab1e3c2 100644 --- a/Assets/Resources/UI/SettingsMenu/SettingsButton.prefab +++ b/Assets/Resources/UI/SettingsMenu/SettingsButton.prefab @@ -24,6 +24,7 @@ GameObject: - 114: {fileID: 114000013521423838} - 114: {fileID: 114000011852658578} - 114: {fileID: 114000010215954120} + - 114: {fileID: 114000011399251584} m_Layer: 5 m_Name: SettingsButton m_TagString: Untagged @@ -90,6 +91,17 @@ MonoBehaviour: m_Calls: [] m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +--- !u!114 &114000011399251584 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1000011889461486} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5d9d9b4ba7df5664b97950a2c6fbf394, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!114 &114000011728363504 MonoBehaviour: m_ObjectHideFlags: 1 diff --git a/Assets/Resources/UI/SettingsMenu/SettingsDropdown.prefab b/Assets/Resources/UI/SettingsMenu/SettingsDropdown.prefab index 0e31e9f3a..118d07f67 100644 --- a/Assets/Resources/UI/SettingsMenu/SettingsDropdown.prefab +++ b/Assets/Resources/UI/SettingsMenu/SettingsDropdown.prefab @@ -88,6 +88,7 @@ GameObject: - 222: {fileID: 222000013032223076} - 114: {fileID: 114000014179489124} - 114: {fileID: 114000010358411874} + - 114: {fileID: 114000013719909410} m_Layer: 5 m_Name: SettingsDropdown m_TagString: Untagged @@ -592,6 +593,17 @@ MonoBehaviour: m_FillAmount: 1 m_FillClockwise: 1 m_FillOrigin: 0 +--- !u!114 &114000013719909410 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1000011237016840} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5d9d9b4ba7df5664b97950a2c6fbf394, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!114 &114000013956353114 MonoBehaviour: m_ObjectHideFlags: 1 diff --git a/Assets/Resources/UI/SettingsMenu/SettingsField.prefab b/Assets/Resources/UI/SettingsMenu/SettingsField.prefab index d1306da59..b364618a0 100644 --- a/Assets/Resources/UI/SettingsMenu/SettingsField.prefab +++ b/Assets/Resources/UI/SettingsMenu/SettingsField.prefab @@ -22,6 +22,7 @@ GameObject: - 222: {fileID: 222000012311069016} - 114: {fileID: 114000010206266248} - 114: {fileID: 114000011715643710} + - 114: {fileID: 114000011260665556} m_Layer: 5 m_Name: SettingsField m_TagString: Untagged @@ -123,6 +124,17 @@ MonoBehaviour: m_VerticalOverflow: 0 m_LineSpacing: 1 m_Text: Enter text... +--- !u!114 &114000011260665556 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1000011427886720} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5d9d9b4ba7df5664b97950a2c6fbf394, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!114 &114000011715643710 MonoBehaviour: m_ObjectHideFlags: 1 diff --git a/Assets/Resources/UI/SettingsMenu/SettingsMenu.prefab b/Assets/Resources/UI/SettingsMenu/SettingsMenu.prefab index 5961f1140..021b07329 100644 --- a/Assets/Resources/UI/SettingsMenu/SettingsMenu.prefab +++ b/Assets/Resources/UI/SettingsMenu/SettingsMenu.prefab @@ -158,6 +158,7 @@ GameObject: - 224: {fileID: 224000013598409594} - 222: {fileID: 222000011043662548} - 114: {fileID: 114000011840756104} + - 114: {fileID: 114000013415599324} m_Layer: 5 m_Name: SettingsMenu m_TagString: Untagged @@ -1979,6 +1980,17 @@ MonoBehaviour: m_FillAmount: 1 m_FillClockwise: 1 m_FillOrigin: 0 +--- !u!114 &114000013415599324 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1000011176379986} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5d9d9b4ba7df5664b97950a2c6fbf394, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!114 &114000013466440812 MonoBehaviour: m_ObjectHideFlags: 1 diff --git a/Assets/Resources/UI/SettingsMenu/SettingsRadio.prefab b/Assets/Resources/UI/SettingsMenu/SettingsRadio.prefab index c3b497b33..60a07092c 100644 --- a/Assets/Resources/UI/SettingsMenu/SettingsRadio.prefab +++ b/Assets/Resources/UI/SettingsMenu/SettingsRadio.prefab @@ -37,6 +37,7 @@ GameObject: m_Component: - 224: {fileID: 224000010400765800} - 114: {fileID: 114000012045197150} + - 114: {fileID: 114000012290837518} m_Layer: 5 m_Name: SettingsRadio m_TagString: Untagged @@ -160,6 +161,17 @@ MonoBehaviour: m_TypeName: UnityEngine.UI.Toggle+ToggleEvent, UnityEngine.UI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_IsOn: 1 +--- !u!114 &114000012290837518 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1000012075128086} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5d9d9b4ba7df5664b97950a2c6fbf394, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!222 &222000012185448870 CanvasRenderer: m_ObjectHideFlags: 1 diff --git a/Assets/Resources/UI/SettingsMenu/SettingsSlider.prefab b/Assets/Resources/UI/SettingsMenu/SettingsSlider.prefab index 85a312536..98a23a20a 100644 --- a/Assets/Resources/UI/SettingsMenu/SettingsSlider.prefab +++ b/Assets/Resources/UI/SettingsMenu/SettingsSlider.prefab @@ -20,6 +20,7 @@ GameObject: m_Component: - 224: {fileID: 224000013769853932} - 114: {fileID: 114000010705991186} + - 114: {fileID: 114000010407120946} m_Layer: 5 m_Name: SettingsSlider m_TagString: Untagged @@ -136,6 +137,17 @@ MonoBehaviour: m_FillAmount: 1 m_FillClockwise: 1 m_FillOrigin: 0 +--- !u!114 &114000010407120946 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1000012222472366} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5d9d9b4ba7df5664b97950a2c6fbf394, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!114 &114000010705991186 MonoBehaviour: m_ObjectHideFlags: 1 diff --git a/Assets/Resources/UI/SettingsMenu/SettingsSquareRadio.prefab b/Assets/Resources/UI/SettingsMenu/SettingsSquareRadio.prefab index 3562e9a3e..33732b05d 100644 --- a/Assets/Resources/UI/SettingsMenu/SettingsSquareRadio.prefab +++ b/Assets/Resources/UI/SettingsMenu/SettingsSquareRadio.prefab @@ -20,6 +20,7 @@ GameObject: m_Component: - 224: {fileID: 224000011034739758} - 114: {fileID: 114000011688845056} + - 114: {fileID: 114000012197679114} m_Layer: 5 m_Name: SettingsSquareRadio m_TagString: Untagged @@ -133,6 +134,17 @@ MonoBehaviour: m_TypeName: UnityEngine.UI.Toggle+ToggleEvent, UnityEngine.UI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_IsOn: 1 +--- !u!114 &114000012197679114 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1000011483629928} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5d9d9b4ba7df5664b97950a2c6fbf394, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!114 &114000012458001780 MonoBehaviour: m_ObjectHideFlags: 1 diff --git a/Assets/Resources/UI/SettingsMenu/SettingsSwitch.prefab b/Assets/Resources/UI/SettingsMenu/SettingsSwitch.prefab index 749828f85..b09d5f0ff 100644 --- a/Assets/Resources/UI/SettingsMenu/SettingsSwitch.prefab +++ b/Assets/Resources/UI/SettingsMenu/SettingsSwitch.prefab @@ -37,6 +37,7 @@ GameObject: m_Component: - 224: {fileID: 224000013036247610} - 114: {fileID: 114000012921276924} + - 114: {fileID: 114000012594959840} m_Layer: 5 m_Name: SettingsSwitch m_TagString: Untagged @@ -88,6 +89,17 @@ MonoBehaviour: m_FillAmount: 1 m_FillClockwise: 1 m_FillOrigin: 0 +--- !u!114 &114000012594959840 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1000010638297662} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5d9d9b4ba7df5664b97950a2c6fbf394, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!114 &114000012921276924 MonoBehaviour: m_ObjectHideFlags: 1 diff --git a/Assets/Resources/UI/SettingsMenu/SettingsText.prefab b/Assets/Resources/UI/SettingsMenu/SettingsText.prefab index c30b54545..861e9fd68 100644 --- a/Assets/Resources/UI/SettingsMenu/SettingsText.prefab +++ b/Assets/Resources/UI/SettingsMenu/SettingsText.prefab @@ -21,6 +21,7 @@ GameObject: - 224: {fileID: 224000014255584338} - 222: {fileID: 222000012472736264} - 114: {fileID: 114000010165475254} + - 114: {fileID: 114000012374642832} m_Layer: 5 m_Name: SettingsText m_TagString: Untagged @@ -61,6 +62,17 @@ MonoBehaviour: m_VerticalOverflow: 0 m_LineSpacing: 1 m_Text: +--- !u!114 &114000012374642832 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1000011330954174} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5d9d9b4ba7df5664b97950a2c6fbf394, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!222 &222000012472736264 CanvasRenderer: m_ObjectHideFlags: 1 diff --git a/Assets/Resources/UI/SettingsMenu/SettingsToggle.prefab b/Assets/Resources/UI/SettingsMenu/SettingsToggle.prefab index 255c57327..529850c17 100644 --- a/Assets/Resources/UI/SettingsMenu/SettingsToggle.prefab +++ b/Assets/Resources/UI/SettingsMenu/SettingsToggle.prefab @@ -54,6 +54,7 @@ GameObject: m_Component: - 224: {fileID: 224000010693051802} - 114: {fileID: 114000014154172918} + - 114: {fileID: 114000010207217168} m_Layer: 5 m_Name: SettingsToggle m_TagString: Untagged @@ -61,6 +62,17 @@ GameObject: m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 +--- !u!114 &114000010207217168 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1000014203165242} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5d9d9b4ba7df5664b97950a2c6fbf394, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!114 &114000012008749980 MonoBehaviour: m_ObjectHideFlags: 1 diff --git a/Assets/Scripts/UI/UIElementScaleFixer.cs b/Assets/Scripts/UI/UIElementScaleFixer.cs new file mode 100644 index 000000000..476c46099 --- /dev/null +++ b/Assets/Scripts/UI/UIElementScaleFixer.cs @@ -0,0 +1,20 @@ +#region License +// ==================================================== +// Project Porcupine Copyright(C) 2016 Team Porcupine +// This program comes with ABSOLUTELY NO WARRANTY; This is free software, +// and you are welcome to redistribute it under certain conditions; See +// file LICENSE, which is part of this source code package, for details. +// ==================================================== +#endregion + +using UnityEngine; + +// HACK: This is a needed workaround for any most any UI ELeemnt that is instantiated after start. +// If this script isn't attached it may cause errors at different scalings. +public class UIElementScaleFixer : MonoBehaviour +{ + public void Start() + { + transform.localScale = Vector3.one; + } +} diff --git a/Assets/Scripts/UI/UIElementScaleFixer.cs.meta b/Assets/Scripts/UI/UIElementScaleFixer.cs.meta new file mode 100644 index 000000000..4e7678149 --- /dev/null +++ b/Assets/Scripts/UI/UIElementScaleFixer.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 5d9d9b4ba7df5664b97950a2c6fbf394 +timeCreated: 1489652266 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/UI/UIRescaler.cs b/Assets/Scripts/UI/UIRescaler.cs new file mode 100644 index 000000000..b44499f7e --- /dev/null +++ b/Assets/Scripts/UI/UIRescaler.cs @@ -0,0 +1,67 @@ +#region License +// ==================================================== +// Project Porcupine Copyright(C) 2016 Team Porcupine +// This program comes with ABSOLUTELY NO WARRANTY; This is free software, +// and you are welcome to redistribute it under certain conditions; See +// file LICENSE, which is part of this source code package, for details. +// ==================================================== +#endregion + +using System.Collections; +using UnityEngine; +using UnityEngine.UI; + +public class UIRescaler : MonoBehaviour +{ + private const float MaxScale = 2f; + private const float MinScale = .5f; + + private int lastScreenHeight = 0; + private float scale = 1f; + + public float Scale + { + get + { + return scale; + } + + set + { + if (value > MaxScale) + { + scale = MaxScale; + } + else if (value < MinScale) + { + scale = MinScale; + } + else + { + scale = value; + } + } + } + + public void Start() + { + lastScreenHeight = Screen.height; + + AdjustScale(); + } + + public void Update() + { + if (lastScreenHeight != Screen.height) + { + lastScreenHeight = Screen.height; + AdjustScale(); + } + } + + public void AdjustScale() + { + Settings.GetSetting("ui_scale", out scale); + this.GetComponent().scaleFactor = (Screen.height / 1080f) * scale; + } +} \ No newline at end of file diff --git a/Assets/Scripts/UI/UIRescaler.cs.meta b/Assets/Scripts/UI/UIRescaler.cs.meta new file mode 100644 index 000000000..bedb7684f --- /dev/null +++ b/Assets/Scripts/UI/UIRescaler.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 2125ec9446c957546833e5124271beda +timeCreated: 1487391455 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/StreamingAssets/CSharp/SettingsMenuFunctions.cs b/Assets/StreamingAssets/CSharp/SettingsMenuFunctions.cs index dc2c6574d..e7e50208a 100644 --- a/Assets/StreamingAssets/CSharp/SettingsMenuFunctions.cs +++ b/Assets/StreamingAssets/CSharp/SettingsMenuFunctions.cs @@ -85,6 +85,11 @@ public static DeveloperConsoleSlider GetDeveloperConsoleSlider() return new DeveloperConsoleSlider(); } + public static UIScaleSlider GetUIScaleSlider() + { + return new UIScaleSlider(); + } + public static SoundSlider GetSoundSlider() { return new SoundSlider(); @@ -191,14 +196,14 @@ public override GameObject InitializeElement() fieldElement.transform.SetParent(element.transform); fieldElement.textComponent.alignment = TextAnchor.MiddleCenter; fieldElement.onValueChanged.AddListener( - (string v) => - { - if (v != value) + (string v) => { - valueChanged = true; - value = v; - } - }); + if (v != value) + { + valueChanged = true; + value = v; + } + }); LayoutElement layout = fieldElement.gameObject.AddComponent(); layout.minWidth = 60; @@ -245,15 +250,15 @@ public char ValidateInputForPositiveNumber(string text, int charIndex, char adde char output = addedChar; if (addedChar != '1' - && addedChar != '2' - && addedChar != '3' - && addedChar != '4' - && addedChar != '5' - && addedChar != '6' - && addedChar != '7' - && addedChar != '8' - && addedChar != '9' - && addedChar != '0') + && addedChar != '2' + && addedChar != '3' + && addedChar != '4' + && addedChar != '5' + && addedChar != '6' + && addedChar != '7' + && addedChar != '8' + && addedChar != '9' + && addedChar != '0') { //return a null character output = '\0'; @@ -469,14 +474,14 @@ public override GameObject InitializeElement() GameObject go = DropdownHelperFromText(new string[] { "Low", "Med", "High" }, getValue()); dropdownElement.onValueChanged.AddListener( - (int v) => - { - if (v != selectedValue) + (int v) => { - valueChanged = true; - selectedValue = v; - } - }); + if (v != selectedValue) + { + valueChanged = true; + selectedValue = v; + } + }); count = dropdownElement.options.Count; @@ -513,14 +518,14 @@ public override GameObject InitializeElement() GameObject go = DropdownHelperFromText(new string[] { "Light" }, getValue()); dropdownElement.onValueChanged.AddListener( - (int v) => - { - if (v != selectedValue) + (int v) => { - valueChanged = true; - selectedValue = v; - } - }); + if (v != selectedValue) + { + valueChanged = true; + selectedValue = v; + } + }); return go; } @@ -545,14 +550,14 @@ public override GameObject InitializeElement() GameObject go = DropdownHelperFromText(new string[] { "Disable", "Enable", "Force Enable" }, getValue()); dropdownElement.onValueChanged.AddListener( - (int v) => - { - if (v != selectedValue) + (int v) => { - valueChanged = true; - selectedValue = v; - } - }); + if (v != selectedValue) + { + valueChanged = true; + selectedValue = v; + } + }); return go; } @@ -593,14 +598,14 @@ public override GameObject InitializeElement() GameObject go = DropdownHelperFromText(new string[] { "Disabled", "2x Multi-Sampling", "4x Multi-Sampling", "8x Multi-Sampling" }, getValue()); dropdownElement.onValueChanged.AddListener( - (int v) => - { - if (v != selectedValue) + (int v) => { - valueChanged = true; - selectedValue = v; - } - }); + if (v != selectedValue) + { + valueChanged = true; + selectedValue = v; + } + }); return go; } @@ -646,14 +651,14 @@ public override GameObject InitializeElement() GameObject go = DropdownHelperFromText(new string[] { "Very High", "High", "Medium", "Low", "Disabled" }, getValue()); dropdownElement.onValueChanged.AddListener( - (int v) => - { - if (v != selectedValue) + (int v) => { - valueChanged = true; - selectedValue = v; - } - }); + if (v != selectedValue) + { + valueChanged = true; + selectedValue = v; + } + }); return go; } @@ -709,15 +714,15 @@ public override GameObject InitializeElement() GameObject go = DropdownHelperFromOptionData(CreateDeviceDropdown(), WorldController.Instance.soundController.GetCurrentAudioDriver()); dropdownElement.onValueChanged.AddListener( - (int v) => - { - if (v != selectedValue) + (int v) => { - valueChanged = true; - selectedOption = (DriverDropdownOption)dropdownElement.options[v]; - selectedValue = v; - } - }); + if (v != selectedValue) + { + valueChanged = true; + selectedOption = (DriverDropdownOption)dropdownElement.options[v]; + selectedValue = v; + } + }); return go; } @@ -731,10 +736,10 @@ private Dropdown.OptionData[] CreateDeviceDropdown() DriverInfo info = WorldController.Instance.soundController.GetDriverInfo(i); options[i] = new DriverDropdownOption - { - text = info.name.ToString(), - driverInfo = info.guid.ToString() - }; + { + text = info.name.ToString(), + driverInfo = info.guid.ToString() + }; } return options; @@ -782,14 +787,14 @@ public override GameObject InitializeElement() GameObject go = DropdownHelperFromText(new string[] { "Disabled", "Every frame", "Every second frame" }, getValue()); dropdownElement.onValueChanged.AddListener( - (int v) => - { - if (v != selectedValue) + (int v) => { - valueChanged = true; - selectedValue = v; - } - }); + if (v != selectedValue) + { + valueChanged = true; + selectedValue = v; + } + }); return go; } @@ -830,14 +835,14 @@ public override GameObject InitializeElement() GameObject go = DropdownHelperFromText(groupNames, locationOfVariable); dropdownElement.onValueChanged.AddListener( - (int v) => - { - if (v != selectedValue) + (int v) => { - valueChanged = true; - selectedValue = v; - } - }); + if (v != selectedValue) + { + valueChanged = true; + selectedValue = v; + } + }); return go; } @@ -895,26 +900,26 @@ private Dropdown.OptionData[] CreateResolutionDropdown() { Dropdown.OptionData[] options = new Dropdown.OptionData[Screen.resolutions.Length + 1]; options[0] = new ResolutionOption - { - text = string.Format( - "{0} x {1} @ {2}", - Screen.currentResolution.width, - Screen.currentResolution.height, - Screen.currentResolution.refreshRate), - Resolution = Screen.currentResolution - }; - - for (int i = 0; i < Screen.resolutions.Length; i++) - { - options[i + 1] = new ResolutionOption { text = string.Format( "{0} x {1} @ {2}", - Screen.resolutions[i].width, - Screen.resolutions[i].height, - Screen.resolutions[i].refreshRate), - Resolution = Screen.resolutions[i] + Screen.currentResolution.width, + Screen.currentResolution.height, + Screen.currentResolution.refreshRate), + Resolution = Screen.currentResolution }; + + for (int i = 0; i < Screen.resolutions.Length; i++) + { + options[i + 1] = new ResolutionOption + { + text = string.Format( + "{0} x {1} @ {2}", + Screen.resolutions[i].width, + Screen.resolutions[i].height, + Screen.resolutions[i].refreshRate), + Resolution = Screen.resolutions[i] + }; } return options; @@ -950,6 +955,45 @@ public override void CancelSetting() } } +public class UIScaleSlider : GenericSlider +{ + public override GameObject InitializeElement() + { + GameObject go = base.InitializeElement(); + + // Set it from 0 - 100 (still reflective of 0-1, but shows from 0 - 100) + format = "({0:0.#}) "; + + sliderElement.wholeNumbers = true; + sliderElement.minValue = 5; + sliderElement.maxValue = 20; + sliderElement.value = getValue() * 10; + // We want to apply our own listener + sliderElement.onValueChanged.RemoveAllListeners(); + sliderElement.onValueChanged.AddListener( + (float v) => + { + if (v != value) + { + valueChanged = true; + value = v; + textElement.text = string.Format(format, value / 10) + LocalizationTable.GetLocalization(option.name); + } + }); + + sliderElement.onValueChanged.Invoke(sliderElement.value); + textElement.text = string.Format(format, value / 10) + LocalizationTable.GetLocalization(option.name); + + return go; + } + + public override void ApplySetting() + { + Settings.SetSetting(option.key, value / 10); + sliderElement.GetComponentInParent().AdjustScale(); + } +} + public class SoundSlider : GenericSlider { public override GameObject InitializeElement() diff --git a/Assets/StreamingAssets/Data/SettingsTemplate.xml b/Assets/StreamingAssets/Data/SettingsTemplate.xml index 750aa294b..e6e65117a 100644 --- a/Assets/StreamingAssets/Data/SettingsTemplate.xml +++ b/Assets/StreamingAssets/Data/SettingsTemplate.xml @@ -16,6 +16,7 @@ diff --git a/Assets/_Scenes_/_World.unity b/Assets/_Scenes_/_World.unity index bc2108602..90fdd064e 100644 --- a/Assets/_Scenes_/_World.unity +++ b/Assets/_Scenes_/_World.unity @@ -1664,6 +1664,7 @@ GameObject: - 223: {fileID: 2038247392} - 114: {fileID: 2038247391} - 114: {fileID: 2038247390} + - 114: {fileID: 2038247393} m_Layer: 5 m_Name: Canvas m_TagString: Untagged @@ -1749,6 +1750,18 @@ Canvas: m_SortingLayerID: 0 m_SortingOrder: 0 m_TargetDisplay: 0 +--- !u!114 &2038247393 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2038247388} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 2125ec9446c957546833e5124271beda, type: 3} + m_Name: + m_EditorClassIdentifier: + lastScreenWidth: 0 --- !u!1 &2048170185 GameObject: m_ObjectHideFlags: 0