From 9fed589a9ec1a2d51e6b136335998a111e39d09a Mon Sep 17 00:00:00 2001 From: VDH Date: Tue, 6 Jan 2026 13:35:43 +0700 Subject: [PATCH] cool down skill ui --- .../PerfectWorld/Scripts/Managers/CECManager.cs | 1 + Assets/PerfectWorld/Scripts/Managers/EC_Skill.cs | 2 +- Assets/PerfectWorld/Scripts/Skills/skill7.cs | 1 + Assets/PerfectWorld/Scripts/Skills/skill8.cs | 1 + Assets/PerfectWorld/Scripts/Skills/skill9.cs | 1 + .../Scripts/UI/GamePlay/CdlgQuickBar.cs | 15 +++++++++------ .../Scripts/UI/GamePlay/SkillUI/AUIClockIcon.cs | 14 +++----------- Assets/Scenes/a61.unity | 4 ++-- Assets/Scripts/CECHostPlayer.cs | 12 +++++++++--- Assets/Scripts/CECUIManager.cs | 5 +++-- 10 files changed, 31 insertions(+), 25 deletions(-) diff --git a/Assets/PerfectWorld/Scripts/Managers/CECManager.cs b/Assets/PerfectWorld/Scripts/Managers/CECManager.cs index 2386436704..1daa295f4e 100644 --- a/Assets/PerfectWorld/Scripts/Managers/CECManager.cs +++ b/Assets/PerfectWorld/Scripts/Managers/CECManager.cs @@ -154,5 +154,6 @@ namespace BrewMonster.Managers + diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_Skill.cs b/Assets/PerfectWorld/Scripts/Managers/EC_Skill.cs index e4528041cb..f37a48d445 100644 --- a/Assets/PerfectWorld/Scripts/Managers/EC_Skill.cs +++ b/Assets/PerfectWorld/Scripts/Managers/EC_Skill.cs @@ -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) diff --git a/Assets/PerfectWorld/Scripts/Skills/skill7.cs b/Assets/PerfectWorld/Scripts/Skills/skill7.cs index 5b7b2a4981..cff04d5a85 100644 --- a/Assets/PerfectWorld/Scripts/Skills/skill7.cs +++ b/Assets/PerfectWorld/Scripts/Skills/skill7.cs @@ -183,5 +183,6 @@ namespace BrewMonster + diff --git a/Assets/PerfectWorld/Scripts/Skills/skill8.cs b/Assets/PerfectWorld/Scripts/Skills/skill8.cs index e7732dc28d..0a1b197740 100644 --- a/Assets/PerfectWorld/Scripts/Skills/skill8.cs +++ b/Assets/PerfectWorld/Scripts/Skills/skill8.cs @@ -181,5 +181,6 @@ namespace BrewMonster + diff --git a/Assets/PerfectWorld/Scripts/Skills/skill9.cs b/Assets/PerfectWorld/Scripts/Skills/skill9.cs index a09098916c..00c65d5d74 100644 --- a/Assets/PerfectWorld/Scripts/Skills/skill9.cs +++ b/Assets/PerfectWorld/Scripts/Skills/skill9.cs @@ -120,5 +120,6 @@ namespace BrewMonster + diff --git a/Assets/PerfectWorld/Scripts/UI/GamePlay/CdlgQuickBar.cs b/Assets/PerfectWorld/Scripts/UI/GamePlay/CdlgQuickBar.cs index 2d3768f142..3e1113d445 100644 --- a/Assets/PerfectWorld/Scripts/UI/GamePlay/CdlgQuickBar.cs +++ b/Assets/PerfectWorld/Scripts/UI/GamePlay/CdlgQuickBar.cs @@ -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(); var a_pszPanel = new List(); 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()); + } } } } diff --git a/Assets/PerfectWorld/Scripts/UI/GamePlay/SkillUI/AUIClockIcon.cs b/Assets/PerfectWorld/Scripts/UI/GamePlay/SkillUI/AUIClockIcon.cs index fb09dd4674..925eba7ad7 100644 --- a/Assets/PerfectWorld/Scripts/UI/GamePlay/SkillUI/AUIClockIcon.cs +++ b/Assets/PerfectWorld/Scripts/UI/GamePlay/SkillUI/AUIClockIcon.cs @@ -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; } diff --git a/Assets/Scenes/a61.unity b/Assets/Scenes/a61.unity index 6564807c11..75f123c15b 100644 --- a/Assets/Scenes/a61.unity +++ b/Assets/Scenes/a61.unity @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:733ae9a8b796ba7d65c4cd6a2164189f914379d0c4cb23a4b6bb0eaa0cc9249c -size 200761813 +oid sha256:07ea288063221ebe282d90b4c6c794d7ec886a625588aa5c70e16adeaed3e8f5 +size 200762164 diff --git a/Assets/Scripts/CECHostPlayer.cs b/Assets/Scripts/CECHostPlayer.cs index 8103b94f78..af604c95b1 100644 --- a/Assets/Scripts/CECHostPlayer.cs +++ b/Assets/Scripts/CECHostPlayer.cs @@ -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 m_skillCoolTime = new(); + Dictionary m_skillCoolTime = new Dictionary(); 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); diff --git a/Assets/Scripts/CECUIManager.cs b/Assets/Scripts/CECUIManager.cs index 05c4c50ea2..d8ce95727f 100644 --- a/Assets/Scripts/CECUIManager.cs +++ b/Assets/Scripts/CECUIManager.cs @@ -22,7 +22,7 @@ public class CECUIManager : MonoSingleton [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 } private void Update() { - m_pDlgQuickBar1.UpdateShortcuts(); + if (m_pDlgQuickBar1 != null) + { m_pDlgQuickBar1.UpdateShortcuts(); } } private void OnDestroy()