Settings cleaned up, working on dragging etc.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
using Minigames.StatueDressup.Data;
|
||||
|
||||
namespace AppleHills.Core.Settings
|
||||
{
|
||||
@@ -170,6 +171,9 @@ namespace AppleHills.Core.Settings
|
||||
Vector2 DefaultIconSize { get; }
|
||||
Vector2 DefaultAuthoredSize { get; }
|
||||
|
||||
// Decoration Content
|
||||
List<DecorationData> AllDecorations { get; }
|
||||
|
||||
// Menu Configuration
|
||||
int ItemsPerPage { get; }
|
||||
int GridColumns { get; }
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using AppleHills.Core.Settings;
|
||||
using System.Collections.Generic;
|
||||
using AppleHills.Core.Settings;
|
||||
using Minigames.StatueDressup.Data;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Core.Settings
|
||||
@@ -16,6 +18,10 @@ namespace Core.Settings
|
||||
[Tooltip("Default full size for decorations when placed on statue")]
|
||||
[SerializeField] private Vector2 defaultAuthoredSize = new Vector2(128f, 128f);
|
||||
|
||||
[Header("Decoration Content")]
|
||||
[Tooltip("List of all available decoration data assets")]
|
||||
[SerializeField] private List<DecorationData> allDecorations = new List<DecorationData>();
|
||||
|
||||
[Header("Menu Configuration")]
|
||||
[Tooltip("Number of decoration items to display per page (2 columns x 5 rows = 10)")]
|
||||
[SerializeField] private int itemsPerPage = 10;
|
||||
@@ -77,6 +83,9 @@ namespace Core.Settings
|
||||
public Vector2 DefaultIconSize => defaultIconSize;
|
||||
public Vector2 DefaultAuthoredSize => defaultAuthoredSize;
|
||||
|
||||
// IStatueDressupSettings implementation - Decoration Content
|
||||
public List<DecorationData> AllDecorations => allDecorations;
|
||||
|
||||
// IStatueDressupSettings implementation - Menu Configuration
|
||||
public int ItemsPerPage => itemsPerPage;
|
||||
public int GridColumns => gridColumns;
|
||||
|
||||
@@ -23,10 +23,6 @@ namespace Minigames.StatueDressup.Controllers
|
||||
[SerializeField] private Transform statueParent; // Parent for placed decorations
|
||||
[SerializeField] private StatueDecorationController statueController; // Controller for registration
|
||||
|
||||
[Header("Configuration")]
|
||||
[SerializeField] private List<DecorationData> allDecorations = new List<DecorationData>();
|
||||
[SerializeField] private int itemsPerPage = 10; // 2 columns x 5 rows
|
||||
|
||||
[Header("Layout")]
|
||||
[SerializeField] private GridLayoutGroup gridLayout;
|
||||
|
||||
@@ -50,10 +46,9 @@ namespace Minigames.StatueDressup.Controllers
|
||||
// Get settings early
|
||||
_settings = GameManager.GetSettingsObject<AppleHills.Core.Settings.IStatueDressupSettings>();
|
||||
|
||||
// Override itemsPerPage with settings value if available
|
||||
if (_settings != null)
|
||||
if (_settings == null)
|
||||
{
|
||||
itemsPerPage = _settings.ItemsPerPage;
|
||||
Logging.Error("[DecorationMenuController] Failed to load StatueDressupSettings!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,11 +59,28 @@ namespace Minigames.StatueDressup.Controllers
|
||||
{
|
||||
base.OnManagedStart();
|
||||
|
||||
Logging.Debug($"[DecorationMenuController] Initializing with {allDecorations.Count} decorations");
|
||||
if (_settings == null)
|
||||
{
|
||||
Logging.Error("[DecorationMenuController] Cannot initialize without settings!");
|
||||
return;
|
||||
}
|
||||
|
||||
var allDecorations = _settings.AllDecorations;
|
||||
int itemsPerPage = _settings.ItemsPerPage;
|
||||
|
||||
Logging.Debug($"[DecorationMenuController] Initializing with {allDecorations?.Count ?? 0} decorations");
|
||||
|
||||
// Calculate total pages
|
||||
_totalPages = Mathf.CeilToInt((float)allDecorations.Count / itemsPerPage);
|
||||
Logging.Debug($"[DecorationMenuController] Total pages: {_totalPages}");
|
||||
if (allDecorations != null && allDecorations.Count > 0)
|
||||
{
|
||||
_totalPages = Mathf.CeilToInt((float)allDecorations.Count / itemsPerPage);
|
||||
Logging.Debug($"[DecorationMenuController] Total pages: {_totalPages}");
|
||||
}
|
||||
else
|
||||
{
|
||||
Logging.Warning("[DecorationMenuController] No decorations found in settings!");
|
||||
_totalPages = 0;
|
||||
}
|
||||
|
||||
// Setup buttons
|
||||
if (nextPageButton != null)
|
||||
@@ -93,6 +105,17 @@ namespace Minigames.StatueDressup.Controllers
|
||||
/// </summary>
|
||||
private void PopulateCurrentPage()
|
||||
{
|
||||
if (_settings == null) return;
|
||||
|
||||
var allDecorations = _settings.AllDecorations;
|
||||
int itemsPerPage = _settings.ItemsPerPage;
|
||||
|
||||
if (allDecorations == null || allDecorations.Count == 0)
|
||||
{
|
||||
Logging.Warning("[DecorationMenuController] No decorations to populate");
|
||||
return;
|
||||
}
|
||||
|
||||
Logging.Debug($"[DecorationMenuController] Populating page {_currentPage + 1}/{_totalPages}");
|
||||
|
||||
// Clear existing items
|
||||
|
||||
Reference in New Issue
Block a user