From 675c41431ae04022f881a4fbbe704c72dd088712 Mon Sep 17 00:00:00 2001 From: Marine Date: Mon, 29 Jan 2024 22:17:14 +0100 Subject: [PATCH] add scriptable object for funny text --- Assets/Scenes/ComputerView.unity | 120 ++++++++---------- Assets/Scenes/PhoneView.unity | 36 +----- Assets/ScriptableObjects/FunnyTextList.asset | 31 +++++ .../FunnyTextList.asset.meta | 8 ++ Assets/Scripts/FunnyText.cs | 4 +- Assets/Scripts/FunnyTextList.cs | 10 ++ Assets/Scripts/FunnyTextList.cs.meta | 11 ++ 7 files changed, 116 insertions(+), 104 deletions(-) create mode 100644 Assets/ScriptableObjects/FunnyTextList.asset create mode 100644 Assets/ScriptableObjects/FunnyTextList.asset.meta create mode 100644 Assets/Scripts/FunnyTextList.cs create mode 100644 Assets/Scripts/FunnyTextList.cs.meta diff --git a/Assets/Scenes/ComputerView.unity b/Assets/Scenes/ComputerView.unity index ff9cd35..4e2a829 100644 --- a/Assets/Scenes/ComputerView.unity +++ b/Assets/Scenes/ComputerView.unity @@ -503,10 +503,10 @@ RectTransform: - {fileID: 1572676829} m_Father: {fileID: 703458665} 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_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 250, y: -197.70337} + m_SizeDelta: {x: 500, y: 59.081345} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &76361013 CanvasRenderer: @@ -816,10 +816,10 @@ RectTransform: m_Children: [] m_Father: {fileID: 6747543} 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_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 150, y: -300} + m_SizeDelta: {x: 300, y: 200} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &132605380 MonoBehaviour: @@ -1589,10 +1589,10 @@ RectTransform: m_Children: [] m_Father: {fileID: 6747543} 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_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 1050, y: -300} + m_SizeDelta: {x: 300, y: 200} m_Pivot: {x: 0, y: 0.5} --- !u!114 &340074661 MonoBehaviour: @@ -2120,10 +2120,10 @@ RectTransform: m_Children: [] m_Father: {fileID: 6747543} 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_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 350, y: -300} + m_SizeDelta: {x: 300, y: 200} m_Pivot: {x: 0, y: 0.5} --- !u!114 &496953434 MonoBehaviour: @@ -2629,7 +2629,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 210.61394} + m_AnchoredPosition: {x: 0, y: 210.61377} m_SizeDelta: {x: 0, y: -421.2278} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &619055282 @@ -3326,10 +3326,10 @@ RectTransform: - {fileID: 120283725} m_Father: {fileID: 703458665} 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_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 250, y: -113.62202} + m_SizeDelta: {x: 500, y: 59.081345} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &741267593 MonoBehaviour: @@ -3934,10 +3934,10 @@ RectTransform: m_Children: [] m_Father: {fileID: 6747543} 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_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 1050, y: -100} + m_SizeDelta: {x: 300, y: 200} m_Pivot: {x: 0, y: 0.5} --- !u!114 &983174567 MonoBehaviour: @@ -4404,10 +4404,10 @@ RectTransform: m_Children: [] m_Father: {fileID: 6747543} 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_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 700, y: -100} + m_SizeDelta: {x: 300, y: 200} m_Pivot: {x: 0, y: 0.5} --- !u!114 &1018720202 MonoBehaviour: @@ -4841,7 +4841,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!224 &1117928115 RectTransform: m_ObjectHideFlags: 0 @@ -6395,10 +6395,10 @@ RectTransform: m_Children: [] m_Father: {fileID: 6747543} 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_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 350, y: -100} + m_SizeDelta: {x: 300, y: 200} m_Pivot: {x: 0, y: 0.5} --- !u!114 &1452182577 MonoBehaviour: @@ -6687,23 +6687,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 94922ac68f10744df9dab89b5202ac76, type: 3} m_Name: m_EditorClassIdentifier: - texts: - - Hideo Kojima is not executive director on this project. - - Medium-hot mustard > all - - Glaceon best eeveelution - - Made with lots of coffee - - Sell Lada, very little used, will be used very little - - It's not very cold at the moment - - 'If laziness were a sport, we would all be champions ' - - Shinji Mikami has not approved this project (but we remain available) - - 'JRPG rules the world ' - - Bravo les lesbiennes ! - - 'Mer il est fou ! ' - - Au revoir... - - '*Angry cat noise*' - - Nyaaaa ~ - - Coded without JS (I think) - - I developed without counting + textList: {fileID: 11400000, guid: 5b22791c486a626428ab508347ebb36e, type: 2} --- !u!1 &1503133438 GameObject: m_ObjectHideFlags: 0 @@ -6971,7 +6955,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 1, y: 1} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: -43, y: -50.999878} + m_AnchoredPosition: {x: -43, y: -51} m_SizeDelta: {x: 200, y: 200} m_Pivot: {x: 1, y: 1} --- !u!114 &1567271223 @@ -7854,10 +7838,10 @@ RectTransform: m_Children: [] m_Father: {fileID: 6747543} 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_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 150, y: -100} + m_SizeDelta: {x: 300, y: 200} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1794849355 MonoBehaviour: @@ -9009,10 +8993,10 @@ RectTransform: - {fileID: 221364888} m_Father: {fileID: 703458665} 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_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 250, y: -281.7847} + m_SizeDelta: {x: 500, y: 59.081345} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &1896563903 CanvasRenderer: @@ -9502,10 +9486,10 @@ RectTransform: - {fileID: 411140635} m_Father: {fileID: 703458665} 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_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 250, y: -29.540672} + m_SizeDelta: {x: 500, y: 59.081345} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1971898521 MonoBehaviour: @@ -10093,10 +10077,10 @@ RectTransform: m_Children: [] m_Father: {fileID: 6747543} 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_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 700, y: -300} + m_SizeDelta: {x: 300, y: 200} m_Pivot: {x: 0, y: 0.5} --- !u!114 &2137991537 MonoBehaviour: diff --git a/Assets/Scenes/PhoneView.unity b/Assets/Scenes/PhoneView.unity index 5f66e1c..2d8549f 100644 --- a/Assets/Scenes/PhoneView.unity +++ b/Assets/Scenes/PhoneView.unity @@ -6137,23 +6137,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 94922ac68f10744df9dab89b5202ac76, type: 3} m_Name: m_EditorClassIdentifier: - texts: - - Hideo Kojima is not executive director on this project. - - Medium-hot mustard > all - - Glaceon best eeveelution - - Made with lots of coffee - - Sell Lada, very little used, will be used very little - - It's not very cold at the moment - - 'If laziness were a sport, we would all be champions ' - - Shinji Mikami has not approved this project (but we remain available) - - 'JRPG rules the world ' - - Bravo les lesbiennes ! - - 'Mer il est fou ! ' - - Au revoir... - - '*Angry cat noise*' - - Nyaaaa ~ - - Coded without JS (I think) - - I developed without counting + textList: {fileID: 11400000, guid: 5b22791c486a626428ab508347ebb36e, type: 2} --- !u!1 &1850164816 GameObject: m_ObjectHideFlags: 0 @@ -7215,23 +7199,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 94922ac68f10744df9dab89b5202ac76, type: 3} m_Name: m_EditorClassIdentifier: - texts: - - Hideo Kojima is not executive director on this project. - - Medium-hot mustard > all - - Glaceon best eeveelution - - Made with lots of coffee - - Sell Lada, very little used, will be used very little - - It's not very cold at the moment - - 'If laziness were a sport, we would all be champions ' - - Shinji Mikami has not approved this project (but we remain available) - - 'JRPG rules the world ' - - Bravo les lesbiennes ! - - 'Mer il est fou ! ' - - Au revoir... - - '*Angry cat noise*' - - Nyaaaa ~ - - Coded without JS (I think) - - I developed without counting + textList: {fileID: 11400000, guid: 5b22791c486a626428ab508347ebb36e, type: 2} --- !u!1 &2103733876 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/ScriptableObjects/FunnyTextList.asset b/Assets/ScriptableObjects/FunnyTextList.asset new file mode 100644 index 0000000..879bfee --- /dev/null +++ b/Assets/ScriptableObjects/FunnyTextList.asset @@ -0,0 +1,31 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4ee411363b53cf844880900b487de82a, type: 3} + m_Name: FunnyTextList + m_EditorClassIdentifier: + funnyList: + - Hideo Kojima is not executive director on this project. + - Medium-hot mustard > all + - Glaceon best eeveelution + - Made with lots of coffee + - Sell Lada, very little used, will be used very little + - It's not very cold at the moment + - 'If laziness were a sport, we would all be champions ' + - Shinji Mikami has not approved this project (but we remain available) + - 'JRPG rules the world ' + - Bravo les lesbiennes ! + - 'Mer il est fou ! ' + - Au revoir... + - '*Angry cat noise*' + - Nyaaaa ~ + - Coded without JS (I think) + - I developed without counting diff --git a/Assets/ScriptableObjects/FunnyTextList.asset.meta b/Assets/ScriptableObjects/FunnyTextList.asset.meta new file mode 100644 index 0000000..480f2d7 --- /dev/null +++ b/Assets/ScriptableObjects/FunnyTextList.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5b22791c486a626428ab508347ebb36e +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/FunnyText.cs b/Assets/Scripts/FunnyText.cs index 2be523b..feeeb58 100644 --- a/Assets/Scripts/FunnyText.cs +++ b/Assets/Scripts/FunnyText.cs @@ -5,9 +5,9 @@ public class FunnyText : MonoBehaviour { - public List texts; + public FunnyTextList textList; private void OnEnable() { - GetComponent().text = texts[Random.Range(0, texts.Count)]; + GetComponent().text = textList.funnyList[Random.Range(0, textList.funnyList.Count)]; } } diff --git a/Assets/Scripts/FunnyTextList.cs b/Assets/Scripts/FunnyTextList.cs new file mode 100644 index 0000000..51eb14b --- /dev/null +++ b/Assets/Scripts/FunnyTextList.cs @@ -0,0 +1,10 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +[CreateAssetMenu(fileName = "FunnyTextList", menuName = "ScriptableObjects/Funny Text List", order = 2)] +public class FunnyTextList : ScriptableObject +{ + public List funnyList = new List(); + +} diff --git a/Assets/Scripts/FunnyTextList.cs.meta b/Assets/Scripts/FunnyTextList.cs.meta new file mode 100644 index 0000000..654b147 --- /dev/null +++ b/Assets/Scripts/FunnyTextList.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4ee411363b53cf844880900b487de82a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: