From 69679db501e354b063edbc2f93fda2e6f546dac4 Mon Sep 17 00:00:00 2001 From: NevesPT Date: Tue, 9 May 2023 21:00:06 +0100 Subject: [PATCH 1/3] Dev Watermark [Added] - a script to check if is beta version or not [Changed] - Elements at persistant Scene --- Assets/Scenes/PersistantScene.unity | 223 +++++++++++++++++++++++++- Assets/Script/UI/DevWatermark.cs | 31 ++++ Assets/Script/UI/DevWatermark.cs.meta | 11 ++ 3 files changed, 261 insertions(+), 4 deletions(-) create mode 100644 Assets/Script/UI/DevWatermark.cs create mode 100644 Assets/Script/UI/DevWatermark.cs.meta diff --git a/Assets/Scenes/PersistantScene.unity b/Assets/Scenes/PersistantScene.unity index 3fbb5cce3..656bec586 100644 --- a/Assets/Scenes/PersistantScene.unity +++ b/Assets/Scenes/PersistantScene.unity @@ -772,6 +772,142 @@ RectTransform: m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} +--- !u!1 &531716086 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 531716087} + - component: {fileID: 531716089} + - component: {fileID: 531716088} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!224 &531716087 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 531716086} + 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: 787126831} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 198.94751, y: -20} + m_SizeDelta: {x: 397.89502, y: 40} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &531716088 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 531716086} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: Yarg v1.22.33b Development Build + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: ae170e91fd29a90479e906ddffb1d8ee, type: 2} + m_sharedMaterial: {fileID: -5480317595949376055, guid: ae170e91fd29a90479e906ddffb1d8ee, + type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4294967295 + m_fontColor: {r: 1, g: 1, b: 1, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 12 + m_fontSizeBase: 12 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 4 + m_VerticalAlignment: 4096 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 0 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_hasFontAssetChanged: 0 + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!222 &531716089 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 531716086} + m_CullTransparentMesh: 1 --- !u!1 &532586439 GameObject: m_ObjectHideFlags: 0 @@ -1296,8 +1432,9 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: - {fileID: 1931647619} + - {fileID: 787126831} m_Father: {fileID: 1694016463} - m_RootOrder: 3 + m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 1, y: 1} @@ -1577,7 +1714,7 @@ RectTransform: - {fileID: 1156818522} - {fileID: 468169332} m_Father: {fileID: 1694016463} - m_RootOrder: 1 + m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -1636,6 +1773,84 @@ MonoBehaviour: m_EditorClassIdentifier: loadingPhrase: {fileID: 1156818523} subPhrase: {fileID: 468169333} +--- !u!1 &787126830 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 787126831} + - component: {fileID: 787126833} + - component: {fileID: 787126834} + m_Layer: 5 + m_Name: Watermark Container + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &787126831 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 787126830} + 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: + - {fileID: 531716087} + m_Father: {fileID: 651382555} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &787126833 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 787126830} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 30649d3a9faa99c48a7b1166b86bf2a0, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_ChildAlignment: 5 + m_Spacing: 7 + m_ChildForceExpandWidth: 1 + m_ChildForceExpandHeight: 1 + m_ChildControlWidth: 1 + m_ChildControlHeight: 0 + m_ChildScaleWidth: 1 + m_ChildScaleHeight: 0 + m_ReverseArrangement: 0 +--- !u!114 &787126834 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 787126830} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e1ba4b46013021a409f887004a28f962, type: 3} + m_Name: + m_EditorClassIdentifier: + watermarkText: {fileID: 531716088} --- !u!1 &788257159 GameObject: m_ObjectHideFlags: 0 @@ -2642,7 +2857,7 @@ RectTransform: m_Children: - {fileID: 3791790936875088609} m_Father: {fileID: 1694016463} - m_RootOrder: 2 + m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -3367,9 +3582,9 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: - {fileID: 340418942} + - {fileID: 651382555} - {fileID: 782876829} - {fileID: 1330279921} - - {fileID: 651382555} m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/Assets/Script/UI/DevWatermark.cs b/Assets/Script/UI/DevWatermark.cs new file mode 100644 index 000000000..4598f15bd --- /dev/null +++ b/Assets/Script/UI/DevWatermark.cs @@ -0,0 +1,31 @@ +using System.Collections; +using System.Collections.Generic; +using TMPro; +using UnityEngine; +using YARG; +using Debug = UnityEngine.Debug; + +public class DevWatermark : MonoBehaviour +{ + + public TextMeshProUGUI watermarkText; + + // Start is called before the first frame update + void Start() + { + // check if Constants.VERSION_TAG ends with "b" + if (Constants.VERSION_TAG.ToString().EndsWith("b")) + { + watermarkText.text = $"YARG {Constants.VERSION_TAG} Developer Build"; + watermarkText.gameObject.SetActive(true); + } + else + { + this.gameObject.SetActive(false); + } + + // disable script + this.enabled = false; + Debug.Log("DevWatermark script disabled"); + } +} diff --git a/Assets/Script/UI/DevWatermark.cs.meta b/Assets/Script/UI/DevWatermark.cs.meta new file mode 100644 index 000000000..0ffcfd9c8 --- /dev/null +++ b/Assets/Script/UI/DevWatermark.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e1ba4b46013021a409f887004a28f962 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: From 6d2b801308eb8818078ff255f57dabc8e00a40ad Mon Sep 17 00:00:00 2001 From: NevesPT Date: Tue, 9 May 2023 21:05:37 +0100 Subject: [PATCH 2/3] Getting a better condition from `Constants.VERSION_TAG.ToString().EndsWith("b")` to `Constants.VERSION_TAG.beta` --- Assets/Script/UI/DevWatermark.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Assets/Script/UI/DevWatermark.cs b/Assets/Script/UI/DevWatermark.cs index 4598f15bd..b0fc0f868 100644 --- a/Assets/Script/UI/DevWatermark.cs +++ b/Assets/Script/UI/DevWatermark.cs @@ -14,7 +14,7 @@ public class DevWatermark : MonoBehaviour void Start() { // check if Constants.VERSION_TAG ends with "b" - if (Constants.VERSION_TAG.ToString().EndsWith("b")) + if (Constants.VERSION_TAG.beta) { watermarkText.text = $"YARG {Constants.VERSION_TAG} Developer Build"; watermarkText.gameObject.SetActive(true); From 2f2f7d9b9305126feac7c157e9495e5796b381b1 Mon Sep 17 00:00:00 2001 From: NevesPT Date: Thu, 11 May 2023 22:40:21 +0100 Subject: [PATCH 3/3] Fix following styling --- Assets/Script/UI/DevWatermark.cs | 42 +++++++++++++++----------------- 1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/Assets/Script/UI/DevWatermark.cs b/Assets/Script/UI/DevWatermark.cs index b0fc0f868..35fb40927 100644 --- a/Assets/Script/UI/DevWatermark.cs +++ b/Assets/Script/UI/DevWatermark.cs @@ -5,27 +5,23 @@ using YARG; using Debug = UnityEngine.Debug; -public class DevWatermark : MonoBehaviour -{ +public class DevWatermark : MonoBehaviour { - public TextMeshProUGUI watermarkText; - - // Start is called before the first frame update - void Start() - { - // check if Constants.VERSION_TAG ends with "b" - if (Constants.VERSION_TAG.beta) - { - watermarkText.text = $"YARG {Constants.VERSION_TAG} Developer Build"; - watermarkText.gameObject.SetActive(true); - } - else - { - this.gameObject.SetActive(false); - } - - // disable script - this.enabled = false; - Debug.Log("DevWatermark script disabled"); - } -} + [SerializeField] + private TextMeshProUGUI watermarkText; + + // Start is called before the first frame update + void Start() { + // check if Constants.VERSION_TAG ends with "b" + if (Constants.VERSION_TAG.beta) { + watermarkText.text = $"YARG {Constants.VERSION_TAG} Developer Build"; + watermarkText.gameObject.SetActive(true); + } else { + this.gameObject.SetActive(false); + } + + // disable script + this.enabled = false; + Debug.Log("DevWatermark script disabled"); + } +}