Merge pull request 'feature/skill-hud' (#230) from feature/skill-hud into develop
Reviewed-on: https://git.pthub.vn/Unity/perfect-world-unity/pulls/230
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1611,19 +1611,5 @@ public static class generate_item_temp
|
||||
}
|
||||
#endregion
|
||||
|
||||
private static void PrintData(byte[] buf, int offset, int size)
|
||||
{
|
||||
for(int i = offset; i < offset + size; i++)
|
||||
{
|
||||
BMLogger.Log("[thn]PrintData: buf[" + i + "]: " + buf[i]);
|
||||
}
|
||||
}
|
||||
private static void PrintPreData(byte[] buf, int offset, int size)
|
||||
{
|
||||
for(int i = offset-1; i >= offset - size; i--)
|
||||
{
|
||||
BMLogger.Log("[thn]PrintPreData: buf[" + i + "]: " + buf[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -505,7 +505,6 @@ namespace BrewMonster
|
||||
ret = -1;
|
||||
break;
|
||||
}
|
||||
//Debug.Log("[THN]return_item_for_sell: ret:" + ret + " size:" + size + " datatype:" + datatype + " id:" + id);
|
||||
if (ret == 0 && size != 0)
|
||||
{
|
||||
sale_item_ptr_array.Add(item);
|
||||
|
||||
@@ -1312,14 +1312,14 @@ namespace BrewMonster.Scripts
|
||||
{
|
||||
if (CECUIManager.Instance != null)
|
||||
{
|
||||
string message = $"Please deactive the fly mode to start the path finding.";
|
||||
// string message = $"Please deactive the fly mode to start the path finding.";
|
||||
|
||||
CECUIManager.Instance.ShowMessageBox(
|
||||
"Fly Mode", // 飞行模式
|
||||
message, // 消息
|
||||
BrewMonster.MessageBoxType.YesButton
|
||||
);
|
||||
Finish();
|
||||
// CECUIManager.Instance.ShowMessageBox(
|
||||
// "Fly Mode", // 飞行模式
|
||||
// message, // 消息
|
||||
// BrewMonster.MessageBoxType.YesButton
|
||||
// );
|
||||
// Finish();
|
||||
//return;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -58,6 +58,7 @@ namespace BrewMonster
|
||||
}
|
||||
public CECSkill GetSkill() { return m_pSkill; }
|
||||
public void SetSkill(CECSkill pSkill) { m_pSkill = pSkill; }
|
||||
public override string GetDesc() { return m_pSkill.GetSkillID().ToString(); }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -274,7 +274,6 @@ namespace BrewMonster.Scripts.Task.UI
|
||||
|
||||
A3DVECTOR3 vPos = instCoord[0].vPos;
|
||||
strName = FormatFromTable(9393, ((int)vPos.x+4000)/10, ((int)vPos.z+5500)/10);
|
||||
Debug.Log($"[DlgTaskTrace] AppendCommand: strName {strName}");
|
||||
strName = string.Format("<link=\"coord\">{0}</link>", strName);
|
||||
//FormatFromTable(9393, ((int)vPos.x+4000)/10, ((int)vPos.z+5500)/10);
|
||||
|
||||
|
||||
@@ -13,17 +13,20 @@ namespace BrewMonster
|
||||
[SerializeField] private SkillUI skillUI;
|
||||
|
||||
bool m_bOpenAction;
|
||||
bool m_bReceivedNCPGreeting; // ÊÇ·ñÊÕµ½ÁËNPCµÄGreeting
|
||||
bool m_bReceivedNCPGreeting; // �Ƿ��յ���NPC��Greeting
|
||||
|
||||
public override void Awake()
|
||||
{
|
||||
base.Awake();
|
||||
uiSkillButton.onClick.RemoveAllListeners();
|
||||
uiSkillButton.onClick.AddListener(OnSkillButtonClicked);
|
||||
EventBus.Unsubscribe<OpenSkillUIEvent>(OnOpenSkillUIEvent);
|
||||
EventBus.Subscribe<OpenSkillUIEvent>(OnOpenSkillUIEvent);
|
||||
}
|
||||
|
||||
public void OnDestroy()
|
||||
{
|
||||
EventBus.Unsubscribe<OpenSkillUIEvent>(OnOpenSkillUIEvent);
|
||||
}
|
||||
|
||||
private void OnOpenSkillUIEvent(OpenSkillUIEvent @event)
|
||||
{
|
||||
TryOpenDialog(false);
|
||||
@@ -35,6 +38,10 @@ namespace BrewMonster
|
||||
}
|
||||
public void TryOpenDialog(bool bAction)
|
||||
{
|
||||
if(skillUI == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var boolll = skillUI.gameObject.activeInHierarchy;
|
||||
if (boolll)
|
||||
{
|
||||
|
||||
@@ -174,7 +174,6 @@ namespace BrewMonster.Scripts.UI
|
||||
string strDesc = pItem.GetDesc();
|
||||
pImage.SetHint(strDesc); // TODO
|
||||
pImage.SetOnClick(OnAwardItemClicked);
|
||||
//Debug.Log("[THN]CDlgAward: pItem.GetDesc():" + pItem.GetDesc());
|
||||
// af_GetFileTitle(pItem.GetIconFile(), strFile); // TODO
|
||||
strFile.ToLower();
|
||||
// TODO: Set the image cover here
|
||||
|
||||
@@ -5,6 +5,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
@@ -44,6 +45,7 @@ namespace BrewMonster.Assets.PerfectWorld.Scripts.UI.GamePlay
|
||||
public void SetDataPtr(CECShortcut pvData, string strName = null)
|
||||
{
|
||||
pSC = pvData;
|
||||
|
||||
}
|
||||
public void SetInteract(bool isInteract)
|
||||
{
|
||||
@@ -141,6 +143,15 @@ namespace BrewMonster.Assets.PerfectWorld.Scripts.UI.GamePlay
|
||||
{
|
||||
return m_hintText;
|
||||
}
|
||||
public void Clear()
|
||||
{
|
||||
// BMLogger.Log("Clear AUIImagePicture with name: " + name) ;
|
||||
pSC = null;
|
||||
this.SetDataPtr(null);
|
||||
borderImage.SetActive(false);
|
||||
m_ClockCounter.SetProgressRange(0, 1);
|
||||
m_ClockCounter.SetProgressPos(1);
|
||||
}
|
||||
}
|
||||
public struct OpenSkillUIEvent
|
||||
{
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace BrewMonster
|
||||
public int m_nCurPanel1 = 1;
|
||||
public int m_nCurPanel2 = 1;
|
||||
|
||||
int m_CurrentShortcutOffset = 0;
|
||||
int currentListIndex = 0;
|
||||
/// <summary>
|
||||
/// Apply for a license remove later
|
||||
/// </summary>
|
||||
@@ -40,7 +40,7 @@ namespace BrewMonster
|
||||
[ContextMenu("SwitchShowSkillShortcut")]
|
||||
public void SwitchShowSkillShortcut()
|
||||
{
|
||||
m_CurrentShortcutOffset += AUIImagePictureList.Count;
|
||||
currentListIndex += 1;
|
||||
UpdateShortcuts();
|
||||
}
|
||||
public bool UpdateShortcuts()
|
||||
@@ -54,7 +54,6 @@ 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>();
|
||||
@@ -62,43 +61,17 @@ namespace BrewMonster
|
||||
GetQuickBarNameAndSC(pHost, a_pszPanel, a_pSCS, nCurPanel9, nCurPanel8);
|
||||
if (a_pSCS == null || a_pSCS.Count < 2)
|
||||
return false;
|
||||
#if LICENSE_VERSION
|
||||
|
||||
int slotIndex = 0;
|
||||
#endif
|
||||
if(m_CurrentShortcutOffset >( a_pSCS.Count * 9)){
|
||||
m_CurrentShortcutOffset = 0;
|
||||
}
|
||||
for (int i = 0; i < a_pSCS.Count; i++)
|
||||
|
||||
if(currentListIndex >= a_pSCS.Count )
|
||||
{
|
||||
if (a_pSCS[i] == null)
|
||||
continue;
|
||||
|
||||
//*//*CDlgQuickBar* pQuickBar = dynamic_cast<CDlgQuickBar*>(GetGameUIMan()->GetDialog(a_pszPanel[i]));
|
||||
//if (!pQuickBar || !pQuickBar->IsShow()) continue;*//*
|
||||
|
||||
#if LICENSE_VERSION
|
||||
|
||||
for (int j = 0; j < AUIImagePictureList.Count /*a_pSCS.Count*/; j++)
|
||||
{
|
||||
#else
|
||||
int nSlots = Mathf.Min(a_pSCS[i].GetShortcutNum(), AUIImagePictureList.Count);
|
||||
currentListIndex = 0;
|
||||
}
|
||||
int nSlots = Mathf.Min(a_pSCS[currentListIndex].GetShortcutNum(), AUIImagePictureList.Count);
|
||||
for (int j = 0; j < nSlots; j++)
|
||||
{
|
||||
#endif
|
||||
#if LICENSE_VERSION
|
||||
if (slotIndex >= AUIImagePictureList.Count) break;
|
||||
pCell = AUIImagePictureList[slotIndex];
|
||||
#else
|
||||
pCell = AUIImagePictureList[j];
|
||||
#endif
|
||||
if (pCell == null || !pCell.gameObject.activeInHierarchy) continue;
|
||||
if(m_CurrentShortcutOffset > countOffset)
|
||||
{
|
||||
countOffset++;
|
||||
continue;
|
||||
}
|
||||
pSC = a_pSCS[i].GetShortcut(j);
|
||||
pSC = a_pSCS[currentListIndex].GetShortcut(j);
|
||||
pClock = pCell.GetClockIcon();
|
||||
pClock.SetProgressRange(0, 1);
|
||||
pClock.SetProgressPos(1);
|
||||
@@ -361,9 +334,6 @@ namespace BrewMonster
|
||||
|
||||
if (pSC != null)
|
||||
{
|
||||
#if LICENSE_VERSION
|
||||
slotIndex++;
|
||||
#endif
|
||||
if (pCell.GetDataPtr() == pSC)
|
||||
{
|
||||
continue;
|
||||
@@ -400,9 +370,10 @@ namespace BrewMonster
|
||||
pCell->SetText(_AL(""));
|
||||
pCell->SetDataPtr(NULL);
|
||||
pCell->SetColor(A3DCOLORRGB(255, 255, 255)); */
|
||||
pCell.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
private void GetQuickBarNameAndSC(CECHostPlayer pHost, List<string> pszPanel, List<CECShortcutSet> pSCS, int panel9, int panel8)
|
||||
|
||||
@@ -72,6 +72,7 @@ namespace BrewMonster
|
||||
int offset = sizeof(uint);
|
||||
int skillSize = Marshal.SizeOf<cmd_skill_data.SKILL>();
|
||||
pCmd.skill_list = new cmd_skill_data.SKILL[pCmd.skill_count];
|
||||
BMLogger.LogError("OnMsgHstSkillData: skill_count= " + pCmd.skill_count);
|
||||
for (int i = 0; i < pCmd.skill_count; i++)
|
||||
{
|
||||
pCmd.skill_list[i] = GPDataTypeHelper.FromBytes<cmd_skill_data.SKILL>((byte[])Msg.dwParam1, offset);
|
||||
@@ -1816,9 +1817,10 @@ namespace BrewMonster
|
||||
}
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
/// <summary>
|
||||
/// Cycles through learned skills by removing all shortcuts and adding 8 new skills to slots 0-7.
|
||||
/// If m_startingSkillID is set (>0), uses that specific skill ID and the next 7 (ID+1 to ID+7).
|
||||
/// If m_startingSkillID is set (>0), uses that specific skill ID and the next 7 (ID+1 through ID+7).
|
||||
/// Otherwise, cycles through all learned skills in groups of 8.
|
||||
/// </summary>
|
||||
#if UNITY_EDITOR
|
||||
@@ -1834,56 +1836,39 @@ namespace BrewMonster
|
||||
|
||||
// Remove all shortcuts
|
||||
pSCS.RemoveAllShortcuts();
|
||||
const int skillsPerCycle = 8;
|
||||
|
||||
// If starting skill ID is configured, cycle through groups of 8 starting from that ID
|
||||
// If starting skill ID is configured, cycle through pairs starting from that ID
|
||||
if (m_startingSkillID > 0)
|
||||
{
|
||||
// Calculate the current skill IDs based on cycle index
|
||||
// First press: startingID + 0 to startingID + 7 (e.g., 5-12)
|
||||
// Second press: startingID + 8 to startingID + 15 (e.g., 13-20)
|
||||
// Third press: startingID + 16 to startingID + 23 (e.g., 21-28)
|
||||
int baseSkillID = m_startingSkillID + (m_currentSkillCycleIndex * skillsPerCycle);
|
||||
BMLogger.LogError($"CycleSkillShortcuts: Trying to add skills {baseSkillID} to {baseSkillID + skillsPerCycle - 1}");
|
||||
|
||||
// Add 8 skills to slots 0-7
|
||||
for (int slot = 0; slot < skillsPerCycle; slot++)
|
||||
// First press: startingID + 0, startingID + 1 (e.g., 5, 6)
|
||||
// Second press: startingID + 2, startingID + 3 (e.g., 7, 8)
|
||||
// Third press: startingID + 4, startingID + 5 (e.g., 9, 10)
|
||||
int firstIndex = m_startingSkillID + (m_currentSkillCycleIndex * 8);
|
||||
List<int> skillIDs = new List<int>();
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
int currentSkillID = baseSkillID + slot;
|
||||
CECSkill pSkill = GetPositiveSkillByID(currentSkillID);
|
||||
|
||||
skillIDs.Add(firstIndex + i);
|
||||
}
|
||||
string skillIDsString = string.Join(", ", skillIDs);
|
||||
BMLogger.LogError($"CycleSkillShortcuts: Trying to add skills {skillIDsString}");
|
||||
for (int i = 0; i < skillIDs.Count; i++)
|
||||
{
|
||||
int skillID = skillIDs[i];
|
||||
CECSkill pSkill = GetPositiveSkillByID(skillID);
|
||||
if (pSkill != null)
|
||||
{
|
||||
pSCS.CreateSkillShortcut(slot, pSkill);
|
||||
Debug.LogError($"CycleSkillShortcuts: Added skill ID {currentSkillID} to slot {slot}");
|
||||
pSCS.CreateSkillShortcut(i, pSkill);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError($"CycleSkillShortcuts: Skill with ID {currentSkillID} not found in learned skills");
|
||||
// Try to find a valid skill by incrementing starting ID
|
||||
int find = 1;
|
||||
while (pSkill == null && find < 100)
|
||||
{
|
||||
m_startingSkillID++;
|
||||
Debug.LogError($"CycleSkillShortcuts: m_startingSkillID {m_startingSkillID}");
|
||||
currentSkillID = m_startingSkillID + (m_currentSkillCycleIndex * skillsPerCycle) + slot;
|
||||
pSkill = GetPositiveSkillByID(currentSkillID);
|
||||
find++;
|
||||
}
|
||||
|
||||
if (pSkill != null)
|
||||
{
|
||||
pSCS.CreateSkillShortcut(slot, pSkill);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError($"CycleSkillShortcuts: Failed to find skill for slot {slot} after {find} attempts");
|
||||
}
|
||||
Debug.LogError($"CycleSkillShortcuts: Skill with ID {skillID} not found in learned skills");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Increment cycle index for next press
|
||||
m_currentSkillCycleIndex++;
|
||||
++m_currentSkillCycleIndex;
|
||||
|
||||
// Update UI
|
||||
CDlgQuickBar cDlgQuickBar2 = CECUIManager.Instance?.GetCDlgQuickBar();
|
||||
@@ -1905,7 +1890,7 @@ namespace BrewMonster
|
||||
}
|
||||
|
||||
// Calculate how many groups of 8 we can make
|
||||
int maxGroups = (skillCount + skillsPerCycle - 1) / skillsPerCycle; // Round up division
|
||||
int maxGroups = (skillCount + 7) / 8; // Round up division
|
||||
|
||||
// Wrap around if we've reached the end
|
||||
if (m_currentSkillCycleIndex >= maxGroups)
|
||||
@@ -1913,19 +1898,19 @@ namespace BrewMonster
|
||||
m_currentSkillCycleIndex = 0;
|
||||
}
|
||||
|
||||
// Calculate skill indices for this cycle
|
||||
int baseSkillIndex = m_currentSkillCycleIndex * skillsPerCycle;
|
||||
// Calculate starting skill index for this cycle
|
||||
int startSkillIndex = m_currentSkillCycleIndex * 8;
|
||||
|
||||
// Add up to 8 skills to slots 0-7
|
||||
for (int slot = 0; slot < skillsPerCycle; slot++)
|
||||
// Fill all 8 shortcut slots
|
||||
for (int slotIndex = 0; slotIndex < 8; slotIndex++)
|
||||
{
|
||||
int skillIndex = baseSkillIndex + slot;
|
||||
int skillIndex = startSkillIndex + slotIndex;
|
||||
if (skillIndex < skillCount)
|
||||
{
|
||||
CECSkill pSkill = GetPositiveSkillByIndex(skillIndex);
|
||||
if (pSkill != null)
|
||||
{
|
||||
pSCS.CreateSkillShortcut(slot, pSkill);
|
||||
pSCS.CreateSkillShortcut(slotIndex, pSkill);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ public class CECUIManager : MonoSingleton<CECUIManager>
|
||||
|
||||
[SerializeField] private UnityEngine.UI.Button btnSecondClick;
|
||||
[SerializeField] CDlgQuickBar m_pDlgQuickBar1;
|
||||
[SerializeField] GameObject ChangeSkillShortcutButton;
|
||||
public CDlgSkillSubOther m_pDlgSkillSubOther;
|
||||
CDlgMessageBox m_pDlgMessageBox;
|
||||
public CDlgSkillAction m_pDlgSkillAction;
|
||||
@@ -61,6 +62,11 @@ public class CECUIManager : MonoSingleton<CECUIManager>
|
||||
}
|
||||
|
||||
ShowUI("Win_Hpmpxp");
|
||||
#if UNITY_EDITOR
|
||||
ChangeSkillShortcutButton.SetActive(true);
|
||||
#else
|
||||
ChangeSkillShortcutButton.SetActive(false);
|
||||
#endif
|
||||
}
|
||||
|
||||
private void Update()
|
||||
|
||||
Reference in New Issue
Block a user