弃牌优化

This commit is contained in:
mnjnhuang 2025-11-14 15:34:07 +08:00
parent dd982e409a
commit f2e8df4c67
3 changed files with 26 additions and 23 deletions

View File

@ -97,24 +97,27 @@ public class CardManager : MonoBehaviour
void callback(bool placeholder) void callback(bool placeholder)
{ {
if (CardOS.Instance.LOCK_GET(CardOSData.LOCK_EXCLUSIVE_CARD_ENUM.LOCK_OS_SHUFFLE_CARD)) return; if (CardOS.Instance.LOCK_GET(CardOSData.LOCK_EXCLUSIVE_CARD_ENUM.LOCK_OS_SHUFFLE_CARD)) return; // 系统是否正在洗牌
if (!CardOS.Instance.LOCK_APPLY(CardOSData.LOCK_EXCLUSIVE_CARD_ENUM.LOCK_OS_DROP_CARD)) return; // 系统弃牌加锁失败
StartCoroutine(coroutine()); StartCoroutine(coroutine());
return; return;
IEnumerator coroutine() IEnumerator coroutine()
{ {
CardOS.Instance.LOCK_APPLY(CardOSData.LOCK_EXCLUSIVE_CARD_ENUM.LOCK_OS_DROP_CARD); if (handCardList.Count > 0)
for (var i = handCardList.Count; i >= 0; i--)
{ {
CardOS.Instance.EVENT_TRIGGER(CardOSData.EVENT_REGISTER_CARD_ENUM.EVENT_LET_CARD_DROP_SELF, for (var i = handCardList.Count; i >= 0; i--)
new CardOSData.STRUCT_EVENT_DROP_CARD {
{ CardOS.Instance.EVENT_TRIGGER(CardOSData.EVENT_REGISTER_CARD_ENUM.EVENT_LET_CARD_DROP_SELF,
ID = i, new CardOSData.STRUCT_EVENT_DROP_CARD
POSITION = drop_card_point_world_position, {
DURATION = cardDropDuration, ID = i,
}); POSITION = drop_card_point_world_position,
yield return new WaitForSeconds(cardDropDuration); DURATION = cardDropDuration,
});
yield return new WaitForSeconds(cardDropDuration);
}
} }
handCardList.Clear(); // 清空 handCardList.Clear(); // 清空

View File

@ -8,7 +8,7 @@ public class CardLockSvc
private bool GetNeedDebugLog() => CardOS.Instance.GetNeedDebugLog(); private bool GetNeedDebugLog() => CardOS.Instance.GetNeedDebugLog();
public bool LOCK_APPLY(CardOSData.LOCK_EXCLUSIVE_CARD_ENUM lock_name) public bool LOCK_APPLY(CardOSData.LOCK_EXCLUSIVE_CARD_ENUM lock_name) // return true 加锁成功
{ {
if (!_exclusive_lock_queue.Add(lock_name)) if (!_exclusive_lock_queue.Add(lock_name))
{ {

View File

@ -296,11 +296,11 @@ RectTransform:
- {fileID: 1803299165} - {fileID: 1803299165}
m_Father: {fileID: 1403623315} m_Father: {fileID: 1403623315}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0} m_AnchorMin: {x: 1, y: 0.5}
m_AnchorMax: {x: 1, y: 0} m_AnchorMax: {x: 1, y: 0.5}
m_AnchoredPosition: {x: -100, y: 80} m_AnchoredPosition: {x: -35, y: -240}
m_SizeDelta: {x: 130.84595, y: 75.03522} m_SizeDelta: {x: 130.84595, y: 75.03522}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 1, y: 0.5}
--- !u!114 &335933409 --- !u!114 &335933409
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1081,9 +1081,9 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0} m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 0} m_AnchorMax: {x: 1, y: 0}
m_AnchoredPosition: {x: -129, y: 220.6} m_AnchoredPosition: {x: -35, y: 135.4}
m_SizeDelta: {x: 194.25, y: 152.2} m_SizeDelta: {x: 194.25, y: 152.20001}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 1, y: 0.5}
--- !u!114 &649480887 --- !u!114 &649480887
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1797,10 +1797,10 @@ RectTransform:
m_Children: [] m_Children: []
m_Father: {fileID: 335933408} m_Father: {fileID: 335933408}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 1, y: 1} m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: -0.5, y: 0}
m_SizeDelta: {x: 0, y: 0} m_SizeDelta: {x: 131, y: 76}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1803299166 --- !u!114 &1803299166
MonoBehaviour: MonoBehaviour: