跑得快显2,三张不带发送字段

master
罗家炜 2025-04-17 15:23:34 +08:00
parent 645e9a576b
commit bd0feb2a37
4 changed files with 106 additions and 118 deletions

View File

@ -228,10 +228,11 @@ function M:SelectedConfigData()
_data["maxPlayers"] = peopleNum == 1 and 2 or 3 --人数 2是2人 3是三人 _data["maxPlayers"] = peopleNum == 1 and 2 or 3 --人数 2是2人 3是三人
_data["rule"] = wanfa1_5 == 0 and 2 or 1 --黑桃3必出 2是选择了该玩法 1是没有该玩法 _data["rule"] = wanfa1_5 == 0 and 2 or 1 --黑桃3必出 2是选择了该玩法 1是没有该玩法
_data["showlength"] = (showCardNum + 1) % 2 --显示手牌数量 0是不显示 1是显示 _data["showlength"] = (showCardNum + 1) % 2 --显示手牌数量 0是不显示 1是显示
_data["planelack"] = wanfa1_2 or wanfa1_1 --[[三张、飞机可少带接完 0是没有该玩法 1是有该玩法, _data["planeNoBelt"] = wanfa1_1 --飞机不带
,]] _data["threeNoBelt"] = wanfa1_1 --三张不带
_data["threelack"] = wanfa1_2 or wanfa1_1 _data["planelack"] = wanfa1_2 --飞机可少带接完
_data["fourDaiThree"] = false --四带三 false没有该玩法 true有该玩法 _data["threelack"] = wanfa1_2 --三张可少带接完
_data["fourDaiThree"] = false --四带三 false没有该玩法 true有该玩法
if wanfa1_3 then if wanfa1_3 then
_data["fourDaiThree"] = true _data["fourDaiThree"] = true
end end

View File

@ -852,7 +852,6 @@ function M:GetHandCardPos(index, card_count)
local middle_x = self.cards_view.width / 2 local middle_x = self.cards_view.width / 2
local start_x = middle_x - (card_count / 2 * (self.card_width + offset)) + (offset / 2) local start_x = middle_x - (card_count / 2 * (self.card_width + offset)) + (offset / 2)
x = start_x + (self.card_width + offset) * (index - 1) x = start_x + (self.card_width + offset) * (index - 1)
print("================================GetHandCardPos", x, y)
return Vector2.New(x, y) return Vector2.New(x, y)
end end

View File

@ -9,66 +9,64 @@ local RunFast_ResultView = {}
local M = RunFast_ResultView local M = RunFast_ResultView
function RunFast_ResultView.new(blur_view, data, roomid, over, win_seat, dissolve, remaincards) function RunFast_ResultView.new(blur_view, data, roomid, over, win_seat, dissolve, remaincards)
setmetatable(M, {__index = ResultView}) setmetatable(M, { __index = ResultView })
local self = setmetatable({}, {__index = M}) local self = setmetatable({}, { __index = M })
self.class = "RunFast_ResultView" self.class = "RunFast_ResultView"
self._currenIndex = 0 self._currenIndex = 0
self._close_zone = false self._close_zone = false
--self._blur_view = blur_view --self._blur_view = blur_view
self._gamectr = ControllerManager.GetController(GameController) self._gamectr = ControllerManager.GetController(GameController)
self:init("ui://Extend_Poker_RunFastNew/clearing", data, roomid, over, win_seat, dissolve, remaincards) self:init("ui://Extend_Poker_RunFastNew/clearing", data, roomid, over, win_seat, dissolve, remaincards)
return self return self
end end
function M:init(url, data, roomid, over, win_seat, dissolve, remaincards) function M:init(url, data, roomid, over, win_seat, dissolve, remaincards)
ResultView.init(self, url, true)
ResultView.init(self, url,true) self.xiPaiCtr = self._view:GetController("xipai")
self.xiPaiCtr=self._view:GetController("xipai")
local round = DataManager.CurrenRoom.room_config.config.times or 1
local round=DataManager.CurrenRoom.room_config.config.times or 1 local xpconfig = DataManager.CurrenRoom.room_config.config.xi_pai
local xpconfig=DataManager.CurrenRoom.room_config.config.xi_pai if xpconfig and round > 1 then
if xpconfig and round>1 then self.xiPaiCtr.selectedIndex = 1
self.xiPaiCtr.selectedIndex=1 else
else self.xiPaiCtr.selectedIndex = 0
self.xiPaiCtr.selectedIndex=0 end
end
--self:InitData(data,roomid) --self:InitData(data,roomid)
--self:InitData(data,roomid) --self:InitData(data,roomid)
printlog("aaaaaaaaaaaaaaaa1111111111111111111111111222222222222222 ",dissolve) printlog("aaaaaaaaaaaaaaaa1111111111111111111111111222222222222222 ", dissolve)
pt(data) pt(data)
if dissolve == 1 then if dissolve == 1 then
-- body -- body
self.xiPaiCtr.selectedIndex=0 self.xiPaiCtr.selectedIndex = 0
self:InitData(data, win_seat, roomid) self:InitData(data, win_seat, roomid)
else else
local xipai=self._view:GetChild("btn_xipai") local xipai = self._view:GetChild("btn_xipai")
xipai.touchable=true xipai.touchable = true
xipai.onClick:Add(function() xipai.onClick:Add(function()
local xiPaiCallBack=function () local xiPaiCallBack = function()
xipai.touchable=false xipai.touchable = false
self.xiPaiCtr.selectedIndex=0 self.xiPaiCtr.selectedIndex = 0
ViewUtil.ErrorTip(1000000,"申请洗牌成功") ViewUtil.ErrorTip(1000000, "申请洗牌成功")
end end
local _gamectr = ControllerManager.GetController(GameController) local _gamectr = ControllerManager.GetController(GameController)
_gamectr:SendXiPaiAction(xiPaiCallBack) _gamectr:SendXiPaiAction(xiPaiCallBack)
end) end)
if DataManager.CurrenRoom.xipaiScore then if DataManager.CurrenRoom.xipaiScore then
--xipai.text="洗牌 积分x"..DataManager.CurrenRoom.xipaiScore --xipai.text="洗牌 积分x"..DataManager.CurrenRoom.xipaiScore
else else
--xipai.text="洗牌 积分x0" --xipai.text="洗牌 积分x0"
end end
self:InitData_One(data, win_seat, over, roomid, remaincards) self:InitData_One(data, win_seat, over, roomid, remaincards)
end end
end end
function M:ChangeCodeByTo( card ) function M:ChangeCodeByTo(card)
local flower = card % 10 local flower = card % 10
local number = math.floor(card / 10) local number = math.floor(card / 10)
if number == 15 then if number == 15 then
@ -79,43 +77,41 @@ end
-- 小结算 -- 小结算
function M:InitData_One(data, winseat, over, roomid, remaincards) function M:InitData_One(data, winseat, over, roomid, remaincards)
local room = DataManager.CurrenRoom local room = DataManager.CurrenRoom
self._view:GetController("sdk").selectedIndex = 1 self._view:GetController("sdk").selectedIndex = 1
local _gamectr = ControllerManager.GetController(GameController) local _gamectr = ControllerManager.GetController(GameController)
local list_view = self._view:GetChild("player_list_1") local list_view = self._view:GetChild("player_list_1")
list_view:RemoveChildrenToPool() list_view:RemoveChildrenToPool()
local leftCardAll = self._view:GetChild("leftCardHand") local leftCardAll = self._view:GetChild("leftCardHand")
leftCardAll:RemoveChildrenToPool() leftCardAll:RemoveChildrenToPool()
if remaincards and #remaincards>0 then if remaincards and #remaincards > 0 then
table.sort(remaincards,function (a,b) table.sort(remaincards, function(a, b)
return a % 100 < b % 100 return a % 100 < b % 100
end) end)
for i=1,#remaincards do for i = 1, #remaincards do
local card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_RunFastNew/"..remaincards[i]) local card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_RunFastNew/" .. remaincards[i])
leftCardAll:AddChild(card_code_obj) leftCardAll:AddChild(card_code_obj)
end end
end end
for i = 1, #data do for i = 1, #data do
local player = data[i] local player = data[i]
local item = list_view:AddItemFromPool("ui://Extend_Poker_RunFastNew/clearing_item_1") local item = list_view:AddItemFromPool("ui://Extend_Poker_RunFastNew/clearing_item_1")
local leftCard = item:GetChild("leftCard") local leftCard = item:GetChild("leftCard")
leftCard:RemoveChildrenToPool() leftCard:RemoveChildrenToPool()
-- table.sort(data[i].handCards,function (a,b) -- table.sort(data[i].handCards,function (a,b)
-- return a % 100 < b % 100 -- return a % 100 < b % 100
-- end) -- end)
for j=1,#data[i].handCards do for j = 1, #data[i].handCards do
local code = data[i].handCards[j] local code = data[i].handCards[j]
local card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_RunFastNew/"..code) local card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_RunFastNew/" .. code)
leftCard:AddChild(card_code_obj) leftCard:AddChild(card_code_obj)
end end
@ -123,38 +119,38 @@ function M:InitData_One(data, winseat, over, roomid, remaincards)
-- return a % 100 < b % 100 -- return a % 100 < b % 100
-- end) -- end)
for k=1,#data[i].outCards do
for k = 1, #data[i].outCards do
local code = data[i].outCards[k] local code = data[i].outCards[k]
local card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_RunFastNew/"..code) local card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_RunFastNew/" .. code)
print("==================================================card_code_obj", card_code_obj, code)
leftCard:AddChild(card_code_obj) leftCard:AddChild(card_code_obj)
card_code_obj:GetChildAt(0):GetChildAt(0).color = Color(0.7,0.7,0.7) card_code_obj:GetChildAt(0):GetChildAt(0).color = Color(0.7, 0.7, 0.7)
end end
local boom = item:GetChild("boom") local boom = item:GetChild("boom")
boom.text = player.thisboomnum boom.text = player.thisboomnum
local piao = item:GetChild("piao") local piao = item:GetChild("piao")
if player.piao <= 0 then if player.piao <= 0 then
piao.text = "0" piao.text = "0"
else else
piao.text = "" .. player.piao piao.text = "" .. player.piao
end end
local nichen = item:GetChild("nichen") local nichen = item:GetChild("nichen")
if player.nick ~= nil then if player.nick ~= nil then
-- body -- body
nichen.text = tostring(player.nick) nichen.text = tostring(player.nick)
else else
nichen.text = tostring(player.self_user.nick_name) nichen.text = tostring(player.self_user.nick_name)
end end
local shengpai = item:GetChild("shengpai") local shengpai = item:GetChild("shengpai")
if player.cards ~= nil then if player.cards ~= nil then
-- body -- body
@ -162,23 +158,22 @@ function M:InitData_One(data, winseat, over, roomid, remaincards)
else else
shengpai.text = tostring(#player.hand_list) shengpai.text = tostring(#player.hand_list)
end end
local rt = 1 local rt = 1
if room.hpOnOff == 1 then if room.hpOnOff == 1 then
rt = room.score_times rt = room.score_times
end end
local hp_nonnegative = room:checkHpNonnegative() local hp_nonnegative = room:checkHpNonnegative()
local roundScore = player.winscore local roundScore = player.winscore
if hp_nonnegative then if hp_nonnegative then
local jifen = "" local jifen = ""
if roundScore > 0 then if roundScore > 0 then
jifen = "+" .. roundScore jifen = "+" .. roundScore
else else
jifen = "" .. roundScore jifen = "" .. roundScore
end end
local tili = "" local tili = ""
local limit = "" local limit = ""
if player.hp_info.round_actual_hp > 0 then if player.hp_info.round_actual_hp > 0 then
@ -192,10 +187,9 @@ function M:InitData_One(data, winseat, over, roomid, remaincards)
limit = "达到下限" limit = "达到下限"
end end
end end
item:GetChild("score").text = jifen .. tili .. limit item:GetChild("score").text = jifen .. tili .. limit
else else
local jifen = "" local jifen = ""
if roundScore >= 0 then if roundScore >= 0 then
jifen = "+" .. roundScore jifen = "+" .. roundScore
@ -203,10 +197,9 @@ function M:InitData_One(data, winseat, over, roomid, remaincards)
jifen = "" .. roundScore jifen = "" .. roundScore
end end
jifen = jifen .. " " jifen = jifen .. " "
local tili = "" local tili = ""
if room.hpOnOff > 0 then if room.hpOnOff > 0 then
local need = roundScore * rt local need = roundScore * rt
tili = "(" tili = "("
if roundScore > 0 then if roundScore > 0 then
@ -214,30 +207,27 @@ function M:InitData_One(data, winseat, over, roomid, remaincards)
else else
tili = tili .. tostring(need) tili = tili .. tostring(need)
end end
tili = tili .. ")" tili = tili .. ")"
end end
item:GetChild("score").text = jifen .. tili item:GetChild("score").text = jifen .. tili
end end
if roundScore >= 0 then if roundScore >= 0 then
if room.self_player.seat == player.seat then if room.self_player.seat == player.seat then
-- body -- body
self._view:GetController("result").selectedIndex = 1 self._view:GetController("result").selectedIndex = 1
end end
else else
if room.self_player.seat == player.seat then if room.self_player.seat == player.seat then
self._view:GetController("result").selectedIndex = 0 self._view:GetController("result").selectedIndex = 0
end end
end end
end end
if over == 0 then if over == 0 then
-- body -- body
local btn_confirm = self._view:GetChild("btn_confirm") local btn_confirm = self._view:GetChild("btn_confirm")
@ -245,78 +235,77 @@ function M:InitData_One(data, winseat, over, roomid, remaincards)
self:Destroy() self:Destroy()
local _gamectr = ControllerManager.GetController(GameController) local _gamectr = ControllerManager.GetController(GameController)
_gamectr:ConformToNextGame() _gamectr:ConformToNextGame()
end) end)
else else
self.xiPaiCtr.selectedIndex=0 self.xiPaiCtr.selectedIndex = 0
local btn_confirm = self._view:GetChild("btn_confirm") local btn_confirm = self._view:GetChild("btn_confirm")
btn_confirm.onClick:Set(function() btn_confirm.onClick:Set(function()
--self:Destroy() --self:Destroy()
self:InitData(data, winseat, roomid) self:InitData(data, winseat, roomid)
-- ViewManager.ChangeView(ViewManager.View_Lobby) -- ViewManager.ChangeView(ViewManager.View_Lobby)
end) end)
end end
end end
-- 大结算 -- 大结算
function M:InitData(data, winseat, roomid) function M:InitData(data, winseat, roomid)
self.xiPaiCtr.selectedIndex=0 self.xiPaiCtr.selectedIndex = 0
self._view:GetController("sdk").selectedIndex = 0 self._view:GetController("sdk").selectedIndex = 0
local room = DataManager.CurrenRoom local room = DataManager.CurrenRoom
local rt = 1 local rt = 1
if room.hpOnOff == 1 and room.score_times ~= 1 then if room.hpOnOff == 1 and room.score_times ~= 1 then
rt = room.score_times rt = room.score_times
end end
-- 赋值result_info聊天室分享需要 -- 赋值result_info聊天室分享需要
local player_list = {} local player_list = {}
for i = 1, #data do for i = 1, #data do
player_list[i] = {} player_list[i] = {}
local user = room:GetPlayerBySeat(data[i].seat).self_user local user = room:GetPlayerBySeat(data[i].seat).self_user
player_list[i].id = user.account_id player_list[i].id = user.account_id
player_list[i].score = data[i].score player_list[i].score = data[i].score
player_list[i].hp_info = data[i].hp_info player_list[i].hp_info = data[i].hp_info
player_list[i].house = room.owner_id == player_list[i].id and 1 or 0 player_list[i].house = room.owner_id == player_list[i].id and 1 or 0
player_list[i].nick = user.nick_name player_list[i].nick = user.nick_name
player_list[i].seat = data[i].seat player_list[i].seat = data[i].seat
player_list[i].head_url = data[i].self_user.head_url player_list[i].head_url = data[i].self_user.head_url
if data[i].entrust ~= nil then if data[i].entrust ~= nil then
player_list[i].entrust = data[i].entrust > 0 player_list[i].entrust = data[i].entrust > 0
else else
player_list[i].entrust = false player_list[i].entrust = false
end end
player_list[i].param = {} player_list[i].param = {}
player_list[i].param[1] = {} player_list[i].param[1] = {}
player_list[i].param[1].key = "赢局数:" player_list[i].param[1].key = "赢局数:"
player_list[i].param[1].value = tostring(data[i].settle_log.winnum) player_list[i].param[1].value = tostring(data[i].settle_log.winnum)
player_list[i].param[2] = {} player_list[i].param[2] = {}
player_list[i].param[2].key = "打出炸弹数:" player_list[i].param[2].key = "打出炸弹数:"
player_list[i].param[2].value = tostring(data[i].settle_log.boomnum) player_list[i].param[2].value = tostring(data[i].settle_log.boomnum)
player_list[i].param[3] = {} player_list[i].param[3] = {}
player_list[i].param[3].key = "春天次数:" player_list[i].param[3].key = "春天次数:"
player_list[i].param[3].value = tostring(data[i].settle_log.springnum) player_list[i].param[3].value = tostring(data[i].settle_log.springnum)
player_list[i].param[4] = {} player_list[i].param[4] = {}
player_list[i].param[4].key = "当局最高分:" player_list[i].param[4].key = "当局最高分:"
player_list[i].param[4].value = tostring(data[i].settle_log.maxscore * rt) player_list[i].param[4].value = tostring(data[i].settle_log.maxscore * rt)
if data[i].daniao > 0 then if data[i].daniao > 0 then
player_list[i].flag = {"打鸟"} player_list[i].flag = { "打鸟" }
end end
end end
self:GenerateRoomResultInfo(room.room_config.Times, room.room_config:GetGameName(), room.room_id, room.create_time, player_list) self:GenerateRoomResultInfo(room.room_config.Times, room.room_config:GetGameName(), room.room_id, room.create_time,
player_list)
self:InitBigResult(room) self:InitBigResult(room)
local big_result = self._view:GetChild("big_result") local big_result = self._view:GetChild("big_result")
local lst_p = big_result:GetChild("player_list") local lst_p = big_result:GetChild("player_list")
@ -329,7 +318,6 @@ function M:InitData(data, winseat, roomid)
tem:GetChild("txt_value").textFormat.size = 30 tem:GetChild("txt_value").textFormat.size = 30
end end
end end
end end
return M return M