fix Item not reset after reopen dlg award

This commit is contained in:
Chomper9981
2026-04-13 16:02:05 +07:00
parent 735799ce0d
commit ad2daf1c55
2 changed files with 35 additions and 3 deletions
@@ -25,6 +25,11 @@ namespace BrewMonster.Scripts.UI
public void SetImage(Sprite sprite)
{
if (img == null)
{
return;
}
img.enabled = sprite != null;
img.sprite = sprite;
}
@@ -36,7 +41,11 @@ namespace BrewMonster.Scripts.UI
public void SetColor(Color color)
{
// TODO : Set color to relevant UI components
if (img == null)
{
return;
}
img.color = color;
}
public void SetHint(string text)
@@ -44,9 +53,24 @@ namespace BrewMonster.Scripts.UI
txtHint = text;
}
/// <summary>
/// Reset slot when this cell has no award (e.g. dialog reopened with fewer items).
/// 清空格子:再次打开奖励界面时清除上一轮的图标与点击逻辑。
/// </summary>
public void ClearCover()
{
// TODO : Implement cover clearing functionality
if (img != null)
{
img.sprite = null;
img.enabled = false;
img.color = Color.white;
}
if (btn != null)
{
btn.onClick.RemoveAllListeners();
}
txtHint = string.Empty;
isOn = false;
}
public void Show(bool show)
@@ -59,6 +59,14 @@ namespace BrewMonster.Scripts.UI
{
toggle.isOn = false;
}
if (itemInfoPanel != null)
{
itemInfoPanel.SetActive(false);
}
if (descriptionOutlet != null)
{
descriptionOutlet.Set(string.Empty);
}
_btnClose.onClick.AddListener(OnCloseDlgAward);
}
@@ -214,7 +222,7 @@ namespace BrewMonster.Scripts.UI
// sprintf(out szName, "Item_%02d01", i);
// pImage = (PAUIIMAGEPICTURE)GetDlgItem(szName);
// if (!pImage) break; // All done.
pImage = GetAwardItemAt(i, i);
pImage = GetAwardItemAt(i, 1);
if (!pImage) break;
// sprintf(out szName, "Rdo_Award%d", i);