Exemplo n.º 1
0
    // 托管:抢地主
    public static void trusteeshipLogic_QiangDiZhu(DDZ_GameBase gameBase, DDZ_RoomData room, DDZ_PlayerData playerData)
    {
        try
        {
            LogUtil.getInstance().writeRoomLog(room, ":托管:帮" + playerData.m_uid + "抢地主");

            JObject data = new JObject();

            data["tag"]        = room.m_tag;
            data["uid"]        = playerData.m_uid;
            data["playAction"] = (int)TLJCommon.Consts.DDZ_PlayAction.PlayAction_QiangDiZhu;

            // 机器人叫分
            if (playerData.m_isAI)
            {
                if (room.m_maxJiaoFenPlayerData == null)
                {
                    int r = RandomUtil.getRandom(1, 3);
                    data["fen"] = r;
                }
                else
                {
                    int r = RandomUtil.getRandom(room.m_maxJiaoFenPlayerData.m_jiaofen + 1, 3);
                    data["fen"] = r;
                }
            }
            // 真人托管不叫分
            else
            {
                data["fen"] = 0;
            }

            DDZ_GameLogic.doTask_QiangDiZhu(gameBase, playerData.m_connId, data.ToString());
        }
        catch (Exception ex)
        {
            TLJ_PlayService.PlayService.log.Error(m_logFlag + "----" + ".trusteeshipLogic_QiangDiZhu: " + ex);
        }
    }
Exemplo n.º 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());
        }
    }