diff --git a/Assets/PerfectWorld/Resources/UI/DialogScriptTableObject.asset b/Assets/PerfectWorld/Resources/UI/DialogScriptTableObject.asset index f7630fe9b9..1c7f2f4e95 100644 --- a/Assets/PerfectWorld/Resources/UI/DialogScriptTableObject.asset +++ b/Assets/PerfectWorld/Resources/UI/DialogScriptTableObject.asset @@ -49,3 +49,5 @@ MonoBehaviour: prefab: {fileID: 1126053271199039253, guid: 526d462bd8c87b74c9e461e80d028cb2, type: 3} - id: DlgPlayerOptions prefab: {fileID: 1813565726936289741, guid: a0e02be030755ab4a917523764fe4eef, type: 3} + - id: DlgPetHatch + prefab: {fileID: 3120870614492201289, guid: eaebf3351c396754fb983e0d5ba83e9a, type: 3} diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_InventoryUI.cs b/Assets/PerfectWorld/Scripts/Managers/EC_InventoryUI.cs index 4a09092de8..c5b877b6b0 100644 --- a/Assets/PerfectWorld/Scripts/Managers/EC_InventoryUI.cs +++ b/Assets/PerfectWorld/Scripts/Managers/EC_InventoryUI.cs @@ -771,7 +771,11 @@ namespace BrewMonster.Scripts.Managers if (eventTrigger == null) eventTrigger = button.gameObject.AddComponent(); - eventTrigger.triggers.Clear(); + eventTrigger.triggers.RemoveAll(e => + e.eventID == EventTriggerType.BeginDrag || + e.eventID == EventTriggerType.Drag || + e.eventID == EventTriggerType.EndDrag || + e.eventID == EventTriggerType.Drop); void AddEvent(EventTriggerType type, UnityEngine.Events.UnityAction action) { diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrPetEgg.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrPetEgg.cs index 2547d30eb4..9cbea2a6f4 100644 --- a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrPetEgg.cs +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem/EC_IvtrPetEgg.cs @@ -378,6 +378,12 @@ namespace PerfectWorld.Scripts.Managers Debug.Log("[THN]GetFollowPetDesc. This is not implemented yet."); return ""; } + + public PET_EGG_ESSENCE GetDBEssence() + { + return m_pDBEssence; + } + private string GetEvolutionPetDesc(bool bRepair) { Debug.Log("[THN]GetEvolutionPetDesc. This is not implemented yet."); diff --git a/Assets/PerfectWorld/Scripts/NPC/CECNPCServer.cs b/Assets/PerfectWorld/Scripts/NPC/CECNPCServer.cs index 6be3876f0c..ba314c8b5c 100644 --- a/Assets/PerfectWorld/Scripts/NPC/CECNPCServer.cs +++ b/Assets/PerfectWorld/Scripts/NPC/CECNPCServer.cs @@ -171,8 +171,6 @@ public class CECNPCServer : CECNPC if (idTask <= 0 || !pTask.HasTask(idTask)) continue; - BMLogger.Log($"[UpdateCurTaskIcon] Check IN task {idTask}, HasTask={pTask.HasTask(idTask)}, CanFinish={pTask.CanFinishTask((idTask))}"); - var pTaskTemp = pTaskMan.GetTaskTemplByID(idTask); if (pTaskTemp == null) continue; @@ -184,7 +182,6 @@ public class CECNPCServer : CECNPC if (pTaskTemp.IsKeyTask()) { m_TaskIcon = IconTaskType.QI_IN_K; - BMLogger.Log($"[UpdateCurTaskIcon] Set icon QI_IN_K for task {idTask}"); _needUpdateTaskIcon = true; return; } @@ -230,7 +227,6 @@ public class CECNPCServer : CECNPC else if ((taskFlag & TASK_COMPLETE_TYPE1) != 0) m_TaskIcon = IconTaskType.QI_IN_TYPE1; - BMLogger.Log($"[UpdateCurTaskIcon] Set complete icon {m_TaskIcon}"); _needUpdateTaskIcon = true; return; } diff --git a/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgNPC.cs b/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgNPC.cs index 877d5d08d8..c66c6cc399 100644 --- a/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgNPC.cs +++ b/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgNPC.cs @@ -2377,10 +2377,12 @@ namespace BrewMonster.UI } else if (iService == CDLGNPC.CDLGNPC_PETHATCH && (pEssence?.combined_services & 0x200) != 0) { - Show(false); + //Show(false); // TO DO: fix later //GetGameUIMan().m_pDlgInventory.Show(true); //GetGameUIMan().m_pDlgPetHatch.Show(true); + var dlgPetHatch = GetGameUIMan().GetDialog("DlgPetHatch"); + dlgPetHatch.Show(true); return; } else if (iService == CDLGNPC.CDLGNPC_PETREC && (pEssence?.combined_services & 0x400) != 0) diff --git a/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgPetHatch.cs b/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgPetHatch.cs new file mode 100644 index 0000000000..f3cacdb8c7 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgPetHatch.cs @@ -0,0 +1,561 @@ +using BrewMonster.Assets.PerfectWorld.Scripts.UI; +using BrewMonster.Common; +using BrewMonster.Managers; +using BrewMonster.Scripts; +using BrewMonster.Scripts.Managers; +using CSNetwork.GPDataType; +using Cysharp.Threading.Tasks.Triggers; +using PerfectWorld.Scripts.Managers; +using System; +using System.Collections.Generic; +using TMPro; +using UnityEngine; +using UnityEngine.EventSystems; +using UnityEngine.UI; + +namespace BrewMonster.UI +{ + public class DlgPetHatch : AUIDialog + { + [Header("Component")] + [SerializeField] private TextMeshProUGUI m_pTxtName; + [SerializeField] private TextMeshProUGUI m_pTxtGold; + [SerializeField] private Image m_pImg_Item; + [SerializeField] private GameObject m_pTxtBindTip; + + [Header("Buttons")] + [SerializeField] private Button m_btnConfirm; + [SerializeField] private Button m_btnCancel; + [SerializeField] private Button m_btnClose; + + [Header("Defautl Icon")] + [SerializeField] private Sprite m_defaultIcon; + + private int m_nSlot = 1; + private EC_IvtrPetEgg m_pCurrentEgg = null; + + private float m_doubleClickTime = 1f; + private Dictionary m_lastClickTime = new Dictionary(); + + public override void Awake() + { + base.Awake(); + RegisterDrop(m_pImg_Item.transform, OnDropEgg); + RegisterClick(m_pImg_Item.transform, OnClickEggSlot); + + if (m_btnConfirm != null) + m_btnConfirm.onClick.AddListener(OnCommandConfirm); + if (m_btnCancel != null) + m_btnCancel.onClick.AddListener(OnCommandCancel); + if (m_btnClose != null) + m_btnClose.onClick.AddListener(OnCommandCancel); + } + + public override void OnEnable() + { + base.OnEnable(); + ClearEgg(); + RegisterInventoryDoubleClick(); + } + + public override void OnDisable() + { + base.OnDisable(); + RestoreInventoryColor(); + UnregisterInventoryDoubleClick(); + } + + public override void Show(bool value) + { + base.Show(value); + if (value) + { + OnShowDialog(); + } + } + + private void OnShowDialog() + { + ClearEgg(); + } + + #region Double-Click Support + private void RegisterInventoryDoubleClick() + { + var inventoryUI = FindFirstObjectByType(); + if (inventoryUI == null) + { + return; + } + + var field = typeof(EC_InventoryUI) + .GetField("inventoryPackButtons", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); + + if (field == null) + { + return; + } + + var buttons = field.GetValue(inventoryUI) as List