放大和博精显示测试

master
罗家炜 2025-04-11 11:23:14 +08:00
parent ba2c17f306
commit 944b9ed164
21 changed files with 517 additions and 549 deletions

View File

@ -152,9 +152,9 @@ function ViewUtil.CardPos(obj, area, oder, index, offset, isAdd, padding)
obj.x = (area.width - obj.width) - index * (obj.width + padding) - offset obj.x = (area.width - obj.width) - index * (obj.width + padding) - offset
elseif oder == AreaOderType.down_up then elseif oder == AreaOderType.down_up then
if isAdd then if isAdd then
obj.y = area.height - obj.height - index * obj.height * 1.5 - offset obj.y = area.height - obj.height - index * (obj.height + padding) * 1.5 - offset
else else
obj.y = area.height - obj.height - index * obj.height - offset obj.y = area.height - obj.height - index * (obj.height + padding) - offset
end end
--obj.y = area.height - obj.height - index * obj.height - offset --obj.y = area.height - obj.height - index * obj.height - offset
end end

View File

@ -42,12 +42,6 @@ function M:InitView(url)
self.Laizi2Btn.visible = true self.Laizi2Btn.visible = true
self.bugangnum = self._view:GetChild("bugangnum") self.bugangnum = self._view:GetChild("bugangnum")
self.jing = self._view:GetChild('jing')
if room.jing then
self.jing.visible = true
end
self:PlayerChangeLineState() self:PlayerChangeLineState()
if room.playing or room.curren_round > 0 then if room.playing or room.curren_round > 0 then

View File

@ -6,8 +6,8 @@ local EXClearingView = {}
local M = EXClearingView local M = EXClearingView
function EXClearingView.new(blur_view) function EXClearingView.new(blur_view)
setmetatable(M, {__index = ResultView}) setmetatable(M, { __index = ResultView })
local self = setmetatable({}, {__index = M}) local self = setmetatable({}, { __index = M })
self._full = true self._full = true
ResultView.init(self, "ui://Main_Majiang/clearing") ResultView.init(self, "ui://Main_Majiang/clearing")
@ -20,69 +20,62 @@ function EXClearingView.new(blur_view)
end end
function M:InitMaPai() function M:InitMaPai()
self.maPaiCtr=self._view:GetController("mapai") self.maPaiCtr = self._view:GetController("mapai")
self.maPaiCtr.selectedIndex=0 self.maPaiCtr.selectedIndex = 0
self.maPaiList={} self.maPaiList = {}
for i=1,8 do for i = 1, 8 do
local tempMP=self._view:GetChild("niao"..i) local tempMP = self._view:GetChild("niao" .. i)
table.insert(self.maPaiList,tempMP) table.insert(self.maPaiList, tempMP)
end end
end end
function M:IsMapaiShow(niao, isShow)
function M:IsMapaiShow(niao,isShow)
if niao then if niao then
niao.visible=isShow niao.visible = isShow
end end
end end
function M:SetMaPaiValue(niao, value)
function M:SetMaPaiValue(niao,value)
if niao then if niao then
niao.icon='ui://Main_Majiang/' ..get_majiang_prefix(DataManager.CurrenRoom.game_id).."201_"..value niao.icon = 'ui://Main_Majiang/' .. get_majiang_prefix(DataManager.CurrenRoom.game_id) .. "201_" .. value
end end
end end
function M:SetMaPaiColor(niao,num) function M:SetMaPaiColor(niao, num)
niao:GetController("color").selectedIndex=num niao:GetController("color").selectedIndex = num
end end
function M:HideAllMapai() function M:HideAllMapai()
for i=1,#self.maPaiList do for i = 1, #self.maPaiList do
self:IsMapaiShow(self.maPaiList[i],false) self:IsMapaiShow(self.maPaiList[i], false)
self:SetMaPaiColor(self.maPaiList[i],0) self:SetMaPaiColor(self.maPaiList[i], 0)
end end
end end
function M:ShowSelectMaPai(niaoList) function M:ShowSelectMaPai(niaoList)
if niaoList and #niaoList>0 then if niaoList and #niaoList > 0 then
self.maPaiCtr.selectedIndex=1 self.maPaiCtr.selectedIndex = 1
self:HideAllMapai() self:HideAllMapai()
for i=1,#niaoList do for i = 1, #niaoList do
self:IsMapaiShow(self.maPaiList[i],true) self:IsMapaiShow(self.maPaiList[i], true)
self:SetMaPaiValue(self.maPaiList[i],niaoList[i].card) self:SetMaPaiValue(self.maPaiList[i], niaoList[i].card)
if niaoList[i].score>0 then if niaoList[i].score > 0 then
self:SetMaPaiColor(self.maPaiList[i],2) self:SetMaPaiColor(self.maPaiList[i], 2)
end end
end end
else else
self.maPaiCtr.selectedIndex=0 self.maPaiCtr.selectedIndex = 0
end end
end end
function M:CalculatePaixingInfo(result) function M:CalculatePaixingInfo(result)
self.WinList={} self.WinList = {}
if result.info_list and #result.info_list>0 then if result.info_list and #result.info_list > 0 then
for i=1,#result.info_list do for i = 1, #result.info_list do
if result.info_list[i].win_list and #result.info_list[i].win_list>0 then if result.info_list[i].win_list and #result.info_list[i].win_list > 0 then
table.insert(self.WinList,result.info_list[i].win_list) table.insert(self.WinList, result.info_list[i].win_list)
end end
end end
end end
@ -91,19 +84,15 @@ function M:CalculatePaixingInfo(result)
pt(self.WinList) pt(self.WinList)
end end
function M:SetPaixingxiangqing(num) function M:SetPaixingxiangqing(num)
for i=1,#self.PaiXingXiangQingCtrList do for i = 1, #self.PaiXingXiangQingCtrList do
if self.PaiXingXiangQingCtrList[i] then if self.PaiXingXiangQingCtrList[i] then
self.PaiXingXiangQingCtrList[i].selectedIndex=num self.PaiXingXiangQingCtrList[i].selectedIndex = num
end end
end end
end end
function M:InitData(over, room, result, total_result, callback) function M:InitData(over, room, result, total_result, callback)
self._callback = callback self._callback = callback
local _overCtr = self._view:GetController("over") local _overCtr = self._view:GetController("over")
local btn_confirm = self._view:GetChild("btn_confirm") local btn_confirm = self._view:GetChild("btn_confirm")
@ -113,7 +102,8 @@ function M:InitData(over, room, result, total_result, callback)
local _sdkCtr = self._view:GetController("sdk") local _sdkCtr = self._view:GetController("sdk")
local ctr_type = self._view:GetController("type") local ctr_type = self._view:GetController("type")
self._view:GetChild("tex_roominfo").text = string.format("房号%s 局%s/%s %s", room.room_id, room.curren_round, room.room_config.round, os.date("%Y-%m-%d %H:%M:%S", os.time())) self._view:GetChild("tex_roominfo").text = string.format("房号%s 局%s/%s %s", room.room_id, room.curren_round,
room.room_config.round, os.date("%Y-%m-%d %H:%M:%S", os.time()))
self._view:GetChild("tex_gameinfo").text = string.gsub(room.room_config:GetDes2(), "\r", "") self._view:GetChild("tex_gameinfo").text = string.gsub(room.room_config:GetDes2(), "\r", "")
if result then if result then
@ -121,20 +111,20 @@ function M:InitData(over, room, result, total_result, callback)
self:CalculatePaixingInfo(result) self:CalculatePaixingInfo(result)
end end
self.PaiXingXiangQingCtrList={} self.PaiXingXiangQingCtrList = {}
local paixingxiangqing=self._view:GetChild("btn_detal") local paixingxiangqing = self._view:GetChild("btn_detal")
local fanhuipaixing=self._view:GetChild("btn_fanhuipaixing") local fanhuipaixing = self._view:GetChild("btn_fanhuipaixing")
fanhuipaixing.visible=false fanhuipaixing.visible = false
paixingxiangqing.visible=true paixingxiangqing.visible = true
paixingxiangqing.onClick:Add(function() paixingxiangqing.onClick:Add(function()
paixingxiangqing.visible=false paixingxiangqing.visible = false
fanhuipaixing.visible=true fanhuipaixing.visible = true
self:SetPaixingxiangqing(1) self:SetPaixingxiangqing(1)
end) end)
fanhuipaixing.onClick:Add(function() fanhuipaixing.onClick:Add(function()
paixingxiangqing.visible=true paixingxiangqing.visible = true
fanhuipaixing.visible=false fanhuipaixing.visible = false
self:SetPaixingxiangqing(0) self:SetPaixingxiangqing(0)
end) end)
@ -169,7 +159,7 @@ function M:InitData(over, room, result, total_result, callback)
_btnCtr.selectedIndex = 1 _btnCtr.selectedIndex = 1
_sdkCtr.selectedIndex = 1 _sdkCtr.selectedIndex = 1
btn_result.onClick:Add(function() btn_result.onClick:Add(function()
self.maPaiCtr.selectedIndex=0 self.maPaiCtr.selectedIndex = 0
_overCtr.selectedIndex = 1 _overCtr.selectedIndex = 1
_btnCtr.selectedIndex = 0 _btnCtr.selectedIndex = 0
_sdkCtr.selectedIndex = 0 _sdkCtr.selectedIndex = 0
@ -185,7 +175,7 @@ function M:InitData(over, room, result, total_result, callback)
end end
else else
_overCtr.selectedIndex = 1 _overCtr.selectedIndex = 1
self.maPaiCtr.selectedIndex=0 self.maPaiCtr.selectedIndex = 0
btn_close.onClick:Add(function() btn_close.onClick:Add(function()
ViewManager.ChangeView(ViewManager.View_Lobby) ViewManager.ChangeView(ViewManager.View_Lobby)
end) end)
@ -194,16 +184,16 @@ function M:InitData(over, room, result, total_result, callback)
end end
end end
function M:AddClearItem(room, data, total_data,over, niao, active_player) function M:AddClearItem(room, data, total_data, over, niao, active_player)
local n = over + 1 local n = over + 1
local list_view1 = self._view:GetChild("player_list_1") local list_view1 = self._view:GetChild("player_list_1")
local list_view2 = self._view:GetChild("player_list_2") local list_view2 = self._view:GetChild("player_list_2")
if 0 == over or 1 == over then if 0 == over or 1 == over then
table.sort(data, function(a,b) return a.seat < b.seat end) table.sort(data, function(a, b) return a.seat < b.seat end)
list_view1:RemoveChildrenToPool() list_view1:RemoveChildrenToPool()
for i=1,#data do for i = 1, #data do
local item = list_view1:AddItemFromPool() local item = list_view1:AddItemFromPool()
self:FillItemData(room, data[i], item, active_player, niao) self:FillItemData(room, data[i], item, active_player, niao)
end end
@ -221,23 +211,22 @@ function M:AddClearItem(room, data, total_data,over, niao, active_player)
end end
function M:FillItemData(room, data, item, active_player, niao) function M:FillItemData(room, data, item, active_player, niao)
local _gamectr = ControllerManager.GetController(GameController) local _gamectr = ControllerManager.GetController(GameController)
local p = room:GetPlayerBySeat(data["seat"]) local p = room:GetPlayerBySeat(data["seat"])
item:GetChild("playerName").text = p.self_user.nick_name item:GetChild("playerName").text = p.self_user.nick_name
item:GetChild("lab_hp").text=""--抓马 item:GetChild("lab_hp").text = "" --抓马
local user = room:GetPlayerBySeat(data["seat"]).self_user local user = room:GetPlayerBySeat(data["seat"]).self_user
local head = item:GetChild('head'):GetChild('n4') local head = item:GetChild('head'):GetChild('n4')
ImageLoad.Load(user.head_url, head) ImageLoad.Load(user.head_url, head)
-- 手牌 -- 手牌
local hand_cards = data["hand_card"] local hand_cards = data["hand_card"]
table.sort( hand_cards, ViewUtil.HandCardSort) table.sort(hand_cards, ViewUtil.HandCardSort)
local hand_list_view = item:GetChild("hand_card_list") local hand_list_view = item:GetChild("hand_card_list")
hand_list_view:RemoveChildrenToPool() hand_list_view:RemoveChildrenToPool()
for i=1,#hand_cards do for i = 1, #hand_cards do
local card = hand_list_view:AddItemFromPool() local card = hand_list_view:AddItemFromPool()
card.icon = "ui://Main_Majiang/202_"..hand_cards[i] card.icon = "ui://Main_Majiang/202_" .. hand_cards[i]
end end
hand_list_view.width = 52 * #hand_cards hand_list_view.width = 52 * #hand_cards
@ -246,28 +235,27 @@ function M:FillItemData(room, data, item, active_player, niao)
fz_card_list.width = 157 * #fz_card * 0.8 fz_card_list.width = 157 * #fz_card * 0.8
fz_card_list:RemoveChildrenToPool() fz_card_list:RemoveChildrenToPool()
for i=1,#fz_card do for i = 1, #fz_card do
if fz_card[i].type == FZType.Peng then if fz_card[i].type == FZType.Peng then
local item = fz_card_list:AddItemFromPool("ui://Main_Majiang/clearing_fz_3") local item = fz_card_list:AddItemFromPool("ui://Main_Majiang/clearing_fz_3")
for j=1,3 do for j = 1, 3 do
local card = item:GetChild("card_" .. j) local card = item:GetChild("card_" .. j)
card.icon = "ui://Main_Majiang/202_"..fz_card[i].card card.icon = "ui://Main_Majiang/202_" .. fz_card[i].card
end end
elseif fz_card[i].type == FZType.Chi then elseif fz_card[i].type == FZType.Chi then
local item = fz_card_list:AddItemFromPool("ui://Main_Majiang/clearing_fz_3") local item = fz_card_list:AddItemFromPool("ui://Main_Majiang/clearing_fz_3")
for j = 1,3 do for j = 1, 3 do
local card = item:GetChild("card_" .. j) local card = item:GetChild("card_" .. j)
card.icon = "ui://Main_Majiang/" .. self:GetPrefix().."202_"..fz_card[i].opcard[j] card.icon = "ui://Main_Majiang/" .. self:GetPrefix() .. "202_" .. fz_card[i].opcard[j]
end end
elseif fz_card[i].type == FZType.Gang or fz_card[i].type == FZType.Gang_An or fz_card[i].type == FZType.Gang_Peng then elseif fz_card[i].type == FZType.Gang or fz_card[i].type == FZType.Gang_An or fz_card[i].type == FZType.Gang_Peng then
local item = fz_card_list:AddItemFromPool("ui://Main_Majiang/clearing_fz_4") local item = fz_card_list:AddItemFromPool("ui://Main_Majiang/clearing_fz_4")
for j=1,4 do for j = 1, 4 do
local card = item:GetChild("card_" .. j) local card = item:GetChild("card_" .. j)
if fz_card[i].type == FZType.Gang_An and j == 4 then if fz_card[i].type == FZType.Gang_An and j == 4 then
card.icon = "ui://Main_Majiang/202_00" card.icon = "ui://Main_Majiang/202_00"
else else
card.icon = "ui://Main_Majiang/202_"..fz_card[i].card card.icon = "ui://Main_Majiang/202_" .. fz_card[i].card
end end
end end
end end
@ -275,11 +263,17 @@ function M:FillItemData(room, data, item, active_player, niao)
local huadd = data["hu_score"] local huadd = data["hu_score"]
local gangadd = data["gang_score"] local gangadd = data["gang_score"]
local jingadd = data["jing_score"]
local total = data["round_score"] local total = data["round_score"]
local geng_zhuan=data["geng_zhuan"] local geng_zhuan = data["geng_zhuan"]
local sp = " " local sp = " "
local str = "胡:"..huadd.."" local str = "胡:" .. huadd .. ""
str = str..sp.."杠:"..gangadd.."" if gangadd then
str = str .. sp .. "杠:" .. gangadd .. ""
end
if jingadd then
str = str .. sp .. "博精:" .. jingadd .. ""
end
@ -288,7 +282,7 @@ function M:FillItemData(room, data, item, active_player, niao)
item:GetChild("score1").text = str item:GetChild("score1").text = str
-- local total_score = data["total_score"] -- local total_score = data["total_score"]
if total >= 0 then if total >= 0 then
item:GetChild("score2").text = "+"..total item:GetChild("score2").text = "+" .. total
item:GetChild("score2").grayed = false item:GetChild("score2").grayed = false
else else
item:GetChild("score2").text = total item:GetChild("score2").text = total
@ -297,166 +291,147 @@ function M:FillItemData(room, data, item, active_player, niao)
--计算牌型 --计算牌型
local totalPeson=DataManager.CurrenRoom.room_config.people_num-1 local totalPeson = DataManager.CurrenRoom.room_config.people_num - 1
local win_list = data["win_list"] local win_list = data["win_list"]
local is_win = data["is_win"] or false local is_win = data["is_win"] or false
local str1="" local str1 = ""
sp="" sp = ""
if is_win then if is_win then
if win_list then if win_list then
if DataManager.CurrenRoom.isZiMoHu then if DataManager.CurrenRoom.isZiMoHu then
str1="自摸" str1 = "自摸"
else else
str1="接炮" str1 = "接炮"
end end
for i=1,#win_list do for i = 1, #win_list do
local huName=Hu_Type_Name[win_list[i].type] local huName = Hu_Type_Name[win_list[i].type]
if huName then if huName then
str1=str1..sp..huName.."x"..win_list[i].score str1 = str1 .. sp .. huName .. "x" .. win_list[i].score
end end
end end
str1=str1.." +"..huadd.."" str1 = str1 .. " +" .. huadd .. ""
end end
else else
printlog("输家============") printlog("输家============")
if DataManager.CurrenRoom.isZiMoHu then if DataManager.CurrenRoom.isZiMoHu then
printlog("自摸处理============") printlog("自摸处理============")
--str1="" --str1=""
if #self.WinList==1 then if #self.WinList == 1 then
for i=1,#self.WinList do for i = 1, #self.WinList do
for j = 1, #self.WinList[i] do
for j=1,#self.WinList[i] do local huName = Hu_Type_Name[self.WinList[i][j].type]
local huName=Hu_Type_Name[self.WinList[i][j].type]
if huName then if huName then
if j==1 then if j == 1 then
str1=str1..huName.."x"..self.WinList[i][j].score str1 = str1 .. huName .. "x" .. self.WinList[i][j].score
else else
str1=str1..sp..huName.."x"..self.WinList[i][j].score str1 = str1 .. sp .. huName .. "x" .. self.WinList[i][j].score
end
end end
end end
end end
str1=str1.." "..huadd.."" end
str1 = str1 .. " " .. huadd .. ""
else else
printlog("服务端自摸计算异常===>>>") printlog("服务端自摸计算异常===>>>")
end end
else else
printlog("非自摸处理====>>>") printlog("非自摸处理====>>>")
--点炮 一炮多响 --点炮 一炮多响
local yipaoduoxiang=false local yipaoduoxiang = false
if #self.WinList>1 then if #self.WinList > 1 then
yipaoduoxiang=true yipaoduoxiang = true
end end
if yipaoduoxiang then if yipaoduoxiang then
printlog("一炮多响====>>>") printlog("一炮多响====>>>")
str="点炮" str = "点炮"
local allTypeList={} local allTypeList = {}
local isHas=false local isHas = false
for i=1,#self.WinList do for i = 1, #self.WinList do
for j=1,#self.WinList[i] do for j = 1, #self.WinList[i] do
isHas=IsHasDictionary(self.WinList[i][j].type,allTypeList) isHas = IsHasDictionary(self.WinList[i][j].type, allTypeList)
if isHas==false then if isHas == false then
table.insert(allTypeList,self.WinList[i][j].type) table.insert(allTypeList, self.WinList[i][j].type)
end
end end
end end
end if #allTypeList > 0 then
for i = 1, #allTypeList do
if #allTypeList>0 then local huName = Hu_Type_Name[allTypeList[i]]
for i=1,#allTypeList do
local huName=Hu_Type_Name[allTypeList[i]]
if huName then if huName then
str1=str1..huName.."" str1 = str1 .. huName .. ""
end end
end end
str1=str1.." "..huadd.."" str1 = str1 .. " " .. huadd .. ""
end end
else else
if p.self_user.account_id == active_player and is_win == false and not data["liuju"] then if p.self_user.account_id == active_player and is_win == false and not data["liuju"] then
str1="点炮" str1 = "点炮"
if #self.WinList==1 then if #self.WinList == 1 then
for i=1,# self.WinList do for i = 1, # self.WinList do
for j = 1, #self.WinList[i] do
for j=1,#self.WinList[i] do local huName = Hu_Type_Name[self.WinList[i][j].type]
local huName=Hu_Type_Name[self.WinList[i][j].type]
if huName then if huName then
str1=str1..sp..huName.."x"..self.WinList[i][j].score str1 = str1 .. sp .. huName .. "x" .. self.WinList[i][j].score
end end
end end
end end
str1=str1.." "..huadd.."" str1 = str1 .. " " .. huadd .. ""
else else
printlog("服务端自摸计算异常===>>>") printlog("服务端自摸计算异常===>>>")
end end
end end
end end
end end
end end
-- --
printlog("牌型计算==>>>",str1) printlog("牌型计算==>>>", str1)
if data["ming_gang_num"]>0 then if data["ming_gang_num"] > 0 then
str1=str1.." 明杠x"..data["ming_gang_num"] str1 = str1 .. " 明杠x" .. data["ming_gang_num"]
end end
if data["an_gang_num"]>0 then if data["an_gang_num"] > 0 then
str1=str1.." 暗杠x"..data["an_gang_num"] str1 = str1 .. " 暗杠x" .. data["an_gang_num"]
end end
if data["dian_gang_num"]>0 then if data["dian_gang_num"] > 0 then
str1=str1.." 点杠x"..data["dian_gang_num"] str1 = str1 .. " 点杠x" .. data["dian_gang_num"]
end end
if gangadd~=0 then if gangadd ~= 0 then
if gangadd>0 then if gangadd > 0 then
str1=str1.." +"..gangadd.."" str1 = str1 .. " +" .. gangadd .. ""
else else
str1=str1.." "..gangadd.."" str1 = str1 .. " " .. gangadd .. ""
end
end end
end if data["ma_geng_gong"] and data["ma_geng_gong"] ~= 0 then
if data["ma_geng_gong"] > 0 then
if data["ma_geng_gong"] and data["ma_geng_gong"]~=0 then str1 = str1 .. " 马跟杠:+" .. data["ma_geng_gong"] .. ""
if data["ma_geng_gong"]>0 then
str1 = str1.." 马跟杠:+"..data["ma_geng_gong"]..""
else else
str1 = str1.." 马跟杠:"..data["ma_geng_gong"].."" str1 = str1 .. " 马跟杠:" .. data["ma_geng_gong"] .. ""
end
end end
end if geng_zhuan and geng_zhuan ~= 0 then
if geng_zhuan > 0 then
if geng_zhuan and geng_zhuan~=0 then str1 = str1 .. " 跟庄:+" .. geng_zhuan .. ""
if geng_zhuan>0 then
str1 = str1.." 跟庄:+"..geng_zhuan..""
else else
str1 = str1.." 跟庄:"..geng_zhuan.."" str1 = str1 .. " 跟庄:" .. geng_zhuan .. ""
end end
end end
item:GetChild("score3").text=str1 item:GetChild("score3").text = str1
item:GetChild("score4").text=str1 item:GetChild("score4").text = str1
local paixingCtr=item:GetController("detail") local paixingCtr = item:GetController("detail")
table.insert(self.PaiXingXiangQingCtrList,paixingCtr) table.insert(self.PaiXingXiangQingCtrList, paixingCtr)
------------------------- -------------------------
local hp_nonnegative = room:checkHpNonnegative() local hp_nonnegative = room:checkHpNonnegative()
@ -477,16 +452,16 @@ function M:FillItemData(room, data, item, active_player, niao)
end end
if is_win then if is_win then
item:GetController("bg").selectedIndex=1 item:GetController("bg").selectedIndex = 1
else else
item:GetController("bg").selectedIndex=0 item:GetController("bg").selectedIndex = 0
end end
local win_card = item:GetChild("win_card") local win_card = item:GetChild("win_card")
win_card.icon = "ui://Main_Majiang/202_"..data["win_card"] win_card.icon = "ui://Main_Majiang/202_" .. data["win_card"]
if niao and #niao>0 then if niao and #niao > 0 then
local currentNiaoList=self:CalculateNiao(niao ,data["seat"]) local currentNiaoList = self:CalculateNiao(niao, data["seat"])
if currentNiaoList and #currentNiaoList>0 then if currentNiaoList and #currentNiaoList > 0 then
local lst_niao = item:GetChild("list_niao") local lst_niao = item:GetChild("list_niao")
lst_niao:RemoveChildrenToPool() lst_niao:RemoveChildrenToPool()
for i = 1, #currentNiaoList do for i = 1, #currentNiaoList do
@ -505,17 +480,16 @@ function M:FillItemData(room, data, item, active_player, niao)
end end
end end
function M:CalculateNiao(niaoList,seat) function M:CalculateNiao(niaoList, seat)
local tempNiao={} local tempNiao = {}
for i=1,#niaoList do for i = 1, #niaoList do
if niaoList[i].seat==seat then if niaoList[i].seat == seat then
table.insert(tempNiao,niaoList[i]) table.insert(tempNiao, niaoList[i])
end end
end end
return tempNiao return tempNiao
end end
function M:FillItemData2(room, data, list) function M:FillItemData2(room, data, list)
-- 赋值result_info聊天室分享需要 -- 赋值result_info聊天室分享需要
local player_list = {} local player_list = {}
@ -531,19 +505,19 @@ function M:FillItemData2(room, data, list)
local settle_log = data[i].settle_log local settle_log = data[i].settle_log
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.zimo) player_list[i].param[1].value = tostring(data[i].settle_log.zimo)
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.jie_pao) player_list[i].param[2].value = tostring(data[i].settle_log.jie_pao)
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.dian_pao) player_list[i].param[3].value = tostring(data[i].settle_log.dian_pao)
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.an_kong) player_list[i].param[4].value = tostring(data[i].settle_log.an_kong)
player_list[i].param[5]={} player_list[i].param[5] = {}
player_list[i].param[5].key = "明杠次数:" player_list[i].param[5].key = "明杠次数:"
player_list[i].param[5].value = tostring(data[i].settle_log.ming_kong) player_list[i].param[5].value = tostring(data[i].settle_log.ming_kong)
end end
@ -551,7 +525,8 @@ function M:FillItemData2(room, data, list)
local round = room.room_config.round local round = room.room_config.round
self:GenerateRoomResultInfo(round, room.room_config:GetGameName(), room.room_id, room.create_time, player_list) self:GenerateRoomResultInfo(round, room.room_config:GetGameName(), room.room_id, room.create_time, player_list)
local big_result = self._view:GetChild("big_result") local big_result = self._view:GetChild("big_result")
big_result:GetChild("txt_room_info").text = string.format("%s 房号%s 局%s/%s", os.date("%Y/%m/%d", os.time()), room.room_id, room.curren_round, room.room_config.round) big_result:GetChild("txt_room_info").text = string.format("%s 房号%s 局%s/%s", os.date("%Y/%m/%d", os.time()),
room.room_id, room.curren_round, room.room_config.round)
local lst_p = big_result:GetChild("player_list") local lst_p = big_result:GetChild("player_list")
if #player_list == 3 then if #player_list == 3 then
lst_p.columnGap = 108 lst_p.columnGap = 108
@ -563,7 +538,7 @@ function M:FillItemData2(room, data, list)
local show_detail = room.hpOnOff == 1 local show_detail = room.hpOnOff == 1
for i = 1, lst_p.numChildren do for i = 1, lst_p.numChildren do
local com_p = lst_p:GetChildAt(i - 1) local com_p = lst_p:GetChildAt(i - 1)
com_p:GetController("jsicon").selectedIndex=i-1 com_p:GetController("jsicon").selectedIndex = i - 1
local list_param = com_p:GetChild("list_param") local list_param = com_p:GetChild("list_param")
for j = 1, list_param.numChildren do for j = 1, list_param.numChildren do
local tem = list_param:GetChildAt(j - 1) local tem = list_param:GetChildAt(j - 1)

View File

@ -101,11 +101,13 @@ function M:UpdateRound()
end end
function M:ShowJing() function M:ShowJing()
print("==========================================self._room.jing", self._room.jing, self.jing)
if self._room.jing then if self._room.jing then
self.jing.icon = 'ui://Main_Majiang/' .. self.jing.icon = 'ui://Main_Majiang/' ..
get_majiang_prefix(DataManager.CurrenRoom.game_id) .. "201_" .. self._room.jing get_majiang_prefix(DataManager.CurrenRoom.game_id) .. "201_" .. self._room.jing
self.jing.visible = true self.jing.visible = true
if self.jing:GetController('jing') then
self.jing:GetController('jing').selectedIndex = 1
end
else else
self.jing.visible = false self.jing.visible = false
end end
@ -151,12 +153,13 @@ function M:EventInit()
_gamectr:AddEventListener(TX_GameEvent.EventBuGang, function(...) _gamectr:AddEventListener(TX_GameEvent.EventBuGang, function(...)
local arg = { ... } local arg = { ... }
self:__BuGang(arg[1], _gamectr:SendGangCard(arg[1][1])
function(id) -- self:__BuGang(arg[1],
printlog(id) -- function(id)
_gamectr:SendGangCard(id) -- printlog(id)
self:__CloseGangTip() -- _gamectr:SendGangCard(id)
end) -- self:__CloseGangTip()
-- end)
end) end)

View File

@ -110,6 +110,7 @@ function M:UpdateHandCard(getcard, mp)
end end
function M:__OnClickHandCard(context) function M:__OnClickHandCard(context)
print("==========================__OnClickHandCard")
local button = context.sender local button = context.sender
local _carViewList = self._carViewList local _carViewList = self._carViewList
local refresh = true local refresh = true

View File

@ -10,17 +10,15 @@ local RunFast_PlayerPokerInfoView = {
local M = RunFast_PlayerPokerInfoView local M = RunFast_PlayerPokerInfoView
function M.new( view,mainView ) function M.new(view, mainView)
local self = {} local self = {}
setmetatable(self, {__index = M}) setmetatable(self, { __index = M })
self._view = view self._view = view
self._mainView = mainView self._mainView = mainView
self:init() self:init()
return self return self
end end
function M:init() function M:init()
local view = self._view local view = self._view
self._gameCtr = ControllerManager.GetController(GameController) self._gameCtr = ControllerManager.GetController(GameController)
@ -41,8 +39,8 @@ function M:init()
self.ani_result_score = view:GetTransition("score_1") self.ani_result_score = view:GetTransition("score_1")
end end
function M:SetOutCardInfo(cardlist,isPass,isAnim) function M:SetOutCardInfo(cardlist, isPass, isAnim)
self.outpoker_list:RemoveChildren(0,-1,true) self.outpoker_list:RemoveChildren(0, -1, true)
if cardlist == nil then if cardlist == nil then
if isPass == true then if isPass == true then
self.ctr_outpoker.selectedIndex = 2 self.ctr_outpoker.selectedIndex = 2
@ -71,37 +69,36 @@ function M:SetOutCardInfo(cardlist,isPass,isAnim)
-- -- body -- -- body
-- card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_RunFast/"..code.."_1") -- card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_RunFast/"..code.."_1")
-- end -- end
if DataManager.CurrenRoom.pai==0 then if DataManager.CurrenRoom.pai == 0 then
if code==310 and DataManager.CurrenRoom.room_config.Heart10 == 1 then if code == 310 and DataManager.CurrenRoom.room_config.Heart10 == 1 then
-- body -- body
card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_RunFastNew/"..code.."_1") card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_RunFastNew/" .. code .. "_1")
else else
card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_RunFastNew/"..code) card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_RunFastNew/" .. code)
end end
else else
if code==310 and DataManager.CurrenRoom.room_config.Heart10 == 1 then if code == 310 and DataManager.CurrenRoom.room_config.Heart10 == 1 then
-- body -- body
card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_RunFastNew/"..code.."_2") card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_RunFastNew/" .. code .. "_2")
else else
card_code_obj = UIPackage.CreateObjectFromURL("ui://Main_Poker/" .. code .. "_2") card_code_obj = UIPackage.CreateObjectFromURL("ui://Main_Poker/" .. code .. "_2")
end end
end end
if card_code_obj == nil then if card_code_obj == nil then
card_code_obj = UIPackage.CreateObjectFromURL("ui://Main_Poker/00") card_code_obj = UIPackage.CreateObjectFromURL("ui://Main_Poker/00")
end end
--card_code_obj:SetScale(1,1)
poker_item:AddChild(card_code_obj) poker_item:AddChild(card_code_obj)
--local poker = self:CreatPoker(cardlist[i],0.7) --local poker = self:CreatPoker(cardlist[i],0.7)
self.outpoker_list:AddChild(poker_item) self.outpoker_list:AddChild(poker_item)
poker_item.xy = Vector2.New(self.out_card_data["start_x"],self.out_card_data["start_y"]) poker_item.xy = Vector2.New(self.out_card_data["start_x"], self.out_card_data["start_y"])
poker_item:TweenMove(self:GetOutCardEndPokerPos(i,#cardlist,self.outpoker_list,poker_item,self.out_card_data["maxcount_x"],1),time) poker_item:TweenMove(
self:GetOutCardEndPokerPos(i, #cardlist, self.outpoker_list, poker_item, self.out_card_data
["maxcount_x"], 1.5), time)
--card_code_obj --card_code_obj
-- self.tween = TweenUtils.TweenFloat(1,0.7,time,function(x) -- self.tween = TweenUtils.TweenFloat(1,0.7,time,function(x)
-- card_code_obj:SetScale(x,x) -- card_code_obj:SetScale(x,x)
-- end) -- end)
card_code_obj:SetScale(0.7,0.7) card_code_obj:SetScale(1.5, 1.5)
end end
self.move_cor = coroutine.start(function() self.move_cor = coroutine.start(function()
coroutine.wait(0.1) coroutine.wait(0.1)
@ -112,31 +109,30 @@ function M:SetOutCardInfo(cardlist,isPass,isAnim)
local poker_item = UIPackage.CreateObject("Extend_Poker_RunFastNew", "poker7") local poker_item = UIPackage.CreateObject("Extend_Poker_RunFastNew", "poker7")
local code = self:ChangeCodeByTo(cardlist[i]) local code = self:ChangeCodeByTo(cardlist[i])
local card_code_obj local card_code_obj
if DataManager.CurrenRoom.pai==0 then if DataManager.CurrenRoom.pai == 0 then
if code==310 and DataManager.CurrenRoom.room_config.Heart10 == 1 then if code == 310 and DataManager.CurrenRoom.room_config.Heart10 == 1 then
-- body -- body
card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_RunFastNew/"..code.."_1") card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_RunFastNew/" .. code .. "_1")
else else
card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_RunFastNew/"..code) card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_RunFastNew/" .. code)
end end
else else
if code==310 and DataManager.CurrenRoom.room_config.Heart10 == 1 then if code == 310 and DataManager.CurrenRoom.room_config.Heart10 == 1 then
-- body -- body
card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_RunFastNew/"..code.."_2") card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_RunFastNew/" .. code .. "_2")
else else
card_code_obj = UIPackage.CreateObjectFromURL("ui://Main_Poker/" .. code .. "_2") card_code_obj = UIPackage.CreateObjectFromURL("ui://Main_Poker/" .. code .. "_2")
end end
end end
if card_code_obj == nil then if card_code_obj == nil then
card_code_obj = UIPackage.CreateObjectFromURL("ui://Main_Poker/00") card_code_obj = UIPackage.CreateObjectFromURL("ui://Main_Poker/00")
end end
card_code_obj:SetScale(0.7,0.7) card_code_obj:SetScale(1.5, 1.5)
poker_item:AddChild(card_code_obj) poker_item:AddChild(card_code_obj)
--local poker = self:CreatPoker(cardlist[i],0.7) --local poker = self:CreatPoker(cardlist[i],0.7)
self.outpoker_list:AddChild(poker_item) self.outpoker_list:AddChild(poker_item)
poker_item.xy = self:GetOutCardEndPokerPos(i,#cardlist,self.outpoker_list,poker_item,self.out_card_data["maxcount_x"],1) poker_item.xy = self:GetOutCardEndPokerPos(i, #cardlist, self.outpoker_list, poker_item,
self.out_card_data["maxcount_x"], 1.5)
end end
end end
--self.ctr_outpoker.selectedIndex = 1 --self.ctr_outpoker.selectedIndex = 1
@ -145,23 +141,24 @@ end
function M:SetOutCardBlack() function M:SetOutCardBlack()
for i = 0, self.outpoker_list.numChildren - 1 do for i = 0, self.outpoker_list.numChildren - 1 do
self.outpoker_list:GetChildAt(i):GetChildAt(0):GetChildAt(0):GetChildAt(0).color = Color(0.7,0.7,0.7) self.outpoker_list:GetChildAt(i):GetChildAt(0):GetChildAt(0):GetChildAt(0).color = Color(0.7, 0.7, 0.7)
end end
end end
-- 12 -61 --11 58 --10 55 --46 -- 12 -61 --11 58 --10 55 --46
function M:GetOffSet(cardLength) -- 15 -70 function M:GetOffSet(cardLength) -- 15 -70
if cardLength > 8 then if cardLength > 8 then
return 52--40 return 52 --40
else else
return - cardLength * 5 + 80 return -cardLength * 5 + 80
end end
end end
function M:GetOutCardEndFirstPokerPos(count,parent_com,poker_obj,max_count,scale)
local parent_width,parent_height = parent_com.width,parent_com.height function M:GetOutCardEndFirstPokerPos(count, parent_com, poker_obj, max_count, scale)
local poker_width,poker_height = poker_obj.width * scale,poker_obj.height * scale local parent_width, parent_height = parent_com.width, parent_com.height
local poker_width, poker_height = poker_obj.width * scale, poker_obj.height * scale
local offset = self:GetOffSet(count) local offset = self:GetOffSet(count)
local x,y = 0,0 local x, y = 0, 0
--local length = (count - 1) * (poker_width + offset) + poker_width --local length = (count - 1) * (poker_width + offset) + poker_width
--if length <= parent_width then --if length <= parent_width then
-- x = (parent_width - length) / 2 -- x = (parent_width - length) / 2
@ -171,22 +168,22 @@ function M:GetOutCardEndFirstPokerPos(count,parent_com,poker_obj,max_count,scale
local length = (count - 1) * offset + poker_width local length = (count - 1) * offset + poker_width
x = (parent_width - length) / 2 x = (parent_width - length) / 2
y = ((parent_height - poker_height) / 2) y = ((parent_height - poker_height) / 2)
end end
return Vector2.New(x,y) return Vector2.New(x, y)
end end
function M:GetOutCardEndPokerPos(index,count,parent_com,poker_obj,max_count,scale) function M:GetOutCardEndPokerPos(index, count, parent_com, poker_obj, max_count, scale)
local offset_x,offset_y = self:GetOffSet(count),-50 local offset_x, offset_y = self:GetOffSet(count), -100
local start_pos = self:GetOutCardEndFirstPokerPos(count,parent_com,poker_obj,max_count,scale) local start_pos = self:GetOutCardEndFirstPokerPos(count, parent_com, poker_obj, max_count, scale)
local poker_width,poker_height = poker_obj.width * scale,poker_obj.height * scale local poker_width, poker_height = poker_obj.width * scale, poker_obj.height * scale
local parent_width,parent_height = parent_com.width,parent_com.height local parent_width, parent_height = parent_com.width, parent_com.height
local pos_x,pos_y = start_pos.x + (index - 1) * offset_x,start_pos.y local pos_x, pos_y = start_pos.x + (index - 1) * offset_x, start_pos.y
if index > max_count then if index > max_count then
pos_x = (index - max_count - 1) * offset_x pos_x = (index - max_count - 1) * offset_x
pos_y = pos_y + poker_height + offset_y pos_y = pos_y + poker_height + offset_y
end end
return Vector2.New(pos_x,pos_y)
return Vector2.New(pos_x, pos_y)
end end
-- function M:PlayCardTypeEff(type1) -- function M:PlayCardTypeEff(type1)
@ -219,13 +216,13 @@ end
-- end) -- end)
-- end -- end
function M:PlayScore(score,isBomb,isWin) function M:PlayScore(score, isBomb, isWin)
if score == nil then if score == nil then
self.text_bomb_score.alpha = 0 self.text_bomb_score.alpha = 0
return return
end end
if isBomb then if isBomb then
self.text_bomb_score.text = score >= 0 and "+"..score or tostring(score) self.text_bomb_score.text = score >= 0 and "+" .. score or tostring(score)
self.text_bomb_score.grayed = score < 0 self.text_bomb_score.grayed = score < 0
self.ani_bomb_score:Play() self.ani_bomb_score:Play()
else else
@ -233,48 +230,45 @@ function M:PlayScore(score,isBomb,isWin)
self.text_bomb_score.text = tostring(score) self.text_bomb_score.text = tostring(score)
self.text_bomb_score.grayed = true self.text_bomb_score.grayed = true
elseif score > 0 then elseif score > 0 then
self.text_bomb_score.text = "+"..score self.text_bomb_score.text = "+" .. score
self.text_bomb_score.grayed = false self.text_bomb_score.grayed = false
else else
local str = isWin and "+" or "-" local str = isWin and "+" or "-"
self.text_bomb_score.text = str..score self.text_bomb_score.text = str .. score
self.text_bomb_score.grayed = not isWin self.text_bomb_score.grayed = not isWin
end end
self.ani_result_score:Play() self.ani_result_score:Play()
end end
end end
function M:UpdateHandPoker(cardList, isPlayAni, isMing)
function M:UpdateHandPoker(cardList,isPlayAni,isMing)
if self.cor_init_poker ~= nil then if self.cor_init_poker ~= nil then
coroutine.stop(self.cor_init_poker) coroutine.stop(self.cor_init_poker)
end end
self.cor_init_poker = nil self.cor_init_poker = nil
self.card_list = {} self.card_list = {}
self.hand_card_list:RemoveChildren(0,-1,true) self.hand_card_list:RemoveChildren(0, -1, true)
local card_length local card_length
local new_card_list local new_card_list
if isMing == true then if isMing == true then
new_card_list = self._gameCtr:ChangeCodeByFrom(cardList,true) new_card_list = self._gameCtr:ChangeCodeByFrom(cardList, true)
card_length = #cardList card_length = #cardList
else else
card_length = cardList card_length = cardList
end end
if isPlayAni == true then if isPlayAni == true then
self.cor_init_poker = coroutine.start(function() self.cor_init_poker = coroutine.start(function()
for i = card_length, 1,-1 do for i = card_length, 1, -1 do
local code = isMing == true and new_card_list[i] or 0 local code = isMing == true and new_card_list[i] or 0
coroutine.wait(0.01) coroutine.wait(0.01)
local poker = self:CreatPoker1(code,0.4) local poker = self:CreatPoker1(code, 0.4)
self.hand_card_list:AddChild(poker) self.hand_card_list:AddChild(poker)
end end
end) end)
else else
for i = card_length, 1,-1 do for i = card_length, 1, -1 do
local code = isMing == true and new_card_list[i] or 0 local code = isMing == true and new_card_list[i] or 0
local poker = self:CreatPoker1(code,0.4) local poker = self:CreatPoker1(code, 0.4)
self.hand_card_list:AddChild(poker) self.hand_card_list:AddChild(poker)
end end
end end
@ -283,7 +277,7 @@ end
function M:SetRemainCardNumber(isPlay) function M:SetRemainCardNumber(isPlay)
if isPlay then if isPlay then
self.ctr_one_card.selectedIndex = 1 self.ctr_one_card.selectedIndex = 1
self.eff_one_card:Play(-1,0,nil) self.eff_one_card:Play(-1, 0, nil)
else else
self.ctr_one_card.selectedIndex = 0 self.ctr_one_card.selectedIndex = 0
end end
@ -293,73 +287,65 @@ function M:SetRemainCardNumber(isPlay)
--end --end
end end
function M:CreatPoker1(poker,scale,bank) function M:CreatPoker1(poker, scale, bank)
local poker_item = UIPackage.CreateObject("Extend_Poker_RunFastNew", "poker" .. scale * 10)
local poker_item = UIPackage.CreateObject("Extend_Poker_RunFastNew", "poker"..scale * 10)
local code = self:ChangeCodeByTo(poker) local code = self:ChangeCodeByTo(poker)
local card_code_obj local card_code_obj
if DataManager.CurrenRoom.pai==0 then if DataManager.CurrenRoom.pai == 0 then
if code==310 and DataManager.CurrenRoom.room_config.Heart10 == 1 then if code == 310 and DataManager.CurrenRoom.room_config.Heart10 == 1 then
-- body -- body
card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_RunFastNew/"..code.."_1") card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_RunFastNew/" .. code .. "_1")
else else
card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_RunFastNew/"..code) card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_RunFastNew/" .. code)
end end
else else
if code==310 and DataManager.CurrenRoom.room_config.Heart10 == 1 then if code == 310 and DataManager.CurrenRoom.room_config.Heart10 == 1 then
-- body -- body
card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_RunFastNew/"..code.."_2") card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_RunFastNew/" .. code .. "_2")
else else
card_code_obj = UIPackage.CreateObjectFromURL("ui://Main_Poker/" .. code .. "_2") card_code_obj = UIPackage.CreateObjectFromURL("ui://Main_Poker/" .. code .. "_2")
end end
end end
if card_code_obj == nil or bank==1 then if card_code_obj == nil or bank == 1 then
card_code_obj = UIPackage.CreateObjectFromURL("ui://Main_Poker/00") card_code_obj = UIPackage.CreateObjectFromURL("ui://Main_Poker/00")
end end
card_code_obj:SetScale(scale,scale) card_code_obj:SetScale(scale, scale)
poker_item:AddChild(card_code_obj) poker_item:AddChild(card_code_obj)
return poker_item return poker_item
end end
function M:CreatPoker(poker,scale,bank) function M:CreatPoker(poker, scale, bank)
local poker_item = UIPackage.CreateObject("Extend_Poker_RunFastNew", "poker" .. 12.5)
local poker_item = UIPackage.CreateObject("Extend_Poker_RunFastNew", "poker"..12.5)
local code = self:ChangeCodeByTo(poker) local code = self:ChangeCodeByTo(poker)
local card_code_obj local card_code_obj
if DataManager.CurrenRoom.pai == 0 then
if DataManager.CurrenRoom.pai==0 then if code == 310 and DataManager.CurrenRoom.room_config.Heart10 == 1 then
if code==310 and DataManager.CurrenRoom.room_config.Heart10 == 1 then
-- body -- body
card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_RunFastNew/"..code.."_1") card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_RunFastNew/" .. code .. "_1")
else else
card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_RunFastNew/"..code) card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_RunFastNew/" .. code)
end end
else else
if code==310 and DataManager.CurrenRoom.room_config.Heart10 == 1 then if code == 310 and DataManager.CurrenRoom.room_config.Heart10 == 1 then
-- body -- body
card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_RunFastNew/"..code.."_2") card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_RunFastNew/" .. code .. "_2")
else else
card_code_obj = UIPackage.CreateObjectFromURL("ui://Main_Poker/" .. code .. "_2") card_code_obj = UIPackage.CreateObjectFromURL("ui://Main_Poker/" .. code .. "_2")
end end
end end
if card_code_obj == nil or bank==1 then if card_code_obj == nil or bank == 1 then
card_code_obj = UIPackage.CreateObjectFromURL("ui://Main_Poker/00") card_code_obj = UIPackage.CreateObjectFromURL("ui://Main_Poker/00")
end end
card_code_obj:SetScale(scale, scale)
card_code_obj:SetScale(scale,scale)
poker_item:AddChild(card_code_obj) poker_item:AddChild(card_code_obj)
return poker_item return poker_item
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
@ -368,13 +354,12 @@ function M:ChangeCodeByTo( card )
return flower * 100 + number return flower * 100 + number
end end
function M:Clear() function M:Clear()
self:PlayScore(nil) self:PlayScore(nil)
self:SetRemainCardNumber(false) self:SetRemainCardNumber(false)
self:SetOutCardInfo(nil,false) self:SetOutCardInfo(nil, false)
self.hand_card_list:RemoveChildren(0,-1,true) self.hand_card_list:RemoveChildren(0, -1, true)
self._mask_liangpai:RemoveChildren(0,-1,true) self._mask_liangpai:RemoveChildren(0, -1, true)
end end
function M:Destroy() function M:Destroy()

View File

@ -17,7 +17,7 @@ local CardView = {
local function NewCardView(card, cardcodenum, cardcodeflower) local function NewCardView(card, cardcodenum, cardcodeflower)
local self = {} local self = {}
setmetatable(self, {__index = CardView}) setmetatable(self, { __index = CardView })
self.btn_card = card self.btn_card = card
self.card_code_number = cardcodenum self.card_code_number = cardcodenum
self.card_code_flower = cardcodeflower self.card_code_flower = cardcodeflower
@ -38,8 +38,8 @@ local RunFast_PlayerSelfPokerInfoView = {
local M = RunFast_PlayerSelfPokerInfoView local M = RunFast_PlayerSelfPokerInfoView
function M.new(view, mainView) function M.new(view, mainView)
setmetatable(M, {__index = RunFast_PlayerPokerInfoView}) setmetatable(M, { __index = RunFast_PlayerPokerInfoView })
local self = setmetatable({}, {__index = M}) local self = setmetatable({}, { __index = M })
self._view = view self._view = view
self._mainView = mainView self._mainView = mainView
self.gameCtr = ControllerManager.GetController(GameController) self.gameCtr = ControllerManager.GetController(GameController)
@ -88,12 +88,13 @@ function M:InitPoker(pokerList, isPlayAni, open)
-- self.zhizhanplay=0 -- self.zhizhanplay=0
-- self.zhizhanzdts=0 -- self.zhizhanzdts=0
local cs = 1.25 local cs = 1.25
if DataManager.CurrenRoom.cardsize==0 then print("==========================DataManager.CurrenRoom.cardsize", DataManager.CurrenRoom.cardsize)
cs = 1.35 if DataManager.CurrenRoom.cardsize == 0 then
cs = 2
elseif DataManager.CurrenRoom.cardsize == 1 then elseif DataManager.CurrenRoom.cardsize == 1 then
cs = 1.25 cs = 1.8
elseif DataManager.CurrenRoom.cardsize == 2 then elseif DataManager.CurrenRoom.cardsize == 2 then
cs = 1.15 cs = 1.5
end end
if self.cor_init_poker ~= nil then if self.cor_init_poker ~= nil then
@ -173,7 +174,6 @@ function M:InitPoker(pokerList, isPlayAni, open)
end end
) )
else else
for i = 1, #pokerList do for i = 1, #pokerList do
local card_number_code = self:ChangeOneCodeByFrom(pokerList[i]) local card_number_code = self:ChangeOneCodeByFrom(pokerList[i])
local card_flower_code = pokerList[i] local card_flower_code = pokerList[i]
@ -197,7 +197,6 @@ function M:InitPoker(pokerList, isPlayAni, open)
end end
function M:updatePoker() function M:updatePoker()
local templist = {} local templist = {}
for i = 1, #self.card_list do for i = 1, #self.card_list do
templist[#templist + 1] = self.card_list[i].card_code_flower templist[#templist + 1] = self.card_list[i].card_code_flower
@ -340,6 +339,7 @@ function M:AddCardMoveEvent(card)
end end
) )
end end
function M:zhizhanxuanpai() --智障选牌 function M:zhizhanxuanpai() --智障选牌
-- body -- body
local temp_send_card = {} local temp_send_card = {}
@ -576,12 +576,11 @@ function M:SetOutCardBlack()
if card and card:GetChildAt(0) and card:GetChildAt(0):GetChildAt(0) and card:GetChildAt(0):GetChildAt(0):GetChildAt(0) then if card and card:GetChildAt(0) and card:GetChildAt(0):GetChildAt(0) and card:GetChildAt(0):GetChildAt(0):GetChildAt(0) then
card:GetChildAt(0):GetChildAt(0):GetChildAt(0).color = Color(0.7, 0.7, 0.7) card:GetChildAt(0):GetChildAt(0):GetChildAt(0).color = Color(0.7, 0.7, 0.7)
end end
end end
end end
function M:SetOutCardList(cardlist, isAnim) function M:SetOutCardList(cardlist, isAnim)
local pos_y = -200 local pos_y = -320
if isAnim then if isAnim then
-- self.zhizhanctr_select=0 -- self.zhizhanctr_select=0
-- self.zhizhantype=0 -- self.zhizhantype=0
@ -611,13 +610,13 @@ function M:SetOutCardList(cardlist, isAnim)
self.cards_view, self.cards_view,
card.btn_card, card.btn_card,
self.out_card_data['maxcount_x'], self.out_card_data['maxcount_x'],
0.7 1.5
) )
card.btn_card:TweenMove(Vector2.New(pos.x, pos_y), time) card.btn_card:TweenMove(Vector2.New(pos.x, pos_y), time)
-- self.tween = TweenUtils.TweenFloat(1, 0.7, time, function(x) -- self.tween = TweenUtils.TweenFloat(1, 0.7, time, function(x)
-- card.btn_card:GetChildAt(0):SetScale(x, x) -- card.btn_card:GetChildAt(0):SetScale(x, x)
-- end) -- end)
card.btn_card:GetChildAt(0):SetScale(0.7, 0.7) card.btn_card:GetChildAt(0):SetScale(1.5, 1.5)
break break
end end
end end
@ -667,7 +666,7 @@ function M:SetOutCardList(cardlist, isAnim)
if card_code_obj == nil then if card_code_obj == nil then
card_code_obj = UIPackage.CreateObjectFromURL('ui://Main_Poker/00') card_code_obj = UIPackage.CreateObjectFromURL('ui://Main_Poker/00')
end end
card_code_obj:SetScale(0.7, 0.7) card_code_obj:SetScale(1.5, 1.5)
poker_item:AddChild(card_code_obj) poker_item:AddChild(card_code_obj)
--local poker = self:CreatPoker(cardlist[i],0.7) --local poker = self:CreatPoker(cardlist[i],0.7)
self.cards_view:AddChild(poker_item) self.cards_view:AddChild(poker_item)
@ -678,7 +677,7 @@ function M:SetOutCardList(cardlist, isAnim)
self.cards_view, self.cards_view,
poker_item, poker_item,
self.out_card_data['maxcount_x'], self.out_card_data['maxcount_x'],
1 1.5
) )
poker_item.xy = Vector2.New(pos.x, pos_y) poker_item.xy = Vector2.New(pos.x, pos_y)
self.out_card_list[#self.out_card_list + 1] = poker_item self.out_card_list[#self.out_card_list + 1] = poker_item
@ -759,10 +758,10 @@ function M:BtnEvent()
end end
local send_card = {} local send_card = {}
self.send_card = {} self.send_card = {}
local currentCard={} local currentCard = {}
for i = 1, #self.card_list do for i = 1, #self.card_list do
local card = self.card_list[i] local card = self.card_list[i]
table.insert(currentCard,card.card_code_flower) table.insert(currentCard, card.card_code_flower)
if card.btn_card.selected then if card.btn_card.selected then
send_card[#send_card + 1] = card.card_code_flower send_card[#send_card + 1] = card.card_code_flower
self.send_card[#self.send_card + 1] = card self.send_card[#self.send_card + 1] = card
@ -772,7 +771,7 @@ function M:BtnEvent()
if #send_card == 0 then if #send_card == 0 then
self:ErrorTip('请选择要出的牌 ') self:ErrorTip('请选择要出的牌 ')
else else
self.gameCtr:SendCard(send_card,currentCard) self.gameCtr:SendCard(send_card, currentCard)
end end
end end
) )
@ -836,15 +835,15 @@ function M:ShowTipsCard(index)
end end
function M:GetHandCardOffset(count) function M:GetHandCardOffset(count)
local start = -70---54 local start = -90 ---54
local offset = 0 local offset = 0
if count > 10 then if count > 10 then
offset = start - count + 18 offset = start - count + 26
else else
offset = -50 offset = -30
end end
return offset return -25
end end
function M:GetHandCardPos(index, card_count) function M:GetHandCardPos(index, card_count)
@ -855,6 +854,7 @@ function M:GetHandCardPos(index, card_count)
x = start_x + (self.card_width + offset) * (index - 1) x = start_x + (self.card_width + offset) * (index - 1)
return Vector2.New(x, y) return Vector2.New(x, y)
end end
function M:GetHandCardPos1(index, card_count) function M:GetHandCardPos1(index, card_count)
local x, y = 0, -18 local x, y = 0, -18
local offset = self:GetHandCardOffset(card_count) local offset = self:GetHandCardOffset(card_count)
@ -863,6 +863,7 @@ function M:GetHandCardPos1(index, card_count)
x = start_x + (self.card_width + offset) * (index - 1) x = start_x + (self.card_width + offset) * (index - 1)
return x, y return x, y
end end
function M:ChangeOneCodeByFrom(card) function M:ChangeOneCodeByFrom(card)
local flower = math.floor(card / 100) local flower = math.floor(card / 100)
local number = card % 100 local number = card % 100
@ -904,7 +905,7 @@ end
function M:GetCardTips(type, number, length, mustPutMaxCard, tip_templist) function M:GetCardTips(type, number, length, mustPutMaxCard, tip_templist)
local tip_list = {} local tip_list = {}
local sidaisan = false local sidaisan = false
local touch_key_list = {3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15} local touch_key_list = { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }
--printlog("aaaaaaaaaaaaacccccccccccccccccccc11111111111111111111111111111") --printlog("aaaaaaaaaaaaacccccccccccccccccccc11111111111111111111111111111")
--pt(self.card_list) --pt(self.card_list)
local card_map, max_key = self:GetCardMapAndMaxKey(self.card_list) local card_map, max_key = self:GetCardMapAndMaxKey(self.card_list)
@ -996,7 +997,7 @@ end
-- 合并多个list -- 合并多个list
function M:GetMergeAllList(...) function M:GetMergeAllList(...)
local lists = {...} local lists = { ... }
local merge_list = {} local merge_list = {}
for i = 1, #lists do for i = 1, #lists do
local list_item = lists[i] local list_item = lists[i]
@ -1024,13 +1025,13 @@ function M:CheckOneCard(pokerMap, num, length)
end end
for k, v in pairs(pokerMap) do for k, v in pairs(pokerMap) do
if k > num and #v == 1 then if k > num and #v == 1 then
one_card_list[#one_card_list + 1] = {v[1]} one_card_list[#one_card_list + 1] = { v[1] }
touch_key_list[#touch_key_list + 1] = k touch_key_list[#touch_key_list + 1] = k
end end
end end
for k, v in pairs(pokerMap) do for k, v in pairs(pokerMap) do
if k > num and #v ~= 1 then if k > num and #v ~= 1 then
one_card_list[#one_card_list + 1] = {v[1]} one_card_list[#one_card_list + 1] = { v[1] }
touch_key_list[#touch_key_list + 1] = k touch_key_list[#touch_key_list + 1] = k
end end
end end
@ -1045,7 +1046,7 @@ function M:CheckOnePair(pokerMap, num, length)
end end
for k, v in pairs(pokerMap) do -- 从三条和对子里面提取 for k, v in pairs(pokerMap) do -- 从三条和对子里面提取
if #v > 1 and k > num then if #v > 1 and k > num then
one_pair_list[#one_pair_list + 1] = {v[1], v[2]} one_pair_list[#one_pair_list + 1] = { v[1], v[2] }
touch_key_list[#touch_key_list + 1] = k touch_key_list[#touch_key_list + 1] = k
end end
end end
@ -1060,7 +1061,7 @@ function M:CheckThree(pokerMap, num, length)
end end
for k, v in pairs(pokerMap) do for k, v in pairs(pokerMap) do
if #v > 2 and k > num then if #v > 2 and k > num then
three_list[#three_list + 1] = {v[1], v[2], v[3]} three_list[#three_list + 1] = { v[1], v[2], v[3] }
touch_key_list[#touch_key_list + 1] = k touch_key_list[#touch_key_list + 1] = k
end end
end end
@ -1107,8 +1108,8 @@ function M:CheckThreeAndOne(pokerMap, num, length)
end end
for k, v in pairs(pokerMap) do for k, v in pairs(pokerMap) do
if #v >= 3 and k > num then if #v >= 3 and k > num then
three_and_one_list[#three_and_one_list + 1] = {v[1], v[2], v[3]} three_and_one_list[#three_and_one_list + 1] = { v[1], v[2], v[3] }
touch_key_list = {3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15} touch_key_list = { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }
end end
end end
return three_and_one_list, touch_key_list return three_and_one_list, touch_key_list
@ -1122,8 +1123,8 @@ function M:CheckThreeAndTwo(pokerMap, num, length)
end end
for k, v in pairs(pokerMap) do for k, v in pairs(pokerMap) do
if #v >= 3 and k > num then if #v >= 3 and k > num then
three_and_two_list[#three_and_two_list + 1] = {v[1], v[2], v[3]} three_and_two_list[#three_and_two_list + 1] = { v[1], v[2], v[3] }
touch_key_list = {3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15} touch_key_list = { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }
end end
end end
return three_and_two_list, touch_key_list return three_and_two_list, touch_key_list
@ -1208,7 +1209,7 @@ function M:CheckPlane(pokerMap, num, length, and_num)
end end
if j == i + pair_length - 1 then if j == i + pair_length - 1 then
plane_list[#plane_list + 1] = item_all_list plane_list[#plane_list + 1] = item_all_list
touch_key_list = {3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15} touch_key_list = { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }
end end
end end
end end
@ -1216,7 +1217,7 @@ function M:CheckPlane(pokerMap, num, length, and_num)
end end
function M:SetNotTouchCard(touch_key_list, card_map) function M:SetNotTouchCard(touch_key_list, card_map)
local all_key_list = {3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15} local all_key_list = { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }
for i = 1, #all_key_list do for i = 1, #all_key_list do
local key = all_key_list[i] local key = all_key_list[i]
local isExsit = self:IsExistByList(touch_key_list, key) local isExsit = self:IsExistByList(touch_key_list, key)
@ -1259,13 +1260,14 @@ function M:GetCardMapAndMaxKey(pokerList)
max_key = number max_key = number
end end
if map[number] == nil then if map[number] == nil then
map[number] = {pokerList[i]} map[number] = { pokerList[i] }
else else
map[number][#map[number] + 1] = pokerList[i] map[number][#map[number] + 1] = pokerList[i]
end end
end end
return map, max_key return map, max_key
end end
function M:CheckOnes(pokerMap, num, length) function M:CheckOnes(pokerMap, num, length)
local one_card_list = {} local one_card_list = {}
local touch_key_list = {} local touch_key_list = {}
@ -1283,7 +1285,7 @@ function M:CheckOnes(pokerMap, num, length)
for i = 0, length - 1 do for i = 0, length - 1 do
if l == k + i and l ~= 15 and l ~= 16 then if l == k + i and l ~= 15 and l ~= 16 then
-- body -- body
text[#text + 1] = {p[1]} text[#text + 1] = { p[1] }
text2[#text2 + 1] = l text2[#text2 + 1] = l
if #text >= length then if #text >= length then
-- body -- body
@ -1311,6 +1313,7 @@ function M:CheckOnes(pokerMap, num, length)
end end
return one_card_list, touch_key_list, length return one_card_list, touch_key_list, length
end end
function M:Clear() function M:Clear()
self:PlayScore(nil) self:PlayScore(nil)
self:SetOutCardInfo(nil, false) self:SetOutCardInfo(nil, false)

View File

@ -308,6 +308,9 @@ function M:UpdateOutCardList(outcard, card_item, cursor)
if DataManager.CurrenRoom.room_config.people_num == 2 then if DataManager.CurrenRoom.room_config.people_num == 2 then
ViewUtil.CardPos(obj, self._area_outcard_list, oder, col, nil, nil, -6) ViewUtil.CardPos(obj, self._area_outcard_list, oder, col, nil, nil, -6)
ViewUtil.CardPos(obj, self._area_outcard_list, multi_oder, row, nil, nil, -12) ViewUtil.CardPos(obj, self._area_outcard_list, multi_oder, row, nil, nil, -12)
elseif DataManager.CurrenRoom.room_config.people_num == 4 then
ViewUtil.CardPos(obj, self._area_outcard_list, oder, col, nil, nil, -6)
ViewUtil.CardPos(obj, self._area_outcard_list, multi_oder, row, nil, nil, -12)
else else
ViewUtil.CardPos(obj, self._area_outcard_list, oder, col) ViewUtil.CardPos(obj, self._area_outcard_list, oder, col)
ViewUtil.CardPos(obj, self._area_outcard_list, multi_oder, row) ViewUtil.CardPos(obj, self._area_outcard_list, multi_oder, row)

View File

@ -57,6 +57,8 @@ end
function M:setHandCardPos(btn_card, i, getcard) function M:setHandCardPos(btn_card, i, getcard)
if DataManager.CurrenRoom.room_config.people_num == 2 then if DataManager.CurrenRoom.room_config.people_num == 2 then
btn_card.x = i * (btn_card.width - 12) + (getcard and 20 or 0) btn_card.x = i * (btn_card.width - 12) + (getcard and 20 or 0)
elseif DataManager.CurrenRoom.room_config.people_num == 4 then
btn_card.x = i * (btn_card.width - 12) + (getcard and 20 or 0)
else else
btn_card.x = i * btn_card.width * 1.05 + (getcard and 20 or 0) btn_card.x = i * btn_card.width * 1.05 + (getcard and 20 or 0)
end end
@ -101,6 +103,8 @@ function M:UpdateHandCard(getcard, mp)
local btn_card = nil local btn_card = nil
if _room.room_config.people_num == 2 then if _room.room_config.people_num == 2 then
btn_card = UIPackage.CreateObject(self:GetCardObjPack(), "Btn_Card_jiangxi" .. b3d) btn_card = UIPackage.CreateObject(self:GetCardObjPack(), "Btn_Card_jiangxi" .. b3d)
elseif _room.room_config.people_num == 4 then
btn_card = UIPackage.CreateObject(self:GetCardObjPack(), "Btn_Card_new_4" .. b3d)
else else
btn_card = UIPackage.CreateObject(self:GetCardObjPack(), "Btn_Card" .. b3d) btn_card = UIPackage.CreateObject(self:GetCardObjPack(), "Btn_Card" .. b3d)
btn_card:SetScale(1.05, 1.05) btn_card:SetScale(1.05, 1.05)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 537 KiB

After

Width:  |  Height:  |  Size: 906 KiB

View File

@ -88,5 +88,5 @@ TextureImporter:
pSDRemoveMatte: 0 pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0 pSDShowRemoveMatteOption: 0
userData: userData:
assetBundleName: assetBundleName: base/main_majiang/d2fa434d27dc07bf09395dc32491060b
assetBundleVariant: assetBundleVariant:

View File

@ -88,5 +88,5 @@ TextureImporter:
pSDRemoveMatte: 0 pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0 pSDShowRemoveMatteOption: 0
userData: userData:
assetBundleName: assetBundleName: base/main_majiang/bceee620094f2c87befefb9d76b9b13b
assetBundleVariant: assetBundleVariant:

View File

@ -3,5 +3,5 @@ guid: fbda7506a5976cb44840289e8ebcb105
TextScriptImporter: TextScriptImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName: base/main_majiang/bceee620094f2c87befefb9d76b9b13b
assetBundleVariant: assetBundleVariant:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 MiB

After

Width:  |  Height:  |  Size: 3.8 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 633 KiB

After

Width:  |  Height:  |  Size: 808 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 MiB

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 910 KiB

After

Width:  |  Height:  |  Size: 540 KiB

View File

@ -88,5 +88,5 @@ TextureImporter:
pSDRemoveMatte: 0 pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0 pSDShowRemoveMatteOption: 0
userData: userData:
assetBundleName: assetBundleName: extend/majiang/lichuan/8dba1742414c996765e2bd85d1b4bea7
assetBundleVariant: assetBundleVariant: