done ui cap phep

This commit is contained in:
VDH
2026-01-20 10:53:12 +07:00
parent 1d43192fb1
commit 5d0f69ab34
12 changed files with 1620 additions and 821 deletions
@@ -15,7 +15,7 @@ MonoBehaviour:
m_DefaultGroup: 712e3991f28e549e7a56ee582a977810
m_currentHash:
serializedVersion: 2
Hash: 00000000000000000000000000000000
Hash: f31c7227b70701eab297439e808bd57d
m_OptimizeCatalogSize: 0
m_BuildRemoteCatalog: 0
m_CatalogRequestsTimeout: 0
File diff suppressed because it is too large Load Diff
@@ -187,7 +187,7 @@ namespace BrewMonster.Scripts.Skills
{
s = SkillStub.GetStub(id);
if (s != null)
return s.GetName();
return s.GetIcon();
return "";
}
// ˵
@@ -19,6 +19,10 @@ namespace BrewMonster
int m_nCurPanel1 = 1;
int m_nCurPanel2 = 1;
/// <summary>
/// Apply for a license remove later
/// </summary>
/// <returns></returns>
public bool UpdateShortcuts()
{
CECShortcut pSC;
@@ -46,10 +50,10 @@ namespace BrewMonster
/*CDlgQuickBar* pQuickBar = dynamic_cast<CDlgQuickBar*>(GetGameUIMan()->GetDialog(a_pszPanel[i]));
if (!pQuickBar || !pQuickBar->IsShow()) continue;*/
for (int j = 0; j < AUIImagePictureList.Count; j++)
int slotIndex = 0;
for (int j = 0; j < a_pSCS.Count; j++)
{
pCell = AUIImagePictureList[j];
pCell = AUIImagePictureList[slotIndex];
pSC = a_pSCS[i].GetShortcut(j);
pClock = pCell.GetClockIcon();
pClock.SetProgressRange(0, 1);
@@ -203,7 +207,7 @@ namespace BrewMonster
{
if (pSkill != null)
{
pCell.gameObject.SetActive(true);
slotIndex++;
//BMLogger.Log("HoangDev: QuickBar Set Skill Icon: " + (uint)pSkill.GetSkillID() + " : " + ElementSkill.GetIcon((uint)pSkill.GetSkillID()));
var nameskill = ElementSkill.GetIcon((uint)pSkill.GetSkillID());
GetGameUIMan().SetCover(pCell, nameskill, EC_GAMEUI_ICONS.ICONS_SKILL);
@@ -226,6 +230,213 @@ namespace BrewMonster
}
return true;
}
/* public bool UpdateShortcuts()
{
CECShortcut pSC;
Image skillImage;
CECSCSkill pSCSkill;
int iIconFile, nMax;
AUIImagePicture pCell;
CECSkill pSkill = new CECSkill(-1, -1);
AUIClockIcon pClock;
int nCurPanel9 = GetCurPanel1();
int nCurPanel8 = GetCurPanel2();
CECHostPlayer pHost = EC_Game.GetGameRun().GetHostPlayer();
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);
for (int i = 0; i <= 1*//*(int)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;*//*
for (int j = 0; j < AUIImagePictureList.Count; j++)
{
pCell = AUIImagePictureList[j];
pSC = a_pSCS[i].GetShortcut(j);
pClock = pCell.GetClockIcon();
pClock.SetProgressRange(0, 1);
pClock.SetProgressPos(1);
if (pSC != null)
{
if (pSC.GetType() == (int)CECShortcut.ShortcutType.SCT_SKILL)
{
iIconFile = (int)EC_GAMEUI_ICONS.ICONS_SKILL;
pSCSkill = (CECSCSkill)pSC;
pSkill = pSCSkill.GetSkill();
if (false*//*m_bDelGoblinSkillSC && GNET::ElementSkill::IsGoblinSkill(pSkill->GetSkillID())*//*)
{
*//* a_pSCS[i]->SetShortcut(j, NULL);
pSC = NULL;*//*
}
else
{
if (pSkill != null && pSkill.ReadyToCast() && pHost.GetPrepSkill() != pSkill)
{
if (ElementSkill.IsGoblinSkill((uint)pSkill.GetSkillID()))
{
*//* if (pHostGoblin && !pHostGoblin->CheckSkillCastCondition(pSkill))
{
pCell->SetColor(A3DCOLORRGB(255, 255, 255));
}
else
{
pCell->SetColor(A3DCOLORRGB(128, 128, 128));
}*//*
}
else
{
if (pHost.CheckSkillCastCondition(pSkill) == 0)
{
//pCell.SetColor(A3DCOLORRGB(255, 255, 255));
}
else
{
//pCell.SetColor(A3DCOLORRGB(128, 128, 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);
}
else
{
pClock.SetProgressPos(pSkill.GetCoolingTime() - pSkill.GetCoolingCnt());
}
}
}
}
*//*else if (pSC->GetType() == CECShortcut::SCT_ITEM)
{
iIconFile = CECGameUIMan::ICONS_INVENTORY;
pCell->SetColor(A3DCOLORRGB(255, 255, 255));
pSCItem = (CECSCItem*)pSC;
pIvtr = GetHostPlayer()->GetPack(pSCItem->GetInventory());
pItem = pIvtr->GetItem(pSCItem->GetIvtrSlot());
if (pItem && pItem->GetCoolTime(&nMax) > 0)
{
pClock->SetProgressRange(0, nMax);
pClock->SetProgressPos(nMax - pItem->GetCoolTime());
pClock->SetColor(A3DCOLORRGBA(0, 0, 0, 128));
}
if (pSCItem->GetInventory() == IVTRTYPE_EQUIPPACK)
pCell->SetColor(A3DCOLORRGBA(128, 128, 255, 128));
}
else if (pSC->GetType() == CECShortcut::SCT_PET)
{
pSCPet = (CECSCPet*)pSC;
CECPetData* pPet = pPetCorral->GetPetData(pSCPet->GetPetIndex());
iIconFile = CECGameUIMan::ICONS_INVENTORY;
pCell->SetColor(A3DCOLORRGB(255, 255, 255));
if (pPet)
{
// dead combat pet
if ((pPet->GetClass() == GP_PET_CLASS_COMBAT || pPet->GetClass() == GP_PET_CLASS_EVOLUTION) && pPet->GetHPFactor() == 0.0f)
{
pCell->SetColor(A3DCOLORRGB(128, 128, 128));
}
// current active pet
else if (pSCPet->IsActivePet())
{
pCell->SetColor(A3DCOLORRGB(255, 255, 0));
}
}
}
else if (pSC->GetType() == CECShortcut::SCT_AUTOFASHION)
{
iIconFile = CECGameUIMan::ICONS_SUITE;
fashionCoolTime = pHost->GetCoolTime(GP_CT_EQUIP_FASHION_ITEM, &fashionCoolTimeMax);
pCell->SetColor(A3DCOLORRGB(255, 255, 255));
if (fashionCoolTimeMax > 0)
{
pClock->SetProgressRange(0, fashionCoolTimeMax);
pClock->SetProgressPos(fashionCoolTimeMax - fashionCoolTime);
pClock->SetColor(A3DCOLORRGBA(0, 0, 0, 175));
}
}
else
{
iIconFile = CECGameUIMan::ICONS_ACTION;
if (pSC->GetType() == CECShortcut::SCT_COMMAND)
{
CECSCCommand* pCommandSC = (CECSCCommand*)pSC;
if (GetHostPlayer()->IsInvisible())
{
if (pCommandSC->GetCommandID() == CECSCCommand::CMD_STARTTRADE ||
pCommandSC->GetCommandID() == CECSCCommand::CMD_SELLBOOTH ||
pCommandSC->GetCommandID() == CECSCCommand::CMD_BINDBUDDY)
{
pCell->SetColor(A3DCOLORRGB(128, 128, 128));
}
else
{
pCell->SetColor(A3DCOLORRGB(255, 255, 255));
}
}
else
{
pCell->SetColor(A3DCOLORRGB(255, 255, 255));
}
}
if (pSC->GetCoolTime(&nMax) > 0)
{
pClock->SetProgressRange(0, nMax);
pClock->SetProgressPos(nMax - pSC->GetCoolTime());
pClock->SetColor(A3DCOLORRGBA(0, 0, 0, 128));
}
}*//*
if (pSC != null)
{
pCell.SetDataPtr(pSC, "ptr_CECShortcut");
if (pSC.GetType() == (int)CECShortcut.ShortcutType.SCT_SKILLGRP)
{
*//* EC_VIDEO_SETTING setting = GetGame()->GetConfigs()->GetVideoSettings();
pCell->SetCover(GetGameUIMan()->m_pA2DSpriteIcons[CECGameUIMan::ICONS_SKILLGRP],
setting.comboSkill[((CECSCSkillGrp*)pSC)->GetGroupIndex()].nIcon + 1);*//*
}
else
{
if (pSkill != null)
{
pCell.gameObject.SetActive(true);
//BMLogger.Log("HoangDev: QuickBar Set Skill Icon: " + (uint)pSkill.GetSkillID() + " : " + ElementSkill.GetIcon((uint)pSkill.GetSkillID()));
var nameskill = ElementSkill.GetIcon((uint)pSkill.GetSkillID());
GetGameUIMan().SetCover(pCell, nameskill, EC_GAMEUI_ICONS.ICONS_SKILL);
}
*//*af_GetFileTitle(pSC->GetIconFile(), strFile);
strFile.MakeLower();
pCell->SetCover(GetGameUIMan()->m_pA2DSpriteIcons[iIconFile],
GetGameUIMan()->m_IconMap[iIconFile][strFile]);*//*
}
}
}
else
{
*//* pCell->SetCover(NULL, -1);
pCell->SetText(_AL(""));
pCell->SetDataPtr(NULL);
pCell->SetColor(A3DCOLORRGB(255, 255, 255));*//*
}
}
}
return true;
}*/
private void GetQuickBarNameAndSC(CECHostPlayer pHost, List<string> pszPanel, List<CECShortcutSet> pSCS, int panel9, int panel8)
{
string dlgName;
@@ -131,7 +131,6 @@ namespace BrewMonster.UI
{
return m_dialogResouce;
}
public Canvas GetCanvas()
{
return m_canvas;
@@ -8,6 +8,7 @@ namespace BrewMonster
{
[Header("LearnedSkillUI")]
[SerializeField] Button learnedSkillbutton;
[SerializeField] private DoubleTapButton wButton;
private void Awake()
{
@@ -15,15 +16,24 @@ namespace BrewMonster
{
Debug.LogError("Learned Skill Button is not assigned in LearnedSkillUI");
}
learnedSkillbutton.onClick.RemoveAllListeners();
learnedSkillbutton.onClick.AddListener(AddShortCutSkill);
wButton.DoubleTapped += OpenSetShortCutSkillUI;
}
private void AddShortCutSkill()
{
learnedSkillbutton.onClick.AddListener(OpenSetShortCutSkillUI);
}
private void OpenSetShortCutSkillUI()
{
}
}
/*public struct OpenSetShortCutSkillUIEvent
{
public OpenSetShortCutSkillUIEvent()
{
}
}*/
}
@@ -0,0 +1,67 @@
using System;
using UnityEngine;
using UnityEngine.EventSystems;
public class DoubleTapButton : MonoBehaviour, IPointerClickHandler
{
[SerializeField] private float doubleTapThreshold = 0.25f;
// Subscribe bằng code: doubleTapButton.DoubleTapped += () => ...
public event Action SingleTapped;
public event Action DoubleTapped;
private float _lastTapTime = -999f;
private bool _waitingSingle;
private int _tapCount;
private Coroutine _singleRoutine;
public void OnPointerClick(PointerEventData eventData)
{
if (eventData.button != PointerEventData.InputButton.Left) return;
float now = Time.unscaledTime;
if (now - _lastTapTime <= doubleTapThreshold) _tapCount++;
else _tapCount = 1;
_lastTapTime = now;
if (_tapCount == 2)
{
_tapCount = 0;
// huỷ single đang chờ
_waitingSingle = false;
if (_singleRoutine != null)
{
StopCoroutine(_singleRoutine);
_singleRoutine = null;
}
DoubleTapped?.Invoke();
}
else
{
// chờ 1 khoảng để xem có tap lần 2 không, rồi mới fire single
if (!_waitingSingle)
{
_waitingSingle = true;
_singleRoutine = StartCoroutine(WaitThenSingle());
}
}
}
private System.Collections.IEnumerator WaitThenSingle()
{
float start = Time.unscaledTime;
while (Time.unscaledTime - start < doubleTapThreshold)
{
if (!_waitingSingle) yield break; // đã double-tap
yield return null;
}
_waitingSingle = false;
_singleRoutine = null;
SingleTapped?.Invoke();
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 106e019fdd0d35744a1cf51aa2ea4b01
+2 -2
View File
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5db879889e44dd2b56efd7a8e828bc01595c1ba111ee36c3aeb1c1b56fc4f7f1
size 200605217
oid sha256:b11c373eb2b380fb668b7b6033a675da6c2248d4acca18072418c65c712d12d7
size 200540506
+21 -21
View File
@@ -770,7 +770,7 @@ namespace BrewMonster
// Is skill cool time
int idSkill = item.idx - (int)CoolTimeIndex.GP_CT_SKILL_START;
COOLTIME ct = m_skillCoolTime[idSkill];
COOLTIME ct = default;
ct.iCurTime = item.cooldown;
ct.iMaxTime = item.max_cooltime;
Mathf.Clamp(ct.iCurTime, 0, ct.iMaxTime);
@@ -1385,27 +1385,27 @@ namespace BrewMonster
}
}
// Restore and convert shortcuts after loading new skills
/* if (hostPlayer.HostIsReady())
{
hostPlayer.ConvertSkillShortcut(skillSCConfigArray1);
hostPlayer.AssignSkillShortcut(skillSCConfigArray1, hostPlayer.m_aSCSets1);
hostPlayer.ConvertSkillShortcut(skillSCConfigArray2);
hostPlayer.AssignSkillShortcut(skillSCConfigArray2, hostPlayer.m_aSCSets2);
hostPlayer.ConvertComboSkill();
hostPlayer.ValidateSkillGrpShortcut(skillGrpSCConfigArray1);
hostPlayer.AssignSkillGrpShortcut(skillGrpSCConfigArray1, hostPlayer.m_aSCSets1);
hostPlayer.ValidateSkillGrpShortcut(skillGrpSCConfigArray2);
hostPlayer.AssignSkillGrpShortcut(skillGrpSCConfigArray2, hostPlayer.m_aSCSets2);
}
if (HostIsReady())
{
/* ConvertSkillShortcut(skillSCConfigArray1);
AssignSkillShortcut(skillSCConfigArray1, hostPlayer.m_aSCSets1);*/
/* ConvertSkillShortcut(skillSCConfigArray2);
AssignSkillShortcut(skillSCConfigArray2, hostPlayer.m_aSCSets2);*/
/* ConvertComboSkill();
ValidateSkillGrpShortcut(skillGrpSCConfigArray1);
AssignSkillGrpShortcut(skillGrpSCConfigArray1, hostPlayer.m_aSCSets1);
ValidateSkillGrpShortcut(skillGrpSCConfigArray2);
AssignSkillGrpShortcut(skillGrpSCConfigArray2, hostPlayer.m_aSCSets2);*/
}
if (hostPlayer.HostIsReady())
{
// Update UI when profession changes, save all shortcut configurations
// to remove effects from intermediate skills (invalid pointers)
// C++: CECGameUIMan *pGameUIMan = g_pGame.GetGameRun().GetUIManager().GetInGameUIMan();
// pGameUIMan.UpdateSkillRelatedUI();
hostPlayer.UpdateSkillRelatedUI();
}*/
if (HostIsReady())
{
// Update UI when profession changes, save all shortcut configurations
// to remove effects from intermediate skills (invalid pointers)
// C++: CECGameUIMan *pGameUIMan = g_pGame.GetGameRun().GetUIManager().GetInGameUIMan();
// pGameUIMan.UpdateSkillRelatedUI();
CECUIManager.Instance.UpdateSkillRelatedUI();
}
}
public bool HostIsReady()
+13
View File
@@ -116,6 +116,19 @@ public class CECUIManager : MonoSingleton<CECUIManager>
}
return null;
}
public void UpdateSkillRelatedUI()
{
// ¸üм¼ÄÜÏà¹ØµÄ½çÃæÏÔʾ
if (m_pDlgQuickBar1)
m_pDlgQuickBar1.UpdateShortcuts();
/* if (m_pDlgSkillEdit != null && m_pDlgSkillEdit->IsShow())
{
// ¼¼Äܱ༭½çÃæÖ»ÔÚ Show(true) µÄʱºò²ÅÄܸüÐÂ
m_pDlgSkillEdit->Show(false);
}*/
}
private void OnMessageBox(MessageBoxEvent messageBoxEvent)
{
File diff suppressed because one or more lines are too long