This commit is contained in:
DESKTOP-SAJ6RKV\Administrator 2025-05-29 02:13:58 +08:00
parent 41accf40ff
commit 2634ec9bb6

View File

@ -49,6 +49,7 @@ namespace GameLogic
private Dictionary<string, List<Buff>> m_Buffs = new Dictionary<string, List<Buff>>(); //自身Buff列表
private int timerId = -1;
private float m_CurrentFillAmount = 0.1f; // 当前显示的进度条值
protected override void OnCreate()
{
@ -484,29 +485,35 @@ namespace GameLogic
/// </summary>
public void UpdateScale()
{
if (DataGameSceneManager.Instance.m_TeamSortList.Count <= 0)
{
var teamList = DataGameSceneManager.Instance.m_TeamSortList;
if (teamList.Count <= 0)
return;
}
// 获取当前第一名的值
double oneNum = DataGameSceneManager.Instance.m_TeamSortList[0].GetAllPower();
double oneNum = teamList[0].GetAllPower();
if (oneNum == 0)
// 检查是否所有队伍都在初始状态
bool allInit = true;
foreach (var team in teamList)
{
m_imgValue.fillAmount = 0.1f;
AlignCarWithFillAmount();
return;
if (team.GetAllPower() != oneNum)
{
allInit = false;
break;
}
}
// 计算自己的百分比
double percent = (float)m_AllPush / oneNum;
if (percent > 1)
float targetFill = 0.1f;
if (!allInit && oneNum > 0)
{
percent = 1;
double percent = m_AllPush / oneNum;
if (percent > 1) percent = 1;
if (percent < 0.1) percent = 0.1;
targetFill = (float)percent;
}
m_imgValue.fillAmount = (float)percent;
// 平滑过渡
m_CurrentFillAmount = Mathf.Lerp(m_CurrentFillAmount, targetFill, Time.deltaTime * 8f);
m_imgValue.fillAmount = m_CurrentFillAmount;
AlignCarWithFillAmount();
}