同步新二人,四人到mainmajiang
parent
779e1fb029
commit
ffed5e0ac1
|
|
@ -1,7 +1,7 @@
|
|||
local MJPlayerSelfCardInfoView = import(".MJPlayerSelfCardInfoView_jiangxi")
|
||||
-- local MJPlayerCardInfoView = import(".MJPlayerCardInfoView_jiangxi")
|
||||
local MJPlayerCardInfoView = import(".MJPlayerCardInfoView_jiangxi")
|
||||
-- local MJPlayerSelfCardInfoView = import(".MJPlayerSelfCardInfoView")
|
||||
local MJPlayerCardInfoView = require("main.majiang.MJPlayerCardInfoView")
|
||||
-- local MJPlayerCardInfoView = require("main.majiang.MJPlayerCardInfoView")
|
||||
local MJMainView = require("main.majiang.MJMainView")
|
||||
local EXClearingView = import(".EXClearingView")
|
||||
local TX_GameEvent = import(".GameEvent")
|
||||
|
|
|
|||
|
|
@ -185,7 +185,6 @@ function M:UpdateOutCardList(outcard, card_item, cursor)
|
|||
cursor = cursor or nil
|
||||
|
||||
local outCardName = self._viewText_cardInfo['Out_Card']
|
||||
local outcard
|
||||
|
||||
local outlist = self._player.outcard_list
|
||||
-- if self._view_outCardList.numItems < #outlist - 1 then
|
||||
|
|
@ -245,17 +244,7 @@ function M:UpdateFzList(fz, index, show_card)
|
|||
index = index or 0
|
||||
show_card = show_card or nil
|
||||
|
||||
local outCard
|
||||
|
||||
-- if self._view_outCardList.numItems < #outlist - 1 then
|
||||
-- for i = 1, #outlist - 1 do
|
||||
-- outcard = self._view_outCardList:AddItemFromPool()
|
||||
-- -- end
|
||||
-- self:fillCard2(outcard, outCardName, outlist[i])
|
||||
-- end
|
||||
-- end
|
||||
|
||||
outCard = self._view_FZList:AddItemFromPool()
|
||||
local outCard = self._view_FZList:AddItemFromPool()
|
||||
|
||||
if fz.type == FZType.Chi then
|
||||
for i = 1, 3 do
|
||||
|
|
@ -280,7 +269,7 @@ function M:UpdateFzList(fz, index, show_card)
|
|||
end
|
||||
end
|
||||
end
|
||||
-- self:fillCard2(outcard, outCardName, card_item)
|
||||
|
||||
end
|
||||
|
||||
function M:GetOutCardByIndex(index)
|
||||
|
|
|
|||
|
|
@ -36,11 +36,13 @@ function M.new(view, mainView)
|
|||
end
|
||||
|
||||
function M:init()
|
||||
print("lingmenginithand")
|
||||
MJPlayerSelfCardInfoView.init(self)
|
||||
-- print("lingmenginithand")
|
||||
-- MJPlayerSelfCardInfoView.init(self)
|
||||
|
||||
local CardInfo = self._view:GetChild('Text_CardInfo')
|
||||
self._viewText_cardInfo = json.decode(CardInfo.text)
|
||||
-- local CardInfo = self._view:GetChild('Text_CardInfo')
|
||||
--手机蓝屏点
|
||||
-- local CardInfoText = CardInfo.text
|
||||
-- self._viewText_cardInfo = json.decode(CardInfoText)
|
||||
|
||||
self._view_handCardList = self._view:GetChild('List_HandCard')
|
||||
self._view_FZList = self._view:GetChild('List_FZ')
|
||||
|
|
@ -49,6 +51,8 @@ function M:init()
|
|||
|
||||
self._ctr_getCard = self._view:GetController('getCard')
|
||||
self._ctr_seletedGet = self._view:GetController('seletedGetCard')
|
||||
|
||||
ViewUtil.ErrorTip(nil, self._view:GetChild('n39') == nil and "11111" or "2222")
|
||||
end
|
||||
|
||||
function M:ShowHuTip(card_list)
|
||||
|
|
@ -69,7 +73,7 @@ function M:ShowHuTip(card_list)
|
|||
end
|
||||
|
||||
function M:UpdateHandCard(getcard, mp)
|
||||
MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp)
|
||||
-- -- MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp)
|
||||
local _carViewList = self._carViewList
|
||||
local card_list = DataManager.CurrenRoom.self_player.card_list
|
||||
--[[
|
||||
|
|
@ -143,35 +147,33 @@ function M:UpdateHandCard(getcard, mp)
|
|||
end
|
||||
self._out_card = false
|
||||
end
|
||||
]]
|
||||
--]]
|
||||
|
||||
|
||||
|
||||
-----------------------lingmeng---------------------------
|
||||
-- -----------------------lingmeng---------------------------
|
||||
getcard = getcard or false
|
||||
mp = mp or false
|
||||
|
||||
local handCardName = self._viewText_cardInfo['Hand_Card']
|
||||
-- if self._view_handCardList.numItems > #card_list - 1 then
|
||||
-- -- local handCardName = self._viewText_cardInfo['Hand_Card']
|
||||
local handCardName = "202_"
|
||||
if self._view_handCardList.numItems > 0 then
|
||||
self._view_handCardList:RemoveChildren()
|
||||
end
|
||||
if self._view_handCardList.numItems > 0 then
|
||||
self._view_getCard:RemoveChildren()
|
||||
-- end
|
||||
end
|
||||
|
||||
for i = 0, (#card_list) - 1 do
|
||||
local tem_card = card_list[i + 1]
|
||||
local btn_card
|
||||
if getcard and i == (#card_list) - 1 then
|
||||
btn_card = self._view_getCard:AddItemFromPool()
|
||||
-- btn_card = self._view:GetChild('Btn_HandCard')
|
||||
btn_card.onClick:Add(function(context)
|
||||
self:__OnClickGetCard(context)
|
||||
end)
|
||||
else
|
||||
-- if i >= self._view_handCardList.numItems then
|
||||
btn_card = self._view_handCardList:AddItemFromPool()
|
||||
-- else
|
||||
-- btn_card = self._view_handCardList:GetChildAt(i)
|
||||
-- end
|
||||
end
|
||||
self:fillCard2(btn_card, handCardName, tem_card)
|
||||
local c_v = NewCardView(btn_card, tem_card)
|
||||
|
|
@ -181,9 +183,8 @@ function M:UpdateHandCard(getcard, mp)
|
|||
btn_card.onTouchBegin:Set(handler(self, self.onTouchBegin))
|
||||
btn_card.onTouchMove:Set(handler(self, self.onTouchMove))
|
||||
btn_card.onTouchEnd:Set(handler(self, self.__OnDragEnd))
|
||||
-- btn_card.onClick:Set(handler(self, self.__OnClickHandCard))
|
||||
btn_card.onClick:Set(handler(self, self.__OnClickHandCard))
|
||||
end
|
||||
print("lingmenghand3", getcard, self._ctr_getCard)
|
||||
|
||||
if getcard then
|
||||
self._ctr_getCard.selectedIndex = 1
|
||||
|
|
@ -193,7 +194,6 @@ function M:UpdateHandCard(getcard, mp)
|
|||
self._view_handCardList.onClickItem:Set(function(context)
|
||||
self:__OnClickHandCard(context)
|
||||
end)
|
||||
print("lingmenghand4")
|
||||
----------------------------------------------------------
|
||||
end
|
||||
|
||||
|
|
@ -203,30 +203,17 @@ function M:UpdateOutCardList(outcard, card_item)
|
|||
outcard = outcard or nil
|
||||
card_item = card_item or 0
|
||||
|
||||
local outCardName = self._viewText_cardInfo['Out_Card']
|
||||
-- local outCardName = self._viewText_cardInfo['Out_Card']
|
||||
local outCardName = "202_"
|
||||
local outcard
|
||||
|
||||
local outlist = self._player.outcard_list
|
||||
self._view_outCardList:RemoveChildren()
|
||||
|
||||
-- if self._view_outCardList.numItems < #outlist - 1 then
|
||||
-- for i = 1, #outlist - 1 do
|
||||
-- outcard = self._view_outCardList:AddItemFromPool()
|
||||
-- -- end
|
||||
-- self:fillCard2(outcard, outCardName, outlist[i])
|
||||
-- end
|
||||
-- end
|
||||
for i = 0, #outlist - 1 do
|
||||
outcard = self._view_outCardList:AddItemFromPool()
|
||||
self:fillCard2(outcard, outCardName, outlist[i + 1])
|
||||
end
|
||||
-- if self._viewText_cardInfo['Order'] == "desc" then
|
||||
-- outcard = self._view_handCardList:GetFromPool("ui://Main_Majiang/Comp_4_OutCard")
|
||||
-- self._view_outCardList:AddChildAt(outcard, 0)
|
||||
-- else
|
||||
-- outcard = self._view_outCardList:AddItemFromPool()
|
||||
-- -- end
|
||||
-- self:fillCard2(outcard, outCardName, card_item)
|
||||
end
|
||||
|
||||
function M:onTouchBegin(context)
|
||||
|
|
@ -236,9 +223,6 @@ function M:onTouchBegin(context)
|
|||
self._touchIndex = card.index
|
||||
local xy = self._view_handCardList:GlobalToLocal(Vector2.New(context.inputEvent.x, context.inputEvent.y))
|
||||
card.touch_pos = xy - button.xy
|
||||
-- if self.__OnDragStart then
|
||||
-- self:__OnDragStart(card.card_item)
|
||||
-- end
|
||||
end
|
||||
|
||||
function M:onTouchMove(context)
|
||||
|
|
@ -261,14 +245,12 @@ function M:__OnDragEnd(context)
|
|||
local _room = DataManager.CurrenRoom
|
||||
if not _room or _room:GetReloadStatus() then return end
|
||||
|
||||
-- -- -- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
if (button.y < -150 and _room.curren_outcard_seat == _room.self_player.seat) then
|
||||
self._mainView:OutCard(card.card_item)
|
||||
button.touchable = false
|
||||
self.outcard_button = button
|
||||
button.xy = self._touchPos
|
||||
else
|
||||
-- self._area_handcard_list:AddChildAt(button, card.index)
|
||||
if self._touchIndex ~= card.index then
|
||||
-- local tempPos = self._touchPos
|
||||
-- self._touchPos = button.xy
|
||||
|
|
@ -302,37 +284,9 @@ function M:__OnClickHandCard(context)
|
|||
self._click_index = self._view_handCardList.selectedIndex
|
||||
end
|
||||
|
||||
-- function M:__OnClickHandCard(context)
|
||||
-- print("=======================lingmengclickhand")
|
||||
-- self._ctr_seletedGet.selectedIndex = 0
|
||||
-- local button = context.sender
|
||||
-- -- local _carViewList = self._carViewList
|
||||
-- -- for i = 1, #_carViewList do
|
||||
-- -- if (_carViewList[i].card ~= button) then
|
||||
-- -- _carViewList[i].card.selected = false
|
||||
-- -- end
|
||||
-- -- end
|
||||
-- button.selected = true
|
||||
-- local _room = DataManager.CurrenRoom
|
||||
-- if ((Utils.IsDoubleClick(context)) and _room.curren_outcard_seat == _room.self_player.seat) then
|
||||
-- local card = button.data
|
||||
-- self._mainView:OutCard(card.card_item)
|
||||
-- self._view_handCardList.selectedIndex = -1
|
||||
-- self._click_index = self._view_handCardList.selectedIndex
|
||||
-- self._ctr_seletedGet.selectedIndex = 0
|
||||
-- end
|
||||
-- -- self._click_index = self._view_handCardList.selectedIndex
|
||||
-- end
|
||||
|
||||
function M:__OnClickGetCard(context)
|
||||
self._view_handCardList.selectedIndex = -1
|
||||
local button = context.sender
|
||||
-- local _carViewList = self._carViewList
|
||||
-- for i = 1, #_carViewList do
|
||||
-- if (_carViewList[i].card ~= button) then
|
||||
-- _carViewList[i].card.selected = false
|
||||
-- end
|
||||
-- end
|
||||
local _room = DataManager.CurrenRoom
|
||||
if (Utils.IsDoubleClick(context) and _room.curren_outcard_seat == _room.self_player.seat) then
|
||||
local card = button.data
|
||||
|
|
@ -349,20 +303,13 @@ function M:UpdateFzList(fz, index, show_card)
|
|||
isFour = true
|
||||
end
|
||||
|
||||
local FZame = self._viewText_cardInfo['FZ_Card']
|
||||
-- local FZame = self._viewText_cardInfo['FZ_Card']
|
||||
local FZame = "202_"
|
||||
index = index or 0
|
||||
show_card = show_card or nil
|
||||
|
||||
local outCard
|
||||
|
||||
-- if self._view_outCardList.numItems < #outlist - 1 then
|
||||
-- for i = 1, #outlist - 1 do
|
||||
-- outcard = self._view_outCardList:AddItemFromPool()
|
||||
-- -- end
|
||||
-- self:fillCard2(outcard, outCardName, outlist[i])
|
||||
-- end
|
||||
-- end
|
||||
|
||||
outCard = self._view_FZList:AddItemFromPool()
|
||||
|
||||
if fz.type == FZType.Chi then
|
||||
|
|
@ -384,10 +331,11 @@ function M:UpdateFzList(fz, index, show_card)
|
|||
self:fillCard2(FZCard, FZame, fz.card)
|
||||
if fz.type == FZType.Gang_An then
|
||||
self:fillCard2(FZCard, FZame, '00')
|
||||
elseif fz.type == FZType.Gang_Peng then
|
||||
self._view_FZList:RemoveChildAt(self._view_FZList.numItems - 2)
|
||||
end
|
||||
end
|
||||
end
|
||||
-- self:fillCard2(outcard, outCardName, card_item)
|
||||
end
|
||||
|
||||
--]]
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
local MJPlayerSelfCardInfoView = import(".MJPlayerSelfCardInfoView")
|
||||
local MJPlayerCardInfoView = require("main.majiang.MJPlayerCardInfoView")
|
||||
local MJPlayerCardInfoView = require("main.majiang.MJPlayerCardInfoView_jiangxi")
|
||||
local MJMainView = require("main.majiang.MJMainView")
|
||||
local EXClearingView = import(".EXClearingView")
|
||||
local TX_GameEvent = import(".GameEvent")
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
local MJPlayerSelfCardInfoView = require("main.majiang.MJPlayerSelfCardInfoView")
|
||||
local MJPlayerCardInfoView = require("main.majiang.MJPlayerCardInfoView")
|
||||
local MJPlayerSelfCardInfoView = require("main.majiang.MJPlayerSelfCardInfoView_jiangxi")
|
||||
local MJPlayerCardInfoView = require("main.majiang.MJPlayerCardInfoView_jiangxi")
|
||||
local CardCheck = import(".CardCheck")
|
||||
|
||||
local M = {}
|
||||
|
|
@ -33,79 +33,79 @@ end
|
|||
|
||||
function M:UpdateHandCard(getcard, mp)
|
||||
MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp)
|
||||
local _carViewList = self._carViewList
|
||||
-- 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
|
||||
-- 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
|
||||
|
||||
|
||||
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
|
||||
-- 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)
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@ 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")
|
||||
|
|
|
|||
|
|
@ -28,72 +28,25 @@ function M.new(view, mainView)
|
|||
end
|
||||
|
||||
function M:init()
|
||||
local view = self._view
|
||||
local _area_mask = view:GetChild('area_mask')
|
||||
local mask = _area_mask.text
|
||||
|
||||
self._mask_data = json.decode(mask)
|
||||
self._area_handcard_list = view:GetChild('area_handcard_list')
|
||||
|
||||
self._area_fz_list = view:GetChild('area_fz_list')
|
||||
self._area_outcard_list = view:GetChild('area_outcard_list')
|
||||
self._src_fz_list =
|
||||
Vector4(self._area_fz_list.x, self._area_fz_list.y, self._area_fz_list.width, self._area_fz_list.height)
|
||||
local c3d = self._view:GetController('3d')
|
||||
if c3d ~= nil then
|
||||
c3d.selectedIndex = 1
|
||||
end
|
||||
self._src_fz_list_3d =
|
||||
Vector4(self._area_fz_list.x, self._area_fz_list.y, self._area_fz_list.width, self._area_fz_list.height)
|
||||
local c3d = self._view:GetController('3d')
|
||||
if c3d ~= nil then
|
||||
c3d.selectedIndex = 0
|
||||
local CardInfo = self._view:GetChild('Text_CardInfo')
|
||||
self._viewText_cardInfo = json.decode(CardInfo.text)
|
||||
|
||||
local CardInfo = self._view:GetChild('Text_CardInfo')
|
||||
self._viewText_cardInfo = json.decode(CardInfo.text)
|
||||
|
||||
self._view_handCardList = self._view:GetChild('List_HandCard')
|
||||
self._view_FZList = self._view:GetChild('List_FZ')
|
||||
self._view_outCardList = self._view:GetChild('List_OutCard')
|
||||
self._viewBtn_getCard = self._view:GetChild('Btn_HandCard')
|
||||
|
||||
self._ctr_getCard = self._view:GetController('getCard')
|
||||
self._ctr_seletedGet = self._view:GetController('seletedGetCard')
|
||||
|
||||
end
|
||||
|
||||
self._mask_liangpai = view:GetChild('mask_liangpai')
|
||||
|
||||
local _gamectr = ControllerManager.GetController(GameController)
|
||||
if _gamectr then
|
||||
_gamectr:AddEventListener(GameEvent.MJModifySzie, handler(self, self.SetMJSize))
|
||||
end
|
||||
end
|
||||
|
||||
function M:SetMJSize(zS)
|
||||
local tempSzieConfig = {}
|
||||
tempSzieConfig.size = zS
|
||||
local filename = 'mjsize' .. DataManager.SelfUser.account_id
|
||||
Utils.SaveLocalFile(filename, json.encode(tempSzieConfig))
|
||||
|
||||
--ControllerManager.OnConnect(SocketCode.TimeoutDisconnect)
|
||||
ViewManager.refreshGameView()
|
||||
end
|
||||
|
||||
function M:SetPlayer(p)
|
||||
self._player = p
|
||||
end
|
||||
|
||||
function M:FillData(begin)
|
||||
if (begin) then
|
||||
for i = 1, #self._player.fz_list do
|
||||
self:UpdateFzList(self._player.fz_list[i], -1)
|
||||
end
|
||||
self:UpdateOutCardList()
|
||||
else
|
||||
self._current_card_type = DataManager.CurrenRoom.card_type
|
||||
|
||||
if self._current_card_type == 2 then
|
||||
local c3d = self._view:GetController('3d')
|
||||
if c3d ~= nil then
|
||||
c3d.selectedIndex = 1
|
||||
end
|
||||
else
|
||||
local c3d = self._view:GetController('3d')
|
||||
if c3d ~= nil then
|
||||
c3d.selectedIndex = 0
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function M:Clear()
|
||||
--self._ctr_state.selectedIndex = 0
|
||||
|
|
@ -106,6 +59,15 @@ function M:Clear()
|
|||
self._area_handcard_list:RemoveChildren(0, -1, true)
|
||||
self._area_outcard_list:RemoveChildren(0, -1, true)
|
||||
self._mask_liangpai:RemoveChildren(0, -1, true)
|
||||
self._view_handCardList:RemoveChildren(0, -1, true)
|
||||
self._view_outCardList:RemoveChildren(0, -1, true)
|
||||
self._view_FZList:RemoveChildren(0, -1, true)
|
||||
self._view_getCard:RemoveChildren(0, -1, true)
|
||||
|
||||
self._view_handCardList.selectedIndex = -1
|
||||
self._click_index = self._view_handCardList.selectedIndex
|
||||
self._ctr_seletedGet.selectedIndex = 0
|
||||
|
||||
end
|
||||
|
||||
-- 获取麻将资源前缀
|
||||
|
|
@ -131,10 +93,10 @@ function M:fillCard2(obj, pos_str, card)
|
|||
if DataManager.CurrenRoom.jing and card == DataManager.CurrenRoom.jing and obj:GetController('jing') then
|
||||
obj:GetController('jing').selectedIndex = 1
|
||||
end
|
||||
print("lingmenghandfill1")
|
||||
|
||||
|
||||
obj:GetChild("icon").url = 'ui://Main_Majiang/' .. pos_str .. card
|
||||
print("lingmenghandfill2")
|
||||
|
||||
end
|
||||
|
||||
function M:getBackCard(card)
|
||||
|
|
@ -150,73 +112,14 @@ end
|
|||
function M:UpdateHandCard(getcard, mp)
|
||||
getcard = getcard or false
|
||||
mp = mp or false
|
||||
local handcard_list = self._mask_data['handcard_list']
|
||||
local oder = handcard_list['oder']
|
||||
local _player = self._player
|
||||
-- -- print(vardump(self._player))
|
||||
|
||||
self._area_handcard_list:RemoveChildren(0, -1, true)
|
||||
-- -- print(vardump(_player.card_list))
|
||||
if (not mp) then
|
||||
local comp_back = handcard_list['comp_back']
|
||||
if self._current_card_type == 2 then
|
||||
comp_back = comp_back .. '_3d'
|
||||
end
|
||||
|
||||
for i = 0, _player.hand_left_count - 1 do
|
||||
local obj = UIPackage.CreateObjectFromURL(self:getBackCard(comp_back))
|
||||
local _room = DataManager.CurrenRoom
|
||||
local people_num = _room.room_config.people_num
|
||||
local pos = ViewUtil.GetPos(_room.self_player.seat, _player.seat, people_num)
|
||||
local gap = (pos == 3 and people_num == 4 or pos == 2 and people_num == 2) and 15 or 45
|
||||
local offset = getcard and (i == _player.hand_left_count - 1 and gap or 0)
|
||||
-- local offset = getcard and (i == _player.hand_left_count - 1 and 15 or 0)
|
||||
ViewUtil.CardPos(obj, self._area_handcard_list, oder, i, offset)
|
||||
|
||||
--改变左右两边的手牌的x值
|
||||
if self._current_card_type == 2 and (oder == AreaOderType.down_up or oder == AreaOderType.up_down) then
|
||||
obj.x = i * -7.0
|
||||
end
|
||||
|
||||
if (oder == AreaOderType.down_up) then
|
||||
self._area_handcard_list:AddChildAt(obj, 0)
|
||||
else
|
||||
self._area_handcard_list:AddChild(obj)
|
||||
end
|
||||
end
|
||||
else
|
||||
local outcard_list = self._mask_data['outcard_list']
|
||||
local comp = handcard_list['comp']
|
||||
local card = outcard_list['card']
|
||||
---- print("comp"..comp)
|
||||
-- -- print(vardump(_player.card_list))
|
||||
|
||||
if self._current_card_type == 2 then
|
||||
comp = comp .. '_3d'
|
||||
end
|
||||
|
||||
for i = 0, #_player.card_list - 1 do
|
||||
local obj = UIPackage.CreateObject('Main_Majiang', comp)
|
||||
|
||||
self:fillCard(obj, card, _player.card_list[i + 1])
|
||||
-- obj.icon = UIPackage.GetItemURL("Main_Majiang", card .. _player.card_list[i+1])
|
||||
|
||||
local offset = getcard and (i == _player.hand_left_count - 1 and 0 or 0)
|
||||
|
||||
ViewUtil.CardPos(obj, self._area_handcard_list, oder, i, offset)
|
||||
|
||||
--改变左右两边的手牌的x值
|
||||
if self._current_card_type == 2 and (oder == AreaOderType.down_up or oder == AreaOderType.up_down) then
|
||||
obj.x = i * -7
|
||||
end
|
||||
|
||||
if (oder == AreaOderType.down_up) then
|
||||
self._area_handcard_list:AddChildAt(obj, 0)
|
||||
else
|
||||
self._area_handcard_list:AddChild(obj)
|
||||
end
|
||||
end
|
||||
self._view_handCardList:RemoveChildren()
|
||||
for i = 0, self._player.hand_left_count - 1 do
|
||||
-- if i >= self._view_handCardList.numItems then
|
||||
self._view_handCardList:AddItemFromPool()
|
||||
-- end
|
||||
end
|
||||
self._ctr_getCard.selectedIndex = getcard and 1 or 0
|
||||
end
|
||||
|
||||
-- 获取麻将图片资源位置,可以在扩展中复写
|
||||
|
|
@ -264,91 +167,14 @@ function M:UpdateOutCardList(outcard, card_item, cursor)
|
|||
card_item = card_item or 0
|
||||
cursor = cursor or nil
|
||||
|
||||
local outCardName = self._viewText_cardInfo['Out_Card']
|
||||
local outcard
|
||||
|
||||
local outlist = self._player.outcard_list
|
||||
if (outcard) then
|
||||
outcard:SetPivot(0.5, 0.5, true)
|
||||
outcard.touchable = false
|
||||
-- outcard.icon = "ui://Main_Majiang/" .. self:GetPrefix() .. "202_" .. card_item
|
||||
outcard.icon = string.format('ui://%s/%s202_%s', self:GetCardPicPack(), self:GetPrefix(), card_item)
|
||||
self._mask_liangpai:AddChild(outcard)
|
||||
end
|
||||
|
||||
local outcard_list = self._mask_data['outcard_list']
|
||||
local oder = outcard_list['oder']
|
||||
local comp = outcard_list['comp']
|
||||
local card = outcard_list['card']
|
||||
local multi_oder = outcard_list['multi_oder']
|
||||
local num = outcard_list['num']
|
||||
local multi_draw_oder = 0
|
||||
local sortStart = 0
|
||||
local sortType = 0
|
||||
local sortStep = 0
|
||||
if (outcard_list['multi_draw_oder']) then
|
||||
multi_draw_oder = outcard_list['multi_draw_oder']
|
||||
end
|
||||
|
||||
if self._current_card_type == 2 then
|
||||
comp = comp .. '_3d'
|
||||
num = outcard_list['num3d']
|
||||
multi_oder = outcard_list['multi_oder3d']
|
||||
sortType = outcard_list['sorting_order3d']
|
||||
card = outcard_list['card3d']
|
||||
if sortType == 1 then
|
||||
sortStart = 1
|
||||
sortStep = 1
|
||||
elseif sortType == -1 then
|
||||
sortStart = #outlist
|
||||
sortStep = -1
|
||||
end
|
||||
end
|
||||
|
||||
local obj = nil
|
||||
self._area_outcard_list:RemoveChildren(0, -1, true)
|
||||
for i = 0, #outlist - 1 do
|
||||
obj = UIPackage.CreateObjectFromURL('ui://Main_Majiang/' .. comp)
|
||||
local row = math.floor(i / num)
|
||||
local col = math.floor(i % num)
|
||||
|
||||
if self._current_card_type == 2 then
|
||||
if i >= num then
|
||||
row = 1 + math.floor(((i - num) / (num + 2)))
|
||||
col = ((i - num) % (num + 2))
|
||||
end
|
||||
end
|
||||
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, 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
|
||||
ViewUtil.CardPos(obj, self._area_outcard_list, oder, col)
|
||||
ViewUtil.CardPos(obj, self._area_outcard_list, multi_oder, row)
|
||||
end
|
||||
|
||||
|
||||
if self._current_card_type == 2 then
|
||||
self:adjust3dOutPut(obj, self._area_outcard_list, oder, num, i)
|
||||
end
|
||||
|
||||
self:fillCard(obj, card, outlist[i + 1])
|
||||
-- 添加角标
|
||||
self:AddFlag(i + 1, outlist[i], obj)
|
||||
-- obj.icon = "ui://Main_Majiang/"..card .. outlist[i+1]
|
||||
sortStart = sortStart + sortStep
|
||||
obj.sortingOrder = sortStart
|
||||
obj.data = outlist[i + 1]
|
||||
|
||||
if (oder == AreaOderType.down_up or (multi_draw_oder == 1)) then
|
||||
self._area_outcard_list:AddChildAt(obj, 0)
|
||||
else
|
||||
self._area_outcard_list:AddChild(obj)
|
||||
end
|
||||
end
|
||||
if (obj and cursor) then
|
||||
cursor.xy = Vector2(obj.width / 2, obj.height / 2)
|
||||
obj:AddChild(cursor)
|
||||
obj:GetController('color').selectedIndex = 1
|
||||
local outcard = self._view_outCardList:AddItemFromPool()
|
||||
self:fillCard2(outcard, outCardName, outlist[i + 1])
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -380,155 +206,49 @@ local function getPos(my_seat, other_seat, total)
|
|||
end
|
||||
|
||||
function M:UpdateFzList(fz, index, show_card)
|
||||
local gn = 3
|
||||
if fz.type == FZType.Gang or fz.type == FZType.Gang_An or fz.type == FZType.Gang_Peng then
|
||||
gn = 4
|
||||
end
|
||||
|
||||
|
||||
local fz_list = self._mask_data['fz_list']
|
||||
local oder = fz_list['oder']
|
||||
local comp = fz_list['comp'] .. gn
|
||||
local card = fz_list['card']
|
||||
local card3d = ''
|
||||
local adjust3d = 0
|
||||
if self._current_card_type == 2 then
|
||||
comp = comp .. '_3d'
|
||||
oder = fz_list['oder3d']
|
||||
adjust3d = fz_list['adjust3d']
|
||||
card = fz_list['card3d']
|
||||
card3d = 'b'
|
||||
end
|
||||
local FZame = self._viewText_cardInfo['FZ_Card']
|
||||
index = index or 0
|
||||
show_card = show_card or nil
|
||||
|
||||
local obj = UIPackage.CreateObjectFromURL('ui://Main_Majiang/' .. comp)
|
||||
-- print("============================================pengpengpeng", comp)
|
||||
local outCard
|
||||
|
||||
local _area_fz_list = self._area_fz_list
|
||||
local _area_outcard_list = self._area_outcard_list
|
||||
|
||||
if (index == -1) then
|
||||
local num = _area_fz_list.numChildren
|
||||
|
||||
if (oder == AreaOderType.down_up or oder == AreaOderType.up_down) then
|
||||
_area_fz_list.height = _area_fz_list.height + obj.height
|
||||
if (oder == AreaOderType.down_up) then
|
||||
local tem1 = obj.height
|
||||
for i = 1, num do
|
||||
local tem = _area_fz_list:GetChildAt(num - i)
|
||||
tem.y = tem.y + tem1
|
||||
end
|
||||
_area_fz_list.y = _area_fz_list.y - obj.height
|
||||
else
|
||||
ViewUtil.CardPos(obj, _area_outcard_list, oder, num)
|
||||
end
|
||||
elseif (oder == AreaOderType.left_right or oder == AreaOderType.right_left) then
|
||||
_area_fz_list.width = _area_fz_list.width + obj.width
|
||||
if (oder == AreaOderType.right_left) then
|
||||
local tem1 = obj.width
|
||||
for i = 1, num do
|
||||
local tem = _area_fz_list:GetChildAt(num - i)
|
||||
tem.x = tem.x + tem1
|
||||
end
|
||||
_area_fz_list.x = _area_fz_list.x - obj.width
|
||||
else
|
||||
ViewUtil.CardPos(obj, _area_outcard_list, oder, num)
|
||||
end
|
||||
end
|
||||
_area_fz_list:AddChild(obj)
|
||||
|
||||
if self._current_card_type == 2 and (oder == AreaOderType.down_up or oder == AreaOderType.up_down) then
|
||||
num = _area_fz_list.numChildren
|
||||
for i = 1, num do
|
||||
local tem = _area_fz_list:GetChildAt(i - 1)
|
||||
tem.x = adjust3d * (i - 1)
|
||||
end
|
||||
end
|
||||
else
|
||||
local obj1 = _area_fz_list:RemoveChildAt(index)
|
||||
obj1:Dispose()
|
||||
obj.xy = obj1.xy
|
||||
_area_fz_list:AddChildAt(obj, index)
|
||||
end
|
||||
|
||||
-- 显示fz的牌
|
||||
local obj_show
|
||||
if show_card then
|
||||
obj_show = UIPackage.CreateObjectFromURL('ui://Main_Majiang/Fz_0_' .. gn)
|
||||
end
|
||||
|
||||
for i = 1, gn do
|
||||
local _oc = obj:GetChild('card_' .. i)
|
||||
local _oc2 = nil
|
||||
|
||||
if show_card then
|
||||
_oc2 = obj_show:GetChild('card_' .. i)
|
||||
end
|
||||
|
||||
if (fz.type == FZType.Gang_An and i == gn) then
|
||||
if self._current_card_type == 2 then
|
||||
_oc.icon = UIPackage.GetItemURL('MajiangCard3d', card3d .. card .. '00')
|
||||
else
|
||||
_oc.icon = UIPackage.GetItemURL(self:GetCardPicPack(), card3d .. card .. '00')
|
||||
end
|
||||
|
||||
if show_card then
|
||||
_oc2.icon = UIPackage.GetItemURL('Main_Majiang', '202_00')
|
||||
end
|
||||
else
|
||||
if (fz.type == FZType.Chi) then
|
||||
local index = i
|
||||
if oder == AreaOderType.right_left or oder == AreaOderType.down_up then
|
||||
index = gn - i + 1
|
||||
end
|
||||
|
||||
self:fillCard(_oc, card, fz.opcard[index])
|
||||
|
||||
if show_card then
|
||||
self:fillCard(_oc2, '202_', fz.opcard[index], false)
|
||||
end
|
||||
else
|
||||
self:fillCard(_oc, card, fz.card)
|
||||
|
||||
if show_card then
|
||||
self:fillCard(_oc2, '202_', fz.card, false)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
obj.touchable = false
|
||||
|
||||
if show_card then
|
||||
obj_show.touchable = false
|
||||
obj_show:SetPivot(0.5, 0.5, true)
|
||||
obj_show:SetScale(0.8, 0.8)
|
||||
self._mask_liangpai:AddChildAt(obj_show, 0)
|
||||
coroutine.start(
|
||||
function()
|
||||
coroutine.wait(2)
|
||||
obj_show:Dispose()
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
-- -- 标记碰牌对象
|
||||
-- local num = self._area_fz_list.numChildren
|
||||
-- if num == 0 then return end
|
||||
-- if index == -1 then
|
||||
-- -- local obj = self._area_fz_list:GetChildAt(num - 1)
|
||||
-- local pic_arrow = UIPackage.CreateObjectFromURL("ui://Main_Majiang/com_arrow")
|
||||
-- obj:AddChild(pic_arrow)
|
||||
-- pic_arrow:Center()
|
||||
-- local my_seat = self._player.seat
|
||||
-- if fz.from_seat ~= my_seat then
|
||||
-- pic_arrow:GetController("show").selectedIndex = 1
|
||||
-- pic_arrow:GetController("pos").selectedIndex = getPos(DataManager.CurrenRoom.self_player.seat, fz.from_seat, #DataManager.CurrenRoom.player_list)
|
||||
-- pic_arrow:SetPivot(0.5, 0.5)
|
||||
-- if DataManager.CurrenRoom.self_player.seat ~= self._player.seat then
|
||||
-- pic_arrow.scaleX = 0.5
|
||||
-- pic_arrow.scaleY = 0.5
|
||||
-- end
|
||||
-- if self._view_outCardList.numItems < #outlist - 1 then
|
||||
-- for i = 1, #outlist - 1 do
|
||||
-- outcard = self._view_outCardList:AddItemFromPool()
|
||||
-- -- end
|
||||
-- self:fillCard2(outcard, outCardName, outlist[i])
|
||||
-- end
|
||||
-- end
|
||||
|
||||
outCard = self._view_FZList:AddItemFromPool()
|
||||
|
||||
if fz.type == FZType.Chi then
|
||||
for i = 1, 3 do
|
||||
local FZCard = outCard:GetChild(string.format("Comp_Card%d", i))
|
||||
self:fillCard2(FZCard, FZame, fz.opcard[i])
|
||||
end
|
||||
else
|
||||
local ctr_Four = outCard:GetController("isFour")
|
||||
for i = 1, 3 do
|
||||
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)
|
||||
end
|
||||
if fz.type == FZType.Peng then
|
||||
ctr_Four.selectedIndex = 0
|
||||
else
|
||||
ctr_Four.selectedIndex = 1
|
||||
local FZCard = outCard:GetChild(string.format("Comp_Card%d", 4))
|
||||
self:fillCard2(FZCard, FZame, fz.card)
|
||||
if fz.type == FZType.Gang_An then
|
||||
self:fillCard2(FZCard, FZame, '00')
|
||||
end
|
||||
end
|
||||
end
|
||||
-- self:fillCard2(outcard, outCardName, card_item)
|
||||
end
|
||||
|
||||
function M:GetOutCardByIndex(index)
|
||||
|
|
|
|||
|
|
@ -36,129 +36,62 @@ end
|
|||
|
||||
function M:init()
|
||||
MJPlayerCardInfoView.init(self)
|
||||
|
||||
local filename = 'mjsize' .. DataManager.SelfUser.account_id
|
||||
local json_data = Utils.LoadLocalFile(filename)
|
||||
if json_data then
|
||||
local _data = json.decode(json_data)
|
||||
if _data.size == 0 then
|
||||
self._area_handcard_list:SetScale(1, 1.1)
|
||||
self._area_fz_list:SetScale(0.6, 0.6)
|
||||
elseif _data.size == 1 then
|
||||
self._area_handcard_list:SetScale(1, 1)
|
||||
self._area_fz_list:SetScale(1, 1)
|
||||
elseif _data.size == 2 then
|
||||
self._area_handcard_list:SetScale(0.8, 0.8)
|
||||
self._area_fz_list:SetScale(0.8, 0.8)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function M:setHandCardPos(btn_card, i, getcard)
|
||||
if DataManager.CurrenRoom.room_config.people_num == 2 then
|
||||
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
|
||||
btn_card.x = i * btn_card.width * 1.05 + (getcard and 20 or 0)
|
||||
end
|
||||
end
|
||||
|
||||
function M:UpdateHandCard(getcard, mp)
|
||||
print("==========================UpdateHandCardold", getcard, mp)
|
||||
if self.outcard_button then
|
||||
self.outcard_button:Dispose()
|
||||
self.outcard_button = nil
|
||||
end
|
||||
local _carViewList = self._carViewList
|
||||
local card_list = DataManager.CurrenRoom.self_player.card_list
|
||||
|
||||
getcard = getcard or false
|
||||
mp = mp or false
|
||||
local pv = self
|
||||
local _carViewList = self._carViewList
|
||||
|
||||
local _lit = pv._area_handcard_list
|
||||
for i = 1, #_carViewList do
|
||||
_carViewList[i].card:Dispose()
|
||||
end
|
||||
_carViewList = {}
|
||||
local _dragCom = self._dragCom
|
||||
if (_dragCom == nil) then
|
||||
_dragCom = UIPackage.CreateObject("Common", "UIPanel")
|
||||
_dragCom.size = Vector2(1, 1)
|
||||
pv._view:AddChild(_dragCom)
|
||||
end
|
||||
_dragCom.xy = pv._area_handcard_list.xy
|
||||
self._dragCom = _dragCom
|
||||
self._carViewList = _carViewList
|
||||
local handCardName = self._viewText_cardInfo['Hand_Card']
|
||||
|
||||
local b3d = ""
|
||||
if self._current_card_type == 2 then
|
||||
b3d = "_3d"
|
||||
if self._view_handCardList.numItems > 0 then
|
||||
self._view_handCardList:RemoveChildren()
|
||||
end
|
||||
if self._view_handCardList.numItems > 0 then
|
||||
self._view_getCard:RemoveChildren()
|
||||
end
|
||||
|
||||
local _room = DataManager.CurrenRoom
|
||||
local cards = _room.self_player.card_list
|
||||
|
||||
if (not mp) then
|
||||
for i = 0, (#cards) - 1 do
|
||||
local tem_card = cards[i + 1]
|
||||
local btn_card = nil
|
||||
if _room.room_config.people_num == 2 then
|
||||
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)
|
||||
for i = 0, (#card_list) - 1 do
|
||||
local tem_card = card_list[i + 1]
|
||||
local btn_card
|
||||
if getcard and i == (#card_list) - 1 then
|
||||
btn_card = self._view_getCard:AddItemFromPool()
|
||||
btn_card.onClick:Add(function(context)
|
||||
self:__OnClickGetCard(context)
|
||||
end)
|
||||
else
|
||||
btn_card = UIPackage.CreateObject(self:GetCardObjPack(), "Btn_Card" .. b3d)
|
||||
btn_card:SetScale(1.05, 1.05)
|
||||
btn_card = self._view_handCardList:AddItemFromPool()
|
||||
end
|
||||
|
||||
-- btn_card.icon = UIPackage.GetItemURL("Main_Majiang", "201_" .. tem_card)
|
||||
self:fillCard(btn_card, "201_", tem_card)
|
||||
self:setHandCardPos(btn_card, i, i == #cards - 1 and getcard)
|
||||
self:fillCard2(btn_card, handCardName, tem_card)
|
||||
local c_v = NewCardView(btn_card, tem_card)
|
||||
c_v.index = i
|
||||
c_v.old_postion = btn_card.xy
|
||||
_carViewList[#_carViewList + 1] = c_v
|
||||
|
||||
_lit:AddChild(btn_card)
|
||||
|
||||
if (not self._player.auto_out_card) then
|
||||
btn_card.data = c_v
|
||||
-- btn_card.draggable = true;
|
||||
-- btn_card.onDragStart:Set(function(evt)
|
||||
-- local _agent = evt.sender
|
||||
-- _agent:RemoveFromParent()
|
||||
-- _dragCom:AddChild(_agent)
|
||||
-- if self.__OnDragStart then
|
||||
-- self:__OnDragStart(evt)
|
||||
-- end
|
||||
-- _agent.onDragEnd:Set(self.__OnDragEnd,self)
|
||||
-- end)
|
||||
btn_card.onTouchBegin:Set(handler(self, self.onTouchBegin))
|
||||
btn_card.onTouchMove:Set(handler(self, self.onTouchMove))
|
||||
btn_card.onTouchEnd:Set(handler(self, self.__OnDragEnd))
|
||||
btn_card.onClick:Set(self.__OnClickHandCard, self)
|
||||
btn_card.onClick:Set(handler(self, self.__OnClickHandCard))
|
||||
end
|
||||
|
||||
if getcard then
|
||||
self._ctr_getCard.selectedIndex = 1
|
||||
else
|
||||
btn_card:GetChild("icon").color = Color(0.5, 0.5, 0.5)
|
||||
btn_card.touchable = false
|
||||
end
|
||||
end
|
||||
else
|
||||
for i = 0, (#cards) - 1 do
|
||||
local mp_card = UIPackage.CreateObject("Main_Majiang", "Mp_self_card" .. b3d)
|
||||
-- mp_card.icon = UIPackage.GetItemURL("Main_Majiang", "202_" .. cards[i+1])
|
||||
self:fillCard(mp_card, "202_", cards[i + 1])
|
||||
mp_card:SetScale(1.05, 1.05)
|
||||
-- mp_card.x = i * mp_card.width + (i == #cards - 1 and getcard and 20 or 0)
|
||||
self:setHandCardPos(mp_card, i, i == #cards - 1 and getcard)
|
||||
_lit:AddChild(mp_card)
|
||||
end
|
||||
self._ctr_getCard.selectedIndex = 0
|
||||
end
|
||||
self._view_handCardList.onClickItem:Set(function(context)
|
||||
self:__OnClickHandCard(context)
|
||||
end)
|
||||
end
|
||||
|
||||
function M:onTouchBegin(context)
|
||||
local button = context.sender
|
||||
self._touchPos = button.xy
|
||||
local card = button.data
|
||||
local xy = self._area_handcard_list:GlobalToLocal(Vector2.New(context.inputEvent.x, context.inputEvent.y))
|
||||
self._touchIndex = card.index
|
||||
local xy = self._view_handCardList:GlobalToLocal(Vector2.New(context.inputEvent.x, context.inputEvent.y))
|
||||
card.touch_pos = xy - button.xy
|
||||
if self.__OnDragStart then
|
||||
self:__OnDragStart(card.card_item)
|
||||
|
|
@ -167,46 +100,103 @@ end
|
|||
|
||||
function M:onTouchMove(context)
|
||||
local button = context.sender
|
||||
|
||||
local card = button.data
|
||||
local xy = self._area_handcard_list:GlobalToLocal(Vector2.New(context.inputEvent.x, context.inputEvent.y))
|
||||
local xy = self._view_handCardList:GlobalToLocal(Vector2.New(context.inputEvent.x, context.inputEvent.y))
|
||||
button.xy = xy - card.touch_pos
|
||||
end
|
||||
|
||||
function M:__OnDragEnd(context)
|
||||
if self.outcard_button then
|
||||
self.outcard_button:Dispose()
|
||||
self.outcard_button = nil
|
||||
end
|
||||
local button = context.sender
|
||||
-- button.onDragEnd:Set(nil)
|
||||
--button:RemoveFromParent()
|
||||
|
||||
local card = button.data
|
||||
local _room = DataManager.CurrenRoom
|
||||
if not _room or _room:GetReloadStatus() then return end
|
||||
|
||||
-- -- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
||||
if (button.y < -150 and _room.curren_outcard_seat == _room.self_player.seat) then
|
||||
self._mainView:OutCard(card.card_item)
|
||||
button.touchable = false
|
||||
self.outcard_button = buttond
|
||||
self.outcard_button = button
|
||||
button.xy = self._touchPos
|
||||
else
|
||||
self._area_handcard_list:AddChildAt(button, card.index)
|
||||
button:TweenMove(card.old_postion, 0.2)
|
||||
if self._touchIndex ~= card.index then
|
||||
-- local tempPos = self._touchPos
|
||||
-- self._touchPos = button.xy
|
||||
-- button:TweenMove(tempPos, 0.2)
|
||||
else
|
||||
button:TweenMove(self._touchPos, 0.2)
|
||||
self._touchPos = -1
|
||||
self._touchIndex = -1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function M:__OnClickHandCard(context)
|
||||
self._ctr_seletedGet.selectedIndex = 1
|
||||
local button = context.data
|
||||
|
||||
local _room = DataManager.CurrenRoom
|
||||
if ((Utils.IsDoubleClick(context) or self._click_index == self._view_handCardList.selectedIndex) and _room.curren_outcard_seat == _room.self_player.seat) then
|
||||
local card = button.data
|
||||
self._mainView:OutCard(card.card_item)
|
||||
self._view_handCardList.selectedIndex = -1
|
||||
self._click_index = self._view_handCardList.selectedIndex
|
||||
self._ctr_seletedGet.selectedIndex = 0
|
||||
end
|
||||
self._click_index = self._view_handCardList.selectedIndex
|
||||
end
|
||||
|
||||
function M:__OnClickGetCard(context)
|
||||
self._view_handCardList.selectedIndex = -1
|
||||
local button = context.sender
|
||||
local _carViewList = self._carViewList
|
||||
for i = 1, #_carViewList do
|
||||
if (_carViewList[i].card ~= button) then
|
||||
_carViewList[i].card.selected = false
|
||||
end
|
||||
end
|
||||
local _room = DataManager.CurrenRoom
|
||||
if (Utils.IsDoubleClick(context) and _room.curren_outcard_seat == _room.self_player.seat) then
|
||||
local card = button.data
|
||||
self._mainView:OutCard(card.card_item)
|
||||
self._view_handCardList.selectedIndex = -1
|
||||
self._click_index = self._view_handCardList.selectedIndex
|
||||
self._ctr_seletedGet.selectedIndex = 0
|
||||
end
|
||||
end
|
||||
|
||||
function M:UpdateFzList(fz, index, show_card)
|
||||
local isFour = false
|
||||
if fz.type == FZType.Gang or fz.type == FZType.Gang_An or fz.type == FZType.Gang_Peng then
|
||||
isFour = true
|
||||
end
|
||||
|
||||
-- local FZame = self._viewText_cardInfo['FZ_Card']
|
||||
local FZame = "202_"
|
||||
index = index or 0
|
||||
show_card = show_card or nil
|
||||
|
||||
local outCard
|
||||
|
||||
outCard = self._view_FZList:AddItemFromPool()
|
||||
|
||||
if fz.type == FZType.Chi then
|
||||
for i = 1, 3 do
|
||||
local FZCard = outCard:GetChild(string.format("Comp_Card%d", i))
|
||||
self:fillCard2(FZCard, FZame, fz.opcard[i])
|
||||
end
|
||||
else
|
||||
local ctr_Four = outCard:GetController("isFour")
|
||||
for i = 1, 3 do
|
||||
local FZCard = outCard:GetChild(string.format("Comp_Card%d", i))
|
||||
self:fillCard2(FZCard, FZame, fz.card)
|
||||
end
|
||||
if fz.type == FZType.Peng then
|
||||
ctr_Four.selectedIndex = 0
|
||||
else
|
||||
ctr_Four.selectedIndex = 1
|
||||
local FZCard = outCard:GetChild(string.format("Comp_Card%d", 4))
|
||||
self:fillCard2(FZCard, FZame, fz.card)
|
||||
if fz.type == FZType.Gang_An then
|
||||
self:fillCard2(FZCard, FZame, '00')
|
||||
elseif fz.type == FZType.Gang_Peng then
|
||||
self._view_FZList:RemoveChildAt(self._view_FZList.numItems - 2)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -217,10 +207,6 @@ end
|
|||
|
||||
function M:Clear()
|
||||
MJPlayerCardInfoView.Clear(self)
|
||||
for i = 1, #self._carViewList do
|
||||
self._carViewList[i].card:Dispose()
|
||||
end
|
||||
self._carViewList = {}
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 1.5 MiB |
|
|
@ -0,0 +1,92 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 48b155ec7d34db94f9fc660cfaccafae
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 11
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: -1
|
||||
aniso: -1
|
||||
mipBias: -100
|
||||
wrapU: -1
|
||||
wrapV: -1
|
||||
wrapW: -1
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
applyGammaDecoding: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName: base/main_majiang/bceee620094f2c87befefb9d76b9b13b
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 3b7e84f83e9350d488dacbb797e5d51d
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName: base/main_majiang/bceee620094f2c87befefb9d76b9b13b
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 2.5 MiB After Width: | Height: | Size: 2.5 MiB |
Binary file not shown.
Loading…
Reference in New Issue