1
This commit is contained in:
parent
0f6e312f01
commit
3dce727aed
@ -70,7 +70,7 @@ Material:
|
||||
- _OutlineSoftness: 0
|
||||
- _OutlineUVSpeedX: 0
|
||||
- _OutlineUVSpeedY: 0
|
||||
- _OutlineWidth: 0
|
||||
- _OutlineWidth: 0.02
|
||||
- _PerspectiveFilter: 0.875
|
||||
- _Reflectivity: 10
|
||||
- _ScaleRatioA: 0.8333333
|
||||
|
@ -278,18 +278,20 @@ namespace GameLogic
|
||||
|
||||
m_IsFillAnimPlaying = true;
|
||||
|
||||
// AlignCarWithFillAmount();
|
||||
|
||||
// 给进度条一个缩减回弹效果
|
||||
float originalFill = m_CurrentFillAmount;
|
||||
float shrinkTo = Mathf.Max(0.1f, originalFill - 0.4f); // 缩到原值-0.2,最小0.1
|
||||
DOTween.To(
|
||||
() => m_imgValue.fillAmount,
|
||||
x => m_imgValue.fillAmount = x,
|
||||
x => { m_imgValue.fillAmount = x; OnFillAmountChanged(x); },
|
||||
shrinkTo, 0.15f
|
||||
).SetEase(Ease.InQuad).OnComplete(() =>
|
||||
{
|
||||
DOTween.To(
|
||||
() => m_imgValue.fillAmount,
|
||||
x => m_imgValue.fillAmount = x,
|
||||
x => { m_imgValue.fillAmount = x; OnFillAmountChanged(x); },
|
||||
originalFill, 0.35f
|
||||
).SetEase(Ease.OutElastic)
|
||||
.OnComplete(() =>
|
||||
@ -749,40 +751,44 @@ namespace GameLogic
|
||||
/// </summary>
|
||||
public void UpdateScale()
|
||||
{
|
||||
var teamList = DataGameSceneManager.Instance.m_TeamSortList;
|
||||
if (teamList.Count <= 0)
|
||||
return;
|
||||
|
||||
double oneNum = teamList[0].GetAllPower();
|
||||
|
||||
// 检查是否所有队伍都在初始状态
|
||||
bool allInit = true;
|
||||
foreach (var team in teamList)
|
||||
if (!m_IsFillAnimPlaying)
|
||||
{
|
||||
if (team.GetAllPower() != oneNum)
|
||||
var teamList = DataGameSceneManager.Instance.m_TeamSortList;
|
||||
if (teamList.Count <= 0)
|
||||
return;
|
||||
|
||||
double oneNum = teamList[0].GetAllPower();
|
||||
|
||||
// 检查是否所有队伍都在初始状态
|
||||
bool allInit = true;
|
||||
foreach (var team in teamList)
|
||||
{
|
||||
allInit = false;
|
||||
break;
|
||||
if (team.GetAllPower() != oneNum)
|
||||
{
|
||||
allInit = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
float targetFill = 0.1f;
|
||||
if (!allInit && oneNum > 0)
|
||||
{
|
||||
double percent = m_AllPush / oneNum;
|
||||
if (percent > 1) percent = 1;
|
||||
if (percent < 0.1) percent = 0.1;
|
||||
targetFill = (float)percent;
|
||||
}
|
||||
|
||||
// 平滑过渡
|
||||
m_CurrentFillAmount = Mathf.Lerp(m_CurrentFillAmount, targetFill, Time.deltaTime * 8f);
|
||||
m_imgValue.fillAmount = m_CurrentFillAmount;
|
||||
|
||||
m_tmpValue.gameObject.SetActive(m_imgValue.fillAmount < 0.3f);
|
||||
m_tmpValue.gameObject.SetActive(m_imgValue.fillAmount > 0.3f);
|
||||
AlignCarWithFillAmount();
|
||||
}
|
||||
|
||||
float targetFill = 0.1f;
|
||||
if (!allInit && oneNum > 0)
|
||||
{
|
||||
double percent = m_AllPush / oneNum;
|
||||
if (percent > 1) percent = 1;
|
||||
if (percent < 0.1) percent = 0.1;
|
||||
targetFill = (float)percent;
|
||||
}
|
||||
|
||||
// 平滑过渡
|
||||
m_CurrentFillAmount = Mathf.Lerp(m_CurrentFillAmount, targetFill, Time.deltaTime * 8f);
|
||||
m_imgValue.fillAmount = m_CurrentFillAmount;
|
||||
|
||||
m_tmpValue.gameObject.SetActive(m_imgValue.fillAmount < 0.3f);
|
||||
m_tmpValue.gameObject.SetActive(m_imgValue.fillAmount > 0.3f);
|
||||
|
||||
AlignCarWithFillAmount();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -812,6 +818,7 @@ namespace GameLogic
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 加载动图
|
||||
/// </summary>
|
||||
@ -835,5 +842,30 @@ namespace GameLogic
|
||||
|
||||
m_rectCar.transform.GetChild(key).gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
// 新增回调方法
|
||||
private void OnFillAmountChanged(float newValue)
|
||||
{
|
||||
// 这里写你需要执行的逻辑,比如同步UI、特效等
|
||||
if (m_imgValue == null || m_rectCar == null)
|
||||
return;
|
||||
|
||||
// 获取 m_imgValue 的 RectTransform
|
||||
RectTransform imgRectTransform = m_imgValue.GetComponent<RectTransform>();
|
||||
|
||||
if (imgRectTransform == null)
|
||||
return;
|
||||
|
||||
// 获取 m_imgValue 的宽度
|
||||
float imgWidth = imgRectTransform.rect.width;
|
||||
|
||||
// 计算裁剪后的 X 坐标
|
||||
float targetX = imgWidth * newValue;
|
||||
|
||||
// 更新 m_rectCar 的位置
|
||||
Vector3 localPosition = m_rectCar.localPosition;
|
||||
localPosition.x = targetX - (imgWidth / 2); // 调整为相对于中心点的位置
|
||||
m_rectCar.localPosition = localPosition;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -875,7 +875,7 @@ namespace GameLogic
|
||||
eGo.transform.localScale = Vector3.one * 0.5f;
|
||||
|
||||
// 移动特效
|
||||
eGo.transform.DOLocalMoveX(-1, 45f).OnComplete(() =>
|
||||
eGo.transform.DOLocalMoveX(-1, 15f).OnComplete(() =>
|
||||
{
|
||||
GameObject.Destroy(eGo);
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user