[Fix] Refactor project

This commit is contained in:
2026-03-02 12:49:12 +07:00
parent f65976796d
commit f52131f755
44 changed files with 449 additions and 404 deletions
+5 -2
View File
@@ -95,8 +95,11 @@ namespace YachtDice.UI
private void OnDestroy()
{
for (int i = 0; i < diceButtons.Length; i++)
diceButtons[i].onClick.RemoveAllListeners();
for (var index = 0; index < diceButtons.Length; index++)
{
var t = diceButtons[index];
t.onClick.RemoveAllListeners();
}
rollButton.onClick.RemoveAllListeners();
}
+1 -2
View File
@@ -137,9 +137,8 @@ namespace YachtDice.UI
var entries = new List<ModifierSaveEntry>();
var permanentIds = new HashSet<string>();
for (int i = 0; i < save.ownedModifiers.Count; i++)
foreach (var oldEntry in save.ownedModifiers)
{
var oldEntry = save.ownedModifiers[i];
var def = _modifierCatalog.FindById(oldEntry.modifierId);
if (def == null)
+9 -9
View File
@@ -57,10 +57,10 @@ namespace YachtDice.UI
public void ClearAllPreviews()
{
for (int i = 0; i < categoryRows.Count; i++)
foreach (var t in categoryRows)
{
categoryRows[i].HidePreview();
categoryRows[i].SetInteractable(false);
t.HidePreview();
t.SetInteractable(false);
}
}
@@ -72,8 +72,8 @@ namespace YachtDice.UI
public void SetAllInteractable(bool interactable)
{
for (int i = 0; i < categoryRows.Count; i++)
categoryRows[i].SetInteractable(interactable);
foreach (var t in categoryRows)
t.SetInteractable(interactable);
}
public void UpdateTotalDisplay(int totalScore, int upperSum, bool hasUpperBonus)
@@ -85,8 +85,8 @@ namespace YachtDice.UI
public void ResetAll()
{
for (int i = 0; i < categoryRows.Count; i++)
categoryRows[i].ResetRow();
foreach (var t in categoryRows)
t.ResetRow();
UpdateTotalDisplay(0, 0, false);
}
@@ -98,8 +98,8 @@ namespace YachtDice.UI
private void OnDestroy()
{
for (int i = 0; i < categoryRows.Count; i++)
categoryRows[i].OnCategorySelected -= HandleCategorySelected;
foreach (var t in categoryRows)
t.OnCategorySelected -= HandleCategorySelected;
}
}
}