From 6f826d916dc44abf0619e43388492c31a3998725 Mon Sep 17 00:00:00 2001 From: mnjnhuang <1090031856@qq.com> Date: Tue, 18 Nov 2025 17:50:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=B4=E6=97=B6=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/00_scripts/Events/EventEnum.cs | 7 ++ Assets/00_scripts/Events/EventStruct.cs | 12 ++- .../Events/TurnScripts/TurnEventManagement.cs | 4 + .../Events/TurnScripts/TurnHandlerDropCard.cs | 76 +++++++++---------- 4 files changed, 58 insertions(+), 41 deletions(-) diff --git a/Assets/00_scripts/Events/EventEnum.cs b/Assets/00_scripts/Events/EventEnum.cs index 32b8e3d..39d0c17 100644 --- a/Assets/00_scripts/Events/EventEnum.cs +++ b/Assets/00_scripts/Events/EventEnum.cs @@ -22,4 +22,11 @@ public enum EVENT_METHODS // 事件方法 PUT = 3, // 修改 POST = 0, // 默认发送, 不需要任何返回 DELETE = 2, // 删除 +} + +public enum EVENT_EVENT_OS_STATUS +{ + NULL = 0, // 等待 + DEAL_RUNNING = 1, // 正在发牌 + DROP_RUNNING = 2, // 正在弃牌 } \ No newline at end of file diff --git a/Assets/00_scripts/Events/EventStruct.cs b/Assets/00_scripts/Events/EventStruct.cs index 417bd00..d812f1f 100644 --- a/Assets/00_scripts/Events/EventStruct.cs +++ b/Assets/00_scripts/Events/EventStruct.cs @@ -5,7 +5,13 @@ using UnityEngine; public struct EVENT_STRUCT { // ************** 系统数据结构 **************** - public struct STRUCT_EVENT_OS_DEAL_CARD + // public struct STRUCT_EVENT_OS_SWITCH_STATUS + // { + // public EVENT_METHODS METHOD; + // public EVENT_STATUS_ENUM STATUS; + // } + + public struct STRUCT_EVENT_OS_DEAL_CARD // 系统发牌 { public EVENT_METHODS METHOD; public int HAND_CARD_COUNT; // 手牌数量 @@ -15,7 +21,7 @@ public struct EVENT_STRUCT // ************** 卡牌数据结构 **************** - public struct STRUCT_EVENT_CARD_DRAW_CARD + public struct STRUCT_EVENT_CARD_DRAW_CARD // 抽卡 { public EVENT_METHODS METHOD; public int ID; @@ -26,7 +32,7 @@ public struct EVENT_STRUCT public float DURATION; } - public struct STRUCT_EVENT_CARD_DROP_CARD + public struct STRUCT_EVENT_CARD_DROP_CARD // 弃牌 { public EVENT_METHODS METHOD; public int ID; diff --git a/Assets/00_scripts/Events/TurnScripts/TurnEventManagement.cs b/Assets/00_scripts/Events/TurnScripts/TurnEventManagement.cs index 040bb4c..07bcfbd 100644 --- a/Assets/00_scripts/Events/TurnScripts/TurnEventManagement.cs +++ b/Assets/00_scripts/Events/TurnScripts/TurnEventManagement.cs @@ -18,6 +18,10 @@ public class TurnEventManagement : MonoBehaviour EVENT_dispatch_os_deal_card(); } + // ================================ + // 注册管理事件 + // ================================ + // ================================ // 触发事件 diff --git a/Assets/00_scripts/Events/TurnScripts/TurnHandlerDropCard.cs b/Assets/00_scripts/Events/TurnScripts/TurnHandlerDropCard.cs index ab5efba..7fdcd32 100644 --- a/Assets/00_scripts/Events/TurnScripts/TurnHandlerDropCard.cs +++ b/Assets/00_scripts/Events/TurnScripts/TurnHandlerDropCard.cs @@ -17,7 +17,7 @@ public class TurnHandlerDropCard : MonoBehaviour private void Awake() { EventOS = CombatScenarioEventOS.Instance; - REGISTER_EVENT_drop_card(); + // REGISTER_EVENT_drop_card(); } private void Start() @@ -30,41 +30,41 @@ public class TurnHandlerDropCard : MonoBehaviour out drop_card_point_world_position); } - private void REGISTER_EVENT_drop_card() // 系统弃牌 - { - EventOS.EVENT_REGISTER(EVENT_ENUM.EVENT_LET_OS_DROP_CARD, callback); - return; - - void callback(bool placeholder) - { - if (EventOS.LOCK_GET(EVENT_EXCLUSIVE_LOCK.LOCK_OS_DEAL_CARD)) return; // 系统是否正在发牌 - if (!EventOS.LOCK_APPLY(EVENT_EXCLUSIVE_LOCK.LOCK_OS_DROP_CARD)) return; // 系统弃牌加锁失败 - StartCoroutine(coroutine()); - return; - - - IEnumerator coroutine() - { - if (handCardList.Count > 0) - { - // for (var i = handCardList.Count; i >= 0; i--) - for (var i = 0; i < handCardList.Count; i++) - { - EventOS.EVENT_TRIGGER(EventData.EVENT_REGISTER_EVENT_ENUM.EVENT_LET_CARD_DROP_SELF, - new EventStruct.STRUCT_EVENT_DROP_CARD - { - ID = i, - POSITION = drop_card_point_world_position, - DURATION = cardDropDuration, - }); - yield return new WaitForSeconds(cardDropDuration); - } - } - - handCardList.Clear(); // 清空 - EventOS.LOCK_RELEASE(EventLock.LOCK_EXCLUSIVE_CARD_ENUM.LOCK_OS_DROP_CARD); - // REGISTER_EVENT_ENEMY_TURN_START(); - } - } - } + // private void REGISTER_EVENT_drop_card() // 系统弃牌 + // { + // EventOS.EVENT_REGISTER(EVENT_ENUM.EVENT_LET_OS_DROP_CARD, callback); + // return; + // + // void callback(bool placeholder) + // { + // if (EventOS.LOCK_GET(EVENT_EXCLUSIVE_LOCK.LOCK_OS_DEAL_CARD)) return; // 系统是否正在发牌 + // if (!EventOS.LOCK_APPLY(EVENT_EXCLUSIVE_LOCK.LOCK_OS_DROP_CARD)) return; // 系统弃牌加锁失败 + // StartCoroutine(coroutine()); + // return; + // + // + // IEnumerator coroutine() + // { + // if (handCardList.Count > 0) + // { + // // for (var i = handCardList.Count; i >= 0; i--) + // for (var i = 0; i < handCardList.Count; i++) + // { + // EventOS.EVENT_TRIGGER(EventData.EVENT_REGISTER_EVENT_ENUM.EVENT_LET_CARD_DROP_SELF, + // new EventStruct.STRUCT_EVENT_DROP_CARD + // { + // ID = i, + // POSITION = drop_card_point_world_position, + // DURATION = cardDropDuration, + // }); + // yield return new WaitForSeconds(cardDropDuration); + // } + // } + // + // handCardList.Clear(); // 清空 + // EventOS.LOCK_RELEASE(EventLock.LOCK_EXCLUSIVE_CARD_ENUM.LOCK_OS_DROP_CARD); + // // REGISTER_EVENT_ENEMY_TURN_START(); + // } + // } + // } } \ No newline at end of file