changhong/lua_probject/extend_project/extend/zipai/fanpaofa/FanPaoFa_ResultView.lua

1103 lines
49 KiB
Lua
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

require('Game.View.ResultView')
local PendulumRule = import('.main.PendulumRule')
local FanPaoFa_ResultView = {}
local M = FanPaoFa_ResultView
function FanPaoFa_ResultView.new(blur_view, index)
setmetatable(M, {__index = ResultView})
local self = setmetatable({}, {__index = M})
self.class = 'FanPaoFa_ResultView'
self._currenIndex = 0
if index ~= 1 then
self._blur_view = blur_view
end
self._close_zone = false
self:init("ui://Extend_Poker_FanPaoFa/clearing")
self.xiPaiCtr=self._view:GetController("xipai")
return self
end
function M:init(url)
ResultView.init(self, url)
local btn_share = self._view:GetChild('btn_share')
btn_share.onClick:Set(
function()
ShareScreenShot()
end
)
end
function M:InitData(over, room, result, total_result, callback)
local _overCtr = self._view:GetController('over')
local btn_confirm = self._view:GetChild('btn_confirm')
local btn_result = self._view:GetChild('btn_showResult')
local _btnCtr = self._view:GetController('button')
local _sdkCtr = self._view:GetController('sdk')
local _icon = self._view:GetChild('win_base')
local btn_close = self._view:GetChild('btn_close')
self._view:GetChild('tex_roomnum').text = room.room_id
self._view:GetChild('tex_data').text = os.date('%Y-%m-%d %H:%M', os.time())
local xpconfig=DataManager.CurrenRoom.room_config.config.xi_pai
if xpconfig then
self.xiPaiCtr.selectedIndex=1
else
self.xiPaiCtr.selectedIndex=0
end
local xipai=self._view:GetChild("btn_xipai")
xipai.touchable=true
xipai.onClick:Add(function()
local xiPaiCallBack=function ()
xipai.touchable=false
self.xiPaiCtr.selectedIndex=0
-- ViewUtil.ErrorTip(1000000,"申请洗牌成功")
local _gamectr = ControllerManager.GetController(GameController)
_gamectr:PlayerReady()
self:Close()
end
local _gamectr = ControllerManager.GetController(GameController)
_gamectr:SendXiPaiAction(xiPaiCallBack)
end)
if result and result.xipai_score then
xipai.text="洗牌 积分x"..result.xipai_score
end
if result ~= nil and result.liuju == true then
_icon.icon = 'ui://Main_RunBeard/liuju'
_btnCtr.selectedIndex = 0
_sdkCtr.selectedIndex = 1
_overCtr.selectedIndex = 2
if over ~= 1 then
btn_confirm.onClick:Add(
function()
local _gamectr = ControllerManager.GetController(GameController)
_gamectr:PlayerReady()
self:Close()
if callback then
callback()
end
end
)
self:AddClearItem(room, result, nil, over)
return
else
self.xiPaiCtr.selectedIndex=0
_btnCtr.selectedIndex = 1
_sdkCtr.selectedIndex = 1
btn_result.onClick:Add(
function()
_overCtr.selectedIndex = 3
_btnCtr.selectedIndex = 0
_sdkCtr.selectedIndex = 0
end
)
btn_close.onClick:Add(
function()
ViewManager.ChangeView(ViewManager.View_Lobby)
end
)
self:AddClearItem(room, result, total_result.info_list, over)
end
end
if over == 0 and result.liuju == false then
--printlog("jiesuanjefeef efef ef1")
_icon.icon = 'ui://Main_RunBeard/jiesuan'
_btnCtr.selectedIndex = 0
_sdkCtr.selectedIndex = 1
_overCtr.selectedIndex = 0
btn_confirm.onClick:Add(
function()
local _gamectr = ControllerManager.GetController(GameController)
_gamectr:PlayerReady()
self:Close()
if callback then
callback()
end
end
)
self:AddClearItem(room, result, nil, over)
elseif over == 1 and result.liuju == false then
_icon.icon = 'ui://Main_RunBeard/jiesuan'
_btnCtr.selectedIndex = 1
_sdkCtr.selectedIndex = 1
_overCtr.selectedIndex = 0
btn_result.onClick:Add(
function()
_overCtr.selectedIndex = 3
_btnCtr.selectedIndex = 0
_sdkCtr.selectedIndex = 0
end
)
btn_close.onClick:Add(
function()
ViewManager.ChangeView(ViewManager.View_Lobby)
end
)
-- 自动跳转
--[[
coroutine.start(
function()
coroutine.wait(3)
_overCtr.selectedIndex = 3
_btnCtr.selectedIndex = 0
_sdkCtr.selectedIndex = 0
end
)
]]
self:AddClearItem(room, result, total_result.info_list, over)
else
if result ~= nil then
if result.liuju == false then
_icon.icon = 'ui://Main_RunBeard/jiesuan'
over = 2
_overCtr.selectedIndex = 3
btn_close.onClick:Add(
function()
ViewManager.ChangeView(ViewManager.View_Lobby)
end
)
self:AddClearItem(room, nil, total_result.info_list, over)
end
else
_icon.icon = 'ui://Main_RunBeard/jiesuan'
over = 2
_overCtr.selectedIndex = 3
self.xiPaiCtr.selectedIndex=0
btn_close.onClick:Add(
function()
ViewManager.ChangeView(ViewManager.View_Lobby)
end
)
self:AddClearItem(room, nil, total_result.info_list, over)
end
end
end
function M:AddClearItem(room, data, total_data, over)
local n = over + 1
local list_view1 = self._view:GetChild('player_list')
local list_view2 = self._view:GetChild('player_list_2')
if data ~= nil and data.liuju == true then
self:FillLiuJuItemData(room, data,list_view1)
if over == 1 then
self:FillItemData2(room, total_data, list_view2)
end
else
if 0 == over or 1 == over and data.liuju == false then
self:FillItemData(room, data, list_view1)
if 1 == over then
self:FillItemData2(room, total_data, list_view2)
end
elseif 2 == over then
self:FillItemData2(room, total_data, list_view2)
end
end
end
function M:GetPos(room, seat)
return ViewUtil.GetPos(room.self_player.seat, seat, room.room_config.people_num)
end
function M:FillLiuJuItemData(room, data,item)
--流局
local qipai_list = self._view:GetChild('qipai_listl')
local _dipaiC = self._view:GetController('qipai')
qipai_list:RemoveChildrenToPool()
--[[ if data.throw_card ~= nil and #data.throw_card > 0 then
_dipaiC.selectedIndex = 1
local hand_card = PendulumRule.GetHandCard(data.throw_card, 3)
for k = 1, #hand_card do
local cards = qipai_list:AddItemFromPool()
for j = 1, #hand_card[k] do
cards:GetChild('card_' .. (j)).icon = self:getCardItem('ui://Main_RunBeard/202_', hand_card[k][j])
end
end
else
_dipaiC.selectedIndex = 0
end]]
for i = 1, #data.info_list do
if data.info_list[i].seat == room.banker_seat then
local p = room:GetPlayerBySeat(data.info_list[i].seat)
self._view:GetChild('WinerName').text = p.self_user.nick_name
self._view:GetChild("WinerID").text = "ID:"..p.self_user.account_id
local btn_head = self._view:GetChild('btn_head')
ImageLoad.Load(p.self_user.head_url, btn_head._iconObject)
end
printlog("ddddd==========")
printlog(room.banker_seat)
printlog(data.info_list[i].seat)
if data.info_list[i].seat == room.banker_seat then
local card_list
--[[if #data.info_list == 2 then
card_list = self._view:GetChild('card_list_2')
else
if self:GetPos(room, data.info_list[i].seat) == 2 then
card_list = self._view:GetChild('card_list_1')
else
card_list = self._view:GetChild('card_list_3')
end
end]]
card_list = self._view:GetChild('card_list_2')
card_list.visible =true
card_list:RemoveChildrenToPool()
for k = 1, #data.info_list[i].opCardList do
local fztype = data.info_list[i].opCardList[k].type
if fztype == RB_FZType.Kan then
local cards = card_list:AddItemFromPool()
cards:GetController('c1').selectedIndex = 1
cards:GetChild('card_type').text = ''
cards:GetChild('card_huxi').text = data.info_list[i].opCardList[k].hu_xi
for j = 1, 3 do
cards:GetChild('card_' .. j).icon = self:getCardItem('ui://Main_RunBeard/202_', data.info_list[i].opCardList[k].card1)
end
elseif fztype == RB_FZType.Peng then
local cards = card_list:AddItemFromPool()
cards:GetController('c1').selectedIndex = 2
cards:GetChild('card_type').text = ''
cards:GetChild('card_huxi').text = data.info_list[i].opCardList[k].hu_xi
for j = 1, 3 do
cards:GetChild('card_' .. j).icon =
self:getCardItem('ui://Main_RunBeard/202_', data.info_list[i].opCardList[k].card1)
end
elseif fztype == RB_FZType.Wei or fztype == RB_FZType.ChouWei then
local cards = card_list:AddItemFromPool()
cards:GetController('c1').selectedIndex = 1
cards:GetChild('card_type').text = ''
cards:GetChild('card_huxi').text = data.info_list[i].opCardList[k].hu_xi
for j = 1, 3 do
cards:GetChild('card_' .. j).icon = self:getCardItem('ui://Main_RunBeard/202_', data.info_list[i].opCardList[k].card1)
end
elseif fztype == RB_FZType.Ti then
local cards = card_list:AddItemFromPool()
cards:GetController('c1').selectedIndex = 2
cards:GetChild('card_type').text = ''
cards:GetChild('card_huxi').text = data.info_list[i].opCardList[k].hu_xi
for j = 1, 4 do
cards:GetChild('card_' .. j).icon = self:getCardItem('ui://Main_RunBeard/202_', data.info_list[i].opCardList[k].card1)
end
elseif fztype == RB_FZType.Pao then
local cards = card_list:AddItemFromPool()
cards:GetController('c1').selectedIndex = 2
cards:GetChild('card_type').text = ''
cards:GetChild('card_huxi').text = data.info_list[i].opCardList[k].hu_xi
for j = 1, 4 do
cards:GetChild('card_' .. j).icon = self:getCardItem('ui://Main_RunBeard/202_', data.info_list[i].opCardList[k].card1)
end
elseif fztype == RB_FZType.Chi then
local cards = card_list:AddItemFromPool()
cards:GetController('c1').selectedIndex = 1
cards:GetChild('card_type').text = ''
cards:GetChild('card_huxi').text = data.info_list[i].opCardList[k].hu_xi
cards:GetChild('card_1').icon =
self:getCardItem('ui://Main_RunBeard/202_', data.info_list[i].opCardList[k].card1)
cards:GetChild('card_2').icon =
self:getCardItem('ui://Main_RunBeard/202_', data.info_list[i].opCardList[k].card2)
cards:GetChild('card_3').icon =
self:getCardItem('ui://Main_RunBeard/202_', data.info_list[i].opCardList[k].card3)
else
local cards = card_list:AddItemFromPool()
cards:GetController('c1').selectedIndex = 1
cards:GetChild('card_type').text = ''
cards:GetChild('card_huxi').text = data.info_list[i].opCardList[k].hu_xi
cards:GetChild('card_1').icon =
self:getCardItem('ui://Main_RunBeard/202_', data.info_list[i].opCardList[k].card1)
cards:GetChild('card_2').icon =
self:getCardItem('ui://Main_RunBeard/202_', data.info_list[i].opCardList[k].card2)
end
end
local hand_card = {}
if #data.info_list[i].hand_card>=2 then
hand_card = PendulumRule.GetHandCard(data.info_list[i].hand_card, 3)
for k = 1, #hand_card do
local cards = card_list:AddItemFromPool()
cards:GetController('c1').selectedIndex = 2
cards:GetChild('card_huxi').text = hand_card[k].hu_xi
for j = 1, #hand_card[k] do
cards:GetChild('card_' .. (j)).icon =
self:getCardItem('ui://Main_RunBeard/202_', hand_card[k][j])
end
end
else
hand_card = data.info_list[i].hand_card
local item = card_list:AddItemFromPool()
item:GetController('c1').selectedIndex = 1
for j = 1, #hand_card do
item:GetChild('card_' .. (j)).icon = self:getCardItem('ui://Main_RunBeard/202_', hand_card[j])
end
end
end
end
item:RemoveChildrenToPool()
local info_list = data.info_list
for i = 1, #info_list do
if info_list[i].is_win == false and info_list[i].seat ~= room.banker_seat then
local player = item:AddItemFromPool()
local p = room:GetPlayerBySeat(info_list[i].seat)
if p.self_user.account_id == room.owner_id then
player:GetController('owner').selectedIndex = 1
end
if p.seat == room.banker_seat then
player:GetController('bank').selectedIndex = 1
end
local btn_head = player:GetChild('btn_head')
ImageLoad.Load(p.self_user.head_url, btn_head._iconObject)
player:GetChild('playerName').text = p.self_user.nick_name
if info_list[i].round_score >= 0 then
player:GetChild('score').text = '+' .. info_list[i].round_score
player:GetChild('score').grayed = false
else
player:GetChild('score').text = info_list[i].round_score
player:GetChild('score').grayed = true
end
local hp_info = info_list[i].hp_info
player:GetChild("txt_userid").text = p.self_user.account_id
if (hp_info ~= nil and room.hpOnOff == 1 or room:checkHpNonnegative()) then
local isupper_limit = hp_info.upper_limit -- // 输赢是否已达上限
if (isupper_limit) then
player:GetChild('yidashangxian').text = '已达上限'
else
player:GetChild('yidashangxian').text = ''
end
end
local card_list = player:GetChild('card_list')
card_list:RemoveChildrenToPool()
for k = 1, #info_list[i].opCardList do
local fztype = info_list[i].opCardList[k].type
if fztype == RB_FZType.Chi then
local cards = card_list:AddItemFromPool()
cards:GetController('c1').selectedIndex = 2
cards:GetChild('card_type').text = ''
cards:GetChild('card_huxi').text = info_list[i].opCardList[k].hu_xi
cards:GetChild('card_1').icon =
self:getCardItem('ui://Main_RunBeard/202_', info_list[i].opCardList[k].card1)
cards:GetChild('card_2').icon =
self:getCardItem('ui://Main_RunBeard/202_', info_list[i].opCardList[k].card2)
cards:GetChild('card_3').icon =
self:getCardItem('ui://Main_RunBeard/202_', info_list[i].opCardList[k].card3)
elseif fztype == RB_FZType.Peng then
local cards = card_list:AddItemFromPool()
cards:GetController('c1').selectedIndex = 2
cards:GetChild('card_type').text = ''
cards:GetChild('card_huxi').text = info_list[i].opCardList[k].hu_xi
for j = 1, 3 do
cards:GetChild('card_' .. j).icon =
self:getCardItem('ui://Main_RunBeard/202_', info_list[i].opCardList[k].card1)
end
elseif fztype == RB_FZType.Kan then
local cards = card_list:AddItemFromPool()
cards:GetController('c1').selectedIndex = 2
cards:GetChild('card_type').text = ''
cards:GetChild('card_huxi').text = info_list[i].opCardList[k].hu_xi
for j = 1, 3 do
cards:GetChild('card_' .. j).icon =
self:getCardItem('ui://Main_RunBeard/202_', info_list[i].opCardList[k].card1)
end
elseif fztype == RB_FZType.Wei or fztype == RB_FZType.ChouWei then
local cards = card_list:AddItemFromPool()
cards:GetController('c1').selectedIndex = 2
cards:GetChild('card_type').text = ''
cards:GetChild('card_huxi').text = info_list[i].opCardList[k].hu_xi
for j = 1, 3 do
cards:GetChild('card_' .. j).icon =
self:getCardItem('ui://Main_RunBeard/202_', info_list[i].opCardList[k].card1)
end
elseif fztype == RB_FZType.Pao then
local cards = card_list:AddItemFromPool()
cards:GetController('c1').selectedIndex = 2
cards:GetChild('card_type').text = ''
cards:GetChild('card_huxi').text = info_list[i].opCardList[k].hu_xi
for j = 1, 4 do
cards:GetChild('card_' .. j).icon =
self:getCardItem('ui://Main_RunBeard/202_', info_list[i].opCardList[k].card1)
end
elseif fztype == RB_FZType.Ti then
local cards = card_list:AddItemFromPool()
cards:GetController('c1').selectedIndex = 2
cards:GetChild('card_type').text = ''
cards:GetChild('card_huxi').text = info_list[i].opCardList[k].hu_xi
for j = 1, 4 do
cards:GetChild('card_' .. j).icon =
self:getCardItem('ui://Main_RunBeard/202_', info_list[i].opCardList[k].card1)
end
else
local cards = card_list:AddItemFromPool()
cards:GetController('c1').selectedIndex = 1
cards:GetChild('card_type').text = ''
cards:GetChild('card_huxi').text = info_list[i].opCardList[k].hu_xi
cards:GetChild('card_1').icon =
self:getCardItem('ui://Main_RunBeard/202_', info_list[i].opCardList[k].card1)
cards:GetChild('card_2').icon =
self:getCardItem('ui://Main_RunBeard/202_', info_list[i].opCardList[k].card2)
end
end
if #info_list[i].hand_card > 0 then
--local hand_card = PendulumRule.GetHandCard(info_list[i].hand_card, 3)
local hand_card
if #info_list[i].hand_card>2 then
hand_card = PendulumRule.GetHandCard(info_list[i].hand_card, 3)
for k = 1, #hand_card do
local cards = card_list:AddItemFromPool()
cards:GetController('c1').selectedIndex = 2
cards:GetChild('card_huxi').text = hand_card[k].hu_xi
for j = 1, #hand_card[k] do
cards:GetChild('card_' .. (j)).icon =
self:getCardItem('ui://Main_RunBeard/202_', hand_card[k][j])
end
end
else
hand_card = info_list[i].hand_card
local cards = card_list:AddItemFromPool()
cards:GetController('c1').selectedIndex = 2
for j = 1, #hand_card do
cards:GetChild('card_' .. (j)).icon =
self:getCardItem('ui://Main_RunBeard/202_', hand_card[j])
end
end
end
end
end
end
function M:FillItemData(room, data, item)
--printlog("FillItemData11")
--有赢结算
local dipai_list = self._view:GetChild('dipai_list')
dipai_list:RemoveChildren(0, -1, true)
if data.left_card ~= nil and #data.left_card > 0 then
for i = 1, #data.left_card do
local dipais = UIPackage.CreateObjectFromURL('ui://Main_RunBeard/Qipais')
dipais:GetChild('icon').icon = self:getCardItem('ui://Main_RunBeard/202_', data.left_card[i])
dipai_list:AddChild(dipais)
end
end
local qipai_list = self._view:GetChild('qipai_list')
local _dipaiC = self._view:GetController('qipai')
--printlog("FillItemData113")
qipai_list:RemoveChildrenToPool()
if data.throw_card ~= nil and #data.throw_card > 0 then
_dipaiC.selectedIndex = 1
local hand_card = PendulumRule.GetHandCard(data.throw_card, 3)
for k = 1, #hand_card do
local cards = qipai_list:AddItemFromPool()
for j = 1, #hand_card[k] do
cards:GetChild('card_' .. (j)).icon = self:getCardItem('ui://Main_RunBeard/202_', hand_card[k][j])
end
end
else
_dipaiC.selectedIndex = 0
end
--printlog("FillItemData112")
local info_list = data.info_list
local Yes_win = false
local win_data = {}
for i = 1, #info_list do
if info_list[i].is_win == true then
Yes_win = true
win_data = info_list[i]
end
end
if win_data.seat == room.self_player.seat then
self._view:GetChild('show_win').visible = true
self._view:GetChild('show_low').visible = false
else
self._view:GetChild('show_win').visible = false
self._view:GetChild('show_low').visible = true
end
--printlog("FillItemData11eww")
if Yes_win == true then
local isWin_Card = true
local p = room:GetPlayerBySeat(win_data.seat)
if p.self_user.account_id == room.owner_id then
self._view:GetController('owner').selectedIndex = 1
end
if p.seat == room.banker_seat then
self._view:GetController('bank').selectedIndex = 1
end
self._view:GetChild('WinerName').text = p.self_user.nick_name
self._view:GetChild("WinerID").text = "ID:"..p.self_user.account_id
--self._view:GetChild('chongtunshu').text = '充囤:' .. room.room_config.tun .. ' 囤'
self._view:GetChild('huxi').text = '胡 息:+' .. win_data.hu_xi
-- self._view:GetChild('tunshu').text = '基础囤数:' .. win_data.tun
-- self._view:GetChild('zongtunshu').text = '总囤数:' .. win_data.total_tun
if win_data.total_score >= 0 then
self._view:GetChild('score').text = '总胡息:+' .. win_data.total_score
self._view:GetChild('score').grayed = false
else
self._view:GetChild('score').text = '总胡息:' .. win_data.total_score
self._view:GetChild('score').grayed = true
end
local hp_info = win_data.hp_info
self._view:GetController("hudianpao").selectedIndex = win_data.hu_type
self._view:GetChild("fangpaoscore").text = "放炮扣息:-"..win_data.fangpaoscore
if (hp_info ~= nil and room.hpOnOff == 1 or room:checkHpNonnegative()) then
local isupper_limit = hp_info.upper_limit -- // 输赢是否已达上限
if (isupper_limit) then
self._view:GetChild('yidashangxian').text = '已达上限'
else
self._view:GetChild('yidashangxian').text = ''
end
end
local btn_head = self._view:GetChild('btn_head')
ImageLoad.Load(p.self_user.head_url, btn_head._iconObject)
local fullname_list = self._view:GetChild('fullname_list')
fullname_list:RemoveChildren(0, -1, true)
if win_data.mingtang ~= nil and #win_data.mingtang > 0 then
for i = 1, #win_data.mingtang do
local dipais = UIPackage.CreateObjectFromURL('ui://Extend_Poker_FanPaoFa/FullName')
dipais:GetChild('n0').icon = 'ui://Extend_Poker_FanPaoFa/hu_' .. win_data.mingtang[i].mingtang
if win_data.mingtang[i].type == 1 and win_data.mingtang[i].score ~= 0 then
dipais:GetChild('n2').text = win_data.mingtang[i].score .. ''
elseif win_data.mingtang[i].type == 2 and win_data.mingtang[i].score ~= 0 then
dipais:GetChild('n2').text = win_data.mingtang[i].score .. ''
elseif win_data.mingtang[i].type == 3 and win_data.mingtang[i].score ~= 0 then
dipais:GetChild('n2').text = win_data.mingtang[i].score .. ''
end
fullname_list:AddChild(dipais)
end
end
local card_list = self._view:GetChild('card_list')
card_list:RemoveChildrenToPool()
--[[ if #win_data.cardList > 0 then
for i = 1, #win_data.cardList do
-- 1 是对子 2 是三个的
local fztype = win_data.cardList[i].type
if fztype == 1 then
local cards = card_list:AddItemFromPool()
cards:GetChild('card_type').text = '将'
cards:GetChild('card_huxi').text = win_data.cardList[i].hu_xi
cards:GetController('c1').selectedIndex = 0
if win_data.cardList[i].card1 == win_data.win_card and isWin_Card == true then
isWin_Card = false
cards:GetController('hu').selectedIndex = 1
end
for j = 1, 2 do
cards:GetChild('card_' .. j).icon =
self:getCardItem('ui://Main_RunBeard/201_', win_data.cardList[i].card1)
end
else
local cards = card_list:AddItemFromPool()
cards:GetChild('card_type').text = '顺'
if
win_data.cardList[i].card1 == win_data.cardList[i].card2 and
win_data.cardList[i].card1 == win_data.cardList[i].card3
then
cards:GetChild('card_type').text = '碰'
end
cards:GetChild('card_huxi').text = win_data.cardList[i].hu_xi
cards:GetController('c1').selectedIndex = 1
cards:GetChild('card_1').icon =
self:getCardItem('ui://Main_RunBeard/201_', win_data.cardList[i].card1)
cards:GetChild('card_2').icon =
self:getCardItem('ui://Main_RunBeard/201_', win_data.cardList[i].card2)
cards:GetChild('card_3').icon =
self:getCardItem('ui://Main_RunBeard/201_', win_data.cardList[i].card3)
if isWin_Card == true then
if win_data.cardList[i].card1 == win_data.win_card then
isWin_Card = false
cards:GetController('hu').selectedIndex = 1
elseif win_data.cardList[i].card2 == win_data.win_card then
isWin_Card = false
cards:GetController('hu').selectedIndex = 2
elseif win_data.cardList[i].card3 == win_data.win_card then
isWin_Card = false
cards:GetController('hu').selectedIndex = 3
end
end
end
end
end]]
for i = 1, #win_data.opCardList do
local fztype = win_data.opCardList[i].type
if fztype == RB_FZType.Chi then
local cards = card_list:AddItemFromPool()
cards:GetChild('card_type').text = ''
cards:GetChild('card_huxi').text = win_data.opCardList[i].hu_xi
cards:GetController('c1').selectedIndex = 1
cards:GetChild('card_1').icon =
self:getCardItem('ui://Main_RunBeard/201_', win_data.opCardList[i].card1)
cards:GetChild('card_2').icon =
self:getCardItem('ui://Main_RunBeard/201_', win_data.opCardList[i].card2)
cards:GetChild('card_3').icon =
self:getCardItem('ui://Main_RunBeard/201_', win_data.opCardList[i].card3)
if isWin_Card == true then
if win_data.opCardList[i].card1 == win_data.win_card then
isWin_Card = false
cards:GetController('hu').selectedIndex = 1
elseif win_data.opCardList[i].card2 == win_data.win_card then
isWin_Card = false
cards:GetController('hu').selectedIndex = 2
elseif win_data.opCardList[i].card3 == win_data.win_card then
isWin_Card = false
cards:GetController('hu').selectedIndex = 3
end
end
elseif fztype == RB_FZType.Peng then
local cards = card_list:AddItemFromPool()
cards:GetChild('card_type').text = ''
cards:GetChild('card_huxi').text = win_data.opCardList[i].hu_xi
cards:GetController('c1').selectedIndex = 1
for j = 1, 3 do
cards:GetChild('card_' .. j).icon =
self:getCardItem('ui://Main_RunBeard/201_', win_data.opCardList[i].card1)
end
if win_data.opCardList[i].card1 == win_data.win_card and isWin_Card == true then
isWin_Card = false
cards:GetController('hu').selectedIndex = 1
end
elseif fztype == RB_FZType.Kan then
local cards = card_list:AddItemFromPool()
cards:GetChild('card_type').text = ''
cards:GetChild('card_huxi').text = win_data.opCardList[i].hu_xi
cards:GetController('c1').selectedIndex = 1
if win_data.opCardList[i].card1 == win_data.win_card and isWin_Card == true then
isWin_Card = false
cards:GetController('hu').selectedIndex = 1
end
for j = 1, 3 do
cards:GetChild('card_' .. j).icon =
self:getCardItem('ui://Main_RunBeard/201_', win_data.opCardList[i].card1)
end
elseif fztype == RB_FZType.Wei or fztype == RB_FZType.ChouWei then
local cards = card_list:AddItemFromPool()
cards:GetChild('card_type').text = ''
cards:GetChild('card_huxi').text = win_data.opCardList[i].hu_xi
cards:GetController('c1').selectedIndex = 1
if win_data.opCardList[i].card1 == win_data.win_card and isWin_Card == true then
isWin_Card = false
cards:GetController('hu').selectedIndex = 1
end
for j = 1, 3 do
cards:GetChild('card_' .. j).icon =
self:getCardItem('ui://Main_RunBeard/201_', win_data.opCardList[i].card1)
end
elseif fztype == RB_FZType.Pao then
local cards = card_list:AddItemFromPool()
cards:GetChild('card_type').text = ''
cards:GetChild('card_huxi').text = win_data.opCardList[i].hu_xi
cards:GetController('c1').selectedIndex = 2
if win_data.opCardList[i].card1 == win_data.win_card and isWin_Card == true then
isWin_Card = false
cards:GetController('hu').selectedIndex = 1
end
for j = 1, 4 do
cards:GetChild('card_' .. j).icon =
self:getCardItem('ui://Main_RunBeard/201_', win_data.opCardList[i].card1)
end
elseif fztype == RB_FZType.Ti then
local cards = card_list:AddItemFromPool()
cards:GetChild('card_type').text = ''
cards:GetChild('card_huxi').text = win_data.opCardList[i].hu_xi
cards:GetController('c1').selectedIndex = 2
if win_data.opCardList[i].card1 == win_data.win_card and isWin_Card == true then
isWin_Card = false
cards:GetController('hu').selectedIndex = 1
end
for j = 1, 4 do
cards:GetChild('card_' .. j).icon =
self:getCardItem('ui://Main_RunBeard/201_', win_data.opCardList[i].card1)
end
else
local cards = card_list:AddItemFromPool()
cards:GetChild('card_type').text = ''
cards:GetChild('card_huxi').text = win_data.opCardList[i].hu_xi
cards:GetController('c1').selectedIndex = 0
if win_data.opCardList[i].card1 == win_data.win_card and isWin_Card == true then
isWin_Card = false
cards:GetController('hu').selectedIndex = 0
end
cards:GetChild('card_1').icon =
self:getCardItem('ui://Main_RunBeard/202_', win_data.opCardList[i].card1)
cards:GetChild('card_2').icon =
self:getCardItem('ui://Main_RunBeard/202_', win_data.opCardList[i].card1)
end
end
--printlog("FillItemData11333333")
--[[ if #win_data.hand_card > 0 then
for i = 1, #win_data.hand_card, 4 do
local cards = card_list:AddItemFromPool()
cards:GetChild('card_type').text = '散'
cards:GetChild('card_huxi').text = 0
cards:GetController('c1').selectedIndex = 2
for j = 0, 3 do
if (i + j) <= #win_data.hand_card then
cards:GetChild('card_' .. (j + 1)).icon =
self:getCardItem('ui://Main_RunBeard/201_', win_data.hand_card[i + j])
if win_data.hand_card[i + j] == win_data.win_card and isWin_Card == true then
isWin_Card = false
cards:GetController('hu').selectedIndex = j + 1
end
end
end
end
end]]
end
item:RemoveChildrenToPool()
--printlog("FillItemData133331")
for i = 1, #info_list do
if info_list[i].is_win == false then
local player = item:AddItemFromPool()
local p = room:GetPlayerBySeat(info_list[i].seat)
if p.self_user.account_id == room.owner_id then
player:GetController('owner').selectedIndex = 1
end
if p.seat == room.banker_seat then
player:GetController('bank').selectedIndex = 1
end
local btn_head = player:GetChild('btn_head')
ImageLoad.Load(p.self_user.head_url, btn_head._iconObject)
player:GetChild('playerName').text = p.self_user.nick_name
if info_list[i].round_score >= 0 then
player:GetChild('score').text = '+' .. info_list[i].round_score
player:GetChild('score').grayed = false
else
player:GetChild('score').text = info_list[i].round_score
player:GetChild('score').grayed = true
end
local hp_info = info_list[i].hp_info
player:GetChild("txt_userid").text = p.self_user.account_id
if (hp_info ~= nil and room.hpOnOff == 1 or room:checkHpNonnegative()) then
local isupper_limit = hp_info.upper_limit -- // 输赢是否已达上限
if (isupper_limit) then
player:GetChild('yidashangxian').text = '已达上限'
else
player:GetChild('yidashangxian').text = ''
end
end
local card_list = player:GetChild('card_list')
card_list:RemoveChildrenToPool()
for k = 1, #info_list[i].opCardList do
local fztype = info_list[i].opCardList[k].type
if fztype == RB_FZType.Chi then
local cards = card_list:AddItemFromPool()
cards:GetChild('card_type').text = ''
cards:GetChild('card_huxi').text = info_list[i].opCardList[k].hu_xi
cards:GetController('c1').selectedIndex = 1
cards:GetChild('card_1').icon =
self:getCardItem('ui://Main_RunBeard/202_', info_list[i].opCardList[k].card1)
cards:GetChild('card_2').icon =
self:getCardItem('ui://Main_RunBeard/202_', info_list[i].opCardList[k].card2)
cards:GetChild('card_3').icon =
self:getCardItem('ui://Main_RunBeard/202_', info_list[i].opCardList[k].card3)
elseif fztype == RB_FZType.Peng then
local cards = card_list:AddItemFromPool()
cards:GetChild('card_type').text = ''
cards:GetChild('card_huxi').text = info_list[i].opCardList[k].hu_xi
cards:GetController('c1').selectedIndex = 1
for j = 1, 3 do
cards:GetChild('card_' .. j).icon =
self:getCardItem('ui://Main_RunBeard/202_', info_list[i].opCardList[k].card1)
end
elseif fztype == RB_FZType.Kan then
local cards = card_list:AddItemFromPool()
cards:GetChild('card_type').text = ''
cards:GetChild('card_huxi').text = info_list[i].opCardList[k].hu_xi
cards:GetController('c1').selectedIndex = 1
for j = 1, 3 do
cards:GetChild('card_' .. j).icon =
self:getCardItem('ui://Main_RunBeard/202_', info_list[i].opCardList[k].card1)
end
elseif fztype == RB_FZType.Wei or fztype == RB_FZType.ChouWei then
local cards = card_list:AddItemFromPool()
cards:GetChild('card_type').text = ''
cards:GetChild('card_huxi').text = info_list[i].opCardList[k].hu_xi
cards:GetController('c1').selectedIndex = 1
for j = 1, 3 do
cards:GetChild('card_' .. j).icon =
self:getCardItem('ui://Main_RunBeard/202_', info_list[i].opCardList[k].card1)
end
elseif fztype == RB_FZType.Pao then
local cards = card_list:AddItemFromPool()
cards:GetChild('card_type').text = ''
cards:GetChild('card_huxi').text = info_list[i].opCardList[k].hu_xi
cards:GetController('c1').selectedIndex = 2
for j = 1, 4 do
cards:GetChild('card_' .. j).icon =
self:getCardItem('ui://Main_RunBeard/202_', info_list[i].opCardList[k].card1)
end
elseif fztype == RB_FZType.Ti then
local cards = card_list:AddItemFromPool()
cards:GetChild('card_type').text = ''
cards:GetChild('card_huxi').text = info_list[i].opCardList[k].hu_xi
cards:GetController('c1').selectedIndex = 2
for j = 1, 4 do
cards:GetChild('card_' .. j).icon =
self:getCardItem('ui://Main_RunBeard/202_', info_list[i].opCardList[k].card1)
end
else
local cards = card_list:AddItemFromPool()
cards:GetChild('card_type').text = ''
cards:GetChild('card_huxi').text = info_list[i].opCardList[k].hu_xi
cards:GetController('c1').selectedIndex = 0
cards:GetChild('card_1').icon =
self:getCardItem('ui://Main_RunBeard/202_', info_list[i].opCardList[k].card1)
cards:GetChild('card_2').icon =
self:getCardItem('ui://Main_RunBeard/202_', info_list[i].opCardList[k].card2)
end
end
if #info_list[i].hand_card > 0 then
local hand_card = PendulumRule.GetHandCard(info_list[i].hand_card, 3)
for k = 1, #hand_card do
local cards = card_list:AddItemFromPool()
cards:GetController('c1').selectedIndex = 2
for j = 1, #hand_card[k] do
cards:GetChild('card_' .. (j)).icon =
self:getCardItem('ui://Main_RunBeard/202_', hand_card[k][j])
end
end
end
-- self._view:GetChild('score_shu').text = '总胡息:' .. info_list[i].total_score
end
--printlog("FillItemData1ssssseee1")
end
end
function M:FillItemData2(room, data, list)
-- 赋值result_info聊天室分享需要
local player_list = {}
for i = 1, #data do
player_list[i] = {}
local user = room:GetPlayerBySeat(data[i].seat).self_user
local p = room:GetPlayerBySeat(data[i].seat)
player_list[i].id = user.account_id
player_list[i].userId = user.account_id
local total_score = data[i].total_score
player_list[i].hp_info = data[i].hp_info
player_list[i].score = total_score
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].head_url = user.head_url
local entrust = data[i].entrust
if entrust == nil then
entrust = false
end
player_list[i].entrust = entrust
player_list[i].param = {}
local wcount = 0 --总胡次数
if (data[i].hupai_count ~= nil) then
wcount = data[i].hupai_count
end
local dpcount = 0
if (data[i].dianpao_count ~= nil) then
dpcount = data[i].dianpao_count
end
local tpcount = 0
if (data[i].tipai_count ~= nil) then
tpcount = data[i].tipai_count
end
local ppcount = 0
if (data[i].paopai_count ~= nil) then
ppcount = data[i].paopai_count
end
local dncount =0
if (data[i].niaoscore ~= nil) then
dncount = data[i].niaoscore
end
player_list[i].param[1] = {}
player_list[i].param[1].key = '胡牌次数:'
player_list[i].param[1].value = tostring(wcount)
player_list[i].param[2] = {}
player_list[i].param[2].key = '点炮总数:'
player_list[i].param[2].value = tostring(dpcount)
player_list[i].param[3] = {}
player_list[i].param[3].key = '提牌总数:'
player_list[i].param[3].value = tostring(tpcount)
player_list[i].param[4] = {}
player_list[i].param[4].key = '跑牌总数:'
player_list[i].param[4].value = tostring(ppcount)
player_list[i].param[5] = {}
player_list[i].param[5].key = '打鸟总分:'
player_list[i].param[5].value = tostring(dncount)
player_list[i].param[6] = {}
player_list[i].param[6].key = '[u][color=#0000FF]总胡息:[/color][/u]'
player_list[i].param[6].value = '[u][color=#0000FF]'..tostring(data[i].total_huxi)..'[/color][/u]'
end
local round = room.room_config.round
self:GenerateRoomResultInfo(round, room.room_config:GetGameName(), room.room_id, room.create_time, player_list)
self:SetGSListlineGap(0)
-- room.room_config.isNonnegative = 0
self:InitBigResult(room, 30)
DataManager.CurrenRoom = nil
-- list:RemoveChildrenToPool()
-- for i =1, #data do
-- local total_score = room:GetTotalScore(data[i].total_score)
-- local item = list:AddItemFromPool()
-- local p = room:GetPlayerBySeat(data[i].seat)
-- if p.self_user.account_id == room.owner_id then
-- item:GetController("owner").selectedIndex = 1
-- end
-- local btn_head = item:GetChild("btn_head")
-- ImageLoad.Load(p.self_user.head_url, btn_head._iconObject)
-- item:GetChild("win_count").text = "胡牌次数:"..data[i].win_count.."次"
-- item:GetChild("total_huxi").text = "胡息总数:"..data[i].total_huxi
-- --点赞
-- self:Click_zan(item, p.self_user.account_id)
-- item:GetChild("name").text = p.self_user.nick_name
-- local hp_info = data[i].hp_info
-- if(hp_info ~=nil and room.hpOnOff == 1 or room:checkHpNonnegative()) then
-- -- --体力值
-- -- local round_actual_hp = d2ad(hp_info.round_actual_hp) --// 本局实际输赢体力值
-- local isupper_limit = hp_info.upper_limit -- // 输赢是否已达上限
-- if(isupper_limit)then
-- item:GetChild("yidashangxian").text = "已达上限"
-- else
-- item:GetChild("yidashangxian").text = ""
-- end
-- end
-- local x = room:GetOriginScore(total_score)
-- if total_score >= 0 then
-- item:GetChild("score").text = "+"..x
-- item:GetChild("score").grayed = false
-- else
-- item:GetChild("score").text = x
-- item:GetChild("score").grayed = true
-- end
-- if room.hpOnOff == 1 and room.score_times ~= 1 or room:checkHpNonnegative() then
-- item:GetController("bei") .selectedIndex=1
-- item:GetChild("sss").text = room.score_times
-- if(hp_info ~= nil)then
-- local round_actual_hp = d2ad(hp_info.total_hp) --// 本局实际输赢体力值
-- total_score = round_actual_hp
-- end
-- if total_score >= 0 then
-- item:GetChild("score1").text = "+"..total_score
-- item:GetChild("score1").grayed = false
-- else
-- item:GetChild("score1").text = total_score
-- item:GetChild("score1").grayed = true
-- end
-- end
-- if #data ==3 then
-- if i ==1 then
-- if total_score >data[2].total_score and total_score >data[3].total_score then
-- item:GetController("winer") .selectedIndex=1
-- end
-- elseif i ==2 then
-- if total_score >data[1].total_score and total_score >data[3].total_score then
-- item:GetController("winer") .selectedIndex=1
-- end
-- elseif i ==3 then
-- if total_score >data[2].total_score and total_score >data[1].total_score then
-- item:GetController("winer") .selectedIndex=1
-- end
-- end
-- else
-- if i ==1 then
-- if total_score >data[2].total_score then
-- item:GetController("winer") .selectedIndex=1
-- end
-- elseif i ==2 then
-- if total_score >data[1].total_score then
-- item:GetController("winer") .selectedIndex=1
-- end
-- end
-- end
-- end
-- DataManager.CurrenRoom = nil
end
function M:LoadHead(p, room)
local btn_head = self._view:GetChild('btn_head')
for i = 1, #room.player_list do
local player = room.player_list[i]
if p.seat == player.seat and player.self_user.head_url ~= '' then
ImageLoad.Load(player.self_user.head_url, btn_head.icon)
end
end
end
function M:getCardItem(card_1, card_2)
local _room = DataManager.CurrenRoom
if _room ~= nil and _room.change_card_display ~= nil then
return card_1 .. _room.change_card_display .. card_2
else
return card_1 .. '6_' .. card_2
end
end
return M