[Add] Dice & Refactor private names

This commit is contained in:
2026-03-02 11:22:01 +07:00
parent 4890fa946e
commit f65976796d
36 changed files with 883 additions and 489 deletions
+8 -8
View File
@@ -18,8 +18,8 @@ namespace YachtDice.UI
public event Action<CategoryDefinition> OnCategorySelected;
private CategoryCatalog catalog;
private Dictionary<CategoryDefinition, int> categoryToRowIndex;
private CategoryCatalog _catalog;
private Dictionary<CategoryDefinition, int> _categoryToRowIndex;
/// <summary>
/// Инициализирует скоркарту из каталога категорий.
@@ -27,17 +27,17 @@ namespace YachtDice.UI
/// </summary>
public void Initialize(CategoryCatalog categoryCatalog)
{
catalog = categoryCatalog;
categoryToRowIndex = new Dictionary<CategoryDefinition, int>();
_catalog = categoryCatalog;
_categoryToRowIndex = new Dictionary<CategoryDefinition, int>();
var all = catalog.All;
var all = _catalog.All;
int count = Mathf.Min(categoryRows.Count, all.Count);
for (int i = 0; i < count; i++)
{
categoryRows[i].Initialize(all[i]);
categoryRows[i].OnCategorySelected += HandleCategorySelected;
categoryToRowIndex[all[i]] = i;
_categoryToRowIndex[all[i]] = i;
}
UpdateTotalDisplay(0, 0, false);
@@ -47,7 +47,7 @@ namespace YachtDice.UI
{
foreach (var kvp in previews)
{
if (categoryToRowIndex.TryGetValue(kvp.Key, out int rowIndex))
if (_categoryToRowIndex.TryGetValue(kvp.Key, out int rowIndex))
{
categoryRows[rowIndex].ShowPreview(kvp.Value);
categoryRows[rowIndex].SetInteractable(true);
@@ -66,7 +66,7 @@ namespace YachtDice.UI
public void SetCategoryScored(CategoryDefinition category, int score)
{
if (categoryToRowIndex.TryGetValue(category, out int index))
if (_categoryToRowIndex.TryGetValue(category, out int index))
categoryRows[index].SetRecordedScore(score);
}