diff --git a/Assets/PerfectWorld/Prefab/UIManager.prefab b/Assets/PerfectWorld/Prefab/UIManager.prefab index 4d2553ff3c..8165f81047 100644 --- a/Assets/PerfectWorld/Prefab/UIManager.prefab +++ b/Assets/PerfectWorld/Prefab/UIManager.prefab @@ -1297,7 +1297,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 1} m_AnchorMax: {x: 0.5, y: 1} - m_AnchoredPosition: {x: 0, y: -47.6} + m_AnchoredPosition: {x: -187.8, y: -47.6} m_SizeDelta: {x: 191, y: 60} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &6965363531247653623 @@ -4319,7 +4319,6 @@ RectTransform: - {fileID: 5196010413898095880} - {fileID: 3483809415181351540} - {fileID: 7451658084820611230} - - {fileID: 9121369084142034904} m_Father: {fileID: 2780428059708698453} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} @@ -4847,7 +4846,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 1, y: 1} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: -791.8898, y: -64.69995} + m_AnchoredPosition: {x: -903, y: -64.69995} m_SizeDelta: {x: 96, y: 96} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &4294505687272824498 @@ -9588,13 +9587,13 @@ RectTransform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 6949335809637514808} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: - {fileID: 4956381234499428555} - m_Father: {fileID: 3233441867675090637} + m_Father: {fileID: 3483809415181351540} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0.5} m_AnchorMax: {x: 0, y: 0.5} @@ -10498,6 +10497,7 @@ RectTransform: - {fileID: 5823843793071880086} - {fileID: 1462603449517194619} - {fileID: 1572942396405590444} + - {fileID: 9121369084142034904} - {fileID: 3994932288534442379} - {fileID: 1491137607121893366} - {fileID: 6742883814524417716} @@ -11332,7 +11332,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 1, y: 1} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: -680, y: -64.70001} + m_AnchoredPosition: {x: -791.1102, y: -64.70001} m_SizeDelta: {x: 96, y: 96} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &7156160830622099876 @@ -15603,11 +15603,11 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 5834405183358786743, guid: 22d3972b131ebdb4288f9cbdf996d691, type: 3} propertyPath: m_AnchoredPosition.x - value: 41.1442 + value: 41.144287 objectReference: {fileID: 0} - target: {fileID: 5834405183358786743, guid: 22d3972b131ebdb4288f9cbdf996d691, type: 3} propertyPath: m_AnchoredPosition.y - value: 3.2666 + value: 3.2666016 objectReference: {fileID: 0} - target: {fileID: 5834405183358786743, guid: 22d3972b131ebdb4288f9cbdf996d691, type: 3} propertyPath: m_LocalEulerAnglesHint.x @@ -18559,7 +18559,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 627631504828013321, guid: b78469eadfa272c4f8fee4c8cae4b26f, type: 3} propertyPath: m_AnchoredPosition.x - value: 0.00012207031 + value: 0 objectReference: {fileID: 0} - target: {fileID: 627631504828013321, guid: b78469eadfa272c4f8fee4c8cae4b26f, type: 3} propertyPath: m_AnchoredPosition.y @@ -18832,7 +18832,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 627631504828013321, guid: c7269974711314d68bdb2103c9ecebbd, type: 3} propertyPath: m_AnchoredPosition.x - value: 0.00012207031 + value: 0 objectReference: {fileID: 0} - target: {fileID: 627631504828013321, guid: c7269974711314d68bdb2103c9ecebbd, type: 3} propertyPath: m_AnchoredPosition.y diff --git a/Assets/PerfectWorld/Scripts/GameData/ExpTypes.cs b/Assets/PerfectWorld/Scripts/GameData/ExpTypes.cs index 327da33f03..d2c6fbce61 100644 --- a/Assets/PerfectWorld/Scripts/GameData/ExpTypes.cs +++ b/Assets/PerfectWorld/Scripts/GameData/ExpTypes.cs @@ -4756,7 +4756,8 @@ namespace BrewMonster [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public ushort[] name; // name, max 15 characters - public string Name => ByteToStringUtils.UshortArrayToCP936String(name); + public string Name => ByteToStringUtils.UshortArrayToUnicodeString(name); + //public string Name => ByteToStringUtils.UshortArrayToUnicodeString(name); [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] action_name; // action name, max 15 characters diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_InventoryUI.cs b/Assets/PerfectWorld/Scripts/Managers/EC_InventoryUI.cs index 9b83665e9c..8a3e9d53e7 100644 --- a/Assets/PerfectWorld/Scripts/Managers/EC_InventoryUI.cs +++ b/Assets/PerfectWorld/Scripts/Managers/EC_InventoryUI.cs @@ -43,9 +43,11 @@ namespace BrewMonster.Scripts.Managers [SerializeField] private List moneyTextsLegacy = new List(); [SerializeField] private List moneyTextsTMP = new List(); - [Header("Cash UI (assign any text fields to mirror cash amount)")] - [SerializeField] private List cashTextsLegacy = new List(); - [SerializeField] private List cashTextsTMP = new List(); + [Header("Character UI (assign in Inspector)")] + [SerializeField] private UnityEngine.UI.Text characterNameTextLegacy; + [SerializeField] private TMPro.TextMeshProUGUI characterNameTextTMP; + [SerializeField] private UnityEngine.UI.Text characterLevelTextLegacy; + [SerializeField] private TMPro.TextMeshProUGUI characterLevelTextTMP; private float lastRefreshTime; @@ -53,8 +55,6 @@ namespace BrewMonster.Scripts.Managers private static bool s_hasPendingMoney; private static ulong s_pendingMoneyAmount; private static ulong s_pendingMoneyMaxAmount; - private static bool s_hasPendingCash; - private static int s_pendingCashAmount; // Flags to prevent log spam for extended description warnings // 防止扩展描述警告日志刷屏的标志 @@ -128,6 +128,7 @@ namespace BrewMonster.Scripts.Managers { // Ensure cached values are pushed when the UI is enabled ApplyPendingCurrency(); + UpdateCharacterInfo(); ShowDetailPanel(false); } @@ -207,6 +208,7 @@ namespace BrewMonster.Scripts.Managers view.RenderPackage(inventoryPackButtons, invItems, PKG_INVENTORY, OnInventoryButtonClicked, GetDisplayTextForItem); view.RenderPackage(equipmentPackButtons, eqpItems, PKG_EQUIPMENT, OnInventoryButtonClicked, GetDisplayTextForItem); view.RenderPackage(fashionPackButtons, fshItems, PKG_FASHION, OnInventoryButtonClicked, GetDisplayTextForItem); + UpdateCharacterInfo(); } /// @@ -215,6 +217,9 @@ namespace BrewMonster.Scripts.Managers /// public void UpdateMoney(ulong amount, ulong maxAmount) { + s_pendingMoneyAmount = amount; + s_pendingMoneyMaxAmount = maxAmount; + s_hasPendingMoney = true; string text = amount.ToString(); if (moneyTextsLegacy != null) { @@ -235,29 +240,26 @@ namespace BrewMonster.Scripts.Managers } } - /// - /// Update all configured cash text components with the current boutique cash amount. - /// Call this when PLAYER_CASH arrives. - /// - public void UpdateCash(int amount) + private void UpdateCharacterInfo() { - string text = amount.ToString(); - if (cashTextsLegacy != null) + var host = CECGameRun.Instance?.GetHostPlayer(); + string characterName = string.Empty; + string characterLevel = string.Empty; + + if (host != null) { - for (int i = 0; i < cashTextsLegacy.Count; i++) - { - var t = cashTextsLegacy[i]; - if (t != null) t.text = text; - } - } - if (cashTextsTMP != null) - { - for (int i = 0; i < cashTextsTMP.Count; i++) - { - var t = cashTextsTMP[i]; - if (t != null) t.text = text; - } + characterName = host.GetName() ?? string.Empty; + characterLevel = host.GetBasicProps().iLevel.ToString(); } + + if (characterNameTextLegacy != null) + characterNameTextLegacy.text = characterName; + if (characterNameTextTMP != null) + characterNameTextTMP.text = characterName; + if (characterLevelTextLegacy != null) + characterLevelTextLegacy.text = characterLevel; + if (characterLevelTextTMP != null) + characterLevelTextTMP.text = characterLevel; } // Public static entry points to cache values when UI is unavailable @@ -282,36 +284,12 @@ namespace BrewMonster.Scripts.Managers } } - public static void CacheCash(int amount) - { - s_pendingCashAmount = amount; - s_hasPendingCash = true; - // If an instance exists (even inactive), push immediately so the value is ready - var all = Resources.FindObjectsOfTypeAll(); - if (all != null) - { - for (int i = 0; i < all.Length; i++) - { - var ui = all[i]; - if (ui != null && ui.gameObject.scene.IsValid()) - { - ui.ApplyPendingCurrency(); - break; - } - } - } - } - private void ApplyPendingCurrency() { if (s_hasPendingMoney) { UpdateMoney(s_pendingMoneyAmount, s_pendingMoneyMaxAmount); } - if (s_hasPendingCash) - { - UpdateCash(s_pendingCashAmount); - } } private void OnInventoryButtonClicked(byte package, int slot) diff --git a/Assets/PerfectWorld/Scripts/Move/CECPlayer.cs b/Assets/PerfectWorld/Scripts/Move/CECPlayer.cs index 275fa75ab8..28d912691e 100644 --- a/Assets/PerfectWorld/Scripts/Move/CECPlayer.cs +++ b/Assets/PerfectWorld/Scripts/Move/CECPlayer.cs @@ -1003,18 +1003,17 @@ namespace BrewMonster continue; data = (PLAYER_ACTION_INFO_CONFIG)dataman.get_data_ptr(id, ID_SPACE.ID_SPACE_CONFIG, ref dt); - if (!string.IsNullOrEmpty(data.ActionName) && data.ActionName[0] != '0') + if (!string.IsNullOrEmpty(data.ActionName)) { if (!actionMap.TryAdd(data.ActionName, data)) { } } - if (!string.IsNullOrEmpty(data.ActionName) && data.ActionName[0] != '0') + if (!string.IsNullOrEmpty(data.ActionName)) { if (!skillActionMap.TryAdd(data.Name, data)) - { - + { } } } @@ -1068,14 +1067,15 @@ namespace BrewMonster break; string skillName = ElementSkill.GetName(idSkill); - if (!string.IsNullOrEmpty(skillName)) { - if (skillActionMap.TryGetValue(skillName, out PLAYER_ACTION_INFO_CONFIG data1)) + var checkExist = skillActionMap.TryGetValue(skillName, out PLAYER_ACTION_INFO_CONFIG data1); + if (checkExist) { - // ✅ Gán dữ liệu hành động cho skill tương ứng - _default_skill_actions[idSkill] = data1; - + if(!_default_skill_actions.ContainsKey(idSkill)) + { + _default_skill_actions.Add(idSkill, data1); + } #if DEBUG_OUTPUT_ACTIONS for (int n = 0; n < PlayerSkillAction.NUM_WEAPON_TYPE; n++) { @@ -1499,7 +1499,7 @@ namespace BrewMonster } else { - attackerEvents.Signal(); + attackerEvents.Signal(); } } if (ElementSkill.IsGoblinSkill((uint)idSkill) && @@ -1524,6 +1524,7 @@ namespace BrewMonster && PlaySkillAttackAction(idSkill, nAttackSpeed, ref unusedInt, nSection, pAttack) && (dwModifier & (uint)MOD.MOD_BEAT_BACK) == 0) { + pAttack.m_bSignaled = true; } else { @@ -2100,30 +2101,32 @@ namespace BrewMonster m_pActionController.StopSkillCastAction(); } } - public bool PlaySkillCastAction(int idSkill) + public bool PlaySkillCastAction(int idSkill, CECAttackEvent attackEvent = null) { string szAct = ""; int weapon_type = GetShowingWeaponType(); + int moveEnv = GetMoveEnv(); if (!_default_skill_actions.TryGetValue((uint)idSkill, out PLAYER_ACTION_INFO_CONFIG data) || data.action_prefix == null || data.action_prefix.Length == 0 || data.action_prefix[0] == 0) { - // Check if it's a target item skill if (ElementSkill.GetCommonCoolDown((uint)idSkill) > 1 << 4) { data = m_PlayerActions[(int)PLAYER_ACTION_TYPE.ACT_USING_TARGET_ITEM].data; if (data.action_prefix == null || data.action_prefix.Length == 0 || data.action_prefix[0] == 0) + { return false; + } } else + { return false; + } } - - if (GetMoveEnv() == (int)MoveEnvironment.MOVEENV_GROUND) + if (moveEnv == (int)MoveEnvironment.MOVEENV_GROUND) { - szAct = EC_Utility.BuildActionName(data, weapon_type, "_Ò÷³ª_"); - BMLogger.LogError($"HoangDev: PlaySkillCastAction szAct={szAct} "); + szAct = EC_Utility.BuildActionName(data, weapon_type, "_吟唱_"); } else { diff --git a/Assets/PerfectWorld/Scripts/Network/CSNetwork/GPDataType.cs b/Assets/PerfectWorld/Scripts/Network/CSNetwork/GPDataType.cs index 4001746ecd..1a6f3e0e73 100644 --- a/Assets/PerfectWorld/Scripts/Network/CSNetwork/GPDataType.cs +++ b/Assets/PerfectWorld/Scripts/Network/CSNetwork/GPDataType.cs @@ -1594,6 +1594,12 @@ namespace CSNetwork.GPDataType public int amount; } + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct cmd_spend_money + { + public ulong cost; + } + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct cmd_produce_start { diff --git a/Assets/PerfectWorld/Scripts/Network/CSNetwork/GameSession.cs b/Assets/PerfectWorld/Scripts/Network/CSNetwork/GameSession.cs index 991d98e0d3..0860df0abe 100644 --- a/Assets/PerfectWorld/Scripts/Network/CSNetwork/GameSession.cs +++ b/Assets/PerfectWorld/Scripts/Network/CSNetwork/GameSession.cs @@ -963,6 +963,9 @@ namespace CSNetwork case CommandID.OWN_IVTR_DATA: case CommandID.OWN_IVTR_DETAIL_DATA: case CommandID.GET_OWN_MONEY: + //case CommandID.SPEND_MONEY: + // EC_ManMessage.PostMessage(EC_MsgDef.MSG_HST_SPENDMONEY, MANAGER_INDEX.MAN_PLAYER, 0, pDataBuf, pCmdHeader); + // break; case CommandID.CHANGE_IVTR_SIZE: EC_ManMessage.PostMessage(EC_MsgDef.MSG_HST_IVTRINFO, (int)MANAGER_INDEX.MAN_PLAYER, 0, pDataBuf, pCmdHeader, iHostID); @@ -1006,6 +1009,19 @@ namespace CSNetwork break; case CommandID.PLAYER_CASH: { + if (pDataBuf != null) + { + try + { + var cashData = GPDataTypeHelper.FromBytes(pDataBuf); + int cashAmount = cashData.cash_amount; + PostToUnityContext(() => ShopUIManager.CacheCash(cashAmount)); + } + catch (Exception ex) + { + } + } + EC_ManMessage.PostMessage(EC_MsgDef.MSG_HST_IVTRINFO, (int)MANAGER_INDEX.MAN_PLAYER, 0, pDataBuf, pCmdHeader, iHostID); break; diff --git a/Assets/PerfectWorld/Scripts/Players/CECPlayerActionPlayPolicy.cs b/Assets/PerfectWorld/Scripts/Players/CECPlayerActionPlayPolicy.cs index 19f10f9057..eab5b405cb 100644 --- a/Assets/PerfectWorld/Scripts/Players/CECPlayerActionPlayPolicy.cs +++ b/Assets/PerfectWorld/Scripts/Players/CECPlayerActionPlayPolicy.cs @@ -269,7 +269,7 @@ namespace BrewMonster return false; } m_isCastingSkill = true; - int iTransTime = 0; + int iTransTime = 200; EventBus.PublishChannel(m_pPlayer.GetPlayerInfo().cid, new PlayActionEvent(szActName,iTransTime)); return true; } @@ -285,7 +285,7 @@ namespace BrewMonster return false; } m_isCastingSkill = true; - int iTransTime = 0; + int iTransTime = 200; EventBus.PublishChannel(m_pPlayer.GetPlayerInfo().cid, new PlayActionEvent(szActName,iTransTime)); return true; } diff --git a/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgPetRec.cs b/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgPetRec.cs index f76c5e565c..69602f822a 100644 --- a/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgPetRec.cs +++ b/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgPetRec.cs @@ -205,6 +205,9 @@ namespace BrewMonster.UI if (m_nSlot >= 0) { GetHostPlayer().RestorePet(m_nSlot); + LoadPetSlotFromCorral(); + ClearPet(); + UpdatePetSlotUI(); GetGameUIMan()?.EndNPCService(); Show(false); //GetGameUIMan()->m_pDlgPetList->Show(false); @@ -392,10 +395,10 @@ namespace BrewMonster.UI if (m_pBtn_PetSlots[i] == null) continue; + var buttonImage = m_pBtn_PetSlots[i].GetComponent(); var petData = m_petSlots[i]; if (petData != null) { - var buttonImage = m_pBtn_PetSlots[i].GetComponent(); if (buttonImage != null) { DATA_TYPE dataType = DATA_TYPE.DT_INVALID; @@ -440,6 +443,15 @@ namespace BrewMonster.UI bool isSelectedPet = (m_nSlot == i && m_pCurrentPet != null); m_pBtn_PetSlots[i].interactable = !isActivePet && !isSelectedPet; } + else + { + if (buttonImage != null) + { + ClearSlotIcon(buttonImage); + buttonImage.color = Color.white; + } + m_pBtn_PetSlots[i].interactable = true; + } } } diff --git a/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgProduce.cs b/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgProduce.cs index 163502e67d..561c03662c 100644 --- a/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgProduce.cs +++ b/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgProduce.cs @@ -1,4 +1,4 @@ -using BrewMonster.Network; +using BrewMonster.Network; using BrewMonster.Scripts.Managers; using BrewMonster.Scripts.Task; using BrewMonster.UI; @@ -23,6 +23,7 @@ namespace BrewMonster [SerializeField] private string tabButtonTextComponentName = "Text"; [Header("Produce Detail")] + [SerializeField] private ScrollRect m_scrollRect; [SerializeField] private Transform itemContainer; [SerializeField] private GameObject itemPb; @@ -241,7 +242,12 @@ namespace BrewMonster if(btn != null) { int capturedIndex = pageIndex; - btn.onClick.AddListener(() => OnTabSelected(capturedIndex)); + btn.onClick.AddListener(() => + { + OnTabSelected(capturedIndex); + ResetOnTop(); + }); + } } } @@ -904,6 +910,11 @@ namespace BrewMonster } + private void ResetOnTop() + { + m_scrollRect.verticalNormalizedPosition = 1f; + } + public void OnDestroy() { ClearContainer(tabBtnContainer); diff --git a/Assets/PerfectWorld/Scripts/UI/GamePlay/EC_GameUIMan.cs b/Assets/PerfectWorld/Scripts/UI/GamePlay/EC_GameUIMan.cs index 79efb8c03a..b538a03e37 100644 --- a/Assets/PerfectWorld/Scripts/UI/GamePlay/EC_GameUIMan.cs +++ b/Assets/PerfectWorld/Scripts/UI/GamePlay/EC_GameUIMan.cs @@ -345,10 +345,6 @@ namespace BrewMonster.UI m_IconMap[(byte)EC_GAMEUI_ICONS.ICONS_SKILL] = (SKILL_ICONLIST_NAME, Resources.LoadAll(SKILL_ICONLIST_NAME)); m_IconMap[(byte)EC_GAMEUI_ICONS.ICONS_ACTION] = (ACTION_ICONLIST_NAME, Resources.LoadAll(ACTION_ICONLIST_NAME)); m_IconMap[(byte)EC_GAMEUI_ICONS.ICONS_STATE] = (STATE_ICONLIST_NAME, Resources.LoadAll(STATE_ICONLIST_NAME)); - foreach(var icon in m_IconMap[(byte)EC_GAMEUI_ICONS.ICONS_STATE].Item2) - { - Debug.Log($"Init: icon: {icon.name}"); - } } public void SetCover(AUIImagePictureBase pImgPic, string nameImage, EC_GAMEUI_ICONS iCONS_TYPE) { diff --git a/Assets/PerfectWorld/Scripts/UI/Login/CreateCharacterScreen.cs b/Assets/PerfectWorld/Scripts/UI/Login/CreateCharacterScreen.cs index 47b5ad4bf7..de7f993a0e 100644 --- a/Assets/PerfectWorld/Scripts/UI/Login/CreateCharacterScreen.cs +++ b/Assets/PerfectWorld/Scripts/UI/Login/CreateCharacterScreen.cs @@ -9,6 +9,7 @@ using TMPro; using UnityEngine; using UnityEngine.UI; using BrewMonster.Scripts; +using BrewMonster.PerfectWorld.Scripts.Utility.ChatFilter; namespace BrewMonster.UI { @@ -23,9 +24,12 @@ namespace BrewMonster.UI [SerializeField] private Button maleGenderButton; [SerializeField] private Button femaleGenderButton; [SerializeField] private TMP_InputField nameInputField; + [SerializeField] private TMP_Text validationMessageText; [SerializeField] private Button confirmButton; [SerializeField] private Button cancelButton; [SerializeField] private Button backButton; + [SerializeField] private CDlgMessageBox messageBoxPrefab; + private CDlgMessageBox _messageBoxInstance; private int _currentProfession = -1; private int _currentGender = -1; @@ -79,6 +83,7 @@ namespace BrewMonster.UI if (nameInputField != null) { nameInputField.onSubmit.AddListener((text) => { if (CanConfirm()) OnConfirmClicked(); }); + nameInputField.onValueChanged.AddListener((text) => ClearValidationError()); } } @@ -97,6 +102,8 @@ namespace BrewMonster.UI nameInputField.Select(); } + ClearValidationError(); + UpdateConfirmButtonState(); } @@ -180,10 +187,8 @@ namespace BrewMonster.UI if (!CanConfirm()) return; - string characterName = nameInputField != null ? nameInputField.text : ""; - if (string.IsNullOrWhiteSpace(characterName)) + if (!TryGetValidatedCharacterName(out string characterName)) { - Debug.LogWarning("Character name cannot be empty"); return; } @@ -214,6 +219,77 @@ namespace BrewMonster.UI _onCancel?.Invoke(); } + private bool TryGetValidatedCharacterName(out string characterName) + { + characterName = nameInputField != null ? nameInputField.text.Trim() : string.Empty; + if (string.IsNullOrWhiteSpace(characterName)) + { + ShowValidationError("Character name cannot be empty."); + return false; + } + + if (ChatFilterService.ContainsBadWord(characterName)) + { + ShowValidationError("Character name contains inappropriate words."); + return false; + } + + ClearValidationError(); + return true; + } + + private void ShowValidationError(string message) + { + if (validationMessageText != null) + { + validationMessageText.text = message; + validationMessageText.gameObject.SetActive(true); + } + + var dialog = GetOrCreateMessageBoxInstance(); + if (dialog != null) + { + dialog.ShowMessageBoxYes("Invalid Character Name", message, null, null); + } + else + { + CECUIManager.Instance?.ShowMessageBoxYes("Invalid Character Name", message, null, null); + } + Debug.LogWarning(message); + } + + private CDlgMessageBox GetOrCreateMessageBoxInstance() + { + if (_messageBoxInstance != null) + { + return _messageBoxInstance; + } + + if (messageBoxPrefab == null) + { + return null; + } + + var canvas = GetComponentInParent(); + if (canvas == null) + { + return null; + } + + _messageBoxInstance = Instantiate(messageBoxPrefab, canvas.transform); + _messageBoxInstance.gameObject.SetActive(false); + return _messageBoxInstance; + } + + private void ClearValidationError() + { + if (validationMessageText != null) + { + validationMessageText.text = string.Empty; + validationMessageText.gameObject.SetActive(false); + } + } + private bool CanConfirm() { if (_currentProfession < 0 || _currentProfession >= (int)Profession.NUM_PROFESSION) diff --git a/Assets/PerfectWorld/Scripts/UI/Popup/PopupManager.cs b/Assets/PerfectWorld/Scripts/UI/Popup/PopupManager.cs index 50ec155b01..5d8ab010a7 100644 --- a/Assets/PerfectWorld/Scripts/UI/Popup/PopupManager.cs +++ b/Assets/PerfectWorld/Scripts/UI/Popup/PopupManager.cs @@ -6,6 +6,7 @@ namespace BrewMonster public class PopupManager : MonoBehaviour { public static PopupManager Instance { get; private set; } + private static bool s_shouldShowRevivePopup; [SerializeField] private GameObject ReviveOptionPopup; @@ -14,6 +15,7 @@ namespace BrewMonster if (Instance == null) { Instance = this; + ApplyRevivePopupState(); } else { @@ -31,11 +33,35 @@ namespace BrewMonster public void OnPlayerDied() { - ReviveOptionPopup.SetActive(true); + s_shouldShowRevivePopup = true; + ApplyRevivePopupState(); } public void OnPlayerRevived() { - ReviveOptionPopup.SetActive(false); + s_shouldShowRevivePopup = false; + ApplyRevivePopupState(); + } + + private void ApplyRevivePopupState() + { + if (ReviveOptionPopup == null) + { + return; + } + + ReviveOptionPopup.SetActive(s_shouldShowRevivePopup); + } + + public static void NotifyPlayerDied() + { + s_shouldShowRevivePopup = true; + Instance?.ApplyRevivePopupState(); + } + + public static void NotifyPlayerRevived() + { + s_shouldShowRevivePopup = false; + Instance?.ApplyRevivePopupState(); } } diff --git a/Assets/PerfectWorld/Scripts/UI/ShopItemPanel.cs b/Assets/PerfectWorld/Scripts/UI/ShopItemPanel.cs index 6e4b377cca..8ddc14a964 100644 --- a/Assets/PerfectWorld/Scripts/UI/ShopItemPanel.cs +++ b/Assets/PerfectWorld/Scripts/UI/ShopItemPanel.cs @@ -51,7 +51,14 @@ public class ShopItemPanel : MonoBehaviour { if (itemData.buy[i].price > 0) { - bestPrice = itemData.buy[i].price; + if (itemData.buy[i].price / 100 == 0 && itemData.buy[i].price != 0) + { + gameObject.GetComponent