From a33ef33062258ef2eba0555ee3a679ec3014a422 Mon Sep 17 00:00:00 2001 From: NguyenVanDat Date: Mon, 2 Feb 2026 17:59:33 +0700 Subject: [PATCH] update box message --- .../PerfectWorld/Prefab/UI/MessageBox.prefab | 352 +++++++++++++++++- .../PerfectWorld/Scripts/UI/CDlgMessageBox.cs | 63 +++- Assets/Scripts/CECUIManager.cs | 27 +- 3 files changed, 420 insertions(+), 22 deletions(-) diff --git a/Assets/PerfectWorld/Prefab/UI/MessageBox.prefab b/Assets/PerfectWorld/Prefab/UI/MessageBox.prefab index 3d3caedc34..4c624559eb 100644 --- a/Assets/PerfectWorld/Prefab/UI/MessageBox.prefab +++ b/Assets/PerfectWorld/Prefab/UI/MessageBox.prefab @@ -1,5 +1,126 @@ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: +--- !u!1 &99051929539797809 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4915293664251870536} + - component: {fileID: 7416811990837147698} + - component: {fileID: 6809282891346298764} + - component: {fileID: 7010901635634620631} + m_Layer: 5 + m_Name: ButtonNo + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &4915293664251870536 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 99051929539797809} + 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: 2385775756193422540} + m_Father: {fileID: 2782318616460798463} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 205.9258, y: 56.2433} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &7416811990837147698 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 99051929539797809} + m_CullTransparentMesh: 1 +--- !u!114 &6809282891346298764 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 99051929539797809} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.14578143, g: 0.7924528, b: 0.1864423, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 0} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &7010901635634620631 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 99051929539797809} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_WrapAround: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 6809282891346298764} + m_OnClick: + m_PersistentCalls: + m_Calls: [] --- !u!1 &1448650841350251410 GameObject: m_ObjectHideFlags: 0 @@ -168,10 +289,10 @@ RectTransform: m_Children: [] m_Father: {fileID: 7906706137011413807} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0.5, y: 0.5} - m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 0, y: -81} - m_SizeDelta: {x: 200, y: 50} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &5808684862484431307 CanvasRenderer: @@ -201,7 +322,7 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_text: OK + m_text: "\u0110\u1ED3ng \xDD(Y)" m_isRightToLeft: 0 m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} @@ -228,10 +349,10 @@ MonoBehaviour: m_faceColor: serializedVersion: 2 rgba: 4294967295 - m_fontSize: 36 + m_fontSize: 44.25 m_fontSizeBase: 36 m_fontWeight: 400 - m_enableAutoSizing: 0 + m_enableAutoSizing: 1 m_fontSizeMin: 18 m_fontSizeMax: 72 m_fontStyle: 0 @@ -272,6 +393,70 @@ MonoBehaviour: m_hasFontAssetChanged: 0 m_baseMaterial: {fileID: 0} m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!1 &4140524140714306011 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2782318616460798463} + - component: {fileID: 6567280976245013390} + m_Layer: 5 + m_Name: Buttons + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2782318616460798463 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4140524140714306011} + 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: 4915293664251870536} + - {fileID: 7906706137011413807} + m_Father: {fileID: 8578995796031649400} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 0} + m_AnchoredPosition: {x: 0, y: 41.609} + m_SizeDelta: {x: 0, y: 83.217} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &6567280976245013390 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4140524140714306011} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 30649d3a9faa99c48a7b1166b86bf2a0, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_ChildAlignment: 4 + m_Spacing: 11.43 + m_ChildForceExpandWidth: 0 + m_ChildForceExpandHeight: 1 + m_ChildControlWidth: 0 + m_ChildControlHeight: 0 + m_ChildScaleWidth: 0 + m_ChildScaleHeight: 0 + m_ReverseArrangement: 0 --- !u!1 &4839074738306786208 GameObject: m_ObjectHideFlags: 0 @@ -285,7 +470,7 @@ GameObject: - component: {fileID: 8250962023850685786} - component: {fileID: 7766051278568089760} m_Layer: 5 - m_Name: ButtonExit + m_Name: ButtonOk m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -298,18 +483,18 @@ RectTransform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 4839074738306786208} - 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: 7677644201189461152} - m_Father: {fileID: 8578995796031649400} + m_Father: {fileID: 2782318616460798463} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0.5, y: 0.5} - m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 160, y: 30} + m_SizeDelta: {x: 205.9258, y: 56.2433} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &8280971203118505009 CanvasRenderer: @@ -332,7 +517,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} - m_Color: {r: 1, g: 1, b: 1, a: 1} + m_Color: {r: 0.14578143, g: 0.7924528, b: 0.1864423, a: 1} m_RaycastTarget: 1 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 @@ -562,9 +747,9 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: - - {fileID: 7906706137011413807} - {fileID: 1931146730219979515} - {fileID: 6428994832978992641} + - {fileID: 2782318616460798463} m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} @@ -625,3 +810,140 @@ MonoBehaviour: titleText: {fileID: 5031655611580643013} messageText: {fileID: 7448521238108099750} okButton: {fileID: 7766051278568089760} + _noButton: {fileID: 7010901635634620631} +--- !u!1 &5664175764923475105 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2385775756193422540} + - component: {fileID: 8838082653881325633} + - component: {fileID: 438315464709753381} + m_Layer: 5 + m_Name: Text (TMP) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2385775756193422540 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5664175764923475105} + 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: [] + m_Father: {fileID: 4915293664251870536} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &8838082653881325633 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5664175764923475105} + m_CullTransparentMesh: 1 +--- !u!114 &438315464709753381 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5664175764923475105} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: "H\u1EE7y(N)" + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4278190080 + m_fontColor: {r: 0, g: 0, b: 0, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 50.3 + m_fontSizeBase: 36 + m_fontWeight: 400 + m_enableAutoSizing: 1 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 2 + m_VerticalAlignment: 512 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_TextWrappingMode: 0 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 0 + m_ActiveFontFeatures: 6e72656b + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_EmojiFallbackSupport: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_hasFontAssetChanged: 0 + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} diff --git a/Assets/PerfectWorld/Scripts/UI/CDlgMessageBox.cs b/Assets/PerfectWorld/Scripts/UI/CDlgMessageBox.cs index 488f82b625..3e53f72414 100644 --- a/Assets/PerfectWorld/Scripts/UI/CDlgMessageBox.cs +++ b/Assets/PerfectWorld/Scripts/UI/CDlgMessageBox.cs @@ -1,28 +1,79 @@ -using BrewMonster.UI; +using System; +using BrewMonster.UI; using UnityEngine; using static CECUIManager; namespace BrewMonster { + public enum MessageBoxType + { + YesButton, + NoButton, + BothYesNoButton, + } + public struct MessageBoxData + { + public string Title; + public string Message; + public MessageBoxType MessageBoxType; + public Action OnClickedYes; + public Action OnClickedNo; + } public class CDlgMessageBox : AUIDialog { [SerializeField] private TMPro.TextMeshProUGUI titleText; [SerializeField] private TMPro.TextMeshProUGUI messageText; [SerializeField] private UnityEngine.UI.Button okButton; - private void Awake() + [SerializeField] private UnityEngine.UI.Button _noButton; + + private MessageBoxData _messageData; + + public override void OnEnable() { - okButton.onClick.RemoveAllListeners(); + base.OnEnable(); okButton.onClick.AddListener(OnOkClicked); + _noButton.onClick.AddListener(OnNoClicked); } + + public override void OnDisable() + { + okButton.onClick.RemoveListener(OnOkClicked); + _noButton.onClick.RemoveListener(OnNoClicked); + } + private void OnOkClicked() { EventBus.Publish(new MessageBoxEvent(1,this)); + _messageData.OnClickedYes?.Invoke(); Show(false); } - public void ShowMessageBox(string title, string message) + private void OnNoClicked() { - SetName(title); - messageText.text = message; + EventBus.Publish(new MessageBoxEvent(0,this)); + _messageData.OnClickedNo?.Invoke(); + Show(false); + } + public void ShowMessageBox(MessageBoxData messageBoxData) + { + _messageData = messageBoxData; + SetName(messageBoxData.Title); + messageText.text = messageBoxData.Message; + + okButton.gameObject.SetActive(false); + _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; + } Show(true); } } diff --git a/Assets/Scripts/CECUIManager.cs b/Assets/Scripts/CECUIManager.cs index 3812ccae20..87799c95de 100644 --- a/Assets/Scripts/CECUIManager.cs +++ b/Assets/Scripts/CECUIManager.cs @@ -4,6 +4,7 @@ using BrewMonster.UI; using CSNetwork; using System; using System.Collections.Generic; +using BrewMonster.Scripts.Managers; using UnityEngine; using UnityEngine.UI; using UnityEngine.UIElements; @@ -108,7 +109,12 @@ public class CECUIManager : MonoSingleton var msgBox = GetInGameUIMan().GetDialog("DlgMessageBox") as CDlgMessageBox; if (msgBox != null) { - msgBox.ShowMessageBox(title, message); + msgBox.ShowMessageBox(new MessageBoxData() + { + Title = title, + Message = message, + MessageBoxType = MessageBoxType.YesButton + }); return msgBox; } else @@ -184,6 +190,25 @@ public class CECUIManager : MonoSingleton } } + 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(); + // 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); + } } private bool OnNewMessageBox(int iRetVal)