[Update] Split CategoryRowView scoreText into preview and recorded fields

Separate the single scoreText into previewText (potential score) and
recordedScoreText (committed value) so both are visible simultaneously.
Public API preserved — no changes needed in ScoreCardView or GameController.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-27 19:15:44 +07:00
parent 6340a011f9
commit c56d145714
+10 -6
View File
@@ -7,7 +7,8 @@ public sealed class CategoryRowView : MonoBehaviour
{ {
[Header("UI Elements")] [Header("UI Elements")]
[SerializeField] private TMP_Text categoryNameText; [SerializeField] private TMP_Text categoryNameText;
[SerializeField] private TMP_Text scoreText; [SerializeField] private TMP_Text previewText;
[SerializeField] private TMP_Text recordedScoreText;
[SerializeField] private Button selectButton; [SerializeField] private Button selectButton;
[SerializeField] private Image background; [SerializeField] private Image background;
@@ -27,7 +28,8 @@ public sealed class CategoryRowView : MonoBehaviour
category = cat; category = cat;
isUsed = false; isUsed = false;
categoryNameText.text = displayName; categoryNameText.text = displayName;
scoreText.text = ""; previewText.text = "";
recordedScoreText.text = "-";
selectButton.onClick.AddListener(HandleClick); selectButton.onClick.AddListener(HandleClick);
SetInteractable(false); SetInteractable(false);
background.color = normalColor; background.color = normalColor;
@@ -36,21 +38,22 @@ public sealed class CategoryRowView : MonoBehaviour
public void ShowPreview(int previewScore) public void ShowPreview(int previewScore)
{ {
if (isUsed) return; if (isUsed) return;
scoreText.text = previewScore.ToString(); previewText.text = previewScore.ToString();
background.color = previewScore > 0 ? previewPositiveColor : previewZeroColor; background.color = previewScore > 0 ? previewPositiveColor : previewZeroColor;
} }
public void HidePreview() public void HidePreview()
{ {
if (isUsed) return; if (isUsed) return;
scoreText.text = ""; previewText.text = "";
background.color = normalColor; background.color = normalColor;
} }
public void SetRecordedScore(int score) public void SetRecordedScore(int score)
{ {
isUsed = true; isUsed = true;
scoreText.text = score.ToString(); recordedScoreText.text = score.ToString();
previewText.text = "";
SetInteractable(false); SetInteractable(false);
background.color = usedColor; background.color = usedColor;
} }
@@ -68,7 +71,8 @@ public sealed class CategoryRowView : MonoBehaviour
public void ResetRow() public void ResetRow()
{ {
isUsed = false; isUsed = false;
scoreText.text = ""; previewText.text = "";
recordedScoreText.text = "-";
SetInteractable(false); SetInteractable(false);
background.color = normalColor; background.color = normalColor;
} }