cool down skill ui

This commit is contained in:
VDH
2026-01-06 13:35:43 +07:00
parent 7e83b578fe
commit 9fed589a9e
10 changed files with 31 additions and 25 deletions
@@ -154,5 +154,6 @@ namespace BrewMonster.Managers
@@ -143,12 +143,12 @@ namespace BrewMonster
// Tick routine
public void Tick(float deltaTime)
{
BMLogger.LogError($"CECSkill Tick m_bCooling: = {m_bCooling}, m_iCoolCnt={m_iCoolCnt}" );
// Convert deltaTime (seconds) to milliseconds
int tickTime = (int)(deltaTime * 1000f);
if (m_bCooling)
{
BMLogger.LogError($"CECSkill Tick m_bCooling: = {m_bCooling}, m_iCoolCnt={m_iCoolCnt}");
// In cooling state
m_iCoolCnt -= tickTime;
if (m_iCoolCnt <= 0)
@@ -183,5 +183,6 @@ namespace BrewMonster
@@ -181,5 +181,6 @@ namespace BrewMonster
@@ -120,5 +120,6 @@ namespace BrewMonster
@@ -34,7 +34,7 @@ namespace BrewMonster
int nCurPanel8 = GetCurPanel2();
CECHostPlayer pHost = EC_Game.GetGameRun().GetHostPlayer();
if(pHost == null) return false;
if (pHost == null) return false;
var a_pSCS = new List<CECShortcutSet>();
var a_pszPanel = new List<string>();
GetQuickBarNameAndSC(pHost, a_pszPanel, a_pSCS, nCurPanel9, nCurPanel8);
@@ -90,23 +90,26 @@ namespace BrewMonster
//pCell.SetColor(A3DCOLORRGB(255, 255, 255));
}
else
{
{
//pCell.SetColor(A3DCOLORRGB(128, 128, 128));
}
}
}
/* else
pClock.SetColor(A3DCOLORRGBA(0, 0, 0, 128));*/
/* else
pClock.SetColor(A3DCOLORRGBA(0, 0, 0, 128));*/
if (pSkill != null && (pSkill.GetCoolingTime() > 0 ||
pHost.GetPrepSkill() == pSkill))
{
pClock.SetProgressRange(0, pSkill.GetCoolingTime());
if (pHost.GetPrepSkill() == pSkill)
pClock.SetProgressPos(0);
{
BMLogger.Log("HoangDev: Skill is preparing cast, so set cooling time to 0");
pClock.SetProgressPos(0); }
else
{
BMLogger.LogError($"HoangDev: GetCoolingTime:{pSkill.GetCoolingTime()}, GetCoolingCnt: {pSkill.GetCoolingCnt()} ");
pClock.SetProgressPos(pSkill.GetCoolingTime() - pSkill.GetCoolingCnt()); }
pClock.SetProgressPos(pSkill.GetCoolingTime() - pSkill.GetCoolingCnt());
}
}
}
}
@@ -12,11 +12,10 @@ namespace BrewMonster
[SerializeField] private int m_iPos;
public Image GetClockIcon() => m_ClockIcon;
public void SetProgressPos(float progress)
public void SetProgressPos(int progress)
{
progress = Math.Clamp(progress, m_iMin, m_iMax);
m_iPos = Math.Clamp(progress, m_iMin, m_iMax);
m_ClockIcon.fillAmount = progress;
UpdateClockIcon();
BMLogger.LogError("AUIClockIcon SetProgressPos ");
}
@@ -31,16 +30,9 @@ namespace BrewMonster
m_iMax = max;
m_iPos = Math.Clamp(m_iPos, m_iMin, m_iMax);
}
private void Update()
{
/* if (m_iPos >= m_iMin)
{
UpdateClockIcon();
}*/
}
private void UpdateClockIcon()
{
float progress = (float)(m_iPos - m_iMin) / (m_iMax - m_iMin);
float progress = (float)(m_iMax - m_iPos) / (m_iMax - m_iMin);
m_ClockIcon.fillAmount = progress;
}
+2 -2
View File
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:733ae9a8b796ba7d65c4cd6a2164189f914379d0c4cb23a4b6bb0eaa0cc9249c
size 200761813
oid sha256:07ea288063221ebe282d90b4c6c794d7ec886a625588aa5c70e16adeaed3e8f5
size 200762164
+9 -3
View File
@@ -103,7 +103,7 @@ namespace BrewMonster
public ON_AIR_CDR_INFO m_AirCDRInfo;
public ushort m_wMoveStamp = 0;
private CECCounter m_GatherCnt; // Gather counter
Dictionary<int, COOLTIME> m_skillCoolTime = new();
Dictionary<int, COOLTIME> m_skillCoolTime = new Dictionary<int, COOLTIME>();
COOLTIME[] m_aCoolTimes = new COOLTIME[(int)CoolTimeIndex.GP_CT_MAX]; // Cool times
// Host config data version
@@ -118,7 +118,7 @@ namespace BrewMonster
// ID of summon player skill
const int ID_SUMMONPLAYER_SKILL = 1824;
private CECAutoTeam m_pAutoTeam; // Player auto team / automatic team grouping
private CECAutoTeam m_pAutoTeam;
// ====== Ground cast config ======
[Header("Ground Cast")]
@@ -578,7 +578,13 @@ namespace BrewMonster
{
int idSkill = pCmd.cooldown_index - (int)CoolTimeIndex.GP_CT_SKILL_START;
COOLTIME ct = m_skillCoolTime[idSkill];
COOLTIME ct;
if (!m_skillCoolTime.TryGetValue(idSkill, out ct))
{
// Key doesn't exist, create new entry
ct = new COOLTIME();
m_skillCoolTime[idSkill] = ct;
}
ct.iCurTime = pCmd.cooldown_time;
ct.iMaxTime = pCmd.cooldown_time;
Math.Clamp(ct.iCurTime, 0, ct.iMaxTime);
+3 -2
View File
@@ -22,7 +22,7 @@ public class CECUIManager : MonoSingleton<CECUIManager>
[SerializeField] private Canvas canvasDlg;
[SerializeField] private CDlgQuickBar cDlgQuickBar;
[SerializeField] private Button btnSecondClick;
[SerializeField] private Button btnSecondClick;
[SerializeField] CDlgQuickBar m_pDlgQuickBar1;
protected override void Awake()
@@ -45,7 +45,8 @@ public class CECUIManager : MonoSingleton<CECUIManager>
}
private void Update()
{
m_pDlgQuickBar1.UpdateShortcuts();
if (m_pDlgQuickBar1 != null)
{ m_pDlgQuickBar1.UpdateShortcuts(); }
}
private void OnDestroy()