First MVP of sorting minigame (#60)
Co-authored-by: Michal Pikulski <michal.a.pikulski@gmail.com> Co-authored-by: Michal Pikulski <michal@foolhardyhorizons.com> Reviewed-on: #60
This commit is contained in:
@@ -130,8 +130,9 @@ namespace UI.DragAndDrop.Core
|
||||
SmoothMoveTowardPointer();
|
||||
}
|
||||
|
||||
// Only clamp for non-overlay canvases (WorldSpace/ScreenSpaceCamera)
|
||||
if (_canvas != null && _canvas.renderMode != RenderMode.ScreenSpaceOverlay)
|
||||
// Only clamp when actively being dragged (prevent dragging off-screen)
|
||||
// Don't clamp when just sitting idle - allow objects to move freely off-screen
|
||||
if (_isDragging && _canvas != null && _canvas.renderMode != RenderMode.ScreenSpaceOverlay)
|
||||
{
|
||||
ClampToScreen();
|
||||
}
|
||||
|
||||
@@ -45,6 +45,10 @@ namespace UI.DragAndDrop.Core
|
||||
public Vector3 WorldPosition => transform.position;
|
||||
public RectTransform RectTransform => transform as RectTransform;
|
||||
|
||||
// Support for both UI and world-space slots
|
||||
public bool IsUISlot => transform is RectTransform;
|
||||
public Vector3 SlotPosition => transform.position; // Works for both Transform types
|
||||
|
||||
private void Start()
|
||||
{
|
||||
if (hideImageOnPlay)
|
||||
@@ -78,6 +82,7 @@ namespace UI.DragAndDrop.Core
|
||||
switch (occupantSizeMode)
|
||||
{
|
||||
case OccupantSizeMode.MatchSlotSize:
|
||||
// Only works for UI slots with RectTransform
|
||||
if (draggable.RectTransform != null && RectTransform != null)
|
||||
{
|
||||
Vector2 targetSize = RectTransform.sizeDelta;
|
||||
@@ -85,6 +90,7 @@ namespace UI.DragAndDrop.Core
|
||||
(val) => draggable.RectTransform.sizeDelta = val,
|
||||
scaleTransitionDuration, 0f, Tween.EaseOutBack);
|
||||
}
|
||||
// World-space slots (no RectTransform) skip size matching
|
||||
break;
|
||||
|
||||
case OccupantSizeMode.Scale:
|
||||
|
||||
@@ -157,19 +157,24 @@ namespace UI
|
||||
}
|
||||
}
|
||||
|
||||
// Subscribe to scene load events to adjust HUD based on scene
|
||||
if (SceneManagerService.Instance != null)
|
||||
{
|
||||
SceneManagerService.Instance.SceneLoadCompleted += NewSceneLoaded;
|
||||
}
|
||||
if (SceneManagerService.Instance.CurrentGameplayScene == "AppleHillsOverworld")
|
||||
{
|
||||
NewSceneLoaded("AppleHillsOverworld");
|
||||
}
|
||||
if (SceneManagerService.Instance.CurrentGameplayScene == "StartingScene")
|
||||
{
|
||||
// TODO: Hide all UI until cinematics have played
|
||||
NewSceneLoaded("AppleHillsOverworld");
|
||||
}
|
||||
|
||||
// If in editor - initialize HUD based on current scene
|
||||
#if UNITY_EDITOR
|
||||
if (SceneManagerService.Instance.CurrentGameplayScene == "StartingScene")
|
||||
{
|
||||
// TODO: Hide all UI until cinematics have played
|
||||
NewSceneLoaded("AppleHillsOverworld");
|
||||
}
|
||||
else if (SceneManagerService.Instance.CurrentGameplayScene != null)
|
||||
{
|
||||
NewSceneLoaded(SceneManagerService.Instance.CurrentGameplayScene);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
internal override void OnManagedDestroy()
|
||||
@@ -229,7 +234,7 @@ namespace UI
|
||||
case "Quarry":
|
||||
currentUIMode = UIMode.Puzzle;
|
||||
break;
|
||||
case "DivingForPictures":
|
||||
case "DivingForPictures" or "CardQualityControl":
|
||||
currentUIMode = UIMode.Minigame;
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user