新增请求方式
This commit is contained in:
parent
209795f075
commit
2d1098001c
@ -18,8 +18,8 @@ public enum EVENT_ENUM
|
|||||||
|
|
||||||
public enum EVENT_METHODS // 事件方法
|
public enum EVENT_METHODS // 事件方法
|
||||||
{
|
{
|
||||||
GET = 0, // 获取
|
GET = 1, // 获取
|
||||||
PUT = 3, // 修改
|
PUT = 3, // 修改
|
||||||
POST = 1, // 发送
|
POST = 0, // 默认发送, 不需要任何返回
|
||||||
DELETE = 2, // 删除
|
DELETE = 2, // 删除
|
||||||
}
|
}
|
||||||
@ -7,6 +7,7 @@ public struct EVENT_STRUCT
|
|||||||
// ************** 系统数据结构 ****************
|
// ************** 系统数据结构 ****************
|
||||||
public struct STRUCT_EVENT_OS_DEAL_CARD
|
public struct STRUCT_EVENT_OS_DEAL_CARD
|
||||||
{
|
{
|
||||||
|
public EVENT_METHODS METHOD;
|
||||||
public int HAND_CARD_COUNT; // 手牌数量
|
public int HAND_CARD_COUNT; // 手牌数量
|
||||||
public int DECK_CARD_COUNT; // 牌堆数量
|
public int DECK_CARD_COUNT; // 牌堆数量
|
||||||
public float DURATION; // 动画时长
|
public float DURATION; // 动画时长
|
||||||
@ -16,6 +17,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;
|
public int ID;
|
||||||
public Vector3 POSITION;
|
public Vector3 POSITION;
|
||||||
public Quaternion ROTATION;
|
public Quaternion ROTATION;
|
||||||
@ -26,6 +28,7 @@ public struct EVENT_STRUCT
|
|||||||
|
|
||||||
public struct STRUCT_EVENT_CARD_DROP_CARD
|
public struct STRUCT_EVENT_CARD_DROP_CARD
|
||||||
{
|
{
|
||||||
|
public EVENT_METHODS METHOD;
|
||||||
public int ID;
|
public int ID;
|
||||||
public Vector3 POSITION;
|
public Vector3 POSITION;
|
||||||
public float DURATION;
|
public float DURATION;
|
||||||
|
|||||||
@ -117,6 +117,12 @@ public class Card : MonoBehaviour
|
|||||||
|
|
||||||
void callback(EVENT_STRUCT.STRUCT_EVENT_CARD_DRAW_CARD args)
|
void callback(EVENT_STRUCT.STRUCT_EVENT_CARD_DRAW_CARD args)
|
||||||
{
|
{
|
||||||
|
if (args.METHOD != EVENT_METHODS.POST)
|
||||||
|
{
|
||||||
|
Debug.LogError($"消息回调失败: [{args.GetType()}], 不允许的消息类型: {args.METHOD}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (args.ID != ID) return; // 不接受其他ID的卡牌以及其他消息
|
if (args.ID != ID) return; // 不接受其他ID的卡牌以及其他消息
|
||||||
Vector3 move_position = args.POSITION;
|
Vector3 move_position = args.POSITION;
|
||||||
Quaternion rotation = args.ROTATION;
|
Quaternion rotation = args.ROTATION;
|
||||||
@ -152,6 +158,12 @@ public class Card : MonoBehaviour
|
|||||||
|
|
||||||
void callback(EVENT_STRUCT.STRUCT_EVENT_CARD_DROP_CARD args)
|
void callback(EVENT_STRUCT.STRUCT_EVENT_CARD_DROP_CARD args)
|
||||||
{
|
{
|
||||||
|
if (args.METHOD != EVENT_METHODS.DELETE)
|
||||||
|
{
|
||||||
|
Debug.LogError($"消息回调失败: [{args.GetType()}], 不允许的消息类型: {args.METHOD}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (args.ID != ID) return; // 不接受其他ID的卡牌以及其他消息
|
if (args.ID != ID) return; // 不接受其他ID的卡牌以及其他消息
|
||||||
float duration_scale = args.DURATION / 3f;
|
float duration_scale = args.DURATION / 3f;
|
||||||
float duration_move = args.DURATION - duration_scale;
|
float duration_move = args.DURATION - duration_scale;
|
||||||
|
|||||||
@ -42,6 +42,12 @@ public class TurnHandlerDealCard : MonoBehaviour
|
|||||||
|
|
||||||
void callback(EVENT_STRUCT.STRUCT_EVENT_OS_DEAL_CARD args)
|
void callback(EVENT_STRUCT.STRUCT_EVENT_OS_DEAL_CARD args)
|
||||||
{
|
{
|
||||||
|
if (args.METHOD != EVENT_METHODS.POST)
|
||||||
|
{
|
||||||
|
Debug.LogError($"消息回调失败: [{args.GetType()}], 不允许的消息类型: {args.METHOD}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
print("系统发牌");
|
print("系统发牌");
|
||||||
int handCardCount = args.HAND_CARD_COUNT;
|
int handCardCount = args.HAND_CARD_COUNT;
|
||||||
int deckCardCount = args.DECK_CARD_COUNT;
|
int deckCardCount = args.DECK_CARD_COUNT;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user