Settings cleaned up, working on dragging etc.

This commit is contained in:
Michal Pikulski
2025-11-24 14:18:56 +01:00
parent 6a41fd3340
commit e04db31a98
5 changed files with 60 additions and 13 deletions

View File

@@ -21,7 +21,7 @@ MonoBehaviour:
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: 359004e51663d6442b7d2b960d12b459
m_Address: Assets/Settings/StatueDressupSettings.asset
m_Address: Settings/StatueDressupSettings
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0

View File

@@ -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; }

View File

@@ -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;

View File

@@ -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
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

View File

@@ -14,7 +14,18 @@ MonoBehaviour:
m_EditorClassIdentifier: AppleHillsScripts::Core.Settings.StatueDressupSettings
defaultIconSize: {x: 64, y: 64}
defaultAuthoredSize: {x: 128, y: 128}
itemsPerPage: 10
allDecorations:
- {fileID: 11400000, guid: 2ea75de9ff6dbfb4b8c246a654868479, type: 2}
- {fileID: 11400000, guid: ca949a6208ce5b5488e90ea3e2eed6df, type: 2}
- {fileID: 11400000, guid: 5efa934e009bc234e920904b05db3c2f, type: 2}
- {fileID: 11400000, guid: 8819ec8b1f4910a4494755cf043636d1, type: 2}
- {fileID: 11400000, guid: b09b79db8ef15144bb2138ec59f26a9c, type: 2}
- {fileID: 11400000, guid: 8838477f768600848813a215ab6a46fe, type: 2}
- {fileID: 11400000, guid: f0df83df3cff9d84ba9fd4895e5d1b58, type: 2}
- {fileID: 11400000, guid: 4101d48e428899d409df02f24c83571f, type: 2}
- {fileID: 11400000, guid: b01ee8334ee052b4784225337e9a5ece, type: 2}
- {fileID: 11400000, guid: a5d493c2c7c9cf74cab038023b401273, type: 2}
itemsPerPage: 8
gridColumns: 2
gridSpacing: {x: 10, y: 10}
dragScaleTransitionDuration: 0.2