finished refactor message box
This commit is contained in:
@@ -620,7 +620,7 @@ GameObject:
|
||||
- component: {fileID: 8250962023850685786}
|
||||
- component: {fileID: 7766051278568089760}
|
||||
m_Layer: 5
|
||||
m_Name: ButtonOk
|
||||
m_Name: ButtonYes
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
@@ -927,7 +927,7 @@ MonoBehaviour:
|
||||
imageProgress: {fileID: 0}
|
||||
titleText: {fileID: 5031655611580643013}
|
||||
messageText: {fileID: 7448521238108099750}
|
||||
okButton: {fileID: 7766051278568089760}
|
||||
_yesButton: {fileID: 7766051278568089760}
|
||||
_noButton: {fileID: 7010901635634620631}
|
||||
_closeButton: {fileID: 482550456836939169}
|
||||
--- !u!1 &5664175764923475105
|
||||
|
||||
@@ -1349,11 +1349,12 @@ namespace BrewMonster.Scripts
|
||||
string message = $"Cannot find path to target position.\nPlease move manually to target location.\n\nMap Coordinates: ({mapX}, {mapZ}, ↑{mapY})";
|
||||
string messageCN = $"无法找到到目标位置的路径。\n请手动移动到目标位置。\n\n地图坐标: ({mapX}, {mapZ}, ↑{mapY})";
|
||||
|
||||
CECUIManager.Instance.ShowMessageBox(
|
||||
"Path Not Found", // 路径未找到
|
||||
message, // English message with map coordinates
|
||||
BrewMonster.MessageBoxType.YesButton
|
||||
);
|
||||
// CECUIManager.Instance.ShowMessageBox(
|
||||
// "Path Not Found", // 路径未找到
|
||||
// message, // English message with map coordinates
|
||||
// BrewMonster.MessageBoxType.YesButton
|
||||
// );
|
||||
CECUIManager.Instance.ShowMessageBoxYes("Path Not Found", message, null, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -709,16 +709,13 @@ namespace BrewMonster.Network
|
||||
}
|
||||
|
||||
// Show disconnect message box
|
||||
CECUIManager.Instance?.ShowMessageBox(
|
||||
title: "Disconnected",
|
||||
message: "Connection to the server has been lost.",
|
||||
messageBoxType: MessageBoxType.YesButton,
|
||||
onClickedYes: () =>
|
||||
CECUIManager.Instance?.ShowMessageBoxYes("Disconnected", "Connection to the server has been lost.", null,
|
||||
() =>
|
||||
{
|
||||
// Return to login screen
|
||||
LogoutAccount();
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public static void c2s_CmdGoto(float x, float y, float z)
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
using System;
|
||||
using System;
|
||||
using BrewMonster.UI;
|
||||
using PerfectWorld.Scripts.Common;
|
||||
using UnityEngine;
|
||||
using TMPro;
|
||||
using UnityEngine.Serialization;
|
||||
using UnityEngine.UI;
|
||||
using static CECUIManager;
|
||||
|
||||
@@ -27,16 +28,19 @@ namespace BrewMonster
|
||||
{
|
||||
[SerializeField] private TMP_Text titleText;
|
||||
[SerializeField] private TMP_Text messageText;
|
||||
[SerializeField] private Button okButton;
|
||||
[SerializeField] private Button _yesButton;
|
||||
[SerializeField] private Button _noButton;
|
||||
[SerializeField] private Button _closeButton;
|
||||
|
||||
private Action _onClickedYesBtn;
|
||||
private Action _onClickedNoBtn;
|
||||
|
||||
private MessageBoxData _messageData;
|
||||
|
||||
public override void OnEnable()
|
||||
{
|
||||
base.OnEnable();
|
||||
okButton.onClick.AddListener(OnOkClicked);
|
||||
_yesButton.onClick.AddListener(OnYesClicked);
|
||||
_noButton.onClick.AddListener(OnNoClicked);
|
||||
_closeButton.onClick.AddListener(OnCloseClicked);
|
||||
|
||||
@@ -44,59 +48,135 @@ namespace BrewMonster
|
||||
|
||||
public override void OnDisable()
|
||||
{
|
||||
okButton.onClick.RemoveListener(OnOkClicked);
|
||||
_yesButton.onClick.RemoveListener(OnYesClicked);
|
||||
_noButton.onClick.RemoveListener(OnNoClicked);
|
||||
_closeButton.onClick.RemoveListener(OnCloseClicked);
|
||||
}
|
||||
|
||||
#region Button Events
|
||||
private void OnOkClicked()
|
||||
private void OnYesClicked()
|
||||
{
|
||||
EventBus.Publish(new MessageBoxEvent(1,_messageData.Dlg));
|
||||
_messageData.OnClickedYes?.Invoke();
|
||||
_onClickedYesBtn?.Invoke();
|
||||
Show(false);
|
||||
}
|
||||
private void OnNoClicked()
|
||||
{
|
||||
EventBus.Publish(new MessageBoxEvent(0,_messageData.Dlg));
|
||||
_messageData.OnClickedNo?.Invoke();
|
||||
_onClickedNoBtn?.Invoke();
|
||||
Show(false);
|
||||
}
|
||||
|
||||
private void OnCloseClicked()
|
||||
{
|
||||
// treat the close button as OK button
|
||||
OnOkClicked();
|
||||
OnYesClicked();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public void ShowMessageBox(MessageBoxData messageBoxData)
|
||||
// public void ShowMessageBox(MessageBoxData messageBoxData)
|
||||
// {
|
||||
// _messageData = messageBoxData;
|
||||
// messageBoxData.Message = EC_TextFormatter.FormatForTextMeshPro(messageBoxData.Message);
|
||||
// SetName(string.IsNullOrEmpty(messageBoxData.Title) ? "" : messageBoxData.Title);
|
||||
// messageText.text = string.IsNullOrEmpty(messageBoxData.Message) ? "" : messageBoxData.Message;
|
||||
//
|
||||
// _yesButton.gameObject.SetActive(false);
|
||||
// _noButton.gameObject.SetActive(false);
|
||||
// switch (_messageData.MessageBoxType)
|
||||
// {
|
||||
// case MessageBoxType.YesButton:
|
||||
// _yesButton.gameObject.SetActive(true);
|
||||
// break;
|
||||
// case MessageBoxType.NoButton:
|
||||
// _noButton.gameObject.SetActive(true);
|
||||
// break;
|
||||
// case MessageBoxType.BothYesNoButton:
|
||||
// _yesButton.gameObject.SetActive(true);
|
||||
// _noButton.gameObject.SetActive(true);
|
||||
// break;
|
||||
// }
|
||||
// Show(true);
|
||||
// }
|
||||
|
||||
/// <summary>
|
||||
/// message with title and message only
|
||||
/// </summary>
|
||||
/// <param name="title"></param>
|
||||
/// <param name="message"></param>
|
||||
/// <param name="dlg"></param>
|
||||
public void ShowMessageBoxGeneral(string title, string message, AUIDialog dlg)
|
||||
{
|
||||
_messageData = messageBoxData;
|
||||
// messageBoxData.Message = messageBoxData.Message?
|
||||
// .Replace("\r\n", "\n")
|
||||
// .Replace("\r", "\n");
|
||||
messageBoxData.Message = EC_TextFormatter.FormatForTextMeshPro(messageBoxData.Message);
|
||||
SetName(string.IsNullOrEmpty(messageBoxData.Title) ? "" : messageBoxData.Title);
|
||||
messageText.text = string.IsNullOrEmpty(messageBoxData.Message) ? "" : messageBoxData.Message;
|
||||
|
||||
okButton.gameObject.SetActive(false);
|
||||
_onClickedYesBtn = null;
|
||||
_onClickedYesBtn = null;
|
||||
string formattedMessage = EC_TextFormatter.FormatForTextMeshPro(message);
|
||||
SetName(string.IsNullOrEmpty(title) ? "" : title);
|
||||
messageText.text = string.IsNullOrEmpty(formattedMessage) ? "" : formattedMessage;
|
||||
_noButton.gameObject.SetActive(false);
|
||||
switch (_messageData.MessageBoxType)
|
||||
{
|
||||
case MessageBoxType.YesButton:
|
||||
okButton.gameObject.SetActive(true);
|
||||
break;
|
||||
case MessageBoxType.NoButton:
|
||||
_noButton.gameObject.SetActive(true);
|
||||
break;
|
||||
case MessageBoxType.BothYesNoButton:
|
||||
okButton.gameObject.SetActive(true);
|
||||
_noButton.gameObject.SetActive(true);
|
||||
break;
|
||||
}
|
||||
_yesButton.gameObject.SetActive(true);
|
||||
Show(true);
|
||||
transform.SetAsLastSibling();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// message with yes button only
|
||||
/// </summary>
|
||||
/// <param name="title"></param>
|
||||
/// <param name="message"></param>
|
||||
/// <param name="dlg"></param>
|
||||
/// <param name="onClickedYes"></param>
|
||||
public void ShowMessageBoxYes(string title, string message, AUIDialog dlg, Action onClickedYes)
|
||||
{
|
||||
_onClickedYesBtn = onClickedYes;
|
||||
string formattedMessage = EC_TextFormatter.FormatForTextMeshPro(message);
|
||||
SetName(string.IsNullOrEmpty(title) ? "" : title);
|
||||
messageText.text = string.IsNullOrEmpty(formattedMessage) ? "" : formattedMessage;
|
||||
_noButton.gameObject.SetActive(false);
|
||||
_yesButton.gameObject.SetActive(true);
|
||||
Show(true);
|
||||
transform.SetAsLastSibling();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// message with no button only
|
||||
/// </summary>
|
||||
/// <param name="title"></param>
|
||||
/// <param name="message"></param>
|
||||
/// <param name="dlg"></param>
|
||||
/// <param name="onClickedNo"></param>
|
||||
public void ShowMessageBoxNo(string title, string message, AUIDialog dlg, Action onClickedNo)
|
||||
{
|
||||
_onClickedNoBtn = onClickedNo;
|
||||
string formattedMessage = EC_TextFormatter.FormatForTextMeshPro(message);
|
||||
SetName(string.IsNullOrEmpty(title) ? "" : title);
|
||||
messageText.text = string.IsNullOrEmpty(formattedMessage) ? "" : formattedMessage;
|
||||
_yesButton.gameObject.SetActive(false);
|
||||
_noButton.gameObject.SetActive(true);
|
||||
Show(true);
|
||||
transform.SetAsLastSibling();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// message with yes and no button
|
||||
/// </summary>
|
||||
/// <param name="title"></param>
|
||||
/// <param name="message"></param>
|
||||
/// <param name="dlg"></param>
|
||||
/// <param name="onClickedYes"></param>
|
||||
/// <param name="onClickedNo"></param>
|
||||
public void ShowMessageBoxYesAndNo(string title, string message, AUIDialog dlg, Action onClickedYes, Action onClickedNo)
|
||||
{
|
||||
_onClickedYesBtn = onClickedYes;
|
||||
_onClickedNoBtn = onClickedNo;
|
||||
string formattedMessage = EC_TextFormatter.FormatForTextMeshPro(message);
|
||||
SetName(string.IsNullOrEmpty(title) ? "" : title);
|
||||
messageText.text = string.IsNullOrEmpty(formattedMessage) ? "" : formattedMessage;
|
||||
_yesButton.gameObject.SetActive(true);
|
||||
_noButton.gameObject.SetActive(true);
|
||||
Show(true);
|
||||
transform.SetAsLastSibling();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -431,11 +431,7 @@ namespace BrewMonster
|
||||
if (nMoney > pHost.GetMoneyAmount())
|
||||
{
|
||||
message = GetGameUIMan().GetStringFromTable(226);
|
||||
CECUIManager.Instance.ShowMessageBox(new MessageBoxData()
|
||||
{
|
||||
Message = message,
|
||||
Dlg = this
|
||||
});
|
||||
CECUIManager.Instance.ShowMessageBoxGeneral("", message, this);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -443,11 +439,7 @@ namespace BrewMonster
|
||||
if (!pIvtrA.IsEquipment())
|
||||
{
|
||||
message = GetGameUIMan().GetStringFromTable(223);
|
||||
CECUIManager.Instance.ShowMessageBox(new MessageBoxData()
|
||||
{
|
||||
Message = message,
|
||||
Dlg = this
|
||||
});
|
||||
CECUIManager.Instance.ShowMessageBoxGeneral("", message, this);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -457,11 +449,7 @@ namespace BrewMonster
|
||||
if (pEquipA.GetEmptyHoleNum() <= 0)
|
||||
{
|
||||
message = GetGameUIMan().GetStringFromTable(224);
|
||||
CECUIManager.Instance.ShowMessageBox(new MessageBoxData()
|
||||
{
|
||||
Message = message,
|
||||
Dlg = this
|
||||
});
|
||||
CECUIManager.Instance.ShowMessageBoxGeneral("", message, this);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -469,11 +457,7 @@ namespace BrewMonster
|
||||
if (pIvtrB == null || !pIvtrB.IsEmbeddable())
|
||||
{
|
||||
message = GetGameUIMan().GetStringFromTable(225);
|
||||
CECUIManager.Instance.ShowMessageBox(new MessageBoxData()
|
||||
{
|
||||
Message = message,
|
||||
Dlg = this
|
||||
});
|
||||
CECUIManager.Instance.ShowMessageBoxGeneral("", message, this);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -498,11 +482,7 @@ namespace BrewMonster
|
||||
if (nStoneLevel > nEquipLevel)
|
||||
{
|
||||
message = GetGameUIMan().GetStringFromTable(300);
|
||||
CECUIManager.Instance.ShowMessageBox(new MessageBoxData()
|
||||
{
|
||||
Message = message,
|
||||
Dlg = this
|
||||
});
|
||||
CECUIManager.Instance.ShowMessageBoxGeneral("", message, this);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -515,46 +495,28 @@ namespace BrewMonster
|
||||
pHost.GetPack(InventoryConst.IVTRTYPE_PACK).UnfreezeAllItems();
|
||||
|
||||
message = GetGameUIMan().GetStringFromTable(228);
|
||||
CECUIManager.Instance.ShowMessageBox(new MessageBoxData()
|
||||
{
|
||||
Message = message,
|
||||
Dlg = this
|
||||
});
|
||||
CECUIManager.Instance.ShowMessageBoxGeneral("", message, this);
|
||||
}
|
||||
else if (pHost != null && m_Mode == InstallMode.Disenchase)
|
||||
{
|
||||
if (pEquipA.GetEmptyHoleNum() == pEquipA.GetHoleNum())
|
||||
{
|
||||
message = GetGameUIMan().GetStringFromTable(227);
|
||||
CECUIManager.Instance.ShowMessageBox(new MessageBoxData()
|
||||
{
|
||||
Message = message,
|
||||
Dlg = this
|
||||
});
|
||||
CECUIManager.Instance.ShowMessageBoxGeneral("", message, this);
|
||||
return;
|
||||
}
|
||||
|
||||
message = GetGameUIMan().GetStringFromTable(229);
|
||||
var x = new MessageBoxData()
|
||||
CECUIManager.Instance.ShowMessageBoxYesAndNo("", message, this,
|
||||
() =>
|
||||
{
|
||||
Message = message,
|
||||
Dlg = this,
|
||||
MessageBoxType = MessageBoxType.BothYesNoButton,
|
||||
OnClickedYes = () =>
|
||||
{
|
||||
UnityGameSession.c2s_CmdNPCSevClearEmbeddedChip((ushort)m_FirstInvSlot, pIvtrA.GetTemplateID());
|
||||
ClearEquiment();
|
||||
pHost.GetPack(InventoryConst.IVTRTYPE_PACK).UnfreezeAllItems();
|
||||
UnityGameSession.c2s_CmdNPCSevClearEmbeddedChip((ushort)m_FirstInvSlot, pIvtrA.GetTemplateID());
|
||||
ClearEquiment();
|
||||
pHost.GetPack(InventoryConst.IVTRTYPE_PACK).UnfreezeAllItems();
|
||||
|
||||
string successMessage = GetGameUIMan().GetStringFromTable(230);
|
||||
CECUIManager.Instance.ShowMessageBox(new MessageBoxData()
|
||||
{
|
||||
Message = successMessage,
|
||||
Dlg = this
|
||||
});
|
||||
}
|
||||
};
|
||||
CECUIManager.Instance.ShowMessageBox(x);
|
||||
string successMessage = GetGameUIMan().GetStringFromTable(230);
|
||||
CECUIManager.Instance.ShowMessageBoxGeneral("", message, this);
|
||||
}, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -137,7 +137,7 @@ namespace BrewMonster.UI
|
||||
CDLGNPC_CARDRESPAWN = 0xFFFFF49, // ¿¨ÅÆ×ªÉú
|
||||
CDLGNPC_QUERYCHARIOTAMOUNT = 0xFFFFF50, // Õ½³µÊýÁ¿
|
||||
CDLGNPC_FLYSWORDIMPROVE = 0xFFFFF51, // ·É½£Ç¿»¯
|
||||
CDLGNPC_OPEN_FACTION_PVP = 0xFFFFF52, // ¿ªÆô°ïÅÉÂÓ¶á
|
||||
CDLGNPC_OPEN_FACTION_PVP = 0xFFFFF52, // ¿ªÆô°ïÅÉÂÓ¶á
|
||||
CDLGNPC_FACTION_RENAME = 0xFFFFF53,
|
||||
CDLGNPC_GOLD_SHOP = 0xFFFFF54,
|
||||
CDLGNPC_PLAYER_CHANGE_GENDER = 0xFFFFF55; // ÐÞ¸ÄÐÔ±ð
|
||||
@@ -765,10 +765,10 @@ namespace BrewMonster.UI
|
||||
NPC_MAKE_SERVICE pService = (NPC_MAKE_SERVICE)pData;
|
||||
string serviceName = Encoding.Unicode.GetString(MemoryMarshal.AsBytes<ushort>(pService.name));
|
||||
m_pLst_Main.AddString(strText + serviceName);
|
||||
|
||||
|
||||
// Log NPC_MAKE_SERVICE data
|
||||
BMLogger.Log($"NPC_MAKE_SERVICE detected - ServiceID: {a_uiService[i]}, MakeServiceID: {pService.id}, Name: {serviceName}, MakeSkillID: {pService.id_make_skill}, ProduceType: {pService.produce_type}");
|
||||
|
||||
|
||||
// Log pages data
|
||||
if (pService.pages != null)
|
||||
{
|
||||
@@ -778,7 +778,7 @@ namespace BrewMonster.UI
|
||||
string pageTitle = Encoding.Unicode.GetString(MemoryMarshal.AsBytes<ushort>(page.page_title));
|
||||
// Trim null characters and whitespace from page title
|
||||
pageTitle = pageTitle?.TrimEnd('\0', ' ', '\t', '\r', '\n') ?? "";
|
||||
|
||||
|
||||
// Collect all non-zero goods IDs with their names
|
||||
// Note: id_goods contains RECIPE IDs, not item IDs
|
||||
List<string> goodsInfo = new List<string>();
|
||||
@@ -804,7 +804,7 @@ namespace BrewMonster.UI
|
||||
// Try recipe space first
|
||||
DATA_TYPE dt = DATA_TYPE.DT_INVALID;
|
||||
object recipeData = edm.get_data_ptr(recipeId, ID_SPACE.ID_SPACE_RECIPE, ref dt);
|
||||
|
||||
|
||||
// Check if we got recipe data - sometimes dt is DT_INVALID but data is still RECIPE_ESSENCE
|
||||
RECIPE_ESSENCE? recipe = null;
|
||||
if (recipeData != null && recipeData is RECIPE_ESSENCE)
|
||||
@@ -815,11 +815,11 @@ namespace BrewMonster.UI
|
||||
{
|
||||
recipe = (RECIPE_ESSENCE)recipeData;
|
||||
}
|
||||
|
||||
|
||||
if (recipe.HasValue)
|
||||
{
|
||||
RECIPE_ESSENCE recipeValue = recipe.Value;
|
||||
|
||||
|
||||
// Get output item from first target (main output)
|
||||
if (recipeValue.targets != null && recipeValue.targets.Length > 0)
|
||||
{
|
||||
@@ -853,7 +853,7 @@ namespace BrewMonster.UI
|
||||
{
|
||||
BMLogger.LogWarning($" Recipe {recipeId}: targets is null or empty");
|
||||
}
|
||||
|
||||
|
||||
// Get all materials
|
||||
if (recipeValue.materials != null)
|
||||
{
|
||||
@@ -875,7 +875,7 @@ namespace BrewMonster.UI
|
||||
{
|
||||
materialName = $"error: {ex2.Message}";
|
||||
}
|
||||
|
||||
|
||||
string matEntry = !string.IsNullOrEmpty(materialName)
|
||||
? $"{material.id} ({materialName}) x{material.num}"
|
||||
: $"{material.id} (unknown) x{material.num}";
|
||||
@@ -894,7 +894,7 @@ namespace BrewMonster.UI
|
||||
{
|
||||
BMLogger.LogWarning($" Failed to get data for recipe ID {recipeId}: {ex.Message}\n{ex.StackTrace}");
|
||||
}
|
||||
|
||||
|
||||
// Format: "RecipeID -> Output: ID (Name) | Materials: ID (Name) xCount, ..."
|
||||
string goodsEntry = $"Recipe {recipeId}";
|
||||
if (!string.IsNullOrEmpty(outputItemInfo))
|
||||
@@ -917,7 +917,7 @@ namespace BrewMonster.UI
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Log page if it has a title or has goods
|
||||
if (!string.IsNullOrEmpty(pageTitle) || goodsInfo.Count > 0)
|
||||
{
|
||||
@@ -931,22 +931,22 @@ namespace BrewMonster.UI
|
||||
{
|
||||
NPC_DECOMPOSE_SERVICE pService = (NPC_DECOMPOSE_SERVICE)pData;
|
||||
string serviceName = Encoding.Unicode.GetString(MemoryMarshal.AsBytes<ushort>(pService.name));
|
||||
|
||||
|
||||
// Log NPC_DECOMPOSE_SERVICE data
|
||||
BMLogger.Log($"NPC_DECOMPOSE_SERVICE detected - ServiceID: {a_uiService[i]}, DecomposeServiceID: {pService.id}, Name: {serviceName}, DecomposeSkillID: {pService.id_decompose_skill}");
|
||||
|
||||
|
||||
CECHostPlayer hostPlayer = GetHostPlayer();
|
||||
bool hasRequiredSkill = false;
|
||||
|
||||
|
||||
// TODO: Implement proper skill check when GetPassiveSkillNum() and GetPassiveSkillByIndex() are available
|
||||
// For now, we'll use reflection to access private GetPassiveSkillByID method or implement a workaround
|
||||
// The C++ code checks if player has the required decompose skill (TYPE_LIVE or TYPE_PRODUCE)
|
||||
try
|
||||
{
|
||||
// Try using reflection to access private GetPassiveSkillByID method
|
||||
var method = typeof(CECHostPlayer).GetMethod("GetPassiveSkillByID",
|
||||
var method = typeof(CECHostPlayer).GetMethod("GetPassiveSkillByID",
|
||||
System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
|
||||
|
||||
|
||||
if (method != null)
|
||||
{
|
||||
var pSkill = method.Invoke(hostPlayer, new object[] { (int)pService.id_decompose_skill, false }) as CECSkill;
|
||||
@@ -954,9 +954,9 @@ namespace BrewMonster.UI
|
||||
{
|
||||
int skillType = pSkill.GetType();
|
||||
int skillID = pSkill.GetSkillID();
|
||||
|
||||
|
||||
BMLogger.Log($" Found skill by ID (via reflection): ID={skillID}, Type={skillType}");
|
||||
|
||||
|
||||
// Check if this is the required decompose skill with correct type
|
||||
if ((skillType == (int)CECSkill.SkillType.TYPE_LIVE ||
|
||||
skillType == (int)CECSkill.SkillType.TYPE_PRODUCE) &&
|
||||
@@ -999,7 +999,7 @@ namespace BrewMonster.UI
|
||||
m_pLst_Main.SetItemData(m_pLst_Main.GetCount() - 1, a_uiService[i]);
|
||||
m_pLst_Main.SetItemDataPtr(m_pLst_Main.GetCount() - 1, pData);
|
||||
}
|
||||
|
||||
|
||||
if (!hasRequiredSkill)
|
||||
continue;
|
||||
}
|
||||
@@ -1134,7 +1134,7 @@ namespace BrewMonster.UI
|
||||
// m_pLst_Main.AddString(strText + GetStringFromTable(699));
|
||||
// m_pLst_Main.SetItemData(m_pLst_Main.GetCount() - 1, CDLGNPC_BATTLECHALLENGE);
|
||||
// }
|
||||
// // if( gtime.tm_wday == 5 && gtime.tm_hour >= 18 ||
|
||||
// // if( gtime.tm_wday == 5 && gtime.tm_hour >= 18 ||
|
||||
// // gtime.tm_wday == 6 ||
|
||||
// // gtime.tm_wday == 0 )
|
||||
// if (GetHostPlayer().GetFRoleID() != GNETRoles._R_UNMEMBER)
|
||||
@@ -1647,7 +1647,7 @@ namespace BrewMonster.UI
|
||||
SetDataPtr(pTalk, "ptr_talk_proc");
|
||||
if (!IsShow()) Show(true);
|
||||
}
|
||||
|
||||
|
||||
// bool c(int idFunction, int iService, object pData)
|
||||
// {
|
||||
// AUIDialog pShow1 = null, pShow2 = null;
|
||||
@@ -1687,7 +1687,7 @@ namespace BrewMonster.UI
|
||||
// {
|
||||
// shopManager.OpenNPCShop(npcID);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else if (idFunction == (int)SERVICE_TYPE.NPC_INSTALL)
|
||||
// {
|
||||
@@ -1994,7 +1994,7 @@ namespace BrewMonster.UI
|
||||
//
|
||||
// return true;
|
||||
// }
|
||||
|
||||
|
||||
public void OnCommand_back(string szCommand)
|
||||
{
|
||||
NPC_ESSENCE? pCurNPCEssence = GetGameUIMan().m_pCurNPCEssence;
|
||||
@@ -2096,7 +2096,7 @@ namespace BrewMonster.UI
|
||||
if (id != pTalk.windows[i].id) continue;
|
||||
|
||||
// TO DO: fix later
|
||||
// TO DO: show popup with content is talk_text and 1 btn OK
|
||||
// TO DO: show popup with content is talk_text and 1 btn OK
|
||||
//GetGameUIMan().MessageBox("", pTask.FormatTaskTalk(pTalk.windows[i].talk_text),
|
||||
// MB_OK, A3DCOLORRGBA(255, 255, 255, 160));
|
||||
GetGameUIMan().EndNPCService();
|
||||
@@ -3236,21 +3236,21 @@ namespace BrewMonster.UI
|
||||
{
|
||||
NPC_MAKE_SERVICE pService = (NPC_MAKE_SERVICE)pData;
|
||||
string serviceName = Encoding.Unicode.GetString(MemoryMarshal.AsBytes<ushort>(pService.name));
|
||||
|
||||
|
||||
// Log NPC_MAKE_SERVICE data when selected
|
||||
BMLogger.Log($"SelectListItem - NPC_MAKE_SERVICE selected - ServiceID: {iService}, MakeServiceID: {pService.id}, Name: {serviceName}, MakeSkillID: {pService.id_make_skill}, ProduceType: {pService.produce_type}");
|
||||
|
||||
|
||||
idFunction = (int)SERVICE_TYPE.NPC_MAKE;
|
||||
}
|
||||
else if (DataType == DATA_TYPE.DT_NPC_DECOMPOSE_SERVICE)
|
||||
{
|
||||
NPC_DECOMPOSE_SERVICE pService = (NPC_DECOMPOSE_SERVICE)pData;
|
||||
string serviceName = Encoding.Unicode.GetString(MemoryMarshal.AsBytes<ushort>(pService.name));
|
||||
|
||||
|
||||
// Log NPC_DECOMPOSE_SERVICE data when selected
|
||||
BMLogger.Log($"SelectListItem - NPC_DECOMPOSE_SERVICE selected - ServiceID: {iService}, DecomposeServiceID: {pService.id}, Name: {serviceName}, DecomposeSkillID: {pService.id_decompose_skill}");
|
||||
BMLogger.Log($" Note: This decompose service is being treated as idFunction={SERVICE_TYPE.NPC_DECOMPOSE}");
|
||||
|
||||
|
||||
idFunction = (int)SERVICE_TYPE.NPC_DECOMPOSE;
|
||||
}
|
||||
else if (DataType == DATA_TYPE.DT_NPC_IDENTIFY_SERVICE)
|
||||
@@ -3342,7 +3342,7 @@ namespace BrewMonster.UI
|
||||
CECTaskInterface pTask;
|
||||
ad.m_ulCandItems = 0;
|
||||
opt.param = 0;
|
||||
|
||||
|
||||
// Check if the integer matches any enum value
|
||||
if (Enum.IsDefined(typeof(SERVICE_TYPE), idFunction))
|
||||
{
|
||||
@@ -3391,7 +3391,7 @@ namespace BrewMonster.UI
|
||||
if (pCurNPCEssence.HasValue)
|
||||
{
|
||||
uint npcID = pCurNPCEssence.Value.id;
|
||||
|
||||
|
||||
// var dlgInstall =GetGameUIMan().GetDialog("Win_Enchase");
|
||||
// dlgInstall.Show(true);
|
||||
CECUIManager.Instance.ShowUI("Win_Enchase");
|
||||
@@ -3446,14 +3446,14 @@ namespace BrewMonster.UI
|
||||
else if (idFunction == (int)SERVICE_TYPE.NPC_MAKE)
|
||||
{
|
||||
NPC_MAKE_SERVICE pMake = (NPC_MAKE_SERVICE)pData;
|
||||
|
||||
|
||||
BMLogger.Log($"PopupCorrespondingServiceDialog - NPC_MAKE: produce_type={pMake.produce_type}, MakeSkillID={pMake.id_make_skill}");
|
||||
|
||||
|
||||
// Dialog loading commented out - Win_Produce dialog not yet implemented
|
||||
// Determine which dialog to use based on produce_type
|
||||
//string dialogName = (pMake.produce_type == 2) ? "Win_Produce1" : "Win_Produce";
|
||||
//pShow1 = m_pAUIManager.GetDialog(dialogName);
|
||||
|
||||
|
||||
//if (pShow1 == null)
|
||||
//{
|
||||
// BMLogger.LogError($"NPC_MAKE: Dialog '{dialogName}' not found! Service may not work correctly.");
|
||||
@@ -3464,7 +3464,7 @@ namespace BrewMonster.UI
|
||||
//{
|
||||
// // Get or set DlgProduce reference (if it exists)
|
||||
// // GetGameUIMan().m_pDlgProduce = (CDlgProduce*)pShow1;
|
||||
//
|
||||
//
|
||||
// // Prepare NPC service
|
||||
// try
|
||||
// {
|
||||
@@ -3474,7 +3474,7 @@ namespace BrewMonster.UI
|
||||
// {
|
||||
// BMLogger.LogError($"NPC_MAKE: Error calling PrepareNPCService: {ex.Message}");
|
||||
// }
|
||||
//
|
||||
//
|
||||
// // Set data pointer
|
||||
// try
|
||||
// {
|
||||
@@ -3484,7 +3484,7 @@ namespace BrewMonster.UI
|
||||
// {
|
||||
// BMLogger.LogError($"NPC_MAKE: Error setting data pointer: {ex.Message}");
|
||||
// }
|
||||
//
|
||||
//
|
||||
// // Clear material for certain produce types
|
||||
// if (pMake.produce_type == 1 ||
|
||||
// pMake.produce_type == 3 ||
|
||||
@@ -3502,10 +3502,10 @@ namespace BrewMonster.UI
|
||||
// BMLogger.LogError($"NPC_MAKE: Error clearing material: {ex.Message}");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// // Get inventory dialog
|
||||
// pShow2 = m_pAUIManager.GetDialog("Win_Inventory");
|
||||
//
|
||||
//
|
||||
// // Update produce dialog
|
||||
// try
|
||||
// {
|
||||
@@ -3683,7 +3683,7 @@ namespace BrewMonster.UI
|
||||
pTask = GetHostPlayer().GetTaskInterface();
|
||||
|
||||
pTask.GetAwardCandidates(opt.param, ref ad);
|
||||
|
||||
|
||||
if (ad.m_ulCandItems > 1)
|
||||
{
|
||||
dialogue1 = "Win_Award";
|
||||
@@ -3831,12 +3831,6 @@ namespace BrewMonster.UI
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void CloseDialogue()
|
||||
{
|
||||
base.CloseDialogue();
|
||||
GetGameUIMan().EndNPCService();
|
||||
}
|
||||
|
||||
public void OnCommand_CANCEL(string szCommand)
|
||||
{
|
||||
int idCurFinishTask = GetGameUIMan().m_idCurFinishTask;
|
||||
|
||||
@@ -55,11 +55,7 @@ namespace BrewMonster
|
||||
player.GetCurSkill() != null ||
|
||||
player.IsFighting())
|
||||
{
|
||||
uiManager.ShowMessageBox(new MessageBoxData()
|
||||
{
|
||||
Title = "MessageBox",
|
||||
Message = gameUIMan.GetStringFromTable(11327)
|
||||
});
|
||||
uiManager.ShowMessageBoxGeneral("MessageBox", gameUIMan.GetStringFromTable(11327), this);
|
||||
}
|
||||
|
||||
int nCondition = CECHostSkillModel.Instance.CheckLearnCondition(m_skillID);
|
||||
@@ -102,12 +98,14 @@ namespace BrewMonster
|
||||
int needSp = CECHostSkillModel.Instance.GetSkillSp(m_skillID, m_curLevel + 1);
|
||||
|
||||
string str = GPDataTypeHelper.ReplacePercentD(GetStringFromTable(11326), needMoney, needSp);
|
||||
var messagebox = uiManager.ShowMessageBox(new MessageBoxData()
|
||||
{
|
||||
Title = "Game_LearnSkill",
|
||||
Message = str,
|
||||
OnClickedYes = () => UnityGameSession.c2s_SendCmdNPCSevLearnSkill(m_skillID)
|
||||
});
|
||||
// var messagebox = uiManager.ShowMessageBox(new MessageBoxData()
|
||||
// {
|
||||
// Title = "Game_LearnSkill",
|
||||
// Message = str,
|
||||
// OnClickedYes = () => UnityGameSession.c2s_SendCmdNPCSevLearnSkill(m_skillID)
|
||||
// });
|
||||
var messagebox = uiManager.ShowMessageBoxYes("Game_LearnSkill", str, this,
|
||||
() => UnityGameSession.c2s_SendCmdNPCSevLearnSkill(m_skillID));
|
||||
messagebox.SetData((uint)m_skillID);
|
||||
//GetGameUIMan()->MessageBox("Game_LearnSkill", str, //GetGameUIMan()->GetStringFromTable(231),
|
||||
// MB_OKCANCEL, A3DCOLORRGBA(255, 255, 255, 160), &pMsgBox);
|
||||
|
||||
@@ -40,12 +40,8 @@ namespace BrewMonster.UI
|
||||
|
||||
void OnCommandRepick()
|
||||
{
|
||||
CECUIManager.Instance.ShowMessageBox(
|
||||
title: "Thoát",
|
||||
message: CECUIManager.Instance.GetInGameUIMan().GetStringFromTable(202),
|
||||
messageBoxType: MessageBoxType.BothYesNoButton,
|
||||
onClickedYes: OnClickYes
|
||||
);
|
||||
CECUIManager.Instance.ShowMessageBoxYes("Thoát",
|
||||
CECUIManager.Instance.GetInGameUIMan().GetStringFromTable(202), null, OnClickYes);
|
||||
}
|
||||
|
||||
void OnClickYes()
|
||||
|
||||
@@ -117,7 +117,8 @@ namespace BrewMonster
|
||||
{
|
||||
//pGameRun.AddFixedMessage(FIXMSG_PET_DEAD);
|
||||
//Debug.LogError("FIXMSG_PET_DEAD");
|
||||
pGameUI.ShowMessageBox("MessageBox", "PET_DEAD", MessageBoxType.YesButton);
|
||||
// pGameUI.ShowMessageBox("MessageBox", "PET_DEAD", MessageBoxType.YesButton);
|
||||
pGameUI.ShowMessageBoxYes("MessageBox", "PET_DEAD", null, null);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -138,7 +139,8 @@ namespace BrewMonster
|
||||
{
|
||||
string strText = "";
|
||||
strText = string.Format(pGameUI.GetInGameUIMan().GetStringFromTable(10787), iLevelRequired);
|
||||
pGameUI.ShowMessageBox("MessageBox", strText, MessageBoxType.YesButton);
|
||||
// pGameUI.ShowMessageBox("MessageBox", strText, MessageBoxType.YesButton);
|
||||
pGameUI.ShowMessageBoxYes("MessageBox", strText, null, null);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -656,12 +656,16 @@ namespace BrewMonster
|
||||
// Duel invite: show accept/reject popup (origin MSG_PM_DUELOPT with command DUEL_RECV_REQUEST = 214)
|
||||
if (idOpp != 0)
|
||||
{
|
||||
CECUIManager.Instance?.ShowMessageBox(
|
||||
title: "",
|
||||
message: "Bạn vừa nhận được lời thách đấu. Bạn có chấp nhận không?",
|
||||
messageBoxType: MessageBoxType.BothYesNoButton,
|
||||
onClickedYes: () => UnityGameSession.c2s_CmdDuelReply(true, idOpp),
|
||||
onClickedNo: () => UnityGameSession.c2s_CmdDuelReply(false, idOpp));
|
||||
// CECUIManager.Instance?.ShowMessageBox(
|
||||
// title: "",
|
||||
// message: "Bạn vừa nhận được lời thách đấu. Bạn có chấp nhận không?",
|
||||
// messageBoxType: MessageBoxType.BothYesNoButton,
|
||||
// onClickedYes: () => UnityGameSession.c2s_CmdDuelReply(true, idOpp),
|
||||
// onClickedNo: () => UnityGameSession.c2s_CmdDuelReply(false, idOpp));
|
||||
CECUIManager.Instance?.ShowMessageBoxYesAndNo("",
|
||||
"Bạn vừa nhận được lời thách đấu. Bạn có chấp nhận không?", null,
|
||||
()=>UnityGameSession.c2s_CmdDuelReply(true, idOpp),
|
||||
() => UnityGameSession.c2s_CmdDuelReply(false, idOpp));
|
||||
}
|
||||
break;
|
||||
case CommandID.DUEL_PREPARE:
|
||||
@@ -712,12 +716,15 @@ namespace BrewMonster
|
||||
if (idLeader == 0)
|
||||
return;
|
||||
int seqCapture = team_seq;
|
||||
CECUIManager.Instance?.ShowMessageBox(
|
||||
title: "",
|
||||
message: "Bạn đã nhận được lời mời tham gia tổ đội. Bạn có chấp nhận không?",
|
||||
messageBoxType: MessageBoxType.BothYesNoButton,
|
||||
onClickedYes: () => UnityGameSession.c2s_CmdTeamAgreeInvite(idLeader, seqCapture),
|
||||
onClickedNo: () => UnityGameSession.c2s_CmdTeamRejectInvite(idLeader));
|
||||
// CECUIManager.Instance?.ShowMessageBox(
|
||||
// title: "",
|
||||
// message: "Bạn đã nhận được lời mời tham gia tổ đội. Bạn có chấp nhận không?",
|
||||
// messageBoxType: MessageBoxType.BothYesNoButton,
|
||||
// onClickedYes: () => UnityGameSession.c2s_CmdTeamAgreeInvite(idLeader, seqCapture),
|
||||
// onClickedNo: () => UnityGameSession.c2s_CmdTeamRejectInvite(idLeader));
|
||||
CECUIManager.Instance?.ShowMessageBoxYesAndNo("", "Bạn đã nhận được lời mời tham gia tổ đội. Bạn có chấp nhận không?",null,
|
||||
()=>UnityGameSession.c2s_CmdTeamAgreeInvite(idLeader, seqCapture),
|
||||
() => UnityGameSession.c2s_CmdTeamRejectInvite(idLeader));
|
||||
}
|
||||
|
||||
/// <summary>Called when MSG_PM_PLAYERDUELOPT (229) is received; server may send duel start to both participants. If host is one of the two ids, set duel state.</summary>
|
||||
|
||||
@@ -281,46 +281,95 @@ public class CECUIManager : MonoSingleton<CECUIManager>
|
||||
|
||||
_uiStack.Clear();
|
||||
}
|
||||
|
||||
public CDlgMessageBox ShowMessageBox(MessageBoxData messageBoxData)
|
||||
public CDlgMessageBox ShowMessageBoxGeneral(string title, string message, AUIDialog dlg)
|
||||
{
|
||||
var msgBox = GetInGameUIMan().GetDialog("DlgMessageBox") as CDlgMessageBox;
|
||||
if (msgBox != null)
|
||||
{
|
||||
msgBox.ShowMessageBox(messageBoxData);
|
||||
msgBox.ShowMessageBoxGeneral(title, message, dlg);
|
||||
return msgBox;
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("DlgMessageBox not found in InGameUIMan");
|
||||
}
|
||||
Debug.LogError("DlgMessageBox not found in InGameUIMan");
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public CDlgMessageBox ShowMessageBox(string title, string message, MessageBoxType messageBoxType,
|
||||
Action onClickedYes = null, Action onClickedNo = null)
|
||||
|
||||
public CDlgMessageBox ShowMessageBoxYes(string title, string message, AUIDialog dlg, Action onClickedYes)
|
||||
{
|
||||
var msgBox = GetInGameUIMan().GetDialog("DlgMessageBox") as CDlgMessageBox;
|
||||
if (msgBox != null)
|
||||
{
|
||||
msgBox.ShowMessageBox(new MessageBoxData()
|
||||
{
|
||||
Title = title,
|
||||
Message = message,
|
||||
MessageBoxType = messageBoxType,
|
||||
OnClickedYes = onClickedYes,
|
||||
OnClickedNo = onClickedNo
|
||||
});
|
||||
msgBox.ShowMessageBoxYes(title, message, dlg, onClickedYes);
|
||||
return msgBox;
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("DlgMessageBox not found in InGameUIMan");
|
||||
}
|
||||
Debug.LogError("DlgMessageBox not found in InGameUIMan");
|
||||
|
||||
return null;
|
||||
}
|
||||
public CDlgMessageBox ShowMessageBoxNo(string title, string message, AUIDialog dlg, Action onClickedNo)
|
||||
{
|
||||
var msgBox = GetInGameUIMan().GetDialog("DlgMessageBox") as CDlgMessageBox;
|
||||
if (msgBox != null)
|
||||
{
|
||||
msgBox.ShowMessageBoxNo(title, message, dlg, onClickedNo);
|
||||
return msgBox;
|
||||
}
|
||||
Debug.LogError("DlgMessageBox not found in InGameUIMan");
|
||||
|
||||
return null;
|
||||
}
|
||||
public CDlgMessageBox ShowMessageBoxYesAndNo(string title, string message, AUIDialog dlg, Action onClickedYes, Action onClickedNo)
|
||||
{
|
||||
var msgBox = GetInGameUIMan().GetDialog("DlgMessageBox") as CDlgMessageBox;
|
||||
if (msgBox != null)
|
||||
{
|
||||
msgBox.ShowMessageBoxYesAndNo(title, message, dlg,onClickedYes, onClickedNo);
|
||||
return msgBox;
|
||||
}
|
||||
Debug.LogError("DlgMessageBox not found in InGameUIMan");
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
// public CDlgMessageBox ShowMessageBox(MessageBoxData messageBoxData)
|
||||
// {
|
||||
// var msgBox = GetInGameUIMan().GetDialog("DlgMessageBox") as CDlgMessageBox;
|
||||
// if (msgBox != null)
|
||||
// {
|
||||
// msgBox.ShowMessageBox(messageBoxData);
|
||||
// return msgBox;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// Debug.LogError("DlgMessageBox not found in InGameUIMan");
|
||||
// }
|
||||
//
|
||||
// return null;
|
||||
// }
|
||||
|
||||
// public CDlgMessageBox ShowMessageBox(string title, string message, MessageBoxType messageBoxType,
|
||||
// Action onClickedYes = null, Action onClickedNo = null)
|
||||
// {
|
||||
// var msgBox = GetInGameUIMan().GetDialog("DlgMessageBox") as CDlgMessageBox;
|
||||
// if (msgBox != null)
|
||||
// {
|
||||
// msgBox.ShowMessageBox(new MessageBoxData()
|
||||
// {
|
||||
// Title = title,
|
||||
// Message = message,
|
||||
// MessageBoxType = messageBoxType,
|
||||
// OnClickedYes = onClickedYes,
|
||||
// OnClickedNo = onClickedNo
|
||||
// });
|
||||
// return msgBox;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// Debug.LogError("DlgMessageBox not found in InGameUIMan");
|
||||
// }
|
||||
//
|
||||
// return null;
|
||||
// }
|
||||
|
||||
public void UpdateSkillRelatedUI()
|
||||
{
|
||||
@@ -464,10 +513,8 @@ public class CECUIManager : MonoSingleton<CECUIManager>
|
||||
// m_pCurNPCEssence = NULL;
|
||||
// m_pDlgInventory->Show(false);
|
||||
pHost.GetPack((int)InventoryType.IVTRTYPE_PACK).UnfreezeAllItems();
|
||||
ShowMessageBox(new MessageBoxData()
|
||||
{
|
||||
Message = pDlg.GetStringFromTable(228)
|
||||
});
|
||||
|
||||
ShowMessageBoxGeneral("",pDlg.GetStringFromTable(228), null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user