[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:
@@ -7,7 +7,8 @@ public sealed class CategoryRowView : MonoBehaviour
|
||||
{
|
||||
[Header("UI Elements")]
|
||||
[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 Image background;
|
||||
|
||||
@@ -27,7 +28,8 @@ public sealed class CategoryRowView : MonoBehaviour
|
||||
category = cat;
|
||||
isUsed = false;
|
||||
categoryNameText.text = displayName;
|
||||
scoreText.text = "";
|
||||
previewText.text = "";
|
||||
recordedScoreText.text = "-";
|
||||
selectButton.onClick.AddListener(HandleClick);
|
||||
SetInteractable(false);
|
||||
background.color = normalColor;
|
||||
@@ -36,21 +38,22 @@ public sealed class CategoryRowView : MonoBehaviour
|
||||
public void ShowPreview(int previewScore)
|
||||
{
|
||||
if (isUsed) return;
|
||||
scoreText.text = previewScore.ToString();
|
||||
previewText.text = previewScore.ToString();
|
||||
background.color = previewScore > 0 ? previewPositiveColor : previewZeroColor;
|
||||
}
|
||||
|
||||
public void HidePreview()
|
||||
{
|
||||
if (isUsed) return;
|
||||
scoreText.text = "";
|
||||
previewText.text = "";
|
||||
background.color = normalColor;
|
||||
}
|
||||
|
||||
public void SetRecordedScore(int score)
|
||||
{
|
||||
isUsed = true;
|
||||
scoreText.text = score.ToString();
|
||||
recordedScoreText.text = score.ToString();
|
||||
previewText.text = "";
|
||||
SetInteractable(false);
|
||||
background.color = usedColor;
|
||||
}
|
||||
@@ -68,7 +71,8 @@ public sealed class CategoryRowView : MonoBehaviour
|
||||
public void ResetRow()
|
||||
{
|
||||
isUsed = false;
|
||||
scoreText.text = "";
|
||||
previewText.text = "";
|
||||
recordedScoreText.text = "-";
|
||||
SetInteractable(false);
|
||||
background.color = normalColor;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user