using MessagePack;

namespace GameMessage.NanChengFanDun
{
    [MessagePackObject]
    public class NanChengFanDunS2CPack
    {
        [Key(0)]
        public int GameState;

        [Key(1)]
        public int IsConnect;

        [Key(2)]
        public int Banker;

        [Key(3)]
        public int Score;

        [Key(4)]
        public int OptRole;

        [Key(5)]
        public int LastOutCardRole;

        [Key(6)]
        public int OptRoleTime;

        [Key(7)]
        public NanChengFanDunPlayerS2CPack[] Players;
        
        [Key(8)]
        public int ErrorCode;
    }
    
    [MessagePackObject]
    public class NanChengFanDunPlayerS2CPack
    {
        [Key(0)]
        public CardStyleInfo CardStyleInfo;

        [Key(1)]
        public int ShouCardCnt;

        [Key(2)]
        public int[] HandCardIds;

        [Key(3)]
        public int[] OutCardIds;

        [Key(4)]
        public int WinMoney;

        [Key(5)]
        public int AwardCount;

        [Key(6)]
        public int AwardScore;

        [Key(7)]
        public int AwardNegativeScore;

        [Key(8)]
        public bool InitIsNoAward;

        [Key(9)]
        public int CardStyleAwardScore;

        [Key(10)]
        public bool IsShowHandCards;

        [Key(11)]
        public int[][] BombCardIds;
    }

    /// <summary>
    /// 客户端 - 服务器的操作包
    /// </summary>
    [MessagePackObject]
    public class NanChengFanDunC2SPack
    {
        /// <summary>
        /// 操作类型
        /// </summary>
        [Key(0)]
        public int OperateType;

        /// <summary>
        /// 操作的牌型
        /// </summary>
        [Key(1)]
        public CardStyleInfo OpCardStyleInfo;

        /// <summary>
        /// 操作值
        /// </summary>
        [Key(2)]
        public int[] Value;

        public static NanChengFanDunC2SPack Create(int operateType, int[] value, CardStyleInfo cardStyleInfo = null)
        {
            NanChengFanDunC2SPack pack = new NanChengFanDunC2SPack();
            pack.OperateType = operateType;
            pack.Value = value;
            pack.OpCardStyleInfo = cardStyleInfo;
            return pack;
        }
    }
}