放置提示同步

master
罗家炜 2025-04-25 15:09:34 +08:00
parent 9b42366d4b
commit 8707a270f3
11 changed files with 122 additions and 56 deletions

View File

@ -51,6 +51,7 @@ function M:init()
self._ctr_getCard = self._view:GetController('getCard') self._ctr_getCard = self._view:GetController('getCard')
self._ctr_seletedGet = self._view:GetController('seletedGetCard') self._ctr_seletedGet = self._view:GetController('seletedGetCard')
self._ctr_tip = self._view:GetController('tip')
end end
function M:ShowHuTip(card_list) function M:ShowHuTip(card_list)

View File

@ -575,59 +575,122 @@ function M:OutCard(card)
end end
end end
-- function M:__FangziTip(tip, weight)
-- printlog("__FangziTip")
-- local _gamectr = self._gamectr
-- local _chipeng_tip = UIPackage.CreateObject("Main_Majiang", "Gcm_action_tips")
-- _chipeng_tip:GetController("hide_bg").selectedIndex = 1
-- self._chipeng_tip = _chipeng_tip
-- local p = self._room.self_player
-- -- self._player_card_info[self:GetPos(p.seat)]
-- local _lit_fanzi = _chipeng_tip:GetChild("lit_fanzi")
-- _lit_fanzi:RemoveChildrenToPool()
-- local _tlist = table.keys(tip.tip_map_type)
-- printlog(tip.tip_map_type)
-- pt(_tlist)
-- local tip_hu = false
-- local count = #_tlist
-- table.sort(_tlist)
-- local isHu = false
-- for k = 1, #_tlist do
-- local td = tip.tip_map_type[_tlist[k]][1]
-- local url = "ui://Main_Majiang/Btn_fztip"
-- local td_weight = td.weight
-- if td_weight == 16 then td_weight = 8 end
-- if td_weight == 8 then url = "ui://Main_Majiang/Btn_hu" end
-- local btn_t = _lit_fanzi:AddItemFromPool(url)
-- btn_t.icon = "ui://Main_Majiang/fztip_" .. td_weight
-- btn_t.data = { tip, td }
-- btn_t.onClick:Add(self.__TipAction, self)
-- end
-- -- if not (tonumber(weight) >= 16) then
-- local _btn_pass = _lit_fanzi:AddItemFromPool("ui://Main_Majiang/Btn_pass")
-- -- local _btn_pass = _chipeng_tip:GetChild("btn_pass")
-- _btn_pass.onClick:Set(function()
-- if tonumber(weight) >= 8 then
-- local guo_msg = MsgWindow.new(self._root_view, "确定要点过吗?", MsgWindow.MsgMode.OkAndCancel)
-- guo_msg.onOk:Add(function()
-- _gamectr:SendAction(0)
-- _chipeng_tip:Dispose()
-- self._chipeng_tip = nil
-- guo_msg:Close()
-- end)
-- guo_msg:Show()
-- else
-- _gamectr:SendAction(0)
-- _chipeng_tip:Dispose()
-- self._chipeng_tip = nil
-- end
-- end)
-- -- end
-- self._view:AddChild(_chipeng_tip)
-- _chipeng_tip:Center()
-- end
function M:__FangziTip(tip, weight) function M:__FangziTip(tip, weight)
printlog("__FangziTip") printlog("__FangziTip")
local _gamectr = self._gamectr local _gamectr = self._gamectr
local _chipeng_tip = UIPackage.CreateObject("Main_Majiang", "Gcm_action_tips") local info = self._player_card_info[1]
_chipeng_tip:GetController("hide_bg").selectedIndex = 1 local _chipeng_tip = info._view_FZTips
self._chipeng_tip = _chipeng_tip local _ctr_tips = info._ctr_tip
local p = self._room.self_player
-- self._player_card_info[self:GetPos(p.seat)]
local _lit_fanzi = _chipeng_tip:GetChild("lit_fanzi") print("lingmengfz")
_lit_fanzi:RemoveChildrenToPool() local _lit_fanzi = _chipeng_tip:GetChild("list")
local _tlist = table.keys(tip.tip_map_type) _lit_fanzi:SetVirtual()
printlog(tip.tip_map_type) local _tlist = tip.tip_map_id
pt(_tlist) print("lingmengfz2")
local tip_hu = false _lit_fanzi.itemRenderer = function(index, obj)
local count = #_tlist local type = obj:GetController('type')
table.sort(_tlist) if index == tip.tip_num then
local isHu = false type.selectedIndex = 0
for k = 1, #_tlist do obj.onClick:Set(function()
local td = tip.tip_map_type[_tlist[k]][1] local guo_msg = MsgWindow.new(self._root_view, "确定要点过吗?", MsgWindow.MsgMode.OkAndCancel)
local url = "ui://Main_Majiang/Btn_fztip" guo_msg.onOk:Add(function()
local td_weight = td.weight _gamectr:SendAction(0)
if td_weight == 16 then td_weight = 8 end _ctr_tips.selectedIndex = 0
if td_weight == 8 then url = "ui://Main_Majiang/Btn_hu" end guo_msg:Close()
local btn_t = _lit_fanzi:AddItemFromPool(url) end)
btn_t.icon = "ui://Main_Majiang/fztip_" .. td_weight guo_msg:Show()
btn_t.data = { tip, td }
btn_t.onClick:Add(self.__TipAction, self)
end
-- if not (tonumber(weight) >= 16) then
local _btn_pass = _lit_fanzi:AddItemFromPool("ui://Main_Majiang/Btn_pass")
-- local _btn_pass = _chipeng_tip:GetChild("btn_pass")
_btn_pass.onClick:Set(function()
if tonumber(weight) >= 8 then
local guo_msg = MsgWindow.new(self._root_view, "确定要点过吗?", MsgWindow.MsgMode.OkAndCancel)
guo_msg.onOk:Add(function()
_gamectr:SendAction(0)
_chipeng_tip:Dispose()
self._chipeng_tip = nil
guo_msg:Close()
end) end)
guo_msg:Show()
else else
_gamectr:SendAction(0) index = index + 1
_chipeng_tip:Dispose() if _tlist[index].type == FZType.HU then
self._chipeng_tip = nil type.selectedIndex = 4
obj:GetChild('btn_Card1').icon = string.format('ui://Main_Majiang/202_%d', _tlist[index].card)
elseif _tlist[index].type == FZType.Chi then
type.selectedIndex = FZType.Chi
for i = 1, 3 do
obj:GetChild(string.format('btn_Card%d', i)).icon = string.format('ui://Main_Majiang/202_%d',
_tlist[index].opcard[i])
end
elseif _tlist[index].type == FZType.Peng then
type.selectedIndex = FZType.Peng
for i = 1, 3 do
obj:GetChild(string.format('btn_Card%d', i)).icon = string.format('ui://Main_Majiang/202_%d',
_tlist[index].card)
end
else
for i = 1, 4 do
obj:GetChild(string.format('btn_Card%d', i)).icon = string.format('ui://Main_Majiang/202_%d',
_tlist[index].card)
end
type.selectedIndex = FZType.Gang
if _tlist[index].type == FZType.Gang_An then
obj:GetChild('btn_Card4').icon = 'ui://Main_Majiang/202_00'
end
end
obj.onClick:Set(function()
_gamectr:SendAction(_tlist[index].id)
_ctr_tips.selectedIndex = 0
end)
end end
end) end
-- end _ctr_tips.selectedIndex = 1
_lit_fanzi.numItems = tip.tip_num + 1
self._view:AddChild(_chipeng_tip) print("lingmengfzend", _ctr_tips.selectedIndex)
_chipeng_tip:Center()
end end
function M:__TipAction(context) function M:__TipAction(context)
@ -749,14 +812,10 @@ function M:OnFangziAction(...)
local fs_info = _player_card_info[self:GetPos(fz.from_seat)] local fs_info = _player_card_info[self:GetPos(fz.from_seat)]
fs_info:UpdateOutCardList() fs_info:UpdateOutCardList()
end end
print("lingmengfz1")
info:UpdateFzList(fz, index, true) info:UpdateFzList(fz, index, true)
print("lingmengfz2")
local getcard = fz.type == FZType.Peng or fz.type == FZType.Chi local getcard = fz.type == FZType.Peng or fz.type == FZType.Chi
print("lingmengfz3")
print(getcard) print(getcard)
info:UpdateHandCard(getcard) info:UpdateHandCard(getcard)
print("lingmengfz4")
self:__CloseTip() self:__CloseTip()
end end

View File

@ -30,7 +30,7 @@ local FZTip = {
op_card = nil op_card = nil
} }
]]-- ]] --
FZType = FZType =
{ {
@ -51,9 +51,10 @@ local M = FZTipList
function M.new() function M.new()
local self = {} local self = {}
setmetatable(self,{__index = FZTipList}) setmetatable(self, { __index = FZTipList })
self.tip_map_id = {} self.tip_map_id = {}
self.tip_map_type = {} self.tip_map_type = {}
self.tip_num = 0
return self return self
end end
@ -64,7 +65,8 @@ function M:AddTip(tip)
tiplist = {} tiplist = {}
self.tip_map_type[tip.weight] = tiplist self.tip_map_type[tip.weight] = tiplist
end end
tiplist[#tiplist+1] = tip tiplist[#tiplist + 1] = tip
self.tip_num = self.tip_num + 1
end end
return M return M

View File

@ -229,7 +229,6 @@ function M:UpdateFzList(fz, index, show_card)
local ctr_Four = outCard:GetController("isFour") local ctr_Four = outCard:GetController("isFour")
for i = 1, 3 do for i = 1, 3 do
local FZCard = outCard:GetChild(string.format("Comp_Card%d", i)) local FZCard = outCard:GetChild(string.format("Comp_Card%d", i))
print("lingmengfz", string.format("Comp_Card%d", i), FZCard)
self:fillCard2(FZCard, FZame, fz.card) self:fillCard2(FZCard, FZame, fz.card)
end end
if fz.type == FZType.Peng then if fz.type == FZType.Peng then

View File

@ -38,7 +38,10 @@ function M:init()
MJPlayerCardInfoView.init(self) MJPlayerCardInfoView.init(self)
self._view_getCard = self._view:GetChild('Btn_HandCard') self._view_getCard = self._view:GetChild('Btn_HandCard')
self._view_FZTips = self._view:GetChild('Comp_FZTips')
self._ctr_seletedGet = self._view:GetController('seletedGetCard') self._ctr_seletedGet = self._view:GetController('seletedGetCard')
self._ctr_tip = self._view:GetController('tip')
end end
function M:ShowHuTip(card_list) function M:ShowHuTip(card_list)
@ -223,6 +226,8 @@ end
function M:Clear() function M:Clear()
MJPlayerCardInfoView.Clear(self) MJPlayerCardInfoView.Clear(self)
self._view_FZTips:RemoveChildren(0, -1, true)
self._ctr_seletedGet.selectedIndex = 0 self._ctr_seletedGet.selectedIndex = 0
end end

Binary file not shown.

Before

Width:  |  Height:  |  Size: 820 KiB

After

Width:  |  Height:  |  Size: 819 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 MiB

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 MiB

After

Width:  |  Height:  |  Size: 3.7 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 MiB

After

Width:  |  Height:  |  Size: 2.7 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 888 KiB

After

Width:  |  Height:  |  Size: 887 KiB