local PdkRoomViewConfig = {} local gameConfig = getSubGameConfig(GAME_IDS.hejiangPaoDeKuai) local PDKDefine = require("luaScript.SubGameDefine.Poker.hejiangPdkWanFa") -- 玩家节点位置 PdkRoomViewConfig.PLAYER_POS = { [2] = { cc.p((62+25)*g_radio_x, 111*g_radio_y), cc.p((1224-25)*g_radio_x, 560*g_radio_y),--调整后cc.p(936, 560) }, [3] = { -- cc.p(62, 111), -- cc.p(62, 481), -- cc.p(1224, 481),--x-机器人牌位置 cc.p((62+25)*g_radio_x, 111*g_radio_y), cc.p((1224-25)*g_radio_x, (505+20)*g_radio_y), cc.p((62+25)*g_radio_x, (505+20)*g_radio_y), }, [4] = { cc.p((62+25)*g_radio_x, 111*g_radio_y), cc.p((1224-25)*g_radio_x, 450*g_radio_y), cc.p(940*g_radio_x, 590*g_radio_y), cc.p((62+25)*g_radio_x, 450*g_radio_y), }, } --root cardRoot手牌开始位置 PdkRoomViewConfig.CARD_POS = { [2] = { -- cc.p(62, 111), -- cc.p(62+90, 481+115), cc.p(62*g_radio_x, 111), cc.p((1224-120)*g_radio_x, (660-10)*g_radio_y),--cc.p(936-120, 560-10), }, [3] = { cc.p(62*g_radio_x, 111), cc.p((1224-90)*g_radio_x, (481+115)*g_radio_y), cc.p((62+90)*g_radio_x, (481+115)*g_radio_y), }, [4] = { cc.p(62*g_radio_x, 111), cc.p((1224-110)*g_radio_x, (481-30)*g_radio_y), cc.p((640-150)*g_radio_x, (531+80)*g_radio_y), cc.p((62+110)*g_radio_x, (481-30)*g_radio_y), }, } -- 出牌显示位置 PdkRoomViewConfig.SHOW_CARD_POS = { [2] = { cc.p(200*g_radio_x, 75*g_radio_y), cc.p((1224-120)*g_radio_x, (500+8)*g_radio_y),--x- --cc.p(840, 496-80), }, [3] = { cc.p(200*g_radio_x, (70-10)*g_radio_y), cc.p(1095*g_radio_x, (481-8)*g_radio_y),--x- cc.p(200*g_radio_x, (481-8)*g_radio_y),--x+ }, [4] = { cc.p((200-8)*g_radio_x, 60*g_radio_y), cc.p((1095+30)*g_radio_x, (340+50+8)*g_radio_y),--x- cc.p(840*g_radio_x, (531+8)*g_radio_y),--x- cc.p((200-38)*g_radio_x, (340+50+8)*g_radio_y),--x+ }, } --专门给4人玩回放定义的出牌位置 PdkRoomViewConfig.RECORD_SHOW_CARD_POS4 = { [2] = { cc.p(200*g_radio_x, 75*g_radio_y), cc.p((1095-40)*g_radio_x, (596-80)*g_radio_y),--x- }, [3] = { cc.p(200*g_radio_x, 70), cc.p((1095-40)*g_radio_x, 481*g_radio_y),--x- cc.p((200+40)*g_radio_x, 481*g_radio_y),--x+ }, [4] = { cc.p((200-8)*g_radio_x, 50*g_radio_y), cc.p((1095-20)*g_radio_x, 340*g_radio_y),--x- cc.p((840-240)*g_radio_x, (531-30)*g_radio_y),--x- cc.p((200+20)*g_radio_x, 340*g_radio_y),--x+ }, } PdkRoomViewConfig.NEW_SHOW_CARD_POS = { [2] = { -- cc.p(640, 330), -- cc.p(230, 0),--x+ cc.p(640*g_radio_x, 290*g_radio_y), cc.p((-130-16)*g_radio_x, 0),--x- }, [3] = { cc.p(640*g_radio_x, 290*g_radio_y), cc.p((-130-16)*g_radio_x, 0),--x- cc.p((230+15)*g_radio_x, 0),--x+ }, [4] = { cc.p(640*g_radio_x, 285*g_radio_y), cc.p((-130-16)*g_radio_x, 0),--x- cc.p((-130-16)*g_radio_x, 0),--x- cc.p((230+15)*g_radio_x, 0),--x+ }, } PdkRoomViewConfig.PASS_SHOW_POS = { [2] = { -- cc.p(580, 200), -- cc.p(170, 0),--x+ cc.p(580*g_radio_x, 200*g_radio_y), cc.p((-160-40)*g_radio_x, 0),--x- }, [3] = { cc.p(580*g_radio_x, 200*g_radio_y), cc.p((-160-40)*g_radio_x, 0),--x- cc.p((170+40)*g_radio_x, 0),--x+ }, [4] = { cc.p(580*g_radio_x, 200*g_radio_y), cc.p((-160-40)*g_radio_x, 0),--x- cc.p((-160-40)*g_radio_x, 0),--x+ cc.p((170+40)*g_radio_x, 0),--x+ }, } -- 牌缩放 PdkRoomViewConfig.CARD_SCALE = { [1] = 1, [2] = 0.5, [3] = 0.5, [4] = 0.5, } -- 发牌时的起始缩放 PdkRoomViewConfig.CARD_SCALE_START = 0.5 -- 牌间距 PdkRoomViewConfig.CARD_DLT_WIDTH = 60 -- 发牌开始位置 PdkRoomViewConfig.CARD_START_POS = cc.p(640*g_radio_x, 340*g_radio_y) -- 牌的正常位置高度 PdkRoomViewConfig.NORMAL_HEIGHT = 111 -- 牌选择时的高度 PdkRoomViewConfig.SELECTED_HEIGHT = 111+40 -- 卡牌高度 PdkRoomViewConfig.CARD_HEIGHT = 231 PdkRoomViewConfig.CARD_WIDTH = 163 --[[ ]] -- 牌型显示类型 PdkRoomViewConfig.EffectType = { PASS = 0,--要不起 SINGLE_CARD = 1, --//单牌 DUI_ZI = 2, --//对子 THREE = 3, --三个 THREE_AND_TWO = 4, --//三带二张 THREE_AND_DUI = 5, --//三带一对 SHUN_ZI = 6, --//顺子 LIAN_DUI = 7, --//连对(至少3连对) AIRPLANE = 8, --//飞机不带翅膀 AIRPLANE_TOW = 9, --//飞机带散牌 AIRPLANE_DUI = 10, --//飞机带对 BOMB = 11, --//炸弹 THREE_AND_ONE = 80, --//三带一 SPRING_HUA = 99, -- 春天花 NONE = 100, --不适用类型 } -- 游戏桌子状态 PdkRoomViewConfig.GameStatus = { GAME_STATE_INIT =0, --//游戏准备状态 GAME_STATE_SEND_HAND_CARD =1, --//发牌 GAME_STATE_OUT_CARD =2, --//打牌 GAME_STATE_ROUND_OVER =3, --//游戏一局结束 GAME_STATE_GAME_OVER =4, --//游戏结束 } -- 创建房间参数 PdkRoomViewConfig.CreateParams = { 0x0001, --记牌器 0x0002, --有大必打 } PdkRoomViewConfig.CreateParamsMean = PDKDefine.CreateParamsMean PdkRoomViewConfig.RoonInfoConfig = { play = PDKDefine.GameTypesStr, num = PDKDefine.GamePlayerCount, wanfa = PDKDefine.GameWanfa, gui = PDKDefine.GameGui, keshu = PDKDefine.GameKeShu, tieyixian = PDKDefine.GameTieYiXian, sandaiyi = PDKDefine.GameSanDaiYi, } PdkRoomViewConfig.InviteConfig = { [2] = { [0] = "零缺二", [1] = "一缺一", [2] = "", }, [3] = { [0] = "零缺三", [1] = "一缺二", [2] = "二缺一", [3] = "", }, [4] = { [0] = "零缺四", [1] = "一缺三", [2] = "二缺二", [3] = "三缺一", [4] = "", } } --[[ print("------------rule--------", getNumBand(rule, 0x0001)) print("------------rule--------", getNumBand(rule, 0x0002)) print("------------rule--------", getNumBand(rule, 0x0004)) print("------------rule--------", getNumBand(rule, 0x0008)) print("------------rule--------", getNumBand(rule, 0x0010)) print("------------rule--------", getNumBand(rule, 0x0020)) print("------------rule--------", getNumBand(rule, 0x0040)) ]] PdkRoomViewConfig.PayConfig = { [0] = "房主付费", [1] = "AA支付" } function PdkRoomViewConfig.getPayInfo( gameInfo ) local data = json.decode(gameInfo) if data == nil then return "" end return PdkRoomViewConfig.PayConfig[tonumber(data.deductRule)] end function PdkRoomViewConfig.getRoundCount( gameInfo ) local data = json.decode(gameInfo) if data == nil then return "" end return PdkRoomViewConfig.RoonInfoConfig.num[tonumber(data.playnum)] end --带鬼数量 function PdkRoomViewConfig.getGuiCount( gameInfo ) local data = json.decode(gameInfo) if data == nil then return "" end return PdkRoomViewConfig.RoonInfoConfig.gui[tonumber(data.jokerCount)] end --颗数 function PdkRoomViewConfig.getKeCount( gameInfo ) local data = json.decode(gameInfo) if data == nil then return "" end return PdkRoomViewConfig.RoonInfoConfig.keshu[tonumber(data.keCount)] end --末手三带一 function PdkRoomViewConfig.getSanDaiYi( gameInfo ) local data = json.decode(gameInfo) if data == nil then return "" end return PdkRoomViewConfig.RoonInfoConfig.sandaiyi[tonumber(data.endsandaiyi)] end --铁一线 function PdkRoomViewConfig.getTieYiXian( gameInfo ) local data = json.decode(gameInfo) if data == nil or data.tieyixian == 0 then return nil end return PdkRoomViewConfig.RoonInfoConfig.tieyixian[tonumber(data.tieyixian)] end function PdkRoomViewConfig.getWanfa( gameInfo ) local data = json.decode(gameInfo) if data == nil then return "" end return PdkRoomViewConfig.RoonInfoConfig.wanfa[tonumber(data.allowPass)] end --[[获取房间详情字符串--]] function PdkRoomViewConfig.getRuleString(gameInfo) -- local gameInfo = app.room:getRoomInfo().nGameInfo local data = json.decode(gameInfo) if data == nil then return "" end local rule = tonumber(data.specialRule) local ruleStr = "" ruleStr = ruleStr..PdkRoomViewConfig.RoonInfoConfig.play[tonumber(data.gamerule)].." " ruleStr = ruleStr..PdkRoomViewConfig.RoonInfoConfig.num[tonumber(data.playnum)].." " ruleStr = ruleStr..PdkRoomViewConfig.RoonInfoConfig.gui[tonumber(data.jokerCount)].." " ruleStr = ruleStr..PdkRoomViewConfig.RoonInfoConfig.keshu[tonumber(data.keCount)].." " ruleStr = ruleStr..PdkRoomViewConfig.RoonInfoConfig.sandaiyi[tonumber(data.endsandaiyi)].." " if data.tieyixian > 0 then ruleStr = ruleStr..PdkRoomViewConfig.RoonInfoConfig.tieyixian[tonumber(data.tieyixian)].." " end if data.baseMulti and data.baseMulti > 0 then ruleStr = ruleStr .. "积分倍数x" .. data.baseMulti .. " " end -- if data.forbidProp and data.forbidProp > 0 then -- ruleStr = ruleStr .. "屏蔽聊天与互动道具 " -- end if data.forbidProp and data.forbidProp > 0 then ruleStr = ruleStr .. "屏蔽快捷语与道具" .. " " end if data.forbidVoice and data.forbidVoice > 0 then ruleStr = ruleStr .. "屏蔽语音" .. " " end --[[if data.allowPass and data.allowPass >= 0 then ruleStr = ruleStr..PdkRoomViewConfig.RoonInfoConfig.wanfa[tonumber(data.allowPass)].."," end--]] if getNumBand(rule, 0x0001)>0 then ruleStr = ruleStr..PdkRoomViewConfig.CreateParamsMean[0x0001].." " end if getNumBand(rule, 0x0002)>0 then ruleStr = ruleStr..PdkRoomViewConfig.CreateParamsMean[0x0002].." " end if getNumBand(rule, 0x0004)>0 then ruleStr = ruleStr..PdkRoomViewConfig.CreateParamsMean[0x0004].." " end -- if getNumBand(rule, 0x0008)>0 then -- ruleStr = ruleStr..PdkRoomViewConfig.CreateParamsMean[0x0008].."," -- end if getNumBand(rule, 0x0010)>0 then ruleStr = ruleStr..PdkRoomViewConfig.CreateParamsMean[0x0010].." " end if getNumBand(rule, 0x0020)>0 then ruleStr = ruleStr..PdkRoomViewConfig.CreateParamsMean[0x0020].." " end if getNumBand(rule, 0x0040)>0 then ruleStr = ruleStr..PdkRoomViewConfig.CreateParamsMean[0x0040].." " end if getNumBand(rule, 0x0080)>0 then ruleStr = ruleStr..PdkRoomViewConfig.CreateParamsMean[0x0080].." " end if string.len(ruleStr) > 0 then ruleStr = string.sub(ruleStr, 1, string.len(ruleStr)-1) end return ruleStr end function PdkRoomViewConfig.getRuleString2(gameInfo) -- local gameInfo = app.room:getRoomInfo().nGameInfo local data = json.decode(gameInfo) if data == nil then return "" end local rule = tonumber(data.specialRule) local ruleStr = "" ruleStr = ruleStr..PdkRoomViewConfig.RoonInfoConfig.play[tonumber(data.gamerule)].."、" ruleStr = ruleStr..PdkRoomViewConfig.RoonInfoConfig.num[tonumber(data.playnum)].."、" ruleStr = ruleStr..PdkRoomViewConfig.RoonInfoConfig.gui[tonumber(data.jokerCount)].."、" ruleStr = ruleStr..PdkRoomViewConfig.RoonInfoConfig.keshu[tonumber(data.keCount)].."、" ruleStr = ruleStr..PdkRoomViewConfig.RoonInfoConfig.sandaiyi[tonumber(data.endsandaiyi)].."、" if data.tieyixian > 0 then ruleStr = ruleStr..PdkRoomViewConfig.RoonInfoConfig.tieyixian[tonumber(data.tieyixian)].."、" end if data.baseMulti and data.baseMulti > 0 then ruleStr = ruleStr .. "积分倍数x" .. data.baseMulti .. " " end -- if data.forbidProp and data.forbidProp > 0 then -- ruleStr = ruleStr .. "屏蔽聊天与互动道具" .. " " -- end if data.forbidProp and data.forbidProp > 0 then ruleStr = ruleStr .. "屏蔽快捷语与道具" .. " " end if data.forbidVoice and data.forbidVoice > 0 then ruleStr = ruleStr .. "屏蔽语音" .. " " end if getNumBand(rule, 0x0001)>0 then ruleStr = ruleStr..PdkRoomViewConfig.CreateParamsMean[0x0001].. "、" end if getNumBand(rule, 0x0002)>0 then ruleStr = ruleStr..PdkRoomViewConfig.CreateParamsMean[0x0002] end --if getNumBand(rule, 0x0004)>0 then -- ruleStr = ruleStr..PdkRoomViewConfig.CreateParamsMean[0x0004].. "、" --end return ruleStr end function PdkRoomViewConfig.getWanfaTab(strGameInfo) local data = json.decode(strGameInfo) local rule = tonumber(data.specialRule) local rules = {} table.insert(rules,PdkRoomViewConfig.getPayInfo(strGameInfo)) table.insert(rules,PdkRoomViewConfig.getRoundCount(strGameInfo)) table.insert(rules,PdkRoomViewConfig.getGuiCount(strGameInfo)) table.insert(rules,PdkRoomViewConfig.getKeCount(strGameInfo)) table.insert(rules,PdkRoomViewConfig.getSanDaiYi(strGameInfo)) table.insert(rules,PdkRoomViewConfig.getTieYiXian(strGameInfo)) if data.baseMulti and data.baseMulti > 0 then table.insert(rules, "积分倍数x" .. data.baseMulti) end -- if data.forbidProp and data.forbidProp > 0 then -- table.insert(rules, "屏蔽聊天与互动道具") -- end if data.forbidProp and data.forbidProp > 0 then table.insert(rules, "屏蔽快捷语与道具") end if data.forbidVoice and data.forbidVoice > 0 then table.insert(rules, "屏蔽语音") end --table.insert(rules,PdkRoomViewConfig.RoonInfoConfig.wanfa[tonumber(data.allowPass)]) if getNumBand(rule, 0x0001)>0 then table.insert(rules,PdkRoomViewConfig.CreateParamsMean[0x0001]) -- ruleStr = ruleStr..PdkRoomViewConfig.CreateParamsMean[0x0001].. "、" end if getNumBand(rule, 0x0002)>0 then table.insert(rules,PdkRoomViewConfig.CreateParamsMean[0x0002]) -- ruleStr = ruleStr..PdkRoomViewConfig.CreateParamsMean[0x0002].. "、" end --[[if getNumBand(rule, 0x0004)>0 then table.insert(rules,PdkRoomViewConfig.CreateParamsMean[0x0004]) -- ruleStr = ruleStr..PdkRoomViewConfig.CreateParamsMean[0x0004].. "、" end--]] return rules end function PdkRoomViewConfig.getClubInviteWanFa(gameId, roomInfo) local data = json.decode(roomInfo.nGameInfo or "") if data == nil then return "" end local gamerule = data.gamerule -- 玩法 local roundCount = roomInfo.nTotalGameNum -- 局数 local gameConfig = getSubGameConfig(gameId) local gameType = gameConfig.GameType or {} local content = string.format("%s局 %s", roundCount, gameType[gamerule] or gameConfig.gameName) return content end return PdkRoomViewConfig