diff --git a/Assets/PerfectWorld/Scripts/UI/Action/CDlgSkillSubAction.cs b/Assets/PerfectWorld/Scripts/UI/Action/CDlgSkillSubAction.cs index f8659fc4ee..80dfd55700 100644 --- a/Assets/PerfectWorld/Scripts/UI/Action/CDlgSkillSubAction.cs +++ b/Assets/PerfectWorld/Scripts/UI/Action/CDlgSkillSubAction.cs @@ -37,7 +37,7 @@ namespace BrewMonster OnShowDialog(); } - public void Init() + private void Init() { int[] objCount = { 8, 2, 2, 27 }; @@ -53,17 +53,17 @@ namespace BrewMonster image = orderTP, pLabel = orderTP.GetComponentInChildren() }); - + } } for (int j = 0; j < 27; j++) { var actionTP = Instantiate(actionTemplate, actionContain); actionTP.gameObject.SetActive(true); - + // Set up click handler for action items / 为动作项设置点击处理程序 SetupActionClickHandler(actionTP); - + m_aActionInfo.Add(new ActionInfo { image = actionTP, @@ -73,7 +73,7 @@ namespace BrewMonster //force refresh layout orderContain anc actionContain //then refresh layout of this gameobject } - public void OnShowDialog() + private void OnShowDialog() { AUIImagePicture pImage; TextMeshProUGUI pLabel; @@ -129,14 +129,14 @@ namespace BrewMonster Debug.Log($"CDlgSkillSubAction::SetupActionClickHandler():: Setting up click handler for action item: {actionImage.name}"); // Get the button component / 获取按钮组件 var button = actionImage.GetComponentInChildren(); - if (button == null) + if (button == null) return; - + // Remove existing listeners and add our custom handler / 移除现有监听器并添加我们的自定义处理程序 button.onClick.RemoveAllListeners(); button.onClick.AddListener(() => OnActionClicked(actionImage)); } - + /// /// Handle action icon click, similar to wave hand logic / 处理动作图标点击,类似于挥手逻辑 /// @@ -147,7 +147,7 @@ namespace BrewMonster // Get the shortcut from the action image / 从动作图像获取快捷方式 actionImage.Execute(); } - + [Serializable] public struct ActionInfo { diff --git a/Assets/PerfectWorld/Scripts/UI/GamePlay/AUIToggle.cs b/Assets/PerfectWorld/Scripts/UI/GamePlay/AUIToggle.cs index 3df0df3674..74e88b5d45 100644 --- a/Assets/PerfectWorld/Scripts/UI/GamePlay/AUIToggle.cs +++ b/Assets/PerfectWorld/Scripts/UI/GamePlay/AUIToggle.cs @@ -41,29 +41,29 @@ namespace BrewMonster } } public struct CloseAssignSkillEvent - { + { public int skillID; public CloseAssignSkillEvent(int id) { skillID = id; } } - public struct OpenAssignSlotEvent - { - public int slotIndex; - public OpenAssignSlotEvent(int index) - { - slotIndex = index; - } - } - public struct CloseAssignSlotEvent - { - public int slotIndex; - public CloseAssignSlotEvent(int index) - { - slotIndex = index; - } - } + // public struct OpenAssignSlotEvent + // { + // public int slotIndex; + // public OpenAssignSlotEvent(int index) + // { + // slotIndex = index; + // } + // } + // public struct CloseAssignSlotEvent + // { + // public int slotIndex; + // public CloseAssignSlotEvent(int index) + // { + // slotIndex = index; + // } + // } public struct OnAssignSkillEvent { public int skillID; diff --git a/Assets/PerfectWorld/Scripts/UI/GamePlay/AUIToggleAssignSlot.cs b/Assets/PerfectWorld/Scripts/UI/GamePlay/AUIToggleAssignSlot.cs index b85c6f5b64..c470972970 100644 --- a/Assets/PerfectWorld/Scripts/UI/GamePlay/AUIToggleAssignSlot.cs +++ b/Assets/PerfectWorld/Scripts/UI/GamePlay/AUIToggleAssignSlot.cs @@ -1,3 +1,4 @@ +using System; using BrewMonster.Assets.PerfectWorld.Scripts.UI.GamePlay; using UnityEngine; using BrewMonster.UI; @@ -6,6 +7,7 @@ namespace BrewMonster { public class AUIToggleAssignSlot : AUIToggle { + public event Action OnSetSlot;//bool: is active, int: slot id // [Header("AssignSlotToggleUI")] // [SerializeField] int slotIndex; public override void Awake() @@ -31,12 +33,13 @@ namespace BrewMonster } private void OnToggleValueChanged(bool isOn) { - if (isOn) - { - EventBus.Publish(new OpenAssignSlotEvent(slotIndex)); - }else{ - EventBus.Publish(new CloseAssignSlotEvent(slotIndex)); - } + OnSetSlot?.Invoke(isOn, slotIndex); + // if (isOn) + // { + // EventBus.Publish(new OpenAssignSlotEvent(slotIndex)); + // }else{ + // EventBus.Publish(new CloseAssignSlotEvent(slotIndex)); + // } } private void OnAssignSlotEvent(OnAssignSkillEvent @event) { diff --git a/Assets/PerfectWorld/Scripts/UI/GamePlay/AUIToggleSkillAssign.cs b/Assets/PerfectWorld/Scripts/UI/GamePlay/AUIToggleSkillAssign.cs index 598255858a..1d09a27923 100644 --- a/Assets/PerfectWorld/Scripts/UI/GamePlay/AUIToggleSkillAssign.cs +++ b/Assets/PerfectWorld/Scripts/UI/GamePlay/AUIToggleSkillAssign.cs @@ -31,7 +31,7 @@ namespace BrewMonster { if (isOn) { - EventBus.Publish(new OpenAssignSkillEvent(skillID)); + EventBus.Publish(new OpenAssignSkillEvent(skillID)); }else{ EventBus.Publish(new CloseAssignSkillEvent(skillID)); } diff --git a/Assets/PerfectWorld/Scripts/UI/SkillUI/AssignSkill.cs b/Assets/PerfectWorld/Scripts/UI/SkillUI/AssignSkill.cs index d3579a1e81..3fbb173687 100644 --- a/Assets/PerfectWorld/Scripts/UI/SkillUI/AssignSkill.cs +++ b/Assets/PerfectWorld/Scripts/UI/SkillUI/AssignSkill.cs @@ -23,7 +23,6 @@ namespace BrewMonster actionButton.onClick.AddListener(OnActionButtonClicked); itemSkillButton.onClick.AddListener(OnItemButtonClicked); buttonClose.onClick.AddListener(OnCloseButtonClicked); - actionButton.interactable = false; itemSkillButton.interactable = false; } void OnEnable() diff --git a/Assets/PerfectWorld/Scripts/UI/SkillUI/DlgAssignSlots.cs b/Assets/PerfectWorld/Scripts/UI/SkillUI/DlgAssignSlots.cs index 3845fc9d0c..8b87f2714d 100644 --- a/Assets/PerfectWorld/Scripts/UI/SkillUI/DlgAssignSlots.cs +++ b/Assets/PerfectWorld/Scripts/UI/SkillUI/DlgAssignSlots.cs @@ -10,6 +10,7 @@ using CSNetwork.GPDataType; using System.Collections.Generic; using System.Linq; using UnityEngine; +using UnityEngine.Serialization; using UnityEngine.UI; using static BrewMonster.PET_EGG_ESSENCE; @@ -20,7 +21,7 @@ namespace BrewMonster //[SerializeField] List m_aSkillImage = new List(); //[SerializeField] List