com.amanotes.magictilescore 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (257) hide show
  1. package/CHANGELOG.md +240 -0
  2. package/CHANGELOG.md.meta +7 -0
  3. package/Docs/Class-Hierarchy.md +729 -0
  4. package/Docs/Class-Hierarchy.md.meta +7 -0
  5. package/Docs/Component-Architecture.md +43 -0
  6. package/Docs/Component-Architecture.md.meta +7 -0
  7. package/Docs/File-Structure.md +327 -0
  8. package/Docs/File-Structure.md.meta +7 -0
  9. package/Docs/Game-Architecture.md +41 -0
  10. package/Docs/Game-Architecture.md.meta +7 -0
  11. package/Docs/Input-System-Guide.md +419 -0
  12. package/Docs/Input-System-Guide.md.meta +7 -0
  13. package/Docs/Knot-System-Guide.md +309 -0
  14. package/Docs/Knot-System-Guide.md.meta +7 -0
  15. package/Docs/Meta-System-Guide.md +249 -0
  16. package/Docs/Meta-System-Guide.md.meta +7 -0
  17. package/Docs/New-Game-Checklist.md +102 -0
  18. package/Docs/New-Game-Checklist.md.meta +7 -0
  19. package/Docs/README.md +37 -0
  20. package/Docs/README.md.meta +7 -0
  21. package/Docs/RhythmCore-Architecture.md +373 -0
  22. package/Docs/RhythmCore-Architecture.md.meta +7 -0
  23. package/Docs/RhythmCore-Customize-Guide.md +391 -0
  24. package/Docs/RhythmCore-Customize-Guide.md.meta +7 -0
  25. package/Docs/Understanding-Rhythm-Core.md +483 -0
  26. package/Docs/Understanding-Rhythm-Core.md.meta +7 -0
  27. package/Docs/VisualWarp-System-Guide.md +377 -0
  28. package/Docs/VisualWarp-System-Guide.md.meta +7 -0
  29. package/Docs/Widget2D-System-Guide.md +450 -0
  30. package/Docs/Widget2D-System-Guide.md.meta +7 -0
  31. package/Docs.meta +8 -0
  32. package/Editor/AdjustHueEditor.cs +90 -0
  33. package/Editor/AdjustHueEditor.cs.meta +11 -0
  34. package/Editor/ClassInstanceDrawer.cs +256 -0
  35. package/Editor/ClassInstanceDrawer.cs.meta +11 -0
  36. package/Editor/CollapsibleGroupEditor.cs +142 -0
  37. package/Editor/CollapsibleGroupEditor.cs.meta +11 -0
  38. package/Editor/ListSongNoteEditor.cs +317 -0
  39. package/Editor/ListSongNoteEditor.cs.meta +11 -0
  40. package/Editor/MagicTilesCore.Editor.asmdef +20 -0
  41. package/Editor/MagicTilesCore.Editor.asmdef.meta +7 -0
  42. package/Editor/MetaLogicDrawer.cs +488 -0
  43. package/Editor/MetaLogicDrawer.cs.meta +11 -0
  44. package/Editor/RhythmContextEditor.EditorDrawer.cs +46 -0
  45. package/Editor/RhythmContextEditor.EditorDrawer.cs.meta +3 -0
  46. package/Editor/RhythmContextEditor.cs +587 -0
  47. package/Editor/RhythmContextEditor.cs.meta +3 -0
  48. package/Editor/RhythmGameEditor.cs +45 -0
  49. package/Editor/RhythmGameEditor.cs.meta +11 -0
  50. package/Editor/RhythmTileEditor.cs +93 -0
  51. package/Editor/RhythmTileEditor.cs.meta +11 -0
  52. package/Editor/TagConfigDrawer.cs +30 -0
  53. package/Editor/TagConfigDrawer.cs.meta +11 -0
  54. package/Editor.meta +8 -0
  55. package/LICENSE.md +7 -0
  56. package/LICENSE.md.meta +7 -0
  57. package/README.md +88 -0
  58. package/README.md.meta +7 -0
  59. package/Runtime/AssemblyInfo.cs +4 -0
  60. package/Runtime/AssemblyInfo.cs.meta +11 -0
  61. package/Runtime/Input/Base/BaseTileInput.cs +44 -0
  62. package/Runtime/Input/Base/BaseTileInput.cs.meta +11 -0
  63. package/Runtime/Input/Base/IInputHandler.cs +11 -0
  64. package/Runtime/Input/Base/IInputHandler.cs.meta +11 -0
  65. package/Runtime/Input/Base/InputData.cs +94 -0
  66. package/Runtime/Input/Base/InputData.cs.meta +3 -0
  67. package/Runtime/Input/Base/InputDirection.cs +17 -0
  68. package/Runtime/Input/Base/InputDirection.cs.meta +3 -0
  69. package/Runtime/Input/Base/InputPhase.cs +4 -0
  70. package/Runtime/Input/Base/InputPhase.cs.meta +3 -0
  71. package/Runtime/Input/Base.meta +3 -0
  72. package/Runtime/Input/Components/DragInput.cs +44 -0
  73. package/Runtime/Input/Components/DragInput.cs.meta +11 -0
  74. package/Runtime/Input/Components/HoldInput.cs +75 -0
  75. package/Runtime/Input/Components/HoldInput.cs.meta +12 -0
  76. package/Runtime/Input/Components/SwipeInput.cs +45 -0
  77. package/Runtime/Input/Components/SwipeInput.cs.meta +12 -0
  78. package/Runtime/Input/Components/TouchInput.cs +31 -0
  79. package/Runtime/Input/Components/TouchInput.cs.meta +11 -0
  80. package/Runtime/Input/Components.meta +8 -0
  81. package/Runtime/Input.meta +8 -0
  82. package/Runtime/MagicTilesCore.asmdef +24 -0
  83. package/Runtime/MagicTilesCore.asmdef.meta +7 -0
  84. package/Runtime/MoodChange/AdjustHue.ComponentInfo.cs +12 -0
  85. package/Runtime/MoodChange/AdjustHue.ComponentInfo.cs.meta +3 -0
  86. package/Runtime/MoodChange/AdjustHue.MaterialInfo.cs +115 -0
  87. package/Runtime/MoodChange/AdjustHue.MaterialInfo.cs.meta +3 -0
  88. package/Runtime/MoodChange/AdjustHue.ParticleSystemInfo.cs +36 -0
  89. package/Runtime/MoodChange/AdjustHue.ParticleSystemInfo.cs.meta +3 -0
  90. package/Runtime/MoodChange/AdjustHue.SpriteRendererInfo.cs +28 -0
  91. package/Runtime/MoodChange/AdjustHue.SpriteRendererInfo.cs.meta +3 -0
  92. package/Runtime/MoodChange/AdjustHue.TrailRendererInfo.cs +37 -0
  93. package/Runtime/MoodChange/AdjustHue.TrailRendererInfo.cs.meta +3 -0
  94. package/Runtime/MoodChange/AdjustHue.cs +219 -0
  95. package/Runtime/MoodChange/AdjustHue.cs.meta +11 -0
  96. package/Runtime/MoodChange/ColorHueExtensions.cs +227 -0
  97. package/Runtime/MoodChange/ColorHueExtensions.cs.meta +3 -0
  98. package/Runtime/MoodChange/HueCache.cs +167 -0
  99. package/Runtime/MoodChange/HueCache.cs.meta +11 -0
  100. package/Runtime/MoodChange/MoodChange.cs +52 -0
  101. package/Runtime/MoodChange/MoodChange.cs.meta +3 -0
  102. package/Runtime/MoodChange.meta +3 -0
  103. package/Runtime/Physics/TriggerCallback.cs +21 -0
  104. package/Runtime/Physics/TriggerCallback.cs.meta +3 -0
  105. package/Runtime/Physics.meta +8 -0
  106. package/Runtime/Preset/AudioSourcePlayer/AudioSourcePlayer.cs +153 -0
  107. package/Runtime/Preset/AudioSourcePlayer/AudioSourcePlayer.cs.meta +11 -0
  108. package/Runtime/Preset/AudioSourcePlayer/AudioSourcePlayer.prefab +145 -0
  109. package/Runtime/Preset/AudioSourcePlayer/AudioSourcePlayer.prefab.meta +7 -0
  110. package/Runtime/Preset/AudioSourcePlayer.meta +8 -0
  111. package/Runtime/Preset/AudioTimeText/AudioTimeText.cs +22 -0
  112. package/Runtime/Preset/AudioTimeText/AudioTimeText.cs.meta +11 -0
  113. package/Runtime/Preset/AudioTimeText/AudioTimeText.prefab +188 -0
  114. package/Runtime/Preset/AudioTimeText/AudioTimeText.prefab.meta +7 -0
  115. package/Runtime/Preset/AudioTimeText.meta +8 -0
  116. package/Runtime/Preset/ParticleSystemPlayer/ParticleSystemPlayer.cs +32 -0
  117. package/Runtime/Preset/ParticleSystemPlayer/ParticleSystemPlayer.cs.meta +11 -0
  118. package/Runtime/Preset/ParticleSystemPlayer.meta +8 -0
  119. package/Runtime/Preset/RendererAlpha.cs +56 -0
  120. package/Runtime/Preset/RendererAlpha.cs.meta +11 -0
  121. package/Runtime/Preset/ScoreText/ScoreText.anim +198 -0
  122. package/Runtime/Preset/ScoreText/ScoreText.anim.meta +8 -0
  123. package/Runtime/Preset/ScoreText/ScoreText.cs +32 -0
  124. package/Runtime/Preset/ScoreText/ScoreText.cs.meta +11 -0
  125. package/Runtime/Preset/ScoreText/ScoreText_2D.prefab +170 -0
  126. package/Runtime/Preset/ScoreText/ScoreText_2D.prefab.meta +7 -0
  127. package/Runtime/Preset/ScoreText/ScoreText_3D.prefab +206 -0
  128. package/Runtime/Preset/ScoreText/ScoreText_3D.prefab.meta +7 -0
  129. package/Runtime/Preset/ScoreText.meta +8 -0
  130. package/Runtime/Preset/StartHint/StartHint.cs +26 -0
  131. package/Runtime/Preset/StartHint/StartHint.cs.meta +3 -0
  132. package/Runtime/Preset/StartHint.meta +8 -0
  133. package/Runtime/Preset/WowText/WowText.cs +38 -0
  134. package/Runtime/Preset/WowText/WowText.cs.meta +3 -0
  135. package/Runtime/Preset/WowText.meta +8 -0
  136. package/Runtime/Preset.meta +8 -0
  137. package/Runtime/Rhythm/Components/Controls.meta +8 -0
  138. package/Runtime/Rhythm/Components/Helper/CameraFollow.cs +28 -0
  139. package/Runtime/Rhythm/Components/Helper/CameraFollow.cs.meta +11 -0
  140. package/Runtime/Rhythm/Components/Helper/MeshSpriteSorter.cs +89 -0
  141. package/Runtime/Rhythm/Components/Helper/MeshSpriteSorter.cs.meta +11 -0
  142. package/Runtime/Rhythm/Components/Helper/RecycleLayoutZ.cs +74 -0
  143. package/Runtime/Rhythm/Components/Helper/RecycleLayoutZ.cs.meta +11 -0
  144. package/Runtime/Rhythm/Components/Helper.meta +8 -0
  145. package/Runtime/Rhythm/Components.meta +8 -0
  146. package/Runtime/Rhythm/Core/GameMode.cs +10 -0
  147. package/Runtime/Rhythm/Core/GameMode.cs.meta +3 -0
  148. package/Runtime/Rhythm/Core/IAudioPlayer.cs +16 -0
  149. package/Runtime/Rhythm/Core/IAudioPlayer.cs.meta +3 -0
  150. package/Runtime/Rhythm/Core/IRhythmBehaviour.cs +10 -0
  151. package/Runtime/Rhythm/Core/IRhythmBehaviour.cs.meta +3 -0
  152. package/Runtime/Rhythm/Core/RhythmBehaviour.cs +57 -0
  153. package/Runtime/Rhythm/Core/RhythmBehaviour.cs.meta +11 -0
  154. package/Runtime/Rhythm/Core/RhythmDebug.cs +48 -0
  155. package/Runtime/Rhythm/Core/RhythmDebug.cs.meta +11 -0
  156. package/Runtime/Rhythm/Core/RhythmGameT.cs +323 -0
  157. package/Runtime/Rhythm/Core/RhythmGameT.cs.meta +3 -0
  158. package/Runtime/Rhythm/Core/RhythmMatch.cs +65 -0
  159. package/Runtime/Rhythm/Core/RhythmMatch.cs.meta +11 -0
  160. package/Runtime/Rhythm/Core/RhythmTile.cs +77 -0
  161. package/Runtime/Rhythm/Core/RhythmTile.cs.meta +3 -0
  162. package/Runtime/Rhythm/Core/RhythmTileHandler.cs +59 -0
  163. package/Runtime/Rhythm/Core/RhythmTileHandler.cs.meta +3 -0
  164. package/Runtime/Rhythm/Core.meta +8 -0
  165. package/Runtime/Rhythm/Extensions/CollectionExtensions.cs +120 -0
  166. package/Runtime/Rhythm/Extensions/CollectionExtensions.cs.meta +11 -0
  167. package/Runtime/Rhythm/Extensions/ColliderExtensions.cs +27 -0
  168. package/Runtime/Rhythm/Extensions/ColliderExtensions.cs.meta +11 -0
  169. package/Runtime/Rhythm/Extensions/GameHandlerExtensions.cs +56 -0
  170. package/Runtime/Rhythm/Extensions/GameHandlerExtensions.cs.meta +11 -0
  171. package/Runtime/Rhythm/Extensions/GameObjectExtensions.cs +61 -0
  172. package/Runtime/Rhythm/Extensions/GameObjectExtensions.cs.meta +11 -0
  173. package/Runtime/Rhythm/Extensions/InputDirectionExtensions.cs +76 -0
  174. package/Runtime/Rhythm/Extensions/InputDirectionExtensions.cs.meta +11 -0
  175. package/Runtime/Rhythm/Extensions/MTCListExtensions.cs +127 -0
  176. package/Runtime/Rhythm/Extensions/MTCListExtensions.cs.meta +11 -0
  177. package/Runtime/Rhythm/Extensions/MeshRendererExtensions.cs +81 -0
  178. package/Runtime/Rhythm/Extensions/MeshRendererExtensions.cs.meta +11 -0
  179. package/Runtime/Rhythm/Extensions/ParticleSystemExtensions.cs +54 -0
  180. package/Runtime/Rhythm/Extensions/ParticleSystemExtensions.cs.meta +11 -0
  181. package/Runtime/Rhythm/Extensions.meta +8 -0
  182. package/Runtime/Rhythm/Game/MTCSongAutoStart.cs +40 -0
  183. package/Runtime/Rhythm/Game/MTCSongAutoStart.cs.meta +11 -0
  184. package/Runtime/Rhythm/Game/RhythmConfig.cs +68 -0
  185. package/Runtime/Rhythm/Game/RhythmConfig.cs.meta +11 -0
  186. package/Runtime/Rhythm/Game/RhythmContext.Api.cs +533 -0
  187. package/Runtime/Rhythm/Game/RhythmContext.Api.cs.meta +11 -0
  188. package/Runtime/Rhythm/Game/RhythmContext.Dev.cs +121 -0
  189. package/Runtime/Rhythm/Game/RhythmContext.Dev.cs.meta +11 -0
  190. package/Runtime/Rhythm/Game/RhythmContext.Initialization.cs +114 -0
  191. package/Runtime/Rhythm/Game/RhythmContext.Initialization.cs.meta +11 -0
  192. package/Runtime/Rhythm/Game/RhythmContext.Runtime.cs +126 -0
  193. package/Runtime/Rhythm/Game/RhythmContext.Runtime.cs.meta +11 -0
  194. package/Runtime/Rhythm/Game/RhythmContext.State.cs +221 -0
  195. package/Runtime/Rhythm/Game/RhythmContext.State.cs.meta +11 -0
  196. package/Runtime/Rhythm/Game/RhythmContext.Tile.cs +90 -0
  197. package/Runtime/Rhythm/Game/RhythmContext.Tile.cs.meta +11 -0
  198. package/Runtime/Rhythm/Game/RhythmContext.TimeMachine.cs +315 -0
  199. package/Runtime/Rhythm/Game/RhythmContext.TimeMachine.cs.meta +11 -0
  200. package/Runtime/Rhythm/Game/RhythmContext.cs +312 -0
  201. package/Runtime/Rhythm/Game/RhythmContext.cs.meta +11 -0
  202. package/Runtime/Rhythm/Game/RhythmContextExtensions.cs +91 -0
  203. package/Runtime/Rhythm/Game/RhythmContextExtensions.cs.meta +11 -0
  204. package/Runtime/Rhythm/Game/Tile/ITileProgress.cs +7 -0
  205. package/Runtime/Rhythm/Game/Tile/ITileProgress.cs.meta +3 -0
  206. package/Runtime/Rhythm/Game/Tile/TileContext.cs +194 -0
  207. package/Runtime/Rhythm/Game/Tile/TileContext.cs.meta +11 -0
  208. package/Runtime/Rhythm/Game/Tile.meta +3 -0
  209. package/Runtime/Rhythm/Game.meta +3 -0
  210. package/Runtime/Rhythm/Math/Parabol.cs +35 -0
  211. package/Runtime/Rhythm/Math/Parabol.cs.meta +11 -0
  212. package/Runtime/Rhythm/Math.meta +8 -0
  213. package/Runtime/Rhythm/System/Event/GameEvent.cs +82 -0
  214. package/Runtime/Rhythm/System/Event/GameEvent.cs.meta +3 -0
  215. package/Runtime/Rhythm/System/Event.meta +8 -0
  216. package/Runtime/Rhythm/System/Meta/MetaLogic.cs +121 -0
  217. package/Runtime/Rhythm/System/Meta/MetaLogic.cs.meta +11 -0
  218. package/Runtime/Rhythm/System/Meta/VisualSpeedMeta.cs +132 -0
  219. package/Runtime/Rhythm/System/Meta/VisualSpeedMeta.cs.meta +11 -0
  220. package/Runtime/Rhythm/System/Meta.meta +8 -0
  221. package/Runtime/Rhythm/System/SongData/ListSongNote.cs +45 -0
  222. package/Runtime/Rhythm/System/SongData/ListSongNote.cs.meta +3 -0
  223. package/Runtime/Rhythm/System/SongData.meta +8 -0
  224. package/Runtime/Rhythm/System/StateMachine/RhythmStateMachine.State.cs +22 -0
  225. package/Runtime/Rhythm/System/StateMachine/RhythmStateMachine.State.cs.meta +11 -0
  226. package/Runtime/Rhythm/System/StateMachine/RhythmStateMachine.cs +138 -0
  227. package/Runtime/Rhythm/System/StateMachine/RhythmStateMachine.cs.meta +11 -0
  228. package/Runtime/Rhythm/System/StateMachine.meta +8 -0
  229. package/Runtime/Rhythm/System/TimeKnot/ListTimeKnots.cs +135 -0
  230. package/Runtime/Rhythm/System/TimeKnot/ListTimeKnots.cs.meta +11 -0
  231. package/Runtime/Rhythm/System/TimeKnot.meta +8 -0
  232. package/Runtime/Rhythm/System/TimeMachine/MTCTimeInterpolator.cs +365 -0
  233. package/Runtime/Rhythm/System/TimeMachine/MTCTimeInterpolator.cs.meta +11 -0
  234. package/Runtime/Rhythm/System/TimeMachine/MTCTimeMachine.TimeMarker.cs +107 -0
  235. package/Runtime/Rhythm/System/TimeMachine/MTCTimeMachine.TimeMarker.cs.meta +3 -0
  236. package/Runtime/Rhythm/System/TimeMachine/MTCTimeMachine.TimeNode.cs +14 -0
  237. package/Runtime/Rhythm/System/TimeMachine/MTCTimeMachine.TimeNode.cs.meta +3 -0
  238. package/Runtime/Rhythm/System/TimeMachine/MTCTimeMachine.TimeSpanNode.cs +21 -0
  239. package/Runtime/Rhythm/System/TimeMachine/MTCTimeMachine.TimeSpanNode.cs.meta +3 -0
  240. package/Runtime/Rhythm/System/TimeMachine/MTCTimeMachine.ZLaneSpeed.cs +28 -0
  241. package/Runtime/Rhythm/System/TimeMachine/MTCTimeMachine.ZLaneSpeed.cs.meta +3 -0
  242. package/Runtime/Rhythm/System/TimeMachine/MTCTimeMachine.cs +131 -0
  243. package/Runtime/Rhythm/System/TimeMachine/MTCTimeMachine.cs.meta +11 -0
  244. package/Runtime/Rhythm/System/TimeMachine.meta +8 -0
  245. package/Runtime/Rhythm/System/VisualKnot/VisualKnotLogic.cs +160 -0
  246. package/Runtime/Rhythm/System/VisualKnot/VisualKnotLogic.cs.meta +11 -0
  247. package/Runtime/Rhythm/System/VisualKnot.meta +8 -0
  248. package/Runtime/Rhythm/System/VisualWarp/IVisualWarp.cs +10 -0
  249. package/Runtime/Rhythm/System/VisualWarp/IVisualWarp.cs.meta +11 -0
  250. package/Runtime/Rhythm/System/VisualWarp/LinearVisualWarp.cs +27 -0
  251. package/Runtime/Rhythm/System/VisualWarp/LinearVisualWarp.cs.meta +11 -0
  252. package/Runtime/Rhythm/System/VisualWarp.meta +8 -0
  253. package/Runtime/Rhythm/System.meta +8 -0
  254. package/Runtime/Rhythm.meta +8 -0
  255. package/Runtime.meta +8 -0
  256. package/package.json +12 -0
  257. package/package.json.meta +7 -0
@@ -0,0 +1,450 @@
1
+ # Widget2D System Guide
2
+
3
+ ## 🎯 System Overview
4
+
5
+ Widget2D provides a responsive UI layout system for Unity with automatic component resizing, screen adaptation, and flexible transformation pipelines. Core to rhythm games requiring precise positioning and scaling across different screen sizes.
6
+
7
+ ## 🏗️ Core Architecture
8
+
9
+ ### Widget2D (Base Component)
10
+ ```csharp
11
+ public partial class Widget2D : MonoBehaviour
12
+ ```
13
+ - **Component target system** with automatic size application to `RectTransform`, `SpriteRenderer`, `BoxCollider2D`, `TextMeshPro`
14
+ - **Listener notification** via `ISizeListener` interface for custom resize handling
15
+ - **Visual debugging** with configurable gizmos and editor tools
16
+ - **Partial class design** separating size management, component handling, and listener systems
17
+
18
+ ### Screen2D (Screen Adaptation)
19
+ ```csharp
20
+ public class Screen2D : Widget2D
21
+ ```
22
+ **Responsive Features:**
23
+ - `fitWidthToHeight` (0-1) - Blend between fit-width and fit-height scaling
24
+ - **Runtime screen change detection** with automatic size updates
25
+ - **Original size preservation** for consistent scaling ratios
26
+ - **Aspect ratio calculation** maintaining visual consistency
27
+
28
+ ### WidgetTransform (Layout System)
29
+ ```csharp
30
+ public partial class WidgetTransform : MonoBehaviour, ISizeListener
31
+ ```
32
+ **Transform Pipeline:**
33
+ 1. **SizeHandler** - Source-relative sizing with ratio/delta controls
34
+ 2. **ScaleHandler** - Transform scaling with fit/fill modes
35
+ 3. **AlignHandler** - Position alignment with offset and self-align
36
+
37
+ ## 🎮 Component Handler System
38
+
39
+ ### WidgetHandler (Type Registry)
40
+ ```csharp
41
+ public partial class WidgetHandler
42
+ ```
43
+ **Supported Components:**
44
+ - `RectTransform` - `sizeDelta` property control
45
+ - `SpriteRenderer` - Direct size manipulation via `SetSize()`
46
+ - `BoxCollider2D/BoxCollider` - Scale-aware size calculation and application
47
+ - `TextMeshPro/TextMeshProUGUI` - RectTransform-based sizing
48
+
49
+ **Extensible Design:**
50
+ ```csharp
51
+ WidgetHandler.RegisterHandler<YourComponent>(
52
+ (component, size) => {
53
+ // Custom size application logic
54
+ component.customProperty = size;
55
+ }
56
+ );
57
+ ```
58
+
59
+ ## 🎵 MT3 Tile System Integration
60
+
61
+ ### TileContext - The Data Bridge
62
+
63
+ `TileContext` serves as the central data hub connecting rhythm game logic with visual tile representation:
64
+
65
+ ```csharp
66
+ public sealed class TileContext
67
+ {
68
+ public readonly int index; // Tile sequence number
69
+ public readonly SongNote note; // Musical note data
70
+ public readonly RhythmContext context; // Game state reference
71
+
72
+ // Runtime State
73
+ public float progress = 0f; // Hold tile progress (0-1)
74
+ public float accuracy = -1; // Touch accuracy score
75
+ public TileStatus Status { get; set; } // None, Touching, End, Missed
76
+
77
+ // Visual Integration
78
+ public RhythmTile view { get; private set; } // Attached tile visual
79
+ public Transform viewTrans { get; private set; } // Transform cache
80
+ }
81
+ ```
82
+
83
+ **Key Features:**
84
+ - **Immutable Core**: `index`, `note`, and `context` are readonly for data integrity
85
+ - **Status Management**: Automatic listener notification on status changes
86
+ - **View Lifecycle**: Handles attachment/detachment of visual components
87
+ - **Progress Tracking**: Real-time progress calculation using `context.GetDistanceAtTime()`
88
+
89
+ **Status Flow:**
90
+ ```
91
+ None → Touching → End
92
+ ↓ ↓ ↓
93
+ Missed ← → (status change triggers RefreshTileStatus())
94
+ ```
95
+
96
+ ### MT3Tile2 - Modular Base Implementation
97
+
98
+ **Partial Class Architecture:**
99
+ ```csharp
100
+ // Size Management Partial
101
+ partial class MT3Tile2
102
+ {
103
+ public Widget2D widget;
104
+ protected virtual void RefreshTileSize()
105
+ {
106
+ if (tileContext == null || widget == null) return;
107
+ var screen = context.game.GetComponent<Screen2D>();
108
+ widget.width = 1f / context.nLanes * screen.width;
109
+ }
110
+ }
111
+
112
+ // Touch Handling Partial
113
+ partial class MT3Tile2: IPointerDownHandler, IPointerMoveHandler, IPointerUpHandler
114
+ {
115
+ public void OnPointerDown(PointerEventData eventData) { /* Touch logic */ }
116
+ public void OnPointerMove(PointerEventData eventData) { /* Move tracking */ }
117
+ public void OnPointerUp(PointerEventData eventData) { /* Release handling */ }
118
+ }
119
+
120
+ // Core Rhythm Behavior
121
+ public partial class MT3Tile2 : RhythmBehaviour
122
+ {
123
+ public virtual void OnAttach(TileContext tile)
124
+ {
125
+ AttachTileData(); // Calculate size and position
126
+ RefreshTileStatus(); // Update visual state
127
+ RefreshTileSize(); // Apply screen adaptation
128
+ }
129
+ }
130
+ ```
131
+
132
+ ### Screen Adaptation Flow
133
+
134
+ **1. Screen2D Detection:**
135
+ ```csharp
136
+ // Screen2D automatically detects screen changes
137
+ private void Update()
138
+ {
139
+ var currentSize = GetCurrentScreenSize();
140
+ if (Vector2.Distance(currentSize, _lastScreenSize) > 1f)
141
+ {
142
+ _lastScreenSize = currentSize;
143
+ UpdateScreenSize(); // Triggers cascade update
144
+ }
145
+ }
146
+ ```
147
+
148
+ **2. Tile Width Calculation:**
149
+ ```csharp
150
+ // MT3Tile2 receives screen-relative width
151
+ protected virtual void RefreshTileSize()
152
+ {
153
+ var screen = context.game.GetComponent<Screen2D>();
154
+ widget.width = 1f / context.nLanes * screen.width; // Equal lane distribution
155
+ }
156
+ ```
157
+
158
+ **3. Automatic Component Updates:**
159
+ ```csharp
160
+ // Widget2D automatically applies to all target components
161
+ public void Refresh()
162
+ {
163
+ ApplySizeToComponents(); // Updates SpriteRenderer, Colliders, etc.
164
+ NotifyListeners(); // Triggers ISizeListener callbacks
165
+ }
166
+ ```
167
+
168
+ ## 🔧 TileAnchor System - Smart Positioning
169
+
170
+ ### Real-World Example from TileLong
171
+
172
+ `TileAnchor` provides dynamic positioning for tile elements based on calculated tile dimensions:
173
+
174
+ ```csharp
175
+ public class TileAnchor : MonoBehaviour
176
+ {
177
+ [SerializeField] internal MT3Tile2 tile;
178
+ [SerializeField] [Range(0f, 1f)] private float slideMultiplier; // Position along slide length
179
+ [SerializeField] [Range(-1f, 1f)] private float shortMultiplier; // Offset from short tile height
180
+
181
+ public void Refresh()
182
+ {
183
+ if (tile == null) return;
184
+ var tileData = tile.tileData;
185
+ if (tileData == null) return;
186
+
187
+ var slideLength = tileData.slideLength; // Calculated slide distance
188
+ var shortLength = tile.config.shortTileHeight; // Base tile height
189
+ var length = shortLength * shortMultiplier + slideLength * slideMultiplier;
190
+ transform.localPosition = new Vector3(0, length, 0);
191
+ }
192
+ }
193
+ ```
194
+
195
+ ### TileLong Integration Example
196
+
197
+ In the `TileLong` prefab hierarchy:
198
+
199
+ ```
200
+ Tile-Long (Root)
201
+ ├── Widget2D (Screen adaptation)
202
+ ├── TileLong (Behavior script)
203
+ ├── Bottom (Container)
204
+ │ ├── bg (SpriteRenderer - Background)
205
+ │ ├── fill (SpriteRenderer - Progress fill)
206
+ │ └── miss (SpriteRenderer - Miss state)
207
+ ├── arrow (SwipeArrow with TileAnchor)
208
+ │ └── TileAnchor: slideMultiplier = 1.0, shortMultiplier = 0.0
209
+ ├── Index (Debug text with TileAnchor)
210
+ │ └── TileAnchor: slideMultiplier = 1.0, shortMultiplier = 0.65
211
+ └── Info (Additional UI with TileAnchor)
212
+ └── TileAnchor: slideMultiplier = 0.0, shortMultiplier = -0.5
213
+ ```
214
+
215
+ **Usage Patterns:**
216
+
217
+ 1. **Arrow Positioning** (`slideMultiplier = 1.0`):
218
+ - Positions at the end of the slide area
219
+ - Perfect for swipe direction indicators
220
+ - Auto-adjusts when tile length changes
221
+
222
+ 2. **Debug Text** (`slideMultiplier = 1.0, shortMultiplier = 0.65`):
223
+ - Positions at slide end + 65% of short tile height
224
+ - Provides consistent spacing above the tile
225
+ - Useful for tile index display
226
+
227
+ 3. **Info Elements** (`slideMultiplier = 0.0, shortMultiplier = -0.5`):
228
+ - Positions at slide start - 50% of short tile height
229
+ - Creates space below the tile
230
+ - Good for additional UI elements
231
+
232
+ ### TileLong OnAttach Integration
233
+
234
+ ```csharp
235
+ public override void OnAttach(TileContext tile)
236
+ {
237
+ base.OnAttach(tile);
238
+
239
+ // Set Widget2D height to calculated total length
240
+ widget.height = tileData.totalLength;
241
+
242
+ // Refresh all anchors with new tile data
243
+ for (var i = 0; i < anchors.Count; i++)
244
+ {
245
+ anchors[i].tile = this; // Provide tile reference
246
+ anchors[i].Refresh(); // Calculate new positions
247
+ }
248
+ }
249
+ ```
250
+
251
+ ## 🎮 Handler System Details
252
+
253
+ ### SizeHandler (Proportional Sizing)
254
+ ```csharp
255
+ [Serializable] public class SizeHandler
256
+ {
257
+ public AxisFilter axis = AxisFilter.None;
258
+ [Range(0f, 2f)] public float percentX = 1f;
259
+ [Range(0f, 2f)] public float percentY = 1f;
260
+ public bool keepRatio = false;
261
+ public Vector2 delta = Vector2.zero;
262
+ }
263
+ ```
264
+ **Features:**
265
+ - **Percentage-based sizing** - Relative to source widget dimensions
266
+ - **Ratio preservation** - Maintains aspect ratio when enabled
267
+ - **Delta adjustments** - Fixed pixel offsets for fine-tuning
268
+ - **Axis filtering** - Apply to X, Y, or both axes independently
269
+
270
+ **Calculation Logic:**
271
+ ```csharp
272
+ var newSize = inputSize;
273
+ if (axis.HasFlag(AxisFilter.X)) newSize.x = inputSize.x * percentX + delta.x;
274
+ if (axis.HasFlag(AxisFilter.Y)) newSize.y = inputSize.y * percentY + delta.y;
275
+
276
+ if (keepRatio && axis == AxisFilter.Both)
277
+ {
278
+ var ratio = Mathf.Min(newSize.x / originalSize.x, newSize.y / originalSize.y);
279
+ newSize = originalSize * ratio;
280
+ }
281
+ ```
282
+
283
+ ### ScaleHandler (Transform Scaling)
284
+ ```csharp
285
+ [Serializable] public class ScaleHandler
286
+ {
287
+ public AxisFilter axis = AxisFilter.None;
288
+ [Range(0f, 5f)] public float scaleX = 1f;
289
+ [Range(0f, 5f)] public float scaleY = 1f;
290
+ [Range(0f, 1f)] public float fitParameter = 0f;
291
+ }
292
+ ```
293
+ **Features:**
294
+ - **Independent scaling** - Separate X/Y axis control
295
+ - **Ratio preservation** - Uniform scaling with fit/fill blend
296
+ - `fitParameter` (0-1) - Fit (show all) to Fill (cover all) interpolation
297
+
298
+ **Fit/Fill Logic:**
299
+ ```csharp
300
+ var fitScale = Mathf.Min(scaledRatioX, scaledRatioY); // Fit: shows all content
301
+ var fillScale = Mathf.Max(scaledRatioX, scaledRatioY); // Fill: fills entire area
302
+ var finalScale = Mathf.Lerp(fitScale, fillScale, fitParameter);
303
+ ```
304
+
305
+ ### AlignHandler (Position Control)
306
+ ```csharp
307
+ [Serializable] public class AlignHandler
308
+ {
309
+ public AxisFilter axis = AxisFilter.None;
310
+ [Range(-1f, 2f)] public float alignX = 0.5f;
311
+ [Range(-1f, 2f)] public float alignY = 0.5f;
312
+ public Vector2 offset = Vector2.zero;
313
+ public Vector2 selfAlign = Vector2.zero;
314
+ }
315
+ ```
316
+ **Features:**
317
+ - `alignX/Y` (-1 to 2) - **Extended range** for positioning beyond source bounds
318
+ - `0.0` = Left/Bottom edge
319
+ - `0.5` = Center (default)
320
+ - `1.0` = Right/Top edge
321
+ - `< 0` = Outside left/bottom
322
+ - `> 1` = Outside right/top
323
+ - `offset` - Fixed world-space position adjustment
324
+ - `selfAlign` - Self-centering offset based on own size
325
+ - **Pivot-aware positioning** - Respects source widget pivot settings
326
+
327
+ **Position Calculation:**
328
+ ```csharp
329
+ var inputOffset = inputWidget.size;
330
+ inputOffset.Scale(inputWidget.pivot); // NEW: Pivot consideration
331
+
332
+ var alignOffsetX = inputSize.x * (alignX - 0.5f);
333
+ var selfAlignOffsetX = outputSize.x * selfAlign.x * 0.5f;
334
+ newPos.x = inputPos.x + alignOffsetX + offset.x + selfAlignOffsetX;
335
+ ```
336
+
337
+ ## 🎵 Real-World Usage Examples
338
+
339
+ ### Screen Adaptation (MT3Game)
340
+ ```csharp
341
+ // Main screen with 10.8x19.2 design size
342
+ Screen2D screen = GetComponent<Screen2D>();
343
+ screen.fitWidthToHeight = 1f; // Full height fitting
344
+ // Automatically adapts to device screen ratios
345
+ ```
346
+ **Use Case:** Main game area that scales consistently across iPhone/iPad/Android devices
347
+
348
+ ### Perfect Area Positioning
349
+ ```csharp
350
+ // PerfectArea: 10.8x4.8 widget positioned at 25% screen height
351
+ WidgetTransform perfectArea;
352
+ perfectArea.source = gameScreen; // Reference to main screen
353
+ perfectArea.scale.axis = AxisFilter.Y;
354
+ perfectArea.scale.scaleY = 0.25f; // 25% of screen height
355
+ perfectArea.align.axis = AxisFilter.Y;
356
+ perfectArea.align.alignY = 0.25f; // Position at 25% from bottom
357
+ ```
358
+ **Use Case:** Hit detection area that maintains consistent size relative to screen
359
+
360
+ ### Responsive UI Elements
361
+ ```csharp
362
+ // Tile-Start: 2.7x4.8 with ratio-preserved scaling
363
+ WidgetTransform tileStart;
364
+ tileStart.source = gameScreen;
365
+ tileStart.size.keepRatio = true; // Preserve aspect ratio
366
+ tileStart.size.percentX = 0.25f; // 25% of screen width
367
+ ```
368
+ **Use Case:** UI elements that scale proportionally while maintaining visual consistency
369
+
370
+ ### Dynamic Tile Sizing
371
+ ```csharp
372
+ // TileLong: Dynamic height based on note duration
373
+ public override void OnAttach(TileContext tile)
374
+ {
375
+ base.OnAttach(tile);
376
+ widget.height = tileData.totalLength; // Calculated from note duration
377
+
378
+ // Update all anchor positions
379
+ for (var i = 0; i < anchors.Count; i++)
380
+ {
381
+ anchors[i].tile = this;
382
+ anchors[i].Refresh();
383
+ }
384
+ }
385
+ ```
386
+ **Use Case:** Hold tiles that adapt length based on musical note duration
387
+
388
+ ## 🚀 Implementation Best Practices
389
+
390
+ ### 1. Component Setup
391
+ ```csharp
392
+ // Add Widget2D to any GameObject requiring responsive sizing
393
+ var widget = gameObject.AddComponent<Widget2D>();
394
+
395
+ // Screen2D for main game areas
396
+ var screen = gameObject.AddComponent<Screen2D>();
397
+ screen.fitWidthToHeight = 1f; // Adjust based on design requirements
398
+ ```
399
+
400
+ ### 2. Hierarchical Layouts
401
+ ```csharp
402
+ // Parent-child responsive relationships
403
+ var parentWidget = parent.GetComponent<Widget2D>();
404
+ var childTransform = child.AddComponent<WidgetTransform>();
405
+ childTransform.source = parentWidget;
406
+ childTransform.size.percentX = 0.5f; // 50% of parent width
407
+ childTransform.align.alignX = 0.5f; // Center horizontally
408
+ ```
409
+
410
+ ### 3. Custom Component Support
411
+ ```csharp
412
+ // Extend WidgetHandler for new component types
413
+ WidgetHandler.RegisterHandler<YourCustomComponent>(
414
+ (component, size) => {
415
+ // Apply size to your custom component
416
+ component.customWidth = size.x;
417
+ component.customHeight = size.y;
418
+ component.RefreshLayout();
419
+ }
420
+ );
421
+ ```
422
+
423
+ ### 4. Editor Integration
424
+ ```csharp
425
+ #if UNITY_EDITOR
426
+ private void OnValidate()
427
+ {
428
+ // Auto-refresh in editor for immediate feedback
429
+ EditorApplication.delayCall += Refresh;
430
+ }
431
+
432
+ private void OnDrawGizmosSelected()
433
+ {
434
+ // Visual debugging in scene view
435
+ if (widget != null) widget.DrawGizmosSelected();
436
+ }
437
+ #endif
438
+ ```
439
+
440
+ ## 🎯 Key Benefits
441
+
442
+ 1. **Zero Boilerplate**: Tiles adapt to screen size without manual calculations
443
+ 2. **Consistent Scaling**: All components scale together via single Widget2D
444
+ 3. **Designer Friendly**: Visual setup in prefabs, minimal code changes
445
+ 4. **Runtime Adaptive**: Handles device rotation and screen changes automatically
446
+ 5. **Extensible**: Easy to add new tile types or components
447
+ 6. **Data-Driven**: TileContext bridges game logic with visual representation
448
+ 7. **Modular Architecture**: Partial classes separate concerns cleanly
449
+
450
+ This architecture demonstrates excellent separation of concerns, where **data drives behavior**, **Widget2D handles presentation**, and **minimal inheritance provides maximum reusability**. The system achieves complex screen adaptation through declarative configuration rather than imperative code.
@@ -0,0 +1,7 @@
1
+ fileFormatVersion: 2
2
+ guid: 3744a84ff158e4567875f5349784d773
3
+ TextScriptImporter:
4
+ externalObjects: {}
5
+ userData:
6
+ assetBundleName:
7
+ assetBundleVariant:
package/Docs.meta ADDED
@@ -0,0 +1,8 @@
1
+ fileFormatVersion: 2
2
+ guid: 819279cca79214a42b679c21b30b821b
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
@@ -0,0 +1,90 @@
1
+ using UnityEngine;
2
+ using UnityEditor;
3
+
4
+ namespace Amanotes.MagicTilesCore
5
+ {
6
+ [CustomEditor(typeof(AdjustHue))]
7
+ public class AdjustHueEditor : Editor
8
+ {
9
+ private AdjustHue adjustHue;
10
+
11
+ private void OnEnable()
12
+ {
13
+ adjustHue = (AdjustHue)target;
14
+ }
15
+
16
+ public override void OnInspectorGUI()
17
+ {
18
+ serializedObject.Update();
19
+
20
+ // Draw default inspector
21
+ DrawDefaultInspector();
22
+
23
+ EditorGUILayout.Space();
24
+
25
+ // Draw preset color rectangles
26
+ EditorGUILayout.LabelField("Quick Hue Presets (Click to Apply)", EditorStyles.boldLabel);
27
+
28
+ var presets = adjustHue.GetPresets();
29
+ const float colorRectSize = 30f;
30
+ const float spacing = 5f;
31
+
32
+ EditorGUILayout.BeginHorizontal();
33
+
34
+ for (int i = 0; i < presets.Length; i++)
35
+ {
36
+ var presetHue = presets[i];
37
+ // Convert hue (0-255) to HSV with S=100%, V=100%
38
+ float hue01 = presetHue / 255f;
39
+ var presetColor = Color.HSVToRGB(hue01, 1f, 1f);
40
+
41
+ // Create a rect for the color button
42
+ var rect = GUILayoutUtility.GetRect(colorRectSize, colorRectSize, GUILayout.Width(colorRectSize), GUILayout.Height(colorRectSize));
43
+
44
+ // Draw the color rectangle
45
+ EditorGUI.DrawRect(rect, presetColor);
46
+
47
+ // Handle click
48
+ if (Event.current.type == EventType.MouseDown && rect.Contains(Event.current.mousePosition))
49
+ {
50
+ adjustHue.SetHue(presetHue);
51
+ EditorUtility.SetDirty(adjustHue);
52
+ Event.current.Use();
53
+ }
54
+
55
+ // Add spacing between rectangles
56
+ if (i < presets.Length - 1)
57
+ {
58
+ GUILayout.Space(spacing);
59
+ }
60
+ }
61
+
62
+ EditorGUILayout.EndHorizontal();
63
+
64
+ // Show hue values under the rectangles
65
+ EditorGUILayout.BeginHorizontal();
66
+ for (int i = 0; i < presets.Length; i++)
67
+ {
68
+ var labelRect = GUILayoutUtility.GetRect(colorRectSize, 16f, GUILayout.Width(colorRectSize));
69
+ EditorGUI.LabelField(labelRect, presets[i].ToString(), EditorStyles.centeredGreyMiniLabel);
70
+
71
+ if (i < presets.Length - 1)
72
+ {
73
+ GUILayout.Space(spacing);
74
+ }
75
+ }
76
+ EditorGUILayout.EndHorizontal();
77
+
78
+ EditorGUILayout.Space();
79
+
80
+ // Refresh button
81
+ if (GUILayout.Button("Refresh Component List"))
82
+ {
83
+ adjustHue.RefreshComponentList();
84
+ EditorUtility.SetDirty(adjustHue);
85
+ }
86
+
87
+ serializedObject.ApplyModifiedProperties();
88
+ }
89
+ }
90
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 141bb8056d5294c7a875836761b91ed7
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant: