70 lines
2.5 KiB
C#
70 lines
2.5 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class TurnHandlerDropCard : MonoBehaviour
|
|
{
|
|
// ======== serializeField ========
|
|
[SerializeField] private RectTransform dropCardPlace;
|
|
[SerializeField] private Camera mainCamera;
|
|
[SerializeField] private float cardDropDuration = 0.2f;
|
|
|
|
// ======== private ========
|
|
private Vector3 drop_card_point_world_position;
|
|
private CombatScenarioEventOS EventOS;
|
|
|
|
private void Awake()
|
|
{
|
|
EventOS = CombatScenarioEventOS.Instance;
|
|
// REGISTER_EVENT_drop_card();
|
|
}
|
|
|
|
private void Start()
|
|
{
|
|
if (mainCamera == null) mainCamera = Camera.main;
|
|
RectTransformUtility.ScreenPointToWorldPointInRectangle(
|
|
rect: dropCardPlace,
|
|
screenPoint: dropCardPlace.position,
|
|
cam: mainCamera,
|
|
out drop_card_point_world_position);
|
|
}
|
|
|
|
// private void REGISTER_EVENT_drop_card() // 系统弃牌
|
|
// {
|
|
// EventOS.EVENT_REGISTER<bool>(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();
|
|
// }
|
|
// }
|
|
// }
|
|
} |