fix UI DlgInstall.prefab and DlgUninstall.prefab

This commit is contained in:
VuNgocHaiC7
2026-02-04 14:00:31 +07:00
parent 7fdce58713
commit ca4e403513
3 changed files with 118 additions and 101 deletions
@@ -38,7 +38,7 @@ namespace BrewMonster
[Header("Buttons and Money")]
[SerializeField] private TextMeshProUGUI m_TxtMoney;
[SerializeField] private Button m_BtnMerge;
[SerializeField] private Button m_BtnMergeOrReset;
[SerializeField] private Button m_BtnCancel;
[SerializeField] private Sprite khung_item;
@@ -84,7 +84,7 @@ namespace BrewMonster
base.OnEnable();
//todo need to set from other class
// SetName("Win_Enchase");
m_BtnMerge.onClick.AddListener(OnClickedMerge);
m_BtnMergeOrReset.onClick.AddListener(OnClickedMergeOrReset);
m_BtnCancel.onClick.AddListener(OnClickedCancel);
m_install_price = -1;
if(m_SlotSecondlParent != null)
@@ -94,7 +94,7 @@ namespace BrewMonster
public override void OnDisable()
{
base.OnDisable();
m_BtnMerge.onClick.RemoveListener(OnClickedMerge);
m_BtnMergeOrReset.onClick.RemoveListener(OnClickedMergeOrReset);
m_BtnCancel.onClick.RemoveListener(OnClickedCancel);
}
@@ -166,6 +166,8 @@ namespace BrewMonster
private void RegisterClick(Transform target, Action<PointerEventData> callback)
{
if(target == null) return;
var trigger = target.GetComponent<EventTrigger>();
if (trigger == null)
trigger = target.gameObject.AddComponent<EventTrigger>();
@@ -261,6 +263,11 @@ namespace BrewMonster
SetInventorySlotGray(btn, true);
detailedItem.Freeze(true);
if(m_Mode == InstallMode.Disenchase)
{
CalculateUninstallPrice(detailedItem);
}
}
private void OnDropMaterial(PointerEventData eventData)
@@ -438,117 +445,126 @@ namespace BrewMonster
img.sprite = khung_item;
}
private void OnClickedMerge()
private void OnClickedMergeOrReset()
{
// PAUIDIALOG pMsgBox;
CECHostPlayer pHost = GetHostPlayer();
// 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);
return;
}
EC_IvtrItem pIvtrA = m_SelectedEquip;
if( !pIvtrA.IsEquipment() )
if (pHost != null || m_Mode == InstallMode.Enchase)
{
message = GetGameUIMan().GetStringFromTable(223);
CECUIManager.Instance.ShowMessageBox("", message);
// GetGameUIMan().MessageBox("", GetGameUIMan().GetStringFromTable(223), MB_OK,
// A3DCOLORRGBA(255, 255, 255, 160), &pMsgBox);
// pMsgBox.SetLife(3);
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_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);
return;
}
EC_IvtrItem pIvtrA = m_SelectedEquip;
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);
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)
{
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;
}
EC_IvtrItem pIvtrB = m_SelectedMaterial;
if(pIvtrB == null || !pIvtrB.IsEmbeddable() )
{
// GetGameUIMan().MessageBox("", GetGameUIMan()->GetStringFromTable(224), MB_OK,
// A3DCOLORRGBA(255, 255, 255, 160), &pMsgBox);
// pMsgBox.SetLife(3);
return;
}
EC_IvtrItem pIvtrB = m_SelectedMaterial;
if (pIvtrB == null || !pIvtrB.IsEmbeddable())
{
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( 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 )
{
// GetGameUIMan().MessageBox("", GetGameUIMan().GetStringFromTable(225), MB_OK,
// A3DCOLORRGBA(255, 255, 255, 160), &pMsgBox);
// pMsgBox.SetLife(3);
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("", message);
// GetGameUIMan().MessageBox("", GetGameUIMan().GetStringFromTable(300), MB_OK,
// A3DCOLORRGBA(255, 255, 255, 160), &pMsgBox);
// pMsgBox.SetLife(3);
return;
}
//pr
// 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());
// ClearEquipment();
// ClearStone();
pHost.GetPack(InventoryConst.IVTRTYPE_PACK).UnfreezeAllItems();
pIvtrB.GetTemplateID(), pIvtrA.GetTemplateID());
// ClearEquipment();
// ClearStone();
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));
// }
// 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
}
}
private void OnClickedCancel()
{
Show(false);
+2 -1
View File
@@ -10569,12 +10569,13 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 0785d9ccbdc425a44b6ae1f4a3afad06, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Mode: 0
m_SlotFirstParent: {fileID: 5489844476385409289}
m_TxtFirstName: {fileID: 3128721472606901163}
m_SlotSecondlParent: {fileID: 7151360590639773519}
m_TxtSecondName: {fileID: 4492084240745408081}
m_TxtMoney: {fileID: 6140428454487430115}
m_BtnMerge: {fileID: 8208092408021918524}
m_BtnMergeOrReset: {fileID: 8208092408021918524}
m_BtnCancel: {fileID: 4503836757578509720}
khung_item: {fileID: 21300000, guid: a5366f3bce011c046902e39b6bd3a077, type: 3}
itemInventoryRoot: {fileID: 7750009739432212686}
+2 -2
View File
@@ -88,7 +88,7 @@ GameObject:
- component: {fileID: 1483452548792371881}
- component: {fileID: 4189663341364179351}
m_Layer: 0
m_Name: btnMerge
m_Name: btnReset
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@@ -14402,7 +14402,7 @@ MonoBehaviour:
m_SlotSecondlParent: {fileID: 0}
m_TxtSecondName: {fileID: 0}
m_TxtMoney: {fileID: 4189875348703427985}
m_BtnMerge: {fileID: 0}
m_BtnMergeOrReset: {fileID: 4189663341364179351}
m_BtnCancel: {fileID: 5948134181014720611}
khung_item: {fileID: 21300000, guid: a5366f3bce011c046902e39b6bd3a077, type: 3}
itemInventoryRoot: {fileID: 7451395605081796144}