出牌区显示精
parent
0efbe3c99b
commit
5f6d3f15ea
|
|
@ -178,8 +178,8 @@ function M:fillResult0(room, peopleNum, result)
|
|||
handCardList:SetVirtual()
|
||||
handCardList.itemRenderer = function(index, obj)
|
||||
obj.icon = string.format("ui://Main_Majiang/%s202_%d", self:GetPrefix(), infoList.hand_card[index + 1])
|
||||
print("=================================FZType", room.jing)
|
||||
if room.jing == infoList.hand_card[index + 1] then
|
||||
ViewUtil:ErrorTip("显示精")
|
||||
obj:GetController('jing').selectedIndex = 1
|
||||
end
|
||||
end
|
||||
|
|
@ -191,6 +191,7 @@ function M:fillResult0(room, peopleNum, result)
|
|||
end
|
||||
|
||||
if infoList.seat == room.banker_seat then
|
||||
ViewUtil:ErrorTip("显示庄家")
|
||||
isZhuang.selectedIndex = 1
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
local MJPlayerSelfCardInfoView = import(".MJPlayerSelfCardInfoView")
|
||||
local MJPlayerCardInfoView = require(".MJPlayerCardInfoView")
|
||||
local MJPlayerSelfCardInfoView = import(".MJPlayerSelfCardInfoView_jiangxi")
|
||||
local MJPlayerCardInfoView = require(".MJPlayerCardInfoView_jiangxi")
|
||||
local MJMainView = require("main.majiang.MJMainView")
|
||||
local EXClearingView = import(".EXClearingView")
|
||||
local TX_GameEvent = import(".GameEvent")
|
||||
|
|
|
|||
|
|
@ -0,0 +1,213 @@
|
|||
local MJPlayerSelfCardInfoView = require("main.majiang.MJPlayerSelfCardInfoView")
|
||||
local MJPlayerCardInfoView = require("main.majiang.MJPlayerCardInfoView")
|
||||
local CardCheck = import(".CardCheck")
|
||||
|
||||
local M = {}
|
||||
--
|
||||
function M.new(view, mainView)
|
||||
setmetatable(MJPlayerSelfCardInfoView, { __index = MJPlayerCardInfoView })
|
||||
setmetatable(M, { __index = MJPlayerSelfCardInfoView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "PlayerSelfCardInfoView"
|
||||
self._view = view
|
||||
self._mainView = mainView
|
||||
self:init()
|
||||
return self
|
||||
end
|
||||
|
||||
function M:ShowHuTip(card_list)
|
||||
printlog("ShowHuTip")
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui,
|
||||
DataManager.CurrenRoom.room_config.Laizi)
|
||||
pt(tingList)
|
||||
if #tingList > 0 then
|
||||
if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo > 0 then
|
||||
for i = 1, #DataManager.CurrenRoom.laiziInfo do
|
||||
if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i], tingList) == false then
|
||||
table.insert(tingList, DataManager.CurrenRoom.laiziInfo[i])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
self._mainView._hu_tip:FillData(tingList)
|
||||
end
|
||||
|
||||
function M:UpdateHandCard(getcard, mp)
|
||||
print("====================================UpdateHandCard1", mp)
|
||||
MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp)
|
||||
local _carViewList = self._carViewList
|
||||
|
||||
if DataManager.CurrenRoom.laiziInfo and #self._carViewList > 0 then
|
||||
for i = 1, #self._carViewList do
|
||||
local obj = self._carViewList[i]
|
||||
if obj and obj.card then
|
||||
if IsHasDictionary(obj.card_item, DataManager.CurrenRoom.laiziInfo) then
|
||||
if obj.card.GetController then
|
||||
if obj.card:GetController("laizi") then
|
||||
obj.card:GetController("laizi").selectedIndex = 1
|
||||
end
|
||||
end
|
||||
else
|
||||
if obj.card.GetController then
|
||||
if obj.card:GetController("laizi") then
|
||||
obj.card:GetController("laizi").selectedIndex = 0
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
print("====================================UpdateHandCard3")
|
||||
local card_list = DataManager.CurrenRoom.self_player.card_list
|
||||
-- self:ShowHuTip(card_list)
|
||||
if getcard then
|
||||
self._out_card = true
|
||||
local card_list = membe_clone(DataManager.CurrenRoom.self_player.card_list)
|
||||
-- 记录需要标记听牌提示的牌
|
||||
local lst_mark = {}
|
||||
local total_num = 0
|
||||
for i = 1, #_carViewList do
|
||||
local btn = _carViewList[i].card
|
||||
local card = self:GetCard(btn)
|
||||
list_remove(card_list, card)
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true,
|
||||
DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
|
||||
if #tingList > 0 then
|
||||
local count = 0
|
||||
for j = 1, #tingList do
|
||||
count = count + self._mainView:CountCardLeftNum(tingList[j])
|
||||
end
|
||||
local tem = {}
|
||||
tem.item = btn
|
||||
tem.count = count
|
||||
total_num = total_num + count
|
||||
table.insert(lst_mark, tem)
|
||||
end
|
||||
table.insert(card_list, card)
|
||||
end
|
||||
table.sort(lst_mark, function(a, b)
|
||||
return a.count > b.count
|
||||
end)
|
||||
-- 如果几张牌的可胡牌数一致,也只显示'三角',可胡牌数不一致才显示'多'
|
||||
local all_same = #lst_mark ~= 0 and lst_mark[1].count == total_num / #lst_mark or false
|
||||
for i = 1, #lst_mark do
|
||||
local tem = lst_mark[i]
|
||||
if all_same or tem.count < lst_mark[1].count then
|
||||
tem.item:GetController("mark_ting").selectedIndex = 1
|
||||
else
|
||||
tem.item:GetController("mark_ting").selectedIndex = 2
|
||||
end
|
||||
end
|
||||
else
|
||||
for i = 1, #_carViewList do
|
||||
local btn = _carViewList[i].card
|
||||
if btn:GetController("mark_ting").selectedIndex ~= 0 then
|
||||
btn:GetController("mark_ting").selectedIndex = 0
|
||||
end
|
||||
end
|
||||
self._out_card = false
|
||||
end
|
||||
end
|
||||
|
||||
function M:__OnClickHandCard(context)
|
||||
-- print("==========================__OnClickHandCard")
|
||||
local button = context.sender
|
||||
local _carViewList = self._carViewList
|
||||
local refresh = true
|
||||
local card_list = {}
|
||||
for i = 1, #_carViewList do
|
||||
local btn = _carViewList[i].card
|
||||
local card = self:GetCard(btn)
|
||||
if btn ~= button and btn.selected == true then
|
||||
if button.data.card_item == card then
|
||||
refresh = false
|
||||
else
|
||||
self._mainView:markOutCards(false, card)
|
||||
end
|
||||
btn.selected = false
|
||||
end
|
||||
if not btn.selected then
|
||||
table.insert(card_list, card)
|
||||
end
|
||||
end
|
||||
|
||||
if self._out_card then
|
||||
-- self:ShowHuTip(card_list)
|
||||
end
|
||||
|
||||
-- 标记出牌
|
||||
if refresh then
|
||||
if button.selected then
|
||||
self._mainView:markOutCards(true, button.data.card_item)
|
||||
else
|
||||
self._mainView:markOutCards(false, button.data.card_item)
|
||||
end
|
||||
end
|
||||
|
||||
local _room = DataManager.CurrenRoom
|
||||
if not button.selected and _room.curren_outcard_seat == _room.self_player.seat then
|
||||
local card = button.data
|
||||
self._mainView:OutCard(card.card_item)
|
||||
end
|
||||
end
|
||||
|
||||
function M:__OnDragStart(card)
|
||||
local card_list = membe_clone(DataManager.CurrenRoom.self_player.card_list)
|
||||
list_remove(card_list, card)
|
||||
-- self:ShowHuTip(card_list)
|
||||
end
|
||||
|
||||
function M:__OnDragEnd(context)
|
||||
if self.outcard_button then
|
||||
self.outcard_button:Dispose()
|
||||
self.outcard_button = nil
|
||||
end
|
||||
local button = context.sender
|
||||
|
||||
--button:RemoveFromParent()
|
||||
local card = button.data
|
||||
local _room = DataManager.CurrenRoom
|
||||
|
||||
-- -- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
if (button.y - card.old_postion.y < -50 and _room.curren_outcard_seat == _room.self_player.seat and card.card_item ~= 0) then
|
||||
self._mainView:OutCard(card.card_item)
|
||||
button.touchable = false
|
||||
self.outcard_button = button
|
||||
else
|
||||
self._area_handcard_list:AddChildAt(button, card.index)
|
||||
button:TweenMove(card.old_postion, 0.2)
|
||||
end
|
||||
end
|
||||
|
||||
function M:CheckPlayerOnlineState()
|
||||
local room = DataManager.CurrenRoom
|
||||
for i = 1, #room.player_list do
|
||||
if room.player_list[i].line_state == 0 then
|
||||
return false
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function M:Clear(bskip)
|
||||
--self._ctr_state.selectedIndex = 0
|
||||
self._area_fz_list.x = self._src_fz_list.x
|
||||
self._area_fz_list.y = self._src_fz_list.y
|
||||
self._area_fz_list.width = self._src_fz_list.z
|
||||
self._area_fz_list.height = self._src_fz_list.w
|
||||
|
||||
self._area_fz_list:RemoveChildren(0, -1, true)
|
||||
self._area_handcard_list:RemoveChildren(0, -1, true)
|
||||
self._area_outcard_list:RemoveChildren(0, -1, true)
|
||||
if bskip == nil or bskip == false then
|
||||
self._mask_liangpai:RemoveChildren(0, -1, true)
|
||||
end
|
||||
|
||||
for i = 1, #self._carViewList do
|
||||
self._carViewList[i].card:Dispose()
|
||||
end
|
||||
self._carViewList = {}
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
@ -0,0 +1,213 @@
|
|||
local MJPlayerSelfCardInfoView = require("main.majiang.MJPlayerSelfCardInfoView")
|
||||
local MJPlayerCardInfoView = require("main.majiang.MJPlayerCardInfoView")
|
||||
local CardCheck = import(".CardCheck")
|
||||
|
||||
local M = {}
|
||||
--
|
||||
function M.new(view, mainView)
|
||||
setmetatable(MJPlayerSelfCardInfoView, { __index = MJPlayerCardInfoView })
|
||||
setmetatable(M, { __index = MJPlayerSelfCardInfoView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "PlayerSelfCardInfoView"
|
||||
self._view = view
|
||||
self._mainView = mainView
|
||||
self:init()
|
||||
return self
|
||||
end
|
||||
|
||||
function M:ShowHuTip(card_list)
|
||||
printlog("ShowHuTip")
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui,
|
||||
DataManager.CurrenRoom.room_config.Laizi)
|
||||
pt(tingList)
|
||||
if #tingList > 0 then
|
||||
if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo > 0 then
|
||||
for i = 1, #DataManager.CurrenRoom.laiziInfo do
|
||||
if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i], tingList) == false then
|
||||
table.insert(tingList, DataManager.CurrenRoom.laiziInfo[i])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
self._mainView._hu_tip:FillData(tingList)
|
||||
end
|
||||
|
||||
function M:UpdateHandCard(getcard, mp)
|
||||
print("====================================UpdateHandCard1", mp)
|
||||
MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp)
|
||||
local _carViewList = self._carViewList
|
||||
|
||||
if DataManager.CurrenRoom.laiziInfo and #self._carViewList > 0 then
|
||||
for i = 1, #self._carViewList do
|
||||
local obj = self._carViewList[i]
|
||||
if obj and obj.card then
|
||||
if IsHasDictionary(obj.card_item, DataManager.CurrenRoom.laiziInfo) then
|
||||
if obj.card.GetController then
|
||||
if obj.card:GetController("laizi") then
|
||||
obj.card:GetController("laizi").selectedIndex = 1
|
||||
end
|
||||
end
|
||||
else
|
||||
if obj.card.GetController then
|
||||
if obj.card:GetController("laizi") then
|
||||
obj.card:GetController("laizi").selectedIndex = 0
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
print("====================================UpdateHandCard3")
|
||||
local card_list = DataManager.CurrenRoom.self_player.card_list
|
||||
-- self:ShowHuTip(card_list)
|
||||
if getcard then
|
||||
self._out_card = true
|
||||
local card_list = membe_clone(DataManager.CurrenRoom.self_player.card_list)
|
||||
-- 记录需要标记听牌提示的牌
|
||||
local lst_mark = {}
|
||||
local total_num = 0
|
||||
for i = 1, #_carViewList do
|
||||
local btn = _carViewList[i].card
|
||||
local card = self:GetCard(btn)
|
||||
list_remove(card_list, card)
|
||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true,
|
||||
DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
|
||||
if #tingList > 0 then
|
||||
local count = 0
|
||||
for j = 1, #tingList do
|
||||
count = count + self._mainView:CountCardLeftNum(tingList[j])
|
||||
end
|
||||
local tem = {}
|
||||
tem.item = btn
|
||||
tem.count = count
|
||||
total_num = total_num + count
|
||||
table.insert(lst_mark, tem)
|
||||
end
|
||||
table.insert(card_list, card)
|
||||
end
|
||||
table.sort(lst_mark, function(a, b)
|
||||
return a.count > b.count
|
||||
end)
|
||||
-- 如果几张牌的可胡牌数一致,也只显示'三角',可胡牌数不一致才显示'多'
|
||||
local all_same = #lst_mark ~= 0 and lst_mark[1].count == total_num / #lst_mark or false
|
||||
for i = 1, #lst_mark do
|
||||
local tem = lst_mark[i]
|
||||
if all_same or tem.count < lst_mark[1].count then
|
||||
tem.item:GetController("mark_ting").selectedIndex = 1
|
||||
else
|
||||
tem.item:GetController("mark_ting").selectedIndex = 2
|
||||
end
|
||||
end
|
||||
else
|
||||
for i = 1, #_carViewList do
|
||||
local btn = _carViewList[i].card
|
||||
if btn:GetController("mark_ting").selectedIndex ~= 0 then
|
||||
btn:GetController("mark_ting").selectedIndex = 0
|
||||
end
|
||||
end
|
||||
self._out_card = false
|
||||
end
|
||||
end
|
||||
|
||||
function M:__OnClickHandCard(context)
|
||||
-- print("==========================__OnClickHandCard")
|
||||
local button = context.sender
|
||||
local _carViewList = self._carViewList
|
||||
local refresh = true
|
||||
local card_list = {}
|
||||
for i = 1, #_carViewList do
|
||||
local btn = _carViewList[i].card
|
||||
local card = self:GetCard(btn)
|
||||
if btn ~= button and btn.selected == true then
|
||||
if button.data.card_item == card then
|
||||
refresh = false
|
||||
else
|
||||
self._mainView:markOutCards(false, card)
|
||||
end
|
||||
btn.selected = false
|
||||
end
|
||||
if not btn.selected then
|
||||
table.insert(card_list, card)
|
||||
end
|
||||
end
|
||||
|
||||
if self._out_card then
|
||||
-- self:ShowHuTip(card_list)
|
||||
end
|
||||
|
||||
-- 标记出牌
|
||||
if refresh then
|
||||
if button.selected then
|
||||
self._mainView:markOutCards(true, button.data.card_item)
|
||||
else
|
||||
self._mainView:markOutCards(false, button.data.card_item)
|
||||
end
|
||||
end
|
||||
|
||||
local _room = DataManager.CurrenRoom
|
||||
if not button.selected and _room.curren_outcard_seat == _room.self_player.seat then
|
||||
local card = button.data
|
||||
self._mainView:OutCard(card.card_item)
|
||||
end
|
||||
end
|
||||
|
||||
function M:__OnDragStart(card)
|
||||
local card_list = membe_clone(DataManager.CurrenRoom.self_player.card_list)
|
||||
list_remove(card_list, card)
|
||||
-- self:ShowHuTip(card_list)
|
||||
end
|
||||
|
||||
function M:__OnDragEnd(context)
|
||||
if self.outcard_button then
|
||||
self.outcard_button:Dispose()
|
||||
self.outcard_button = nil
|
||||
end
|
||||
local button = context.sender
|
||||
|
||||
--button:RemoveFromParent()
|
||||
local card = button.data
|
||||
local _room = DataManager.CurrenRoom
|
||||
|
||||
-- -- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
if (button.y - card.old_postion.y < -50 and _room.curren_outcard_seat == _room.self_player.seat and card.card_item ~= 0) then
|
||||
self._mainView:OutCard(card.card_item)
|
||||
button.touchable = false
|
||||
self.outcard_button = button
|
||||
else
|
||||
self._area_handcard_list:AddChildAt(button, card.index)
|
||||
button:TweenMove(card.old_postion, 0.2)
|
||||
end
|
||||
end
|
||||
|
||||
function M:CheckPlayerOnlineState()
|
||||
local room = DataManager.CurrenRoom
|
||||
for i = 1, #room.player_list do
|
||||
if room.player_list[i].line_state == 0 then
|
||||
return false
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function M:Clear(bskip)
|
||||
--self._ctr_state.selectedIndex = 0
|
||||
self._area_fz_list.x = self._src_fz_list.x
|
||||
self._area_fz_list.y = self._src_fz_list.y
|
||||
self._area_fz_list.width = self._src_fz_list.z
|
||||
self._area_fz_list.height = self._src_fz_list.w
|
||||
|
||||
self._area_fz_list:RemoveChildren(0, -1, true)
|
||||
self._area_handcard_list:RemoveChildren(0, -1, true)
|
||||
self._area_outcard_list:RemoveChildren(0, -1, true)
|
||||
if bskip == nil or bskip == false then
|
||||
self._mask_liangpai:RemoveChildren(0, -1, true)
|
||||
end
|
||||
|
||||
for i = 1, #self._carViewList do
|
||||
self._carViewList[i].card:Dispose()
|
||||
end
|
||||
self._carViewList = {}
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
@ -28,6 +28,7 @@ function M:InitView(url, use_custom_bg)
|
|||
self._room.card_type = DataManager.CardTypeList[tostring(self._room.game_id)] or 1
|
||||
|
||||
UIPackage.AddPackage("base/main_majiang/ui/Main_Majiang")
|
||||
print("================================player_card_info", url)
|
||||
MainView.InitView(self, url)
|
||||
local _view = self._view
|
||||
self._cursor = UIPackage.CreateObjectFromURL("ui://Main_Majiang/Ani_play_bj")
|
||||
|
|
@ -81,6 +82,8 @@ function M:InitView(url, use_custom_bg)
|
|||
local _player_card_info = self._player_card_info
|
||||
for i = 1, _room.room_config.people_num do
|
||||
local tem = _view:GetChild("player_card_info" .. i)
|
||||
print("====================================", "player_card_info" .. i, tem)
|
||||
pt(_view)
|
||||
_player_card_info[i] = self:NewMJPlayerCardInfoView(tem, i)
|
||||
end
|
||||
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Reference in New Issue