switch skill shortcut

This commit is contained in:
VDH
2026-03-10 18:01:47 +07:00
parent 97e9381015
commit 3fc7106e76
8 changed files with 38 additions and 145 deletions
@@ -237,7 +237,7 @@ namespace BrewMonster
#if UNITY_EDITOR
Vector3 currentPos = m_pMoveMethod.GetPos();
BMLogger.LogError($"[SKILL_GFX_DEBUG] Event.Tick: Registering gizmo - hostPos={m_vHostPos}, targetPos={m_vTargetPos}, currentPos={currentPos}, hostExist={m_bHostExist}, targetExist={m_bTargetExist}");
//BMLogger.LogError($"[SKILL_GFX_DEBUG] Event.Tick: Registering gizmo - hostPos={m_vHostPos}, targetPos={m_vTargetPos}, currentPos={currentPos}, hostExist={m_bHostExist}, targetExist={m_bTargetExist}");
if (m_vHostPos.sqrMagnitude > 0.01f && m_vTargetPos.sqrMagnitude > 0.01f)
{
@@ -320,7 +320,7 @@ namespace BrewMonster
}
GameObject prefab = m_pComposer.GetFlyGFX();
BMLogger.LogError("FlyGfx : " + m_pComposer.flyGfxName);
//BMLogger.LogError("FlyGfx : " + m_pComposer.flyGfxName);
if (prefab == null)
{
BMLogger.LogError($"[SKILL_GFX_DEBUG] SpawnFlyGfx: Fly GFX prefab is NULL - cannot spawn!");
@@ -515,14 +515,14 @@ namespace CSNetwork
{
_logger.Log(LogType.Debug,
$"Sending protocol: {protocol.GetType().Name} (Detail: {protocol.ToString})");
BMLogger.Log($"[GameSession] Sending protocol: {protocol.GetType().Name} (Type: {protocol.GetPType()}) + {protocol.ToString} ");
//BMLogger.Log($"[GameSession] Sending protocol: {protocol.GetType().Name} (Type: {protocol.GetPType()}) + {protocol.ToString} ");
_networkManager.Send(protocol);
complete?.Invoke();
}
else
{
_logger.Log(LogType.Warning, $"Cannot send protocol ({protocol.GetType().Name}), not connected.");
BMLogger.LogError($"[GameSession] Cannot send protocol ({protocol.GetType().Name}), not connected.");
//BMLogger.LogError($"[GameSession] Cannot send protocol ({protocol.GetType().Name}), not connected.");
}
}
@@ -567,7 +567,6 @@ namespace CSNetwork
HandleServerDataSend((gamedatasend)protocol);
break;
case ProtocolType.PROTOCOL_CHATMESSAGE:
_logger.Log(LogType.Warning, $"HoangDev :ProtocolType.PROTOCOL_CHATMESSAGE {protocol.GetPType()}");
OnPrtcChatMessage(protocol, false);
break;
case ProtocolType.PROTOCOL_PLAYERBASEINFO_RE:
@@ -1978,7 +1977,7 @@ namespace CSNetwork
{
gamedatasend gamedatasend = new gamedatasend();
gamedatasend.Data = C2SCommandFactory.CreateTaskNotifyCmd( pData, dwDataSize);
BMLogger.Log($"[MH Task] c2s_SendCmdTaskNotify Command ID : {pData[0]} Size: {dwDataSize}");
//BMLogger.Log($"[MH Task] c2s_SendCmdTaskNotify Command ID : {pData[0]} Size: {dwDataSize}");
SendProtocol(gamedatasend);
}
@@ -266,6 +266,7 @@ namespace BrewMonster
{
m_aShortcuts[iSlot] = null;
}
BMLogger.LogError("SetShortcut iSlot= " + iSlot);
m_aShortcuts[iSlot] = pShortcut;
}
@@ -394,7 +394,7 @@ namespace BrewMonster.Scripts.Task
// Marshal base notification structure from buffer
task_notify_base pNotify = GPDataTypeHelper.FromBytes<task_notify_base>(pBuf);
BMLogger.Log($"[MH Task] TaskClient.OnServerNotify: reason={pNotify.reason}, task={pNotify.task}");
//BMLogger.Log($"[MH Task] TaskClient.OnServerNotify: reason={pNotify.reason}, task={pNotify.task}");
ATaskTempl pTempl = null;
ActiveTaskEntry pEntry = null;
@@ -22,14 +22,17 @@ namespace BrewMonster
[SerializeField] List<AUIImagePicture> AUIImagePictureList = new List<AUIImagePicture>();
int m_nCurPanel1 = 1;
int m_nCurPanel2 = 1;
int m_CurrentShortcutOffset = 0;
/// <summary>
/// Apply for a license remove later
/// </summary>
/// <returns></returns>
[ContextMenu("SwitchShowSkillShortcut")]
public void SwitchShowSkillShortcut()
{
m_CurrentShortcutOffset += AUIImagePictureList.Count;
UpdateShortcuts();
}
public bool UpdateShortcuts()
{
CECShortcut pSC;
@@ -41,7 +44,7 @@ namespace BrewMonster
int nCurPanel9 = GetCurPanel1();
int nCurPanel8 = GetCurPanel2();
int countOffset = 0;
CECHostPlayer pHost = EC_Game.GetGameRun().GetHostPlayer();
if (pHost == null) return false;
var a_pSCS = new List<CECShortcutSet>();
@@ -49,22 +52,24 @@ namespace BrewMonster
GetQuickBarNameAndSC(pHost, a_pszPanel, a_pSCS, nCurPanel9, nCurPanel8);
if (a_pSCS == null || a_pSCS.Count < 2)
return false;
#if LICENSE_VERSION
for (int i = 0; i <= 1/*(int)a_pSCS.Count*/; i++)
int slotIndex = 0;
#endif
if(m_CurrentShortcutOffset >( a_pSCS.Count * 9)){
m_CurrentShortcutOffset = 0;
}
for (int i = 0; i <= a_pSCS.Count; i++)
{
if (a_pSCS[i] == null)
continue;
//*//*CDlgQuickBar* pQuickBar = dynamic_cast<CDlgQuickBar*>(GetGameUIMan()->GetDialog(a_pszPanel[i]));
//if (!pQuickBar || !pQuickBar->IsShow()) continue;*//*
#if LICENSE_VERSION
int slotIndex = 0;
#endif
#if LICENSE_VERSION
for (int j = 0; j < a_pSCS.Count; j++)
for (int j = 0; j < AUIImagePictureList.Count /*a_pSCS.Count*/; j++)
{
#else
int nSlots = Mathf.Min(a_pSCS[i].GetShortcutNum(), AUIImagePictureList.Count);
@@ -78,6 +83,11 @@ namespace BrewMonster
pCell = AUIImagePictureList[j];
#endif
if (pCell == null || !pCell.gameObject.activeInHierarchy) continue;
if(m_CurrentShortcutOffset > countOffset)
{
countOffset++;
continue;
}
pSC = a_pSCS[i].GetShortcut(j);
pClock = pCell.GetClockIcon();
pClock.SetProgressRange(0, 1);
@@ -389,9 +399,7 @@ namespace BrewMonster
{
string dlgName;
// ----- Quickbar 1 Horizontal A -----
dlgName = $"Win_Quickbar{Shortcut.SIZE_HOSTSCSET1}Ha";
pSCS?.Add(pHost.GetShortcutSet1(panel9 - 1));
pszPanel.Add(dlgName);
for (int i = 0; i < (int)Shortcut.NUM_HOSTSCSETS1; i++)
@@ -403,7 +411,6 @@ namespace BrewMonster
// ----- Quickbar 1 Vertical A -----
dlgName = $"Win_Quickbar{(int)Shortcut.SIZE_HOSTSCSET1}Va";
pSCS?.Add(pHost.GetShortcutSet1(panel9 - 1));
pszPanel.Add(dlgName);
for (int i = 0; i < (int)Shortcut.NUM_HOSTSCSETS1; i++)
@@ -415,7 +422,6 @@ namespace BrewMonster
// ----- Quickbar 2 Horizontal A -----
dlgName = $"Win_Quickbar{(int)Shortcut.SIZE_HOSTSCSET2}Ha";
pSCS?.Add(pHost.GetShortcutSet2(panel8 - 1));
pszPanel.Add(dlgName);
for (int i = 0; i < (int)Shortcut.NUM_HOSTSCSETS2; i++)
@@ -427,7 +433,6 @@ namespace BrewMonster
// ----- Quickbar 2 Vertical A -----
dlgName = $"Win_Quickbar{(int)Shortcut.SIZE_HOSTSCSET2}Va";
pSCS?.Add(pHost.GetShortcutSet2(panel8 - 1));
pszPanel.Add(dlgName);
for (int i = 0; i < (int)Shortcut.NUM_HOSTSCSETS2; i++)
+1 -3
View File
@@ -1816,7 +1816,6 @@ namespace BrewMonster
}
}
#if UNITY_EDITOR
/// <summary>
/// Cycles through learned skills by removing all shortcuts and adding 2 new skills to slots 0 and 1.
/// If m_startingSkillID is set (>0), uses that specific skill ID and the next one (ID+1).
@@ -1845,7 +1844,7 @@ namespace BrewMonster
int currentSkillID1 = m_startingSkillID + (m_currentSkillCycleIndex * 2);
int currentSkillID2 = currentSkillID1 + 1;
BMLogger.LogError($"CycleSkillShortcuts: Trying to add skills {currentSkillID1} and {currentSkillID2}");
// Find and add first skill
CECSkill pSkill1 = GetPositiveSkillByID(currentSkillID1);
if (pSkill1 != null)
{
@@ -1967,6 +1966,5 @@ namespace BrewMonster
CDlgQuickBar cDlgQuickBar = CECUIManager.Instance?.GetCDlgQuickBar();
cDlgQuickBar?.UpdateShortcuts();
}
#endif
}
}
-2
View File
@@ -678,9 +678,7 @@ public class CECUIManager : MonoSingleton<CECUIManager>
CECHostPlayer hostPlayer = EC_Game.GetGameRun()?.GetHostPlayer();
if (hostPlayer != null)
{
#if UNITY_EDITOR
hostPlayer.CycleSkillShortcuts();
#endif
}
}
File diff suppressed because one or more lines are too long