From 7ad70e7997d4d2980760780813d906a27eb7cf48 Mon Sep 17 00:00:00 2001 From: "DESKTOP-VVOCIJO\\PC" Date: Fri, 29 May 2026 11:10:00 +0900 Subject: [PATCH] =?UTF-8?q?2026-05-29=20=EC=9B=A8=EC=9D=B4=EB=B8=8C=20?= =?UTF-8?q?=EC=8B=9C=EC=8A=A4=ED=85=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/01_Scenes/BossScene.unity | 4 +- Assets/01_Scenes/GameScene.unity | 4 +- Assets/02_Scripts/Enemy/Boss.cs | 5 + Assets/02_Scripts/Enemy/WaveManager.cs | 46 ++ Assets/02_Scripts/Managers/GameManager.cs | 5 +- .../ColorMan/Prefabs/YellowMan.prefab | 3 + .../ColorMan/Prefabs/YellowMan.prefab.meta | 7 + Assets/05_Data/Wave/WaveData2.asset | 4 +- Assets/TextMesh Pro Effect.meta | 8 + Assets/TextMesh Pro Effect/Documentation.meta | 8 + .../Documentation/Documetation.pdf | 3 + .../Documentation/Documetation.pdf.meta | 14 + Assets/TextMesh Pro Effect/Editor.meta | 8 + .../Editor/TextMeshProEffect.Editor.asmdef | 17 + .../TextMeshProEffect.Editor.asmdef.meta | 14 + .../Editor/TextMeshProEffectEditor.cs | 27 + .../Editor/TextMeshProEffectEditor.cs.meta | 10 + Assets/TextMesh Pro Effect/Examples.meta | 8 + .../Examples/KomikaDemo.asset | 3 + .../Examples/KomikaDemo.asset.meta | 15 + .../Examples/KomikaDemo.ttf | 3 + .../Examples/KomikaDemo.ttf.meta | 29 + .../Examples/SceneTextMeshDemo.unity | 3 + .../Examples/SceneTextMeshDemo.unity.meta | 14 + .../Examples/TextMeshProEffectDemo.unity | 3 + .../Examples/TextMeshProEffectDemo.unity.meta | 14 + .../TextMeshProEffect.asmdef | 14 + .../TextMeshProEffect.asmdef.meta | 14 + .../TextMesh Pro Effect/TextMeshProEffect.cs | 583 ++++++++++++++++++ .../TextMeshProEffect.cs.meta | 18 + ProjectSettings/EditorBuildSettings.asset | 4 +- 31 files changed, 903 insertions(+), 9 deletions(-) create mode 100644 Assets/03_Character/ColorMan/Prefabs/YellowMan.prefab create mode 100644 Assets/03_Character/ColorMan/Prefabs/YellowMan.prefab.meta create mode 100644 Assets/TextMesh Pro Effect.meta create mode 100644 Assets/TextMesh Pro Effect/Documentation.meta create mode 100644 Assets/TextMesh Pro Effect/Documentation/Documetation.pdf create mode 100644 Assets/TextMesh Pro Effect/Documentation/Documetation.pdf.meta create mode 100644 Assets/TextMesh Pro Effect/Editor.meta create mode 100644 Assets/TextMesh Pro Effect/Editor/TextMeshProEffect.Editor.asmdef create mode 100644 Assets/TextMesh Pro Effect/Editor/TextMeshProEffect.Editor.asmdef.meta create mode 100644 Assets/TextMesh Pro Effect/Editor/TextMeshProEffectEditor.cs create mode 100644 Assets/TextMesh Pro Effect/Editor/TextMeshProEffectEditor.cs.meta create mode 100644 Assets/TextMesh Pro Effect/Examples.meta create mode 100644 Assets/TextMesh Pro Effect/Examples/KomikaDemo.asset create mode 100644 Assets/TextMesh Pro Effect/Examples/KomikaDemo.asset.meta create mode 100644 Assets/TextMesh Pro Effect/Examples/KomikaDemo.ttf create mode 100644 Assets/TextMesh Pro Effect/Examples/KomikaDemo.ttf.meta create mode 100644 Assets/TextMesh Pro Effect/Examples/SceneTextMeshDemo.unity create mode 100644 Assets/TextMesh Pro Effect/Examples/SceneTextMeshDemo.unity.meta create mode 100644 Assets/TextMesh Pro Effect/Examples/TextMeshProEffectDemo.unity create mode 100644 Assets/TextMesh Pro Effect/Examples/TextMeshProEffectDemo.unity.meta create mode 100644 Assets/TextMesh Pro Effect/TextMeshProEffect.asmdef create mode 100644 Assets/TextMesh Pro Effect/TextMeshProEffect.asmdef.meta create mode 100644 Assets/TextMesh Pro Effect/TextMeshProEffect.cs create mode 100644 Assets/TextMesh Pro Effect/TextMeshProEffect.cs.meta diff --git a/Assets/01_Scenes/BossScene.unity b/Assets/01_Scenes/BossScene.unity index 2663ada..efa7130 100644 --- a/Assets/01_Scenes/BossScene.unity +++ b/Assets/01_Scenes/BossScene.unity @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b59243d6bdb637313b84e7bc9ec2a0995e0bc68aaadf4435d03428b13291608b -size 185790 +oid sha256:6f0449f350e53ba9607882caeb79fe34720dd2219422d407756b55de38f3d33d +size 191083 diff --git a/Assets/01_Scenes/GameScene.unity b/Assets/01_Scenes/GameScene.unity index f526fbb..4675e22 100644 --- a/Assets/01_Scenes/GameScene.unity +++ b/Assets/01_Scenes/GameScene.unity @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:71897165d315a8071161b514931c56ce5a2f2671a4521bd6334abbcc72b0582b -size 142008 +oid sha256:343da0935a6a2e633e043227f8edb8ae95de9f141d24666494832d6f563e155b +size 145591 diff --git a/Assets/02_Scripts/Enemy/Boss.cs b/Assets/02_Scripts/Enemy/Boss.cs index 3c87929..8ea7947 100644 --- a/Assets/02_Scripts/Enemy/Boss.cs +++ b/Assets/02_Scripts/Enemy/Boss.cs @@ -72,4 +72,9 @@ private async void RunPhaseTransition() _isTransitioning = false; OnPhaseChanged?.Invoke(_currentPhase); } + + private void OnDestroy() + { + GameManager.Instance.WaveM.GameClear(); + } } diff --git a/Assets/02_Scripts/Enemy/WaveManager.cs b/Assets/02_Scripts/Enemy/WaveManager.cs index d2b7979..f136892 100644 --- a/Assets/02_Scripts/Enemy/WaveManager.cs +++ b/Assets/02_Scripts/Enemy/WaveManager.cs @@ -1,7 +1,11 @@ using System; using System.Collections.Generic; +using System.Data; using System.Threading; +using TMPro; +using UnityEditor.Playables; using UnityEngine; +using UnityEngine.UI; // ============================================================================ // WaveManager @@ -61,8 +65,15 @@ public class WaveManager : MonoBehaviour private readonly List _aliveEnemies = new(); private CancellationTokenSource _waveCts; // 전체 웨이브 진행 취소 토큰 (OnDestroy/StopWaves에서 취소) + [SerializeField] private Button BossZoneButton; + public TMP_Text WaveText; + public TMP_Text GameClearText; + + + private void Start() { + OnAllWavesCleared += StageClearEvent; if (_startOnAwake) StartWaves(); } @@ -72,11 +83,33 @@ private void OnDestroy() _waveCts?.Dispose(); } + private async Awaitable WaveUIOn() + { + try + { + WaveText.text = $"Wave {CurrentWaveIndex + 1}"; + WaveText.gameObject.SetActive(true); + + + await Awaitable.WaitForSecondsAsync(3.0f, destroyCancellationToken); + + WaveText.gameObject.SetActive(false); + } + catch (System.OperationCanceledException) + { + + } + } + // 외부에서 호출해 웨이브 시작 (예: UI 버튼, 트리거). public void StartWaves() { + Debug.Log("aaaa"); + if (_waves == null || _waves.Count == 0) return; RunAllWaves(); + + _ = WaveUIOn(); } // 진행 중인 웨이브 강제 중단. 게임 오버/메뉴 진입 등에 사용. @@ -249,6 +282,7 @@ private void DestroyAliveEnemies() // 디버그용 OnGUI 표시. 실제 게임 UI는 별도로 구성하고 이건 빠르게 확인용. private void OnGUI() { + /* GUIStyle style = new GUIStyle(GUI.skin.box) { fontSize = 22, @@ -280,6 +314,7 @@ private void OnGUI() } GUI.Box(new Rect(Screen.width / 2f - 180f, 20f, 360f, 110f), text, style); + */ } private void OnDrawGizmosSelected() @@ -312,4 +347,15 @@ private void OnDrawGizmosSelected() } } } + + public void StageClearEvent() + { + BossZoneButton.gameObject.SetActive(true); + } + + + public void GameClear() + { + GameClearText.gameObject.SetActive(true); + } } diff --git a/Assets/02_Scripts/Managers/GameManager.cs b/Assets/02_Scripts/Managers/GameManager.cs index 5076958..79830a6 100644 --- a/Assets/02_Scripts/Managers/GameManager.cs +++ b/Assets/02_Scripts/Managers/GameManager.cs @@ -1,3 +1,4 @@ +using TMPro; using UnityEngine; public class GameManager : MonoBehaviour,ISceneInitializable @@ -7,6 +8,8 @@ public class GameManager : MonoBehaviour,ISceneInitializable public SkillSupport SkillSupporter {get; private set;} public PlayerController LocalPlayer {get; private set;} + public WaveManager WaveM {get; private set;} + private void Awake() { @@ -22,8 +25,8 @@ private void Awake() public void OnSceneLoaded() { - Debug.Log("aaaa"); SkillSupporter = Object.FindFirstObjectByType(); LocalPlayer = Object.FindFirstObjectByType(); + WaveM = Object.FindFirstObjectByType(); } } diff --git a/Assets/03_Character/ColorMan/Prefabs/YellowMan.prefab b/Assets/03_Character/ColorMan/Prefabs/YellowMan.prefab new file mode 100644 index 0000000..962a481 --- /dev/null +++ b/Assets/03_Character/ColorMan/Prefabs/YellowMan.prefab @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:810e22088c03f40b6b25d22a336aff7d36b8c9814cc892ea49a99f279a59daae +size 14432 diff --git a/Assets/03_Character/ColorMan/Prefabs/YellowMan.prefab.meta b/Assets/03_Character/ColorMan/Prefabs/YellowMan.prefab.meta new file mode 100644 index 0000000..c9d9041 --- /dev/null +++ b/Assets/03_Character/ColorMan/Prefabs/YellowMan.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: e6c1cfb64ee7ec143b32b3f33b3e85f0 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/05_Data/Wave/WaveData2.asset b/Assets/05_Data/Wave/WaveData2.asset index a14d972..2c7d211 100644 --- a/Assets/05_Data/Wave/WaveData2.asset +++ b/Assets/05_Data/Wave/WaveData2.asset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:04081ed018c3dc72a912957f5ec8288fd96574b31b5b287cf0652f825eb0a96f -size 619 +oid sha256:5fffca477c0e321a8017923a4c22e6ab412745f074ece35e495d681aef622d1e +size 732 diff --git a/Assets/TextMesh Pro Effect.meta b/Assets/TextMesh Pro Effect.meta new file mode 100644 index 0000000..d00a938 --- /dev/null +++ b/Assets/TextMesh Pro Effect.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2bdd8076392c3aa49925be36e4af394f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/TextMesh Pro Effect/Documentation.meta b/Assets/TextMesh Pro Effect/Documentation.meta new file mode 100644 index 0000000..4d0bfa0 --- /dev/null +++ b/Assets/TextMesh Pro Effect/Documentation.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9b0ac18428e5255468d5c3fcc25a9b33 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/TextMesh Pro Effect/Documentation/Documetation.pdf b/Assets/TextMesh Pro Effect/Documentation/Documetation.pdf new file mode 100644 index 0000000..e1efa48 --- /dev/null +++ b/Assets/TextMesh Pro Effect/Documentation/Documetation.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:14fdcc6d781fc28a23df1b3bd4c92a25da98e78af00db92be0ac9c8aacc10341 +size 342070 diff --git a/Assets/TextMesh Pro Effect/Documentation/Documetation.pdf.meta b/Assets/TextMesh Pro Effect/Documentation/Documetation.pdf.meta new file mode 100644 index 0000000..4952a9a --- /dev/null +++ b/Assets/TextMesh Pro Effect/Documentation/Documetation.pdf.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 5fd8f10a40423eb41b0321d55366ba47 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156234 + packageName: TextMesh Pro Effect + packageVersion: 1.63 + assetPath: Assets/TextMesh Pro Effect/Documentation/Documetation.pdf + uploadId: 755994 diff --git a/Assets/TextMesh Pro Effect/Editor.meta b/Assets/TextMesh Pro Effect/Editor.meta new file mode 100644 index 0000000..e9905ed --- /dev/null +++ b/Assets/TextMesh Pro Effect/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 169ef5f7f29010d43b5eaaada3ad796a +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/TextMesh Pro Effect/Editor/TextMeshProEffect.Editor.asmdef b/Assets/TextMesh Pro Effect/Editor/TextMeshProEffect.Editor.asmdef new file mode 100644 index 0000000..e6ed3b2 --- /dev/null +++ b/Assets/TextMesh Pro Effect/Editor/TextMeshProEffect.Editor.asmdef @@ -0,0 +1,17 @@ +{ + "name": "TextMeshProEffect.Editor", + "references": [ + "GUID:7d8e9e122924faa4bb27c57e77d13ce7" + ], + "includePlatforms": [ + "Editor" + ], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/Assets/TextMesh Pro Effect/Editor/TextMeshProEffect.Editor.asmdef.meta b/Assets/TextMesh Pro Effect/Editor/TextMeshProEffect.Editor.asmdef.meta new file mode 100644 index 0000000..bffccdf --- /dev/null +++ b/Assets/TextMesh Pro Effect/Editor/TextMeshProEffect.Editor.asmdef.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: f60cd03d3d4d02042aeeb7482062c973 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156234 + packageName: TextMesh Pro Effect + packageVersion: 1.63 + assetPath: Assets/TextMesh Pro Effect/Editor/TextMeshProEffect.Editor.asmdef + uploadId: 755994 diff --git a/Assets/TextMesh Pro Effect/Editor/TextMeshProEffectEditor.cs b/Assets/TextMesh Pro Effect/Editor/TextMeshProEffectEditor.cs new file mode 100644 index 0000000..7592f50 --- /dev/null +++ b/Assets/TextMesh Pro Effect/Editor/TextMeshProEffectEditor.cs @@ -0,0 +1,27 @@ +// ReSharper disable InconsistentNaming +// ReSharper disable CheckNamespace +#pragma warning disable 0649 +using UnityEditor; +using UnityEngine; + +namespace TMPro.Editor +{ + [CustomEditor(typeof(TextMeshProEffect))] + public class TextMeshProEffectEditor : UnityEditor.Editor + { + public override bool RequiresConstantRepaint() + { + return true; + } + + public override void OnInspectorGUI() + { + if (!Application.isPlaying) + { + EditorApplication.QueuePlayerLoopUpdate(); + SceneView.RepaintAll(); + } + base.OnInspectorGUI(); + } + } +} diff --git a/Assets/TextMesh Pro Effect/Editor/TextMeshProEffectEditor.cs.meta b/Assets/TextMesh Pro Effect/Editor/TextMeshProEffectEditor.cs.meta new file mode 100644 index 0000000..6c96a81 --- /dev/null +++ b/Assets/TextMesh Pro Effect/Editor/TextMeshProEffectEditor.cs.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 1df4a663e3074434940d6a419e9e0016 +timeCreated: 1597000388 +AssetOrigin: + serializedVersion: 1 + productId: 156234 + packageName: TextMesh Pro Effect + packageVersion: 1.63 + assetPath: Assets/TextMesh Pro Effect/Editor/TextMeshProEffectEditor.cs + uploadId: 755994 diff --git a/Assets/TextMesh Pro Effect/Examples.meta b/Assets/TextMesh Pro Effect/Examples.meta new file mode 100644 index 0000000..88993f7 --- /dev/null +++ b/Assets/TextMesh Pro Effect/Examples.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 98f268518bdb11542a2eb246af6b22d2 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/TextMesh Pro Effect/Examples/KomikaDemo.asset b/Assets/TextMesh Pro Effect/Examples/KomikaDemo.asset new file mode 100644 index 0000000..70ee304 --- /dev/null +++ b/Assets/TextMesh Pro Effect/Examples/KomikaDemo.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c7b4115ba68b2f615c696de360b4675b1563e3a30433f38cc03116c6771dc78c +size 2210821 diff --git a/Assets/TextMesh Pro Effect/Examples/KomikaDemo.asset.meta b/Assets/TextMesh Pro Effect/Examples/KomikaDemo.asset.meta new file mode 100644 index 0000000..f6aea00 --- /dev/null +++ b/Assets/TextMesh Pro Effect/Examples/KomikaDemo.asset.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: b0f48d9d99c22c8468e45c63949f6113 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156234 + packageName: TextMesh Pro Effect + packageVersion: 1.63 + assetPath: Assets/TextMesh Pro Effect/Examples/KomikaDemo.asset + uploadId: 755994 diff --git a/Assets/TextMesh Pro Effect/Examples/KomikaDemo.ttf b/Assets/TextMesh Pro Effect/Examples/KomikaDemo.ttf new file mode 100644 index 0000000..b0d631c --- /dev/null +++ b/Assets/TextMesh Pro Effect/Examples/KomikaDemo.ttf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0facf5af1758c38ccef29ad7931e089be3c2584ab7782f6014ee80922c72d1e0 +size 51232 diff --git a/Assets/TextMesh Pro Effect/Examples/KomikaDemo.ttf.meta b/Assets/TextMesh Pro Effect/Examples/KomikaDemo.ttf.meta new file mode 100644 index 0000000..50c0249 --- /dev/null +++ b/Assets/TextMesh Pro Effect/Examples/KomikaDemo.ttf.meta @@ -0,0 +1,29 @@ +fileFormatVersion: 2 +guid: 8c0ad88a37ec6b84ca188d44a1cbbda3 +TrueTypeFontImporter: + externalObjects: {} + serializedVersion: 4 + fontSize: 86 + forceTextureCase: -1 + characterSpacing: 0 + characterPadding: 1 + includeFontData: 1 + fontName: Komika Title + fontNames: + - Komika Title + fallbackFontReferences: [] + customCharacters: + fontRenderingMode: 0 + ascentCalculationMode: 1 + useLegacyBoundsCalculation: 0 + shouldRoundAdvanceValue: 1 + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156234 + packageName: TextMesh Pro Effect + packageVersion: 1.63 + assetPath: Assets/TextMesh Pro Effect/Examples/KomikaDemo.ttf + uploadId: 755994 diff --git a/Assets/TextMesh Pro Effect/Examples/SceneTextMeshDemo.unity b/Assets/TextMesh Pro Effect/Examples/SceneTextMeshDemo.unity new file mode 100644 index 0000000..e2efb17 --- /dev/null +++ b/Assets/TextMesh Pro Effect/Examples/SceneTextMeshDemo.unity @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1d2af4c05c5f846f605ad2dd1a0a9e6e74738ce82b9b0038d35288bc7075e240 +size 27893 diff --git a/Assets/TextMesh Pro Effect/Examples/SceneTextMeshDemo.unity.meta b/Assets/TextMesh Pro Effect/Examples/SceneTextMeshDemo.unity.meta new file mode 100644 index 0000000..db2fb9b --- /dev/null +++ b/Assets/TextMesh Pro Effect/Examples/SceneTextMeshDemo.unity.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: a6eaaae1699a82f42aa07f39e6de1f7c +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156234 + packageName: TextMesh Pro Effect + packageVersion: 1.63 + assetPath: Assets/TextMesh Pro Effect/Examples/SceneTextMeshDemo.unity + uploadId: 755994 diff --git a/Assets/TextMesh Pro Effect/Examples/TextMeshProEffectDemo.unity b/Assets/TextMesh Pro Effect/Examples/TextMeshProEffectDemo.unity new file mode 100644 index 0000000..2365a9e --- /dev/null +++ b/Assets/TextMesh Pro Effect/Examples/TextMeshProEffectDemo.unity @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:457ccde00e75514bdd27dd644e4f3b6ab8c65a3ccd5c974a1189be00a316a166 +size 111436 diff --git a/Assets/TextMesh Pro Effect/Examples/TextMeshProEffectDemo.unity.meta b/Assets/TextMesh Pro Effect/Examples/TextMeshProEffectDemo.unity.meta new file mode 100644 index 0000000..ea2ba9b --- /dev/null +++ b/Assets/TextMesh Pro Effect/Examples/TextMeshProEffectDemo.unity.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 51d37d5d76b2b834ba49d4b6834c530a +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156234 + packageName: TextMesh Pro Effect + packageVersion: 1.63 + assetPath: Assets/TextMesh Pro Effect/Examples/TextMeshProEffectDemo.unity + uploadId: 755994 diff --git a/Assets/TextMesh Pro Effect/TextMeshProEffect.asmdef b/Assets/TextMesh Pro Effect/TextMeshProEffect.asmdef new file mode 100644 index 0000000..9cbb1c5 --- /dev/null +++ b/Assets/TextMesh Pro Effect/TextMeshProEffect.asmdef @@ -0,0 +1,14 @@ +{ + "name": "TextMeshProEffect", + "references": [ + "GUID:6055be8ebefd69e48b49212b09b47b2f" + ], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [] +} \ No newline at end of file diff --git a/Assets/TextMesh Pro Effect/TextMeshProEffect.asmdef.meta b/Assets/TextMesh Pro Effect/TextMeshProEffect.asmdef.meta new file mode 100644 index 0000000..47b8a63 --- /dev/null +++ b/Assets/TextMesh Pro Effect/TextMeshProEffect.asmdef.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 7d8e9e122924faa4bb27c57e77d13ce7 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156234 + packageName: TextMesh Pro Effect + packageVersion: 1.63 + assetPath: Assets/TextMesh Pro Effect/TextMeshProEffect.asmdef + uploadId: 755994 diff --git a/Assets/TextMesh Pro Effect/TextMeshProEffect.cs b/Assets/TextMesh Pro Effect/TextMeshProEffect.cs new file mode 100644 index 0000000..c388526 --- /dev/null +++ b/Assets/TextMesh Pro Effect/TextMeshProEffect.cs @@ -0,0 +1,583 @@ +// ReSharper disable InconsistentNaming +// ReSharper disable CheckNamespace +#pragma warning disable 0649 +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Runtime.InteropServices; +using System.Text; +using UnityEngine; + +namespace TMPro +{ + [RequireComponent(typeof(TMP_Text))] + [ExecuteInEditMode] + public class TextMeshProEffect : MonoBehaviour + { + public enum EffectType : byte + { + Waves, + Grow, + Unfold, + UnfoldAndWaves, + Sketch, + Bounce + } + + public enum MixType : byte + { + Multiply, + Add + } + + [ExecuteInEditMode] + internal class SharedState : MonoBehaviour + { + [NonSerialized] + internal bool TextMeshIsUpdated; + + private void LateUpdate() + { + TextMeshIsUpdated = false; + } + } + + [Serializable] + private sealed class о + { + public static readonly о ò = new о(); + + public static Func ó; + + internal bool ô(TextMeshProEffect ö) + { + return ö == null || !ö.enabled; + } + } + + [StructLayout(LayoutKind.Auto)] + private struct Ö + { + public TMP_CharacterInfo º; + + public TextMeshProEffect Ç; + } + + [StructLayout(LayoutKind.Auto)] + private struct ü + { + public float é; + + public TMP_CharacterInfo â; + + public TextMeshProEffect ä; + } + + [StructLayout(LayoutKind.Auto)] + private struct à + { + public float å; + + public TMP_CharacterInfo ç; + + public TextMeshProEffect ê; + } + + public EffectType Type; + + public float DurationInSeconds = 0.5f; + + public float Amplitude = 1f; + + [Space] + [Range(0f, 1f)] + public float CharacterDurationRatio = 0f; + + public int CharactersPerDuration = 0; + + [Space] + public Gradient Gradient = new Gradient(); + + public MixType Mix = MixType.Multiply; + + [Space] + public bool AutoPlay = true; + + public bool Reverse = false; + + public bool Repeat; + + public string ForWords; + + private readonly List> öæ = new List>(); + + [NonSerialized] + public bool IsFinished; + + private float öÆ; + + private TMP_Text öû; + + private EffectType öù; + + private bool öÿ; + + private bool öÜ; + + private bool öƒ; + + private float öá; + + private string öí; + + private ushort öú; + + private float[] öñ = new float[10]; + + private SharedState öÑ; + + private float öª; + + private TMP_TextInfo òo; + + private string òο; + + public List> Intervals => öæ; + + private SharedState SharedStateProp + { + get + { + if (öÑ != null) + { + return öÑ; + } + öÑ = GetComponent(); + if (öÑ == null) + { + öÑ = base.gameObject.AddComponent(); + öÑ.hideFlags = HideFlags.HideInInspector | HideFlags.DontSaveInEditor | HideFlags.NotEditable | HideFlags.DontSaveInBuild; + } + return öÑ; + } + } + + public void CopyTo(TextMeshProEffect effect) + { + effect.Type = Type; + effect.DurationInSeconds = DurationInSeconds; + effect.Amplitude = Amplitude; + effect.CharacterDurationRatio = CharacterDurationRatio; + effect.CharactersPerDuration = CharactersPerDuration; + effect.Gradient = Gradient; + effect.Mix = Mix; + effect.AutoPlay = AutoPlay; + effect.Repeat = Repeat; + effect.ForWords = ForWords; + } + + public void Apply() + { + öû = GetComponent(); + öù = Type; + öÿ = öù == EffectType.Unfold || öù == EffectType.Grow || öù == EffectType.Bounce; + öÜ = öù == EffectType.Sketch; + öƒ = false; + öá = -1f; + } + + private void OnEnable() + { + if (AutoPlay) + { + Play(); + } + } + + private void OnDestroy() + { + öÑ = GetComponent(); + if (!(öÑ == null)) + { + TextMeshProEffect[] components = base.gameObject.GetComponents(); + if (components.Length == 0 || components.All(о.ò.ô)) + { + UnityEngine.Object.Destroy(öÑ); + } + } + } + + private void OnValidate() + { + if (AutoPlay) + { + Play(); + } + else + { + Apply(); + } + } + + private void LateUpdate() + { + if ((UnityEngine.Object)(object)öû == null || DurationInSeconds <= 0f || !öƒ) + { + return; + } + if (Repeat && IsFinished) + { + Play(); + } + if (TMP_Settings.instance == null) + { + return; + } + if (!SharedStateProp.TextMeshIsUpdated) + { + öû.ForceMeshUpdate(); + SharedStateProp.TextMeshIsUpdated = true; + } + òo = öû.textInfo; + if (òo == null || òo.meshInfo == null || òo.meshInfo.Length == 0 || òo.meshInfo[0].vertices == null) + { + return; + } + TMP_MeshInfo[] array = Array.Empty(); + if (Application.isEditor) + { + try + { + array = òo.CopyMeshInfoVertexData(); + } + catch (NullReferenceException ex) + { + FieldInfo field = typeof(TMP_TextInfo).GetField("m_CachedMeshInfo", BindingFlags.Instance | BindingFlags.NonPublic); + if (field != null) + { + field.SetValue(òo, null); + } + Debug.Log("TMP bug. Workaround applied." + ex, this); + array = òo.CopyMeshInfoVertexData(); + } + } + else + { + array = òo.CopyMeshInfoVertexData(); + } + int characterCount = òo.characterCount; + if (characterCount == 0) + { + IsFinished = true; + return; + } + float num = Time.realtimeSinceStartup - öÆ; + if (öí != öû.text || ForWords != òο) + { + öá = -1f; + öí = öû.text; + òο = ForWords; + ë(); + } + if (CharactersPerDuration > 0) + { + öª = DurationInSeconds * (float)öí.Length / (float)CharactersPerDuration; + } + else + { + öª = DurationInSeconds; + } + if (öÜ && num >= öá) + { + öá = num + öª; + öú++; + if (öñ.Length < characterCount * 2) + { + öñ = new float[characterCount * 2]; + } + for (int i = 0; i < öñ.Length; i++) + { + öñ[i] = UnityEngine.Random.value; + } + } + if (öÿ && num > öª) + { + num = öª; + IsFinished = true; + } + float num2 = num / öª; + if (!öÿ) + { + num2 %= 1f; + } + float num3 = num2; + if (Reverse) + { + num3 = 1f - num2; + } + float characterDurationRatio = CharacterDurationRatio; + float num4 = Mathf.Lerp(1f / (float)characterCount, 1f, characterDurationRatio); + int num5 = 0; + int num6 = characterCount; + if (öæ.Count > 0 || !string.IsNullOrEmpty(ForWords)) + { + num6 = 0; + for (int j = 0; j < öæ.Count; j++) + { + ValueTuple valueTuple = öæ[j]; + num6 += valueTuple.Item2 - valueTuple.Item1 + 1; + } + } + for (int k = 0; k < characterCount; k++) + { + if (öæ.Count > 0 || !string.IsNullOrEmpty(ForWords)) + { + bool flag = false; + for (int l = 0; l < öæ.Count; l++) + { + ValueTuple valueTuple2 = öæ[l]; + if (k >= valueTuple2.Item1 && k <= valueTuple2.Item2) + { + flag = true; + } + } + if (!flag) + { + continue; + } + } + TMP_CharacterInfo ä = òo.characterInfo[k]; + if (ä.isVisible) + { + float num7 = Mathf.Lerp((float)num5 * 1f / (float)num6, 0f, characterDurationRatio); + float value = (num3 - num7) / num4; + value = Mathf.Clamp01(value); + int materialReferenceIndex = ä.materialReferenceIndex; + int vertexIndex = ä.vertexIndex; + Color32[] colors = òo.meshInfo[materialReferenceIndex].colors32; + Vector3[] vertices = array[materialReferenceIndex].vertices; + Vector3[] vertices2 = òo.meshInfo[materialReferenceIndex].vertices; + î(òo, ä, vertexIndex, colors, vertices2, vertices, num3, value, öú); + num5++; + } + } + for (int m = 0; m < òo.meshInfo.Length; m++) + { + if (m < òo.materialCount) + { + òo.meshInfo[m].mesh.vertices = òo.meshInfo[m].vertices; + öû.UpdateGeometry(òo.meshInfo[m].mesh, m); + } + } + öû.UpdateVertexData(TMP_VertexDataUpdateFlags.Colors32); + } + + private void ë() + { + öæ.Clear(); + if (string.IsNullOrWhiteSpace(ForWords) || öí == null) + { + return; + } + StringBuilder stringBuilder = new StringBuilder(òo.characterCount); + for (int i = 0; i < òo.characterCount; i++) + { + stringBuilder.Append(òo.characterInfo[i].character); + } + bool flag = (öû.fontStyle & (FontStyles.LowerCase | FontStyles.UpperCase | FontStyles.SmallCaps)) != 0; + string text = stringBuilder.ToString(); + string[] array = ForWords.Split(new char[2] { '\t', ' ' }, StringSplitOptions.RemoveEmptyEntries); + string[] array2 = array; + foreach (string text2 in array2) + { + int startIndex = 0; + while (true) + { + startIndex = text.IndexOf(text2, startIndex, flag ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal); + if (startIndex == -1) + { + break; + } + if (startIndex <= 0 || è(text[startIndex - 1])) + { + int num = startIndex + text2.Length; + if (num >= text.Length || è(text[num])) + { + öæ.Add(new ValueTuple(startIndex, startIndex + text2.Length - 1)); + } + } + startIndex += text2.Length; + } + } + } + + private bool è(char ï) + { + return char.IsWhiteSpace(ï) || char.IsSeparator(ï) || char.IsPunctuation(ï); + } + + private void î(TMP_TextInfo ì, TMP_CharacterInfo Ä, int Å, Color32[] É, Vector3[] æ, Vector3[] Æ, float û, float ù, ushort ÿ) + { + if (öÜ) + { + οο(Ä, Å, É, Ü(öú + Ä.index)); + } + else + { + οο(Ä, Å, É, ù); + } + switch (Type) + { + case EffectType.Waves: + οó(Ä, Å, æ, Æ, û); + break; + case EffectType.Grow: + οë(Ä, Å, æ, Æ, ù); + break; + case EffectType.Unfold: + οÅ(Ä, Å, æ, Æ, ù); + break; + case EffectType.UnfoldAndWaves: + οÅ(Ä, Å, æ, Æ, ù); + οó(Ä, Å, æ, æ, û); + break; + case EffectType.Sketch: + á(Ä, Å, æ, Æ, ù, ÿ); + break; + case EffectType.Bounce: + οâ(Ä, Å, æ, Æ, ù); + break; + default: + throw new ArgumentOutOfRangeException(); + } + } + + private float Ü(int ƒ) + { + int num = Mathf.Abs(ƒ % öñ.Length); + return öñ[num]; + } + + private void á(TMP_CharacterInfo í, int ú, Vector3[] ñ, Vector3[] Ñ, float ª, int οo) + { + Ö οá = default(Ö); + οá.º = í; + οá.Ç = this; + ñ[ú] = Ñ[ú] - οÿ(ú, οo, ref οá); + ñ[ú + 1] = Ñ[ú + 1] - οÿ(ú + 1, οo, ref οá); + ñ[ú + 2] = Ñ[ú + 2] - οÿ(ú + 2, οo, ref οá); + ñ[ú + 3] = Ñ[ú + 3] - οÿ(ú + 3, οo, ref οá); + } + + private void οο(TMP_CharacterInfo οо, int οô, Color32[] οö, float οò) + { + Color color = Gradient.Evaluate(οò); + if (Mix == MixType.Multiply) + { + ref Color32 reference = ref οö[οô]; + reference *= color; + ref Color32 reference2 = ref οö[οô + 1]; + reference2 *= color; + ref Color32 reference3 = ref οö[οô + 2]; + reference3 *= color; + ref Color32 reference4 = ref οö[οô + 3]; + reference4 *= color; + } + else + { + for (int i = 0; i < 4; i++) + { + Color color2 = οö[οô + i] + color; + color2.a *= color.a; + οö[οô + i] = color2; + } + } + } + + private void οó(TMP_CharacterInfo οÖ, int οº, Vector3[] οÇ, Vector3[] οü, float οé) + { + ü οñ = default(ü); + οñ.é = οé; + οñ.â = οÖ; + οñ.ä = this; + οÇ[οº] = οü[οº] - οí(οº, ref οñ); + οÇ[οº + 1] = οü[οº + 1] - οí(οº + 1, ref οñ); + οÇ[οº + 2] = οü[οº + 2] - οí(οº + 2, ref οñ); + οÇ[οº + 3] = οü[οº + 3] - οí(οº + 3, ref οñ); + } + + private void οâ(TMP_CharacterInfo οä, int οà, Vector3[] οå, Vector3[] οç, float οê) + { + à оo = default(à); + оo.å = οê; + оo.ç = οä; + оo.ê = this; + οå[οà] = οç[οà] - οÑ(οà, ref оo); + οå[οà + 1] = οç[οà + 1] - οÑ(οà + 1, ref оo); + οå[οà + 2] = οç[οà + 2] - οÑ(οà + 2, ref оo); + οå[οà + 3] = οç[οà + 3] - οÑ(οà + 3, ref оo); + } + + private void οë(TMP_CharacterInfo οè, int οï, Vector3[] οî, Vector3[] οì, float οÄ) + { + οî[οï] = οì[οï]; + οî[οï + 3] = οì[οï + 3]; + οî[οï + 1] = Vector3.Lerp(οì[οï], οì[οï + 1], οÄ); + οî[οï + 2] = Vector3.Lerp(οì[οï + 3], οì[οï + 2], οÄ); + οî[οï] = Vector3.LerpUnclamped(οì[οï], οî[οï], Amplitude); + οî[οï + 1] = Vector3.LerpUnclamped(οì[οï + 1], οî[οï + 1], Amplitude); + οî[οï + 2] = Vector3.LerpUnclamped(οì[οï + 2], οî[οï + 2], Amplitude); + οî[οï + 3] = Vector3.LerpUnclamped(οì[οï + 3], οî[οï + 3], Amplitude); + } + + private void οÅ(TMP_CharacterInfo οÉ, int οæ, Vector3[] οÆ, Vector3[] οû, float οù) + { + Vector3 a = (οû[οæ] + οû[οæ + 1]) * 0.5f; + Vector3 a2 = (οû[οæ + 3] + οû[οæ + 2]) * 0.5f; + οÆ[οæ] = Vector3.Lerp(a, οû[οæ], οù); + οÆ[οæ + 3] = Vector3.Lerp(a2, οû[οæ + 3], οù); + οÆ[οæ + 1] = Vector3.Lerp(a, οû[οæ + 1], οù); + οÆ[οæ + 2] = Vector3.Lerp(a2, οû[οæ + 2], οù); + οÆ[οæ] = Vector3.LerpUnclamped(οû[οæ], οÆ[οæ], Amplitude); + οÆ[οæ + 1] = Vector3.LerpUnclamped(οû[οæ + 1], οÆ[οæ + 1], Amplitude); + οÆ[οæ + 2] = Vector3.LerpUnclamped(οû[οæ + 2], οÆ[οæ + 2], Amplitude); + οÆ[οæ + 3] = Vector3.LerpUnclamped(οû[οæ + 3], οÆ[οæ + 3], Amplitude); + } + + [ContextMenu("Play")] + public void Play() + { + Apply(); + IsFinished = false; + öÆ = Time.realtimeSinceStartup; + öƒ = true; + } + + [ContextMenu("Finish")] + public void Finish() + { + öÆ = float.MinValue; + } + + private Vector3 οÿ(int οÜ, int οƒ, ref Ö οá) + { + float num = οá.º.pointSize * 0.1f * Amplitude; + float num2 = Ü(οÜ << οƒ); + float num3 = Ü(οÜ << οƒ >> 5); + return new Vector3(num2 * num, num3 * num, 0f); + } + + private Vector3 οí(int οú, ref ü οñ) + { + float f = MathF.PI * -2f * οñ.é + (float)(οú / 4) * 0.3f; + return new Vector3(0f, Mathf.Cos(f) * οñ.â.pointSize * 0.3f * Amplitude, 0f); + } + + private Vector3 οÑ(int οª, ref à оo) + { + float f = MathF.PI * -2f * оo.å; + return new Vector3(0f, Mathf.Cos(f) * оo.ç.pointSize * 0.3f * Amplitude, 0f); + } + } +} diff --git a/Assets/TextMesh Pro Effect/TextMeshProEffect.cs.meta b/Assets/TextMesh Pro Effect/TextMeshProEffect.cs.meta new file mode 100644 index 0000000..691b323 --- /dev/null +++ b/Assets/TextMesh Pro Effect/TextMeshProEffect.cs.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: f6f31fa26b868604483df4f19c00a991 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: +AssetOrigin: + serializedVersion: 1 + productId: 156234 + packageName: TextMesh Pro Effect + packageVersion: 1.63 + assetPath: Assets/TextMesh Pro Effect/TextMeshProEffect.cs + uploadId: 755994 diff --git a/ProjectSettings/EditorBuildSettings.asset b/ProjectSettings/EditorBuildSettings.asset index 1bc48d6..5b28fa7 100644 --- a/ProjectSettings/EditorBuildSettings.asset +++ b/ProjectSettings/EditorBuildSettings.asset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fdb52a9c10bdbceb5bfb380e561718a5a4a0003e1ebff0dd7775bca460b96303 -size 410 +oid sha256:4b7f758a1f856bcf944850fd9c0d665ce36c0b6c643d3690c58c28ee6b3d88f0 +size 509