Exemple #1
0
    // 托管:出牌
    public static void trusteeshipLogic_OutPoker(DDZ_GameBase gameBase, DDZ_RoomData room, DDZ_PlayerData playerData)
    {
        try
        {
            // 轮到自己出牌
            {
                if (playerData.getPokerList().Count > 0)
                {
                    JObject backData = new JObject();
                    backData.Add("tag", room.m_tag);
                    backData.Add("uid", playerData.m_uid);
                    backData.Add("playAction", (int)TLJCommon.Consts.DDZ_PlayAction.PlayAction_PlayerOutPoker);
                    {
                        List <TLJCommon.PokerInfo> listPoker = LandlordsCardsHelper.GetTrusteeshipPoker(room, playerData);

                        //// 打印托管出的牌
                        //{
                        //    string str = "";
                        //    for (int i = 0; i < listPoker.Count; i++)
                        //    {
                        //        str += (listPoker[i].m_num + "、");
                        //    }
                        //    TLJ_PlayService.PlayService.log.Warn(m_logFlag + "----托管出牌:" + playerData.m_uid + ":" + str);
                        //}

                        JArray jarray = new JArray();
                        for (int i = 0; i < listPoker.Count; i++)
                        {
                            int num       = listPoker[i].m_num;
                            int pokerType = (int)listPoker[i].m_pokerType;
                            {
                                JObject temp = new JObject();
                                temp.Add("num", num);
                                temp.Add("pokerType", pokerType);
                                jarray.Add(temp);
                            }
                        }
                        backData.Add("pokerList", jarray);

                        if (listPoker.Count > 0)
                        {
                            backData.Add("hasOutPoker", true);
                        }
                        else
                        {
                            backData.Add("hasOutPoker", false);
                        }
                    }

                    //LogUtil.getInstance().addDebugLog(m_logFlag + "----" + "托管出牌:" + playerData.m_uid + "  " + backData.ToString());
                    DDZ_GameLogic.doTask_ReceivePlayerOutPoker(gameBase, playerData.m_connId, backData.ToString());
                }
            }
        }
        catch (Exception ex)
        {
            TLJ_PlayService.PlayService.log.Error(m_logFlag + "----" + ":trusteeshipLogic_OutPoker:" + ex);
        }
    }
Exemple #2
0
    public void OnReceive(IntPtr connId, string data)
    {
        JObject respondJO = new JObject();

        try
        {
            JObject jo  = JObject.Parse(data);
            string  tag = jo.GetValue("tag").ToString();
            respondJO.Add("tag", tag);

            int playAction = Convert.ToInt32(jo.GetValue("playAction"));

            switch (playAction)
            {
            case (int)TLJCommon.Consts.DDZ_PlayAction.PlayAction_JoinGame:
            {
                doTask_JoinGame(connId, data);
            }
            break;

            case (int)TLJCommon.Consts.DDZ_PlayAction.PlayAction_ExitGame:
            {
                DDZ_GameLogic.doTask_ExitGame(this, connId, data);
            }
            break;

            case (int)TLJCommon.Consts.DDZ_PlayAction.PlayAction_QiangDiZhu:
            {
                DDZ_GameLogic.doTask_QiangDiZhu(this, connId, data);
            }
            break;

            case (int)TLJCommon.Consts.DDZ_PlayAction.PlayAction_JiaBang:
            {
                DDZ_GameLogic.doTask_JiaBang(this, connId, data);
            }
            break;

            case (int)TLJCommon.Consts.DDZ_PlayAction.PlayAction_PlayerOutPoker:
            {
                DDZ_GameLogic.doTask_ReceivePlayerOutPoker(this, connId, data);
            }
            break;

            case (int)TLJCommon.Consts.DDZ_PlayAction.PlayAction_Chat:
            {
                DDZ_GameLogic.doTask_Chat(this, connId, data);
            }
            break;

            case (int)TLJCommon.Consts.DDZ_PlayAction.PlayAction_SetTuoGuanState:
            {
                DDZ_GameLogic.doTask_SetTuoGuanState(this, connId, data);
            }
            break;
            }
        }
        catch (Exception ex)
        {
            LogUtil.getInstance().writeLogToLocalNow(m_logFlag + "----" + ".OnReceive()异常:" + ex.Message);
            // 客户端参数错误
            respondJO.Add("code", Convert.ToInt32(TLJCommon.Consts.Code.Code_ParamError));

            // 发送给客户端
            PlayService.m_serverUtil.sendMessage(connId, respondJO.ToString());
        }
    }