Settings cleaned up, working on dragging etc.
This commit is contained in:
@@ -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