Files
SahikandClaude Opus 5.5 ddd5fdc28b Rebuild the game as a single code-driven scene with a package-folder pack source
- One empty scene; App builds the canvas, safe-area layout and a shared 5x6
  Grid in code. Pages (Intro, Main, Choose, Play, Account, Settings) replace
  5 scenes, 5 prefabs and the per-cell spawner/display components.
- Packs: the game reads Rhyculator/package/ (with All files access) or the
  app folder, like a plugged-in USB stick. Zips stay where they are and are
  extracted to a cache keyed by name/size/mtime; folders are read directly.
  Scans run every second on a background thread. Old songs/ imports and inbox
  zips are migrated automatically.
- Download packs by 8-char code from the new pack website, or via
  rhyculator://pack/<code> links; opened/shared zips go into the package folder.
- Play: pause/resume/retry, auto-pause on background, combo and progress bar;
  judging and scoring unchanged. Choose page fits 9:16 screens; empty state,
  pack delete. Android back key handled everywhere.
- Slimming: removed TextMesh Pro, unused 2D/Timeline/VisualScripting/etc.
  packages and modules, scene template, unused sprites; menu theme wav (20MB)
  -> ogg (2.3MB). Build profile replaced by explicit settings in BuildAndroid.
- Tests: PackLibrary/PackReader/migration/serializer tests (39 passing).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-24 14:18:54 +08:00

25 lines
1.0 KiB
C#

using UnityEngine;
using UnityEngine.UI;
// 螢幕某點是否被 UI(按鈕、輸入框、對話框)擋住
// 格子與一般圖片、文字都不是 raycastTarget,所以只要有 raycastTarget 的圖形就算擋住
public static class UIHitTest
{
public static bool IsBlocked(Vector2 screenPos)
{
foreach (var canvas in Object.FindObjectsByType<Canvas>(FindObjectsSortMode.None))
{
if (!canvas.isActiveAndEnabled) continue;
Camera cam = canvas.rootCanvas.renderMode == RenderMode.ScreenSpaceOverlay ? null : canvas.rootCanvas.worldCamera;
var graphics = GraphicRegistry.GetRaycastableGraphicsForCanvas(canvas);
for (int i = 0; i < graphics.Count; i++)
{
Graphic g = graphics[i];
if (!g.isActiveAndEnabled || g.depth < 0 || g.canvasRenderer.cull) continue;
if (RectTransformUtility.RectangleContainsScreenPoint(g.rectTransform, screenPos, cam)) return true;
}
}
return false;
}
}