1
This commit is contained in:
parent
0f6e312f01
commit
3dce727aed
@ -70,7 +70,7 @@ Material:
|
|||||||
- _OutlineSoftness: 0
|
- _OutlineSoftness: 0
|
||||||
- _OutlineUVSpeedX: 0
|
- _OutlineUVSpeedX: 0
|
||||||
- _OutlineUVSpeedY: 0
|
- _OutlineUVSpeedY: 0
|
||||||
- _OutlineWidth: 0
|
- _OutlineWidth: 0.02
|
||||||
- _PerspectiveFilter: 0.875
|
- _PerspectiveFilter: 0.875
|
||||||
- _Reflectivity: 10
|
- _Reflectivity: 10
|
||||||
- _ScaleRatioA: 0.8333333
|
- _ScaleRatioA: 0.8333333
|
||||||
|
@ -278,18 +278,20 @@ namespace GameLogic
|
|||||||
|
|
||||||
m_IsFillAnimPlaying = true;
|
m_IsFillAnimPlaying = true;
|
||||||
|
|
||||||
|
// AlignCarWithFillAmount();
|
||||||
|
|
||||||
// 给进度条一个缩减回弹效果
|
// 给进度条一个缩减回弹效果
|
||||||
float originalFill = m_CurrentFillAmount;
|
float originalFill = m_CurrentFillAmount;
|
||||||
float shrinkTo = Mathf.Max(0.1f, originalFill - 0.4f); // 缩到原值-0.2,最小0.1
|
float shrinkTo = Mathf.Max(0.1f, originalFill - 0.4f); // 缩到原值-0.2,最小0.1
|
||||||
DOTween.To(
|
DOTween.To(
|
||||||
() => m_imgValue.fillAmount,
|
() => m_imgValue.fillAmount,
|
||||||
x => m_imgValue.fillAmount = x,
|
x => { m_imgValue.fillAmount = x; OnFillAmountChanged(x); },
|
||||||
shrinkTo, 0.15f
|
shrinkTo, 0.15f
|
||||||
).SetEase(Ease.InQuad).OnComplete(() =>
|
).SetEase(Ease.InQuad).OnComplete(() =>
|
||||||
{
|
{
|
||||||
DOTween.To(
|
DOTween.To(
|
||||||
() => m_imgValue.fillAmount,
|
() => m_imgValue.fillAmount,
|
||||||
x => m_imgValue.fillAmount = x,
|
x => { m_imgValue.fillAmount = x; OnFillAmountChanged(x); },
|
||||||
originalFill, 0.35f
|
originalFill, 0.35f
|
||||||
).SetEase(Ease.OutElastic)
|
).SetEase(Ease.OutElastic)
|
||||||
.OnComplete(() =>
|
.OnComplete(() =>
|
||||||
@ -749,40 +751,44 @@ namespace GameLogic
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void UpdateScale()
|
public void UpdateScale()
|
||||||
{
|
{
|
||||||
var teamList = DataGameSceneManager.Instance.m_TeamSortList;
|
|
||||||
if (teamList.Count <= 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
double oneNum = teamList[0].GetAllPower();
|
if (!m_IsFillAnimPlaying)
|
||||||
|
|
||||||
// 检查是否所有队伍都在初始状态
|
|
||||||
bool allInit = true;
|
|
||||||
foreach (var team in teamList)
|
|
||||||
{
|
{
|
||||||
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;
|
if (team.GetAllPower() != oneNum)
|
||||||
break;
|
{
|
||||||
|
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>
|
/// <summary>
|
||||||
@ -812,6 +818,7 @@ namespace GameLogic
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 加载动图
|
/// 加载动图
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -835,5 +842,30 @@ namespace GameLogic
|
|||||||
|
|
||||||
m_rectCar.transform.GetChild(key).gameObject.SetActive(true);
|
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.localScale = Vector3.one * 0.5f;
|
||||||
|
|
||||||
// 移动特效
|
// 移动特效
|
||||||
eGo.transform.DOLocalMoveX(-1, 45f).OnComplete(() =>
|
eGo.transform.DOLocalMoveX(-1, 15f).OnComplete(() =>
|
||||||
{
|
{
|
||||||
GameObject.Destroy(eGo);
|
GameObject.Destroy(eGo);
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user