Update the statue game to include rotation etc.
This commit is contained in:
@@ -26,6 +26,10 @@ namespace Minigames.StatueDressup.Controllers
|
||||
[SerializeField] private GameObject statue;
|
||||
[SerializeField] private DecorationDraggableInstance draggablePrefab; // Prefab for spawning decorations
|
||||
|
||||
[Header("Edit UI")]
|
||||
[SerializeField] private UI.DecorationEditUI editUIPrefab; // Prefab for edit UI
|
||||
private UI.DecorationEditUI _editUIInstance;
|
||||
|
||||
[Header("UI Pages")]
|
||||
[SerializeField] private UI.PlayAreaPage playAreaPage;
|
||||
[SerializeField] private UI.PhotoGalleryPage photoGalleryPage;
|
||||
@@ -37,8 +41,8 @@ namespace Minigames.StatueDressup.Controllers
|
||||
[Header("Photo Settings")]
|
||||
[SerializeField] private RectTransform photoArea; // Area to capture
|
||||
|
||||
private List<DecorationDraggableInstance> placedDecorations = new List<DecorationDraggableInstance>();
|
||||
private bool minigameCompleted;
|
||||
private List<DecorationDraggableInstance> _placedDecorations = new List<DecorationDraggableInstance>();
|
||||
private bool _minigameCompleted;
|
||||
|
||||
// Public properties
|
||||
public Transform StatueParent => statueParent;
|
||||
@@ -127,9 +131,9 @@ namespace Minigames.StatueDressup.Controllers
|
||||
/// </summary>
|
||||
public void RegisterDecoration(DecorationDraggableInstance decoration)
|
||||
{
|
||||
if (decoration != null && !placedDecorations.Contains(decoration))
|
||||
if (decoration != null && !_placedDecorations.Contains(decoration))
|
||||
{
|
||||
placedDecorations.Add(decoration);
|
||||
_placedDecorations.Add(decoration);
|
||||
Logging.Debug($"[StatueDecorationController] Decoration placed: {decoration.Data?.DecorationName}");
|
||||
|
||||
// Auto-save state
|
||||
@@ -142,9 +146,9 @@ namespace Minigames.StatueDressup.Controllers
|
||||
/// </summary>
|
||||
public void UnregisterDecoration(DecorationDraggableInstance decoration)
|
||||
{
|
||||
if (decoration != null && placedDecorations.Contains(decoration))
|
||||
if (decoration != null && _placedDecorations.Contains(decoration))
|
||||
{
|
||||
placedDecorations.Remove(decoration);
|
||||
_placedDecorations.Remove(decoration);
|
||||
Logging.Debug($"[StatueDecorationController] Decoration removed: {decoration.Data?.DecorationName}");
|
||||
|
||||
// Auto-save state
|
||||
@@ -157,7 +161,7 @@ namespace Minigames.StatueDressup.Controllers
|
||||
/// </summary>
|
||||
private void OnTakePhoto()
|
||||
{
|
||||
if (minigameCompleted)
|
||||
if (_minigameCompleted)
|
||||
{
|
||||
Logging.Debug("[StatueDecorationController] Minigame already completed");
|
||||
return;
|
||||
@@ -174,7 +178,7 @@ namespace Minigames.StatueDressup.Controllers
|
||||
/// </summary>
|
||||
private System.Collections.IEnumerator CapturePhotoCoroutine()
|
||||
{
|
||||
int decorationCount = placedDecorations.Count;
|
||||
int decorationCount = _placedDecorations.Count;
|
||||
bool captureSuccess = false;
|
||||
string savedPhotoId = null;
|
||||
|
||||
@@ -222,7 +226,7 @@ namespace Minigames.StatueDressup.Controllers
|
||||
// Show completion feedback
|
||||
ShowCompletionFeedback();
|
||||
|
||||
minigameCompleted = true;
|
||||
_minigameCompleted = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -290,7 +294,7 @@ namespace Minigames.StatueDressup.Controllers
|
||||
};
|
||||
|
||||
// Collect all decoration placements
|
||||
foreach (var decoration in placedDecorations)
|
||||
foreach (var decoration in _placedDecorations)
|
||||
{
|
||||
if (decoration == null || decoration.Data == null) continue;
|
||||
|
||||
@@ -455,6 +459,38 @@ namespace Minigames.StatueDressup.Controllers
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Show edit UI for a placed decoration
|
||||
/// </summary>
|
||||
public void ShowEditUI(DecorationDraggableInstance decoration)
|
||||
{
|
||||
if (decoration == null)
|
||||
{
|
||||
Logging.Warning("[StatueDecorationController] Cannot show edit UI - decoration is null");
|
||||
return;
|
||||
}
|
||||
|
||||
// Create edit UI instance if needed
|
||||
if (_editUIInstance == null)
|
||||
{
|
||||
if (editUIPrefab == null)
|
||||
{
|
||||
Logging.Error("[StatueDecorationController] Edit UI prefab is not assigned!");
|
||||
return;
|
||||
}
|
||||
|
||||
// Instantiate as child of canvas (find appropriate parent)
|
||||
Transform canvasTransform = statueArea != null ? statueArea.root : transform.root;
|
||||
_editUIInstance = Instantiate(editUIPrefab, canvasTransform);
|
||||
_editUIInstance.transform.SetAsLastSibling(); // Ensure it's on top
|
||||
|
||||
Logging.Debug("[StatueDecorationController] Created edit UI instance");
|
||||
}
|
||||
|
||||
// Show the UI
|
||||
_editUIInstance.Show(decoration);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Cleanup when controller is destroyed
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user