Merge branch 'develop' of ssh://git.pthub.vn:3222/Unity/perfect-world-unity into feature-develop

This commit is contained in:
Chomper9981
2026-02-24 10:02:19 +07:00
10 changed files with 205 additions and 212 deletions
@@ -192,7 +192,7 @@ namespace BrewMonster.Scripts
{
if (handle.IsValid())
{
Addressables.Release(handle);
Addressables.Release(handle);
}
}
@@ -20,6 +20,7 @@ namespace BrewMonster
void OnDestroy()
{
BMLogger.Log("AutoInitializer: OnDestroy called, disposing auto initializers");
foreach (var autoInitializer in _autoInitializers)
{
autoInitializer.Dispose();
@@ -73,8 +73,8 @@ namespace BrewMonster
public void ShowMessageBox(MessageBoxData messageBoxData)
{
_messageData = messageBoxData;
SetName(messageBoxData.Title);
messageText.text = messageBoxData.Message;
SetName(string.IsNullOrEmpty(messageBoxData.Title) ? "" : messageBoxData.Title);
messageText.text = string.IsNullOrEmpty(messageBoxData.Message) ? "" : messageBoxData.Message;
okButton.gameObject.SetActive(false);
_noButton.gameObject.SetActive(false);
@@ -25,19 +25,21 @@ namespace BrewMonster
Disenchase
}
[Header("Mode")]
[SerializeField] private InstallMode m_Mode = InstallMode.Enchase;
[Header("Mode")] [SerializeField] private InstallMode m_Mode = InstallMode.Enchase;
[Header("Slot First")] [SerializeField]
private Transform m_SlotFirstParent;
[Header("Slot First")]
[SerializeField] private Transform m_SlotFirstParent;
[SerializeField] private TextMeshProUGUI m_TxtFirstName;
[Header("Slot Second")]
[SerializeField] private Transform m_SlotSecondlParent;
[Header("Slot Second")] [SerializeField]
private Transform m_SlotSecondlParent;
[SerializeField] private TextMeshProUGUI m_TxtSecondName;
[Header("Buttons and Money")]
[SerializeField] private TextMeshProUGUI m_TxtMoney;
[Header("Buttons and Money")] [SerializeField]
private TextMeshProUGUI m_TxtMoney;
[SerializeField] private Button m_BtnMergeOrReset;
[SerializeField] private Button m_BtnCancel;
@@ -51,6 +53,10 @@ namespace BrewMonster
private int m_SecondInvSlot = -1;
private int m_install_price = -1;
public InstallMode GetInstallMode => m_Mode;
public EC_IvtrItem SelectedEquip => m_SelectedEquip;
public int FirstSlotIndex => m_FirstInvSlot;
public override void Awake()
{
base.Awake();
@@ -87,7 +93,7 @@ namespace BrewMonster
m_BtnMergeOrReset.onClick.AddListener(OnClickedMergeOrReset);
m_BtnCancel.onClick.AddListener(OnClickedCancel);
m_install_price = -1;
if(m_SlotSecondlParent != null)
if (m_SlotSecondlParent != null)
m_SlotSecondlParent.gameObject.SetActive(m_Mode == InstallMode.Enchase);
}
@@ -132,7 +138,8 @@ namespace BrewMonster
return null;
var field = typeof(EC_InventoryUI)
.GetField("inventoryPackButtons", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
.GetField("inventoryPackButtons",
System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
if (field == null)
return null;
@@ -143,7 +150,7 @@ namespace BrewMonster
return list[slot];
}
private void RegisterDrop(Transform target, Action<PointerEventData> callback)
{
var trigger = target.GetComponent<EventTrigger>();
@@ -156,17 +163,14 @@ namespace BrewMonster
{
eventID = EventTriggerType.Drop
};
entry.callback.AddListener((data) =>
{
callback((PointerEventData)data);
});
entry.callback.AddListener((data) => { callback((PointerEventData)data); });
trigger.triggers.Add(entry);
}
private void RegisterClick(Transform target, Action<PointerEventData> callback)
{
if(target == null) return;
if (target == null) return;
var trigger = target.GetComponent<EventTrigger>();
if (trigger == null)
@@ -176,10 +180,7 @@ namespace BrewMonster
{
eventID = EventTriggerType.PointerClick
};
entry.callback.AddListener((data) =>
{
callback((PointerEventData)data);
});
entry.callback.AddListener((data) => { callback((PointerEventData)data); });
trigger.triggers.Add(entry);
}
@@ -201,7 +202,7 @@ namespace BrewMonster
ClearMaterialSlot();
}
}
private EC_IvtrItem GetItemFromDrag(PointerEventData eventData)
{
if (eventData.pointerDrag == null)
@@ -261,15 +262,12 @@ namespace BrewMonster
SetSlotIcon(m_SlotFirstParent, detailedItem);
SetInventorySlotGray(btn, true);
detailedItem.Freeze(true);
if(m_Mode == InstallMode.Disenchase)
{
CalculateUninstallPrice(detailedItem);
}
UpdateResourceInfo();
}
private void OnDropMaterial(PointerEventData eventData)
{
if (eventData.pointerDrag == null)
@@ -306,42 +304,8 @@ namespace BrewMonster
SetSlotIcon(m_SlotSecondlParent, detailedItem);
SetInventorySlotGray(btn, true);
// GetGameUIMan().PlayItemSound(pIvtrSrc, true);
EC_IvtrStone pStone = null;
STONE_ESSENCE pEssence;
// ACHAR szText[40] = _AL("0");
//check if material is stone and show price to merge
if(m_SelectedMaterial.GetClassID() == (int)EC_IvtrEquip.EQUIP_CLASS_ID.ICID_STONE)
{
pStone = (EC_IvtrStone)m_SelectedMaterial;
pEssence = pStone.GetDBEssence();
m_TxtMoney.text = $"{pEssence.install_price}";
// a_sprintf(szText, _AL("%d"), pEssence->install_price);
// m_pTxtGold->SetText(szText);
}
// else if( 0 == stricmp(this->GetName(), "Win_Disenchase")
// && pIvtrSrc->IsEquipment() )
// {
// a_LogOutput(1, "[Dat Embed] OnItemDragDrop stricmp(this->GetName(), Win_Disenchase");
// int i, nAmount = 0, idItem;
// CECIvtrEquip *pEquip = (CECIvtrEquip *)pIvtrSrc;
//
// for( i = 0; i < pEquip->GetHoleNum(); i++ )
// {
// idItem = pEquip->GetHoleItem(i);
// if( idItem <= 0 ) continue;
//
// pStone = (CECIvtrStone *)CECIvtrItem::CreateItem(idItem, 0, 1);
// pEssence = (STONE_ESSENCE *)pStone->GetDBEssence();
// nAmount += pEssence->uninstall_price;
// delete pStone;
// }
//
// a_sprintf(szText, _AL("%d"), nAmount);
// m_pTxtGold->SetText(szText);
// }
UpdateResourceInfo();
}
private void CalculateUninstallPrice(EC_IvtrItem equipment)
@@ -455,24 +419,23 @@ namespace BrewMonster
img.sprite = khung_item;
}
private void OnClickedMergeOrReset()
{
// PAUIDIALOG pMsgBox;
CECHostPlayer pHost = GetHostPlayer();
string message = "";
if (pHost != null && m_Mode == InstallMode.Enchase)
{
// if( !m_pItema->GetDataPtr("ptr_CECIvtrItem") ) return;
string message = "";
int nMoney = m_install_price;
if (nMoney > pHost.GetMoneyAmount())
{
message = GetGameUIMan().GetStringFromTable(226);
CECUIManager.Instance.ShowMessageBox("", message);
// GetGameUIMan().GetDialog("")
// A3DCOLORRGBA(255, 255, 255, 160), &pMsgBox);
// pMsgBox->SetLife(3);
CECUIManager.Instance.ShowMessageBox(new MessageBoxData()
{
Message = message,
Dlg = this
});
return;
}
@@ -480,100 +443,104 @@ namespace BrewMonster
if (!pIvtrA.IsEquipment())
{
message = GetGameUIMan().GetStringFromTable(223);
CECUIManager.Instance.ShowMessageBox("", message);
// GetGameUIMan().MessageBox("", GetGameUIMan().GetStringFromTable(223), MB_OK,
// A3DCOLORRGBA(255, 255, 255, 160), &pMsgBox);
// pMsgBox.SetLife(3);
CECUIManager.Instance.ShowMessageBox(new MessageBoxData()
{
Message = message,
Dlg = this
});
return;
}
EC_IvtrEquip pEquipA = (EC_IvtrEquip)pIvtrA;
// a_LogOutput(1, "[Dat Embed] Send protocol here");
// if( 0 == string.CompareOrdinal(GetName(), "Win_Enchase") )
// {
if (pEquipA.GetEmptyHoleNum() <= 0)
if (m_Mode == InstallMode.Enchase)
{
message = GetGameUIMan().GetStringFromTable(224);
CECUIManager.Instance.ShowMessageBox("", message);
// GetGameUIMan().MessageBox("", GetGameUIMan()->GetStringFromTable(224), MB_OK,
// A3DCOLORRGBA(255, 255, 255, 160), &pMsgBox);
// pMsgBox.SetLife(3);
return;
}
if (pEquipA.GetEmptyHoleNum() <= 0)
{
message = GetGameUIMan().GetStringFromTable(224);
CECUIManager.Instance.ShowMessageBox(new MessageBoxData()
{
Message = message,
Dlg = this
});
return;
}
EC_IvtrItem pIvtrB = m_SelectedMaterial;
if (pIvtrB == null || !pIvtrB.IsEmbeddable())
EC_IvtrItem pIvtrB = m_SelectedMaterial;
if (pIvtrB == null || !pIvtrB.IsEmbeddable())
{
message = GetGameUIMan().GetStringFromTable(225);
CECUIManager.Instance.ShowMessageBox(new MessageBoxData()
{
Message = message,
Dlg = this
});
return;
}
if (pIvtrB.GetClassID() != (int)EC_IvtrEquip.EQUIP_CLASS_ID.ICID_STONE)
return;
int nStoneLevel = ((EC_IvtrStone)pIvtrB).GetDBEssence().level;
int nEquipLevel = -1;
switch (pEquipA.GetClassID())
{
case (int)EC_IvtrEquip.EQUIP_CLASS_ID.ICID_WEAPON:
nEquipLevel = ((CECIvtrWeapon)pEquipA).GetDBEssence().level;
break;
case (int)EC_IvtrEquip.EQUIP_CLASS_ID.ICID_ARMOR:
nEquipLevel = ((EC_IvtrArmor)pEquipA).GetDBEssence().level;
break;
case (int)EC_IvtrEquip.EQUIP_CLASS_ID.ICID_DECORATION:
nEquipLevel = ((EC_IvtrDecoration)pEquipA).GetDBEssence().level;
break;
}
if (nStoneLevel > nEquipLevel)
{
message = GetGameUIMan().GetStringFromTable(300);
CECUIManager.Instance.ShowMessageBox(new MessageBoxData()
{
Message = message,
Dlg = this
});
return;
}
//pr
UnityGameSession.c2s_CmdNPCSevEmbed(
(ushort)m_SecondInvSlot, (ushort)m_FirstInvSlot,
pIvtrB.GetTemplateID(), pIvtrA.GetTemplateID());
pHost.GetPack(InventoryConst.IVTRTYPE_PACK).UnfreezeAllItems();
message = GetGameUIMan().GetStringFromTable(228);
CECUIManager.Instance.ShowMessageBox(new MessageBoxData()
{
Message = message,
Dlg = this
});
}
else if (m_Mode == InstallMode.Disenchase)
{
message = GetGameUIMan().GetStringFromTable(225);
CECUIManager.Instance.ShowMessageBox("", message);
// GetGameUIMan().MessageBox("", GetGameUIMan().GetStringFromTable(225), MB_OK,
// A3DCOLORRGBA(255, 255, 255, 160), &pMsgBox);
// pMsgBox.SetLife(3);
return;
if (pEquipA.GetEmptyHoleNum() == pEquipA.GetHoleNum())
{
message = GetGameUIMan().GetStringFromTable(227);
CECUIManager.Instance.ShowMessageBox(new MessageBoxData()
{
Message = message,
Dlg = this
});
return;
}
message = GetGameUIMan().GetStringFromTable(229);
var x = new MessageBoxData()
{
Message = message,
Dlg = this,
MessageBoxType = MessageBoxType.BothYesNoButton
};
CECUIManager.Instance.ShowMessageBox(x);
}
if (pIvtrB.GetClassID() != (int)EC_IvtrEquip.EQUIP_CLASS_ID.ICID_STONE)
return;
int nStoneLevel = ((EC_IvtrStone)pIvtrB).GetDBEssence().level;
int nEquipLevel = -1;
switch (pEquipA.GetClassID())
{
case (int)EC_IvtrEquip.EQUIP_CLASS_ID.ICID_WEAPON:
nEquipLevel = ((CECIvtrWeapon)pEquipA).GetDBEssence().level;
break;
case (int)EC_IvtrEquip.EQUIP_CLASS_ID.ICID_ARMOR:
nEquipLevel = ((EC_IvtrArmor)pEquipA).GetDBEssence().level;
break;
case (int)EC_IvtrEquip.EQUIP_CLASS_ID.ICID_DECORATION:
nEquipLevel = ((EC_IvtrDecoration)pEquipA).GetDBEssence().level;
break;
}
if (nStoneLevel > nEquipLevel)
{
message = GetGameUIMan().GetStringFromTable(300);
CECUIManager.Instance.ShowMessageBox("", message);
// GetGameUIMan().MessageBox("", GetGameUIMan().GetStringFromTable(300), MB_OK,
// A3DCOLORRGBA(255, 255, 255, 160), &pMsgBox);
// pMsgBox.SetLife(3);
return;
}
//pr
UnityGameSession.c2s_CmdNPCSevEmbed(
(ushort)m_SecondInvSlot, (ushort)m_FirstInvSlot,
pIvtrB.GetTemplateID(), pIvtrA.GetTemplateID());
ClearEquipSlot();
ClearMaterialSlot();
pHost.GetPack(InventoryConst.IVTRTYPE_PACK).UnfreezeAllItems();
message = GetGameUIMan().GetStringFromTable(228);
CECUIManager.Instance.ShowMessageBox("", message);
// GetGameUIMan().MessageBox("", GetGameUIMan().GetStringFromTable(228),
// MB_OK, A3DCOLORRGBA(255, 255, 255, 160), &pMsgBox);
// pMsgBox.SetLife(3);
// }
// else if( 0 == stricmp(GetName(), "Win_Disenchase") )
// {
// a_LogOutput(1, "[Dat Embed] Win_Disenchase");
// if( pEquipA->GetEmptyHoleNum() == pEquipA->GetHoleNum() )
// {
// GetGameUIMan()->MessageBox("", GetGameUIMan()->GetStringFromTable(227), MB_OK,
// A3DCOLORRGBA(255, 255, 255, 160), &pMsgBox);
// pMsgBox->SetLife(3);
// return;
// }
// GetGameUIMan()->MessageBox("Game_Disenchase", GetGameUIMan()->GetStringFromTable(229),
// MB_OKCANCEL, A3DCOLORRGBA(255, 255, 255, 160));
// }
}
else if (pHost != null || m_Mode == InstallMode.Disenchase)
{
// TODO: implement uninstall logicq
}
}
@@ -609,12 +576,59 @@ namespace BrewMonster
private void CheckHidePanel(Vector2 screenPos)
{
if (!RectTransformUtility.RectangleContainsScreenPoint(
itemInventoryRoot as RectTransform, screenPos,
Camera.main))
itemInventoryRoot as RectTransform, screenPos,
Camera.main))
{
if(itemInventoryRoot!=null)
if (itemInventoryRoot != null)
itemInventoryRoot.gameObject.SetActive(false);
}
}
private void UpdateResourceInfo()
{
// GetGameUIMan().PlayItemSound(pIvtrSrc, true);
EC_IvtrStone stone;
STONE_ESSENCE pEssence;
// ACHAR szText[40] = _AL("0");
//check if material is stone and show price to merge
if (m_Mode == InstallMode.Enchase)
{
if (m_SelectedMaterial != null)
{
stone = (EC_IvtrStone)m_SelectedMaterial;
pEssence = stone.GetDBEssence();
m_TxtMoney.text = $"{pEssence.install_price}";
// a_sprintf(szText, _AL("%d"), pEssence->install_price);
// m_pTxtGold->SetText(szText);
}
else
{
m_TxtMoney.text = $"{0}";
}
}
else if (m_Mode == InstallMode.Disenchase)
{
int i, nAmount = 0, idItem;
if (m_SelectedEquip is EC_IvtrEquip pEquip)
{
for (i = 0; i < pEquip.GetHoleNum(); i++)
{
idItem = pEquip.GetHoleItem(i);
if (idItem <= 0) continue;
stone = (EC_IvtrStone)EC_IvtrItem.CreateItem(idItem, 0, 1);
pEssence = stone.GetDBEssence();
nAmount += pEssence.uninstall_price;
}
m_TxtMoney.text = $"{nAmount}";
}
else
{
m_TxtMoney.text = $"{0}";
}
}
}
}
}
@@ -54,7 +54,11 @@ namespace BrewMonster
player.GetCurSkill() != null ||
player.IsFighting())
{
uiManager.ShowMessageBox("MessageBox", gameUIMan.GetStringFromTable(11327));
uiManager.ShowMessageBox(new MessageBoxData()
{
Title = "MessageBox",
Message = gameUIMan.GetStringFromTable(11327)
});
}
int nCondition = CECHostSkillModel.Instance.CheckLearnCondition(m_skillID);
@@ -97,7 +101,11 @@ namespace BrewMonster
int needSp = CECHostSkillModel.Instance.GetSkillSp(m_skillID, m_curLevel + 1);
string str = GPDataTypeHelper.ReplacePercentD(GetStringFromTable(11326), needMoney, needSp);
var messagebox = uiManager.ShowMessageBox("Game_LearnSkill", str);
var messagebox = uiManager.ShowMessageBox(new MessageBoxData()
{
Title = "Game_LearnSkill",
Message = str,
});
messagebox.SetData((uint)m_skillID);
//GetGameUIMan()->MessageBox("Game_LearnSkill", str, //GetGameUIMan()->GetStringFromTable(231),
// MB_OKCANCEL, A3DCOLORRGBA(255, 255, 255, 160), &pMsgBox);
@@ -42,10 +42,10 @@ namespace BrewMonster.PerfectWorld.Scripts.Vfx
}
private void OnDestroy()
{
if(!string.IsNullOrEmpty(_vfxPath))
{
AddressableManager.Instance.ReleaseAsset(_vfxPath);
}
//if(!string.IsNullOrEmpty(_vfxPath))
//{
// AddressableManager.Instance.ReleaseAsset(_vfxPath);
//}
}
private void Update()
@@ -79,21 +79,6 @@ public class LitModelHolder : MonoSingleton<LitModelHolder>
_cts.Cancel();
_cts.Dispose();
}
if (addressableObjects == null)
{
return;
}
// go through candidate list and loaded list, unload all objects in those lists.
foreach (var kvp in _candidatesForLoading)
{
kvp.Key.UnloadAsset();
}
foreach (var obj in _loadedObjects)
{
obj.UnloadAsset();
}
}
#endregion
-5
View File
@@ -107,11 +107,6 @@ public partial class CECGameRun
private static void Dispose()
{
instance = null;
AddressableManager.Instance.ReleaseAsset(AddressResourceConfig.PlayerPrefab);
AddressableManager.Instance.ReleaseAsset(AddressResourceConfig.MonsterPrefab);
AddressableManager.Instance.ReleaseAsset(AddressResourceConfig.NpcServerPrefab);
//AddressableManager.Instance.ReleaseAsset(AddressResourceConfig.PetServerPrefab);
//AddressableManager.Instance.ReleaseAsset(AddressResourceConfig.PetMountServerPrefab);
}
private void LoadPrefabs()
+13 -23
View File
@@ -146,17 +146,12 @@ public class CECUIManager : MonoSingleton<CECUIManager>
Debug.LogWarning($"Không tìm thấy UI {componentName} đã spawn trong canvasDlg. Type found: {(type != null ? type.FullName : "null")}");
}
public CDlgMessageBox ShowMessageBox(string title, string message)
public CDlgMessageBox ShowMessageBox(MessageBoxData messageBoxData)
{
var msgBox = GetInGameUIMan().GetDialog("DlgMessageBox") as CDlgMessageBox;
if (msgBox != null)
{
msgBox.ShowMessageBox(new MessageBoxData()
{
Title = title,
Message = message,
MessageBoxType = MessageBoxType.YesButton
});
msgBox.ShowMessageBox(messageBoxData);
return msgBox;
}
else
@@ -299,24 +294,19 @@ public class CECUIManager : MonoSingleton<CECUIManager>
}
}
else if(string.CompareOrdinal("Game_Disenchase",pDlg.GetName())==0 && DialogBoxCommandIDs.IDOK == iRetVal)
{
// PAUIDIALOG pMsgBox;
var clearEmbeddedChipDlg = GetInGameUIMan().GetDialog("Game_Disenchase");
// EC_IvtrItem pIvtr = (EC_IvtrItem)m_pDlgUninstall->m_pItema->GetDataPtr("ptr_CECIvtrItem");
//
// pSession.c2s_CmdNPCSevClearEmbeddedChip(
// (WORD)m_pDlgUninstall->m_pItema->GetData(), pIvtr->GetTemplateID());
//
// m_pDlgUninstall->Show(false);
// pHost->EndNPCService();
else if (pDlg is DlgInstall dlgInstall && dlgInstall.GetInstallMode == DlgInstall.InstallMode.Disenchase && DialogBoxCommandIDs.IDOK == iRetVal)
{
UnityGameSession.c2s_CmdNPCSevClearEmbeddedChip(dlgInstall.FirstSlotIndex, dlgInstall.SelectedEquip.GetTemplateID());
dlgInstall.Show(false);
pHost.EndNPCService();
// m_pCurNPCEssence = NULL;
// m_pDlgInventory->Show(false);
// pHost->GetPack(IVTRTYPE_PACK)->UnfreezeAllItems();
//
// MessageBox("", GetStringFromTable(228), MB_OK,
// A3DCOLORRGBA(255, 255, 255, 160), &pMsgBox);
// pMsgBox->SetLife(3);
pHost.GetPack((int)InventoryType.IVTRTYPE_PACK).UnfreezeAllItems();
ShowMessageBox(new MessageBoxData()
{
Message = pDlg.GetStringFromTable(228)
});
}
}
+1 -1
View File
@@ -802,7 +802,7 @@ PlayerSettings:
PS4: DOTWEEN
PS5: DOTWEEN
QNX: DOTWEEN
Standalone: DOTWEEN;TESTFAST;_TASK_CLIENT
Standalone: DOTWEEN;_TASK_CLIENT
VisionOS: DOTWEEN
WebGL: DOTWEEN
Windows Store Apps: DOTWEEN