引雷标记extender
This commit is contained in:
@@ -20,9 +20,23 @@ namespace Cielonos.MainGame.UI
|
||||
|
||||
private ItemBase.RuntimeFunctionUnit _functionUnit;
|
||||
private Sequence _frameOutlineSequence;
|
||||
private Color _defaultIconColor;
|
||||
private Color _defaultFrameColor;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_defaultIconColor = iconImage.color;
|
||||
_defaultFrameColor = frame.color;
|
||||
}
|
||||
|
||||
public void Initialize(SupportEquipmentBase supportEquipment)
|
||||
{
|
||||
if (_functionUnit != null)
|
||||
{
|
||||
_functionUnit.OnPresentationChanged -= RefreshPresentation;
|
||||
_functionUnit = null;
|
||||
}
|
||||
|
||||
if (supportEquipment == null)
|
||||
{
|
||||
DisableAllParts();
|
||||
@@ -49,11 +63,13 @@ namespace Cielonos.MainGame.UI
|
||||
//如果有多个功能单元,优先显示主功能单元
|
||||
_functionUnit = supportEquipment.functionSm.mainFunction;
|
||||
}
|
||||
|
||||
_functionUnit.OnPresentationChanged += RefreshPresentation;
|
||||
|
||||
timerImage.gameObject.SetActive(true);
|
||||
timerText.gameObject.SetActive(true);
|
||||
costText.gameObject.SetActive(true);
|
||||
iconImage.color = Color.white;
|
||||
iconImage.color = _defaultIconColor;
|
||||
|
||||
if (_functionUnit.maxCooldown <= 0)
|
||||
{
|
||||
@@ -70,13 +86,7 @@ namespace Cielonos.MainGame.UI
|
||||
costText.text = Mathf.CeilToInt(_functionUnit.data.energyCost).ToString("D");
|
||||
}
|
||||
|
||||
if (_functionUnit.data.tags.Contains("Disruption"))
|
||||
{
|
||||
Color newColor = Color.yellow;
|
||||
iconImage.color = newColor;
|
||||
newColor.a = 0.5f;
|
||||
frame.color = newColor;
|
||||
}
|
||||
RefreshPresentation();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -85,10 +95,34 @@ namespace Cielonos.MainGame.UI
|
||||
}
|
||||
}
|
||||
|
||||
private void RefreshPresentation()
|
||||
{
|
||||
if (_functionUnit == null) return;
|
||||
|
||||
iconImage.color = _defaultIconColor;
|
||||
frame.color = _defaultFrameColor;
|
||||
if (_functionUnit.HasTag(FunctionData.FunctionUnit.DisruptionTag))
|
||||
{
|
||||
Color newColor = Color.yellow;
|
||||
iconImage.color = newColor;
|
||||
newColor.a = 0.5f;
|
||||
frame.color = newColor;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
if (_functionUnit != null)
|
||||
{
|
||||
_functionUnit.OnPresentationChanged -= RefreshPresentation;
|
||||
}
|
||||
}
|
||||
|
||||
public void DisableAllParts()
|
||||
{
|
||||
iconImage.sprite = null;
|
||||
iconImage.color = Color.clear;
|
||||
frame.color = _defaultFrameColor;
|
||||
timerImage.gameObject.SetActive(false);
|
||||
timerText.gameObject.SetActive(false);
|
||||
costText.gameObject.SetActive(false);
|
||||
|
||||
Reference in New Issue
Block a user