弃牌优化

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,14 +97,16 @@ public class CardManager : MonoBehaviour
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());
return;
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,
@ -116,6 +118,7 @@ public class CardManager : MonoBehaviour
});
yield return new WaitForSeconds(cardDropDuration);
}
}
handCardList.Clear(); // 清空
CardOS.Instance.LOCK_RELEASE(CardOSData.LOCK_EXCLUSIVE_CARD_ENUM.LOCK_OS_DROP_CARD);

View File

@ -8,7 +8,7 @@ public class CardLockSvc
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))
{

View File

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