Exemple #1
0
    /// <summary>
    /// 点击吃按钮
    /// </summary>
    /// <param name="act"></param>
    /// <param name="cards"></param>
    private void onChiClick(PlayerActType act, List <int> cards, int btnIndex)
    {
        var actC2S = new ChiC2S();

        for (int i = 0; i < cards.Count; i++)
        {
            actC2S.mahjongCodes.Add(cards[i]);
        }
        var card = battleProxy.GetPlayerActTipS2C().actCards[btnIndex];

        actC2S.mahjongCodes.Add(card);//将自己吃的牌放进数组
        actC2S.forbitCards.Add(card);
        if (cards[0] == card + 1)
        {
            if (Array.IndexOf(GlobalData.CardValues, card + 3) != -1)
            {
                actC2S.forbitCards.Add(card + 3);
            }
        }
        else if (cards[0] == card - 2)
        {
            if (Array.IndexOf(GlobalData.CardValues, card - 3) != -1)
            {
                actC2S.forbitCards.Add(card - 3);
            }
        }
        NetMgr.Instance.SendBuff(SocketType.BATTLE, MsgNoC2S.C2S_ROOM_CHI.GetHashCode(), 0, actC2S);
    }
Exemple #2
0
    /// <summary>
    /// 点击吃按钮
    /// </summary>
    /// <param name="act"></param>
    /// <param name="cards"></param>
    private void onChiClick(PlayerActType act, List <int> cards, int btnIndex)
    {
        var actC2S = new ChiC2S();

        for (int i = 0; i < cards.Count; i++)
        {
            actC2S.mahjongCodes.Add(cards[i]);
        }
        var card = battleProxy.playerActTipS2C.actCards[btnIndex];

        actC2S.mahjongCodes.Add(card);//将自己吃的牌放进数组
        actC2S.forbitCards.Add(card);
        if (cards[0] == card + 1)
        {
            if (Array.IndexOf(GlobalData.CardValues, card + 3) != -1)
            {
                actC2S.forbitCards.Add(card + 3);
            }
        }
        else if (cards[0] == card - 2)
        {
            if (Array.IndexOf(GlobalData.CardValues, card - 3) != -1)
            {
                actC2S.forbitCards.Add(card - 3);
            }
        }
        NetMgr.Instance.SendBuff(SocketType.BATTLE, MsgNoC2S.CHI_C2S.GetHashCode(), 0, actC2S);
        cards.Clear();
        for (int i = 0; i < actionBtns.Count; i++)
        {
            Debug.Log("childCount = " + actionBtns[i].gameObject.transform.childCount);
            for (int j = 0; j < actionBtns[i].gameObject.transform.childCount; j++)
            {
                Destroy(actionBtns[i].gameObject.transform.GetChild(j).gameObject);
            }
        }
    }
Exemple #3
0
 /// <summary>
 /// 第一操作响应
 /// </summary>
 /// <param name="actPowerVO"></param>
 private void FirstActHandler(ActPowerVO actPowerVO)
 {
     if (actPowerVO.act == PlayerActType.PASS)
     {
         var actC2S = new GuoC2S();
         NetMgr.Instance.SendBuff(SocketType.BATTLE, MsgNoC2S.C2S_ROOM_PASS.GetHashCode(), 0, actC2S);
         chiPowerArr = null;
     }
     else if (actPowerVO.act == PlayerActType.PENG)
     {
         var actC2S = new PengC2S();
         actC2S.mahjongCode = actPowerVO.actCard;
         NetMgr.Instance.SendBuff(SocketType.BATTLE, MsgNoC2S.C2S_ROOM_PENG.GetHashCode(), 0, actC2S);
         chiPowerArr = null;
     }
     else if (actPowerVO.act == PlayerActType.CHI)
     {
         var actC2S = new ChiC2S();
         actC2S.mahjongCodes.AddRange(chiPowerArr[0].chiCards);
         actC2S.mahjongCodes.Add(chiPowerArr[0].chiCard);
         actC2S.forbitCards.AddRange(chiPowerArr[0].forbitCards);
         NetMgr.Instance.SendBuff(SocketType.BATTLE, MsgNoC2S.C2S_ROOM_PENG.GetHashCode(), 0, actC2S);
     }
     else if (actPowerVO.act == PlayerActType.SELF_HU)
     {
         var actC2S = new ZiMoHuC2S();
         NetMgr.Instance.SendBuff(SocketType.BATTLE, MsgNoC2S.C2S_ROOM_ZI_MO_HU.GetHashCode(), 0, actC2S);
         chiPowerArr = null;
     }
     else if (actPowerVO.act == PlayerActType.QIANG_AN_GANG_HU)
     {
         var actC2S = new QiangAnGangHuC2S();
         NetMgr.Instance.SendBuff(SocketType.BATTLE, MsgNoC2S.C2S_ROOM_QIANG_AN_GANG_HU.GetHashCode(), 0, actC2S);
         chiPowerArr = null;
     }
     else if (actPowerVO.act == PlayerActType.QIANG_PENG_GANG_HU)
     {
         var actC2S = new QiangPengGangHuC2S();
         NetMgr.Instance.SendBuff(SocketType.BATTLE, MsgNoC2S.C2S_ROOM_QIANG_PENG_GANG_HU.GetHashCode(), 0, actC2S);
         chiPowerArr = null;
     }
     else if (actPowerVO.act == PlayerActType.QIANG_ZHI_GANG_HU)
     {
         var actC2S = new QiangZhiGangHuC2S();
         NetMgr.Instance.SendBuff(SocketType.BATTLE, MsgNoC2S.C2S_ROOM_QIANG_ZHI_GANG_HU.GetHashCode(), 0, actC2S);
         chiPowerArr = null;
     }
     else if (actPowerVO.act == PlayerActType.CHI_HU)
     {
         var actC2S = new ChiHuC2S();
         NetMgr.Instance.SendBuff(SocketType.BATTLE, MsgNoC2S.C2S_ROOM_CHI_HU.GetHashCode(), 0, actC2S);
         chiPowerArr = null;
     }
     else if (actPowerVO.act == PlayerActType.COMMON_AN_GANG)
     {
         var actC2S = new CommonAnGangC2S();
         actC2S.mahjongCode = actPowerVO.actCard;
         NetMgr.Instance.SendBuff(SocketType.BATTLE, MsgNoC2S.C2S_ROOM_COMMON_AN_GANG.GetHashCode(), 0, actC2S);
         chiPowerArr = null;
     }
     else if (actPowerVO.act == PlayerActType.BACK_AN_GANG)
     {
         var actC2S = new BackAnGangC2S();
         actC2S.mahjongCode = actPowerVO.actCard;
         NetMgr.Instance.SendBuff(SocketType.BATTLE, MsgNoC2S.C2S_ROOM_BACK_AN_GANG.GetHashCode(), 0, actC2S);
         chiPowerArr = null;
     }
     else if (actPowerVO.act == PlayerActType.ZHI_GANG)
     {
         var actC2S = new ZhiGangC2S();
         actC2S.mahjongCode = actPowerVO.actCard;
         NetMgr.Instance.SendBuff(SocketType.BATTLE, MsgNoC2S.C2S_ROOM_ZHI_GANG.GetHashCode(), 0, actC2S);
         chiPowerArr = null;
     }
     else if (actPowerVO.act == PlayerActType.COMMON_PENG_GANG)
     {
         var actC2S = new CommonPengGangC2S();
         actC2S.mahjongCode = actPowerVO.actCard;
         NetMgr.Instance.SendBuff(SocketType.BATTLE, MsgNoC2S.C2S_ROOM_COMMON_PENG_GANG.GetHashCode(), 0, actC2S);
         chiPowerArr = null;
     }
     else if (actPowerVO.act == PlayerActType.BACK_PENG_GANG)
     {
         var actC2S = new BackPengGangC2S();
         actC2S.mahjongCode = actPowerVO.actCard;
         NetMgr.Instance.SendBuff(SocketType.BATTLE, MsgNoC2S.C2S_ROOM_BACK_PENG_GANG.GetHashCode(), 0, actC2S);
         chiPowerArr = null;
     }
 }