refactor(ui): 移除 BoolButton 本地化文本依赖
This commit is contained in:
@@ -11,7 +11,6 @@ namespace AibisDream
|
||||
public class BoolButton : MonoBehaviour
|
||||
{
|
||||
private Image _buttonImage;
|
||||
private LocalizeStringEvent _stringEvent;
|
||||
private Button _button;
|
||||
public BoolButtonData data;
|
||||
public Func<bool> getBool;
|
||||
@@ -27,7 +26,6 @@ namespace AibisDream
|
||||
|
||||
public void Awake()
|
||||
{
|
||||
_stringEvent = GetComponentInChildren<LocalizeStringEvent>();
|
||||
_buttonImage = GetComponentInChildren<Image>();
|
||||
// 监听按钮点击
|
||||
_button = GetComponent<Button>();
|
||||
@@ -40,11 +38,6 @@ namespace AibisDream
|
||||
{
|
||||
_buttonImage.sprite = getBool.Invoke() ? data.trueSprite : data.falseSprite;
|
||||
}
|
||||
|
||||
if (_stringEvent)
|
||||
{
|
||||
_stringEvent.SetEntry(getBool.Invoke() ? data.trueKey : data.falseKey);
|
||||
}
|
||||
}
|
||||
|
||||
public void FreshState()
|
||||
@@ -56,9 +49,7 @@ namespace AibisDream
|
||||
[Serializable]
|
||||
public struct BoolButtonData
|
||||
{
|
||||
public string trueKey;
|
||||
public Sprite trueSprite;
|
||||
public string falseKey;
|
||||
public Sprite falseSprite;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user