修改字牌
parent
623618f78e
commit
ec8e4f9cd5
|
|
@ -341,8 +341,11 @@ function M:UpdateFamilyRoom(fgCtr, id)
|
||||||
list_room:SetVirtual()
|
list_room:SetVirtual()
|
||||||
local list_gamePlay = self._view:GetChild('list_gamePlay')
|
local list_gamePlay = self._view:GetChild('list_gamePlay')
|
||||||
list_gamePlay:SetVirtual()
|
list_gamePlay:SetVirtual()
|
||||||
local playList = DataManager.groups:get(id).playList
|
local playList = self._group.playList
|
||||||
local roomList = DataManager.groups:get(id).rooms
|
local roomList = self._group.rooms
|
||||||
|
print("=========================playList,rooms")
|
||||||
|
pt(playList)
|
||||||
|
pt(roomList)
|
||||||
list_room.itemRenderer = function(index, obj)
|
list_room.itemRenderer = function(index, obj)
|
||||||
if index < #roomList then
|
if index < #roomList then
|
||||||
-- local config = ExtendManager.GetExtendConfig(roomList[index + 1].pid)
|
-- local config = ExtendManager.GetExtendConfig(roomList[index + 1].pid)
|
||||||
|
|
@ -351,13 +354,13 @@ function M:UpdateFamilyRoom(fgCtr, id)
|
||||||
-- obj:GetChild('Label_gameRule').title = gamePlay
|
-- obj:GetChild('Label_gameRule').title = gamePlay
|
||||||
obj:GetChild('game_type').text = string.format("房间-%s", roomList[index + 1].id)
|
obj:GetChild('game_type').text = string.format("房间-%s", roomList[index + 1].id)
|
||||||
obj:GetChild('btn_joinGame'):GetController('type').selectedIndex = 1
|
obj:GetChild('btn_joinGame'):GetController('type').selectedIndex = 1
|
||||||
obj:GetChild('btn_joinGame').onClick:Add(function()
|
obj:GetChild('btn_joinGame').onClick:Set(function()
|
||||||
ViewUtil.ShowModalWait(self._root_view, "匹配房间中", 'join_room')
|
ViewUtil.ShowModalWait(self._root_view, "匹配房间中", 'join_room')
|
||||||
local roomCtr = ControllerManager.GetController(RoomController)
|
local roomCtr = ControllerManager.GetController(RoomController)
|
||||||
roomCtr:PublicJoinRoom(
|
roomCtr:PublicJoinRoom(
|
||||||
Protocol.WEB_FG_MATCH_ROOM,
|
Protocol.WEB_FG_JOIN_ROOM,
|
||||||
roomList[index + 1].id,
|
roomList[index + 1].id,
|
||||||
true,
|
false,
|
||||||
function(response)
|
function(response)
|
||||||
ViewUtil.CloseModalWait('join_room')
|
ViewUtil.CloseModalWait('join_room')
|
||||||
if (response.ReturnCode == -1) then
|
if (response.ReturnCode == -1) then
|
||||||
|
|
@ -374,7 +377,7 @@ function M:UpdateFamilyRoom(fgCtr, id)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
id,
|
id,
|
||||||
playList[index + 1].id
|
roomList[index + 1].pid
|
||||||
)
|
)
|
||||||
end)
|
end)
|
||||||
else
|
else
|
||||||
|
|
@ -384,7 +387,7 @@ function M:UpdateFamilyRoom(fgCtr, id)
|
||||||
-- obj:GetChild('Label_gameRule').title = gamePlay
|
-- obj:GetChild('Label_gameRule').title = gamePlay
|
||||||
obj:GetChild('game_type').text = playList[index - #roomList + 1].name
|
obj:GetChild('game_type').text = playList[index - #roomList + 1].name
|
||||||
obj:GetChild('btn_joinGame'):GetController('type').selectedIndex = 0
|
obj:GetChild('btn_joinGame'):GetController('type').selectedIndex = 0
|
||||||
obj:GetChild('btn_joinGame').onClick:Add(function()
|
obj:GetChild('btn_joinGame').onClick:Set(function()
|
||||||
ViewUtil.ShowModalWait(self._root_view, "匹配房间中", 'join_room')
|
ViewUtil.ShowModalWait(self._root_view, "匹配房间中", 'join_room')
|
||||||
local roomCtr = ControllerManager.GetController(RoomController)
|
local roomCtr = ControllerManager.GetController(RoomController)
|
||||||
fgCtr:FG_ChangeFag(id, DataManager.SelfUser.acc, 777777, function()
|
fgCtr:FG_ChangeFag(id, DataManager.SelfUser.acc, 777777, function()
|
||||||
|
|
@ -436,6 +439,7 @@ function M:UpdateFamilyRoom(fgCtr, id)
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
print("=======================why", list_room.numItems, #playList, #roomList)
|
||||||
list_room.numItems = #playList + #roomList
|
list_room.numItems = #playList + #roomList
|
||||||
list_gamePlay.numItems = #playList + 1
|
list_gamePlay.numItems = #playList + 1
|
||||||
end
|
end
|
||||||
|
|
@ -535,7 +539,6 @@ function M:OnUpdate()
|
||||||
ViewUtil.ErrorTip(res.ReturnCode, string.format('删除房间-%s失败!', self._group.rooms[i].id))
|
ViewUtil.ErrorTip(res.ReturnCode, string.format('删除房间-%s失败!', self._group.rooms[i].id))
|
||||||
else
|
else
|
||||||
self._roomNum = #self._group.rooms
|
self._roomNum = #self._group.rooms
|
||||||
self._group.update_room = false
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,7 @@ end
|
||||||
|
|
||||||
function M:Show()
|
function M:Show()
|
||||||
BaseView.Show(self)
|
BaseView.Show(self)
|
||||||
-- self:QuickLogin()
|
self:QuickLogin()
|
||||||
end
|
end
|
||||||
|
|
||||||
local function __goto_lobby(response)
|
local function __goto_lobby(response)
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,10 @@ local CardCheck = import(".CardCheck")
|
||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
--
|
--
|
||||||
function M.new(view,mainView)
|
function M.new(view, mainView)
|
||||||
setmetatable(MJPlayerSelfCardInfoView, {__index = MJPlayerCardInfoView})
|
setmetatable(MJPlayerSelfCardInfoView, { __index = MJPlayerCardInfoView })
|
||||||
setmetatable(M, {__index = MJPlayerSelfCardInfoView})
|
setmetatable(M, { __index = MJPlayerSelfCardInfoView })
|
||||||
local self = setmetatable({},{__index = M})
|
local self = setmetatable({}, { __index = M })
|
||||||
self.class = "PlayerSelfCardInfoView"
|
self.class = "PlayerSelfCardInfoView"
|
||||||
self._view = view
|
self._view = view
|
||||||
self._mainView = mainView
|
self._mainView = mainView
|
||||||
|
|
@ -17,16 +17,16 @@ end
|
||||||
|
|
||||||
function M:ShowHuTip(card_list)
|
function M:ShowHuTip(card_list)
|
||||||
printlog("ShowHuTip")
|
printlog("ShowHuTip")
|
||||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
|
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui,
|
||||||
|
DataManager.CurrenRoom.room_config.Laizi)
|
||||||
if #tingList > 0 then
|
if #tingList > 0 then
|
||||||
if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo>0 then
|
if DataManager.CurrenRoom.laiziInfo and #DataManager.CurrenRoom.laiziInfo > 0 then
|
||||||
for i=1,#DataManager.CurrenRoom.laiziInfo do
|
for i = 1, #DataManager.CurrenRoom.laiziInfo do
|
||||||
if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i],tingList)==false then
|
if IsHasDictionary(DataManager.CurrenRoom.laiziInfo[i], tingList) == false then
|
||||||
table.insert(tingList,DataManager.CurrenRoom.laiziInfo[i] )
|
table.insert(tingList, DataManager.CurrenRoom.laiziInfo[i])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
self._mainView._hu_tip:FillData(tingList)
|
self._mainView._hu_tip:FillData(tingList)
|
||||||
end
|
end
|
||||||
|
|
@ -35,30 +35,26 @@ function M:UpdateHandCard(getcard, mp)
|
||||||
MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp)
|
MJPlayerSelfCardInfoView.UpdateHandCard(self, getcard, mp)
|
||||||
local _carViewList = self._carViewList
|
local _carViewList = self._carViewList
|
||||||
|
|
||||||
if DataManager.CurrenRoom.laiziInfo and #self._carViewList>0 then
|
if DataManager.CurrenRoom.laiziInfo and #self._carViewList > 0 then
|
||||||
for i=1,#self._carViewList do
|
for i = 1, #self._carViewList do
|
||||||
local obj=self._carViewList[i]
|
local obj = self._carViewList[i]
|
||||||
if obj and obj.card then
|
if obj and obj.card then
|
||||||
if IsHasDictionary(obj.card_item,DataManager.CurrenRoom.laiziInfo) then
|
if IsHasDictionary(obj.card_item, DataManager.CurrenRoom.laiziInfo) then
|
||||||
if obj.card.GetController then
|
if obj.card.GetController then
|
||||||
if obj.card:GetController("laizi") then
|
if obj.card:GetController("laizi") then
|
||||||
obj.card:GetController("laizi").selectedIndex=1
|
obj.card:GetController("laizi").selectedIndex = 1
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
else
|
||||||
else
|
if obj.card.GetController then
|
||||||
if obj.card.GetController then
|
if obj.card:GetController("laizi") then
|
||||||
if obj.card:GetController("laizi") then
|
obj.card:GetController("laizi").selectedIndex = 0
|
||||||
obj.card:GetController("laizi").selectedIndex=0
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
local card_list = DataManager.CurrenRoom.self_player.card_list
|
local card_list = DataManager.CurrenRoom.self_player.card_list
|
||||||
|
|
@ -73,7 +69,8 @@ function M:UpdateHandCard(getcard, mp)
|
||||||
local btn = _carViewList[i].card
|
local btn = _carViewList[i].card
|
||||||
local card = self:GetCard(btn)
|
local card = self:GetCard(btn)
|
||||||
list_remove(card_list, card)
|
list_remove(card_list, card)
|
||||||
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true, DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
|
local tingList = CardCheck.MuiltiplteCaculateTingPai(card_list, true,
|
||||||
|
DataManager.CurrenRoom.room_config.Qidui, DataManager.CurrenRoom.room_config.Laizi)
|
||||||
if #tingList > 0 then
|
if #tingList > 0 then
|
||||||
local count = 0
|
local count = 0
|
||||||
for j = 1, #tingList do
|
for j = 1, #tingList do
|
||||||
|
|
@ -92,7 +89,7 @@ function M:UpdateHandCard(getcard, mp)
|
||||||
end)
|
end)
|
||||||
-- 如果几张牌的可胡牌数一致,也只显示'三角',可胡牌数不一致才显示'多'
|
-- 如果几张牌的可胡牌数一致,也只显示'三角',可胡牌数不一致才显示'多'
|
||||||
local all_same = #lst_mark ~= 0 and lst_mark[1].count == total_num / #lst_mark or false
|
local all_same = #lst_mark ~= 0 and lst_mark[1].count == total_num / #lst_mark or false
|
||||||
for i = 1, #lst_mark do
|
for i = 1, #lst_mark do
|
||||||
local tem = lst_mark[i]
|
local tem = lst_mark[i]
|
||||||
if all_same or tem.count < lst_mark[1].count then
|
if all_same or tem.count < lst_mark[1].count then
|
||||||
tem.item:GetController("mark_ting").selectedIndex = 1
|
tem.item:GetController("mark_ting").selectedIndex = 1
|
||||||
|
|
@ -109,7 +106,6 @@ function M:UpdateHandCard(getcard, mp)
|
||||||
end
|
end
|
||||||
self._out_card = false
|
self._out_card = false
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:__OnClickHandCard(context)
|
function M:__OnClickHandCard(context)
|
||||||
|
|
@ -117,10 +113,10 @@ function M:__OnClickHandCard(context)
|
||||||
local _carViewList = self._carViewList
|
local _carViewList = self._carViewList
|
||||||
local refresh = true
|
local refresh = true
|
||||||
local card_list = {}
|
local card_list = {}
|
||||||
for i=1,#_carViewList do
|
for i = 1, #_carViewList do
|
||||||
local btn = _carViewList[i].card
|
local btn = _carViewList[i].card
|
||||||
local card = self:GetCard(btn)
|
local card = self:GetCard(btn)
|
||||||
if btn ~= button and btn.selected == true then
|
if btn ~= button and btn.selected == true then
|
||||||
if button.data.card_item == card then
|
if button.data.card_item == card then
|
||||||
refresh = false
|
refresh = false
|
||||||
else
|
else
|
||||||
|
|
@ -160,10 +156,10 @@ function M:__OnDragStart(card)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:__OnDragEnd(context)
|
function M:__OnDragEnd(context)
|
||||||
if self.outcard_button then
|
if self.outcard_button then
|
||||||
self.outcard_button:Dispose()
|
self.outcard_button:Dispose()
|
||||||
self.outcard_button = nil
|
self.outcard_button = nil
|
||||||
end
|
end
|
||||||
local button = context.sender
|
local button = context.sender
|
||||||
|
|
||||||
--button:RemoveFromParent()
|
--button:RemoveFromParent()
|
||||||
|
|
@ -190,6 +186,7 @@ function M:CheckPlayerOnlineState()
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:Clear(bskip)
|
function M:Clear(bskip)
|
||||||
--self._ctr_state.selectedIndex = 0
|
--self._ctr_state.selectedIndex = 0
|
||||||
self._area_fz_list.x = self._src_fz_list.x
|
self._area_fz_list.x = self._src_fz_list.x
|
||||||
|
|
@ -204,10 +201,10 @@ function M:Clear(bskip)
|
||||||
self._mask_liangpai:RemoveChildren(0, -1, true)
|
self._mask_liangpai:RemoveChildren(0, -1, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
for i=1,#self._carViewList do
|
for i = 1, #self._carViewList do
|
||||||
self._carViewList[i].card:Dispose()
|
self._carViewList[i].card:Dispose()
|
||||||
end
|
end
|
||||||
self._carViewList = {}
|
self._carViewList = {}
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
@ -20,7 +20,7 @@ local M = PlayerCardInfoView
|
||||||
--- Create a new PlayerCardInfoView
|
--- Create a new PlayerCardInfoView
|
||||||
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()
|
||||||
|
|
@ -52,22 +52,20 @@ function M:init()
|
||||||
|
|
||||||
self._mask_liangpai = view:GetChild('mask_liangpai')
|
self._mask_liangpai = view:GetChild('mask_liangpai')
|
||||||
|
|
||||||
local _gamectr = ControllerManager.GetController(GameController)
|
local _gamectr = ControllerManager.GetController(GameController)
|
||||||
if _gamectr then
|
if _gamectr then
|
||||||
_gamectr:AddEventListener(GameEvent.MJModifySzie, handler(self, self.SetMJSize))
|
_gamectr:AddEventListener(GameEvent.MJModifySzie, handler(self, self.SetMJSize))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:SetMJSize(zS)
|
function M:SetMJSize(zS)
|
||||||
local tempSzieConfig={}
|
local tempSzieConfig = {}
|
||||||
tempSzieConfig.size=zS
|
tempSzieConfig.size = zS
|
||||||
local filename = 'mjsize' .. DataManager.SelfUser.account_id
|
local filename = 'mjsize' .. DataManager.SelfUser.account_id
|
||||||
Utils.SaveLocalFile(filename, json.encode(tempSzieConfig))
|
Utils.SaveLocalFile(filename, json.encode(tempSzieConfig))
|
||||||
|
|
||||||
--ControllerManager.OnConnect(SocketCode.TimeoutDisconnect)
|
--ControllerManager.OnConnect(SocketCode.TimeoutDisconnect)
|
||||||
ViewManager.refreshGameView()
|
ViewManager.refreshGameView()
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:SetPlayer(p)
|
function M:SetPlayer(p)
|
||||||
|
|
@ -119,12 +117,12 @@ function M:GetPrefix()
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:fillCard(obj, pos_str, card, use3d)
|
function M:fillCard(obj, pos_str, card, use3d)
|
||||||
|
|
||||||
if self._current_card_type == 2 and (use3d == nil or use3d == true) then
|
if self._current_card_type == 2 and (use3d == nil or use3d == true) then
|
||||||
obj.icon = 'ui://MajiangCard3d/' .. 'b' .. pos_str .. card
|
obj.icon = 'ui://MajiangCard3d/' .. 'b' .. pos_str .. card
|
||||||
else
|
else
|
||||||
obj.icon = 'ui://Main_Majiang/' .. self:GetPrefix() .. pos_str .. card
|
obj.icon = 'ui://Main_Majiang/' .. self:GetPrefix() .. pos_str .. card
|
||||||
end
|
end
|
||||||
|
print("================================fillCard", obj, pos_str, card, use3d, obj.icon)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:getBackCard(card)
|
function M:getBackCard(card)
|
||||||
|
|
|
||||||
|
|
@ -1,37 +1,37 @@
|
||||||
local MJPlayerCardInfoView = import(".MJPlayerCardInfoView")
|
local MJPlayerCardInfoView = import(".MJPlayerCardInfoView")
|
||||||
|
|
||||||
local CardView = {
|
local CardView = {
|
||||||
card = nil,
|
card = nil,
|
||||||
-- 牌序号
|
-- 牌序号
|
||||||
card_item =0,
|
card_item = 0,
|
||||||
-- 索引
|
-- 索引
|
||||||
index = 0,
|
index = 0,
|
||||||
-- 原始位置
|
-- 原始位置
|
||||||
old_postion = Vector2.zero
|
old_postion = Vector2.zero
|
||||||
}
|
}
|
||||||
|
|
||||||
local function NewCardView(card,cardItem)
|
local function NewCardView(card, cardItem)
|
||||||
local self = {}
|
local self = {}
|
||||||
setmetatable(self,{__index = CardView})
|
setmetatable(self, { __index = CardView })
|
||||||
self.card = card
|
self.card = card
|
||||||
self.card_item = cardItem
|
self.card_item = cardItem
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
local PlayerSelfView = {
|
local PlayerSelfView = {
|
||||||
_dragCom=nil,
|
_dragCom = nil,
|
||||||
_carViewList = {}
|
_carViewList = {}
|
||||||
}
|
}
|
||||||
|
|
||||||
local M = PlayerSelfView
|
local M = PlayerSelfView
|
||||||
|
|
||||||
function PlayerSelfView.new(view,mainView)
|
function PlayerSelfView.new(view, mainView)
|
||||||
setmetatable(M,{__index = MJPlayerCardInfoView})
|
setmetatable(M, { __index = MJPlayerCardInfoView })
|
||||||
local self = setmetatable({}, {__index = M})
|
local self = setmetatable({}, { __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()
|
||||||
|
|
@ -39,46 +39,46 @@ function M:init()
|
||||||
|
|
||||||
local filename = 'mjsize' .. DataManager.SelfUser.account_id
|
local filename = 'mjsize' .. DataManager.SelfUser.account_id
|
||||||
local json_data = Utils.LoadLocalFile(filename)
|
local json_data = Utils.LoadLocalFile(filename)
|
||||||
if json_data then
|
if json_data then
|
||||||
local _data = json.decode(json_data)
|
local _data = json.decode(json_data)
|
||||||
if _data.size==0 then
|
if _data.size == 0 then
|
||||||
self._area_handcard_list:SetScale(1,1.1)
|
self._area_handcard_list:SetScale(1, 1.1)
|
||||||
self._area_fz_list:SetScale(0.6,0.6)
|
self._area_fz_list:SetScale(0.6, 0.6)
|
||||||
elseif _data.size==1 then
|
elseif _data.size == 1 then
|
||||||
self._area_handcard_list:SetScale(1,1)
|
self._area_handcard_list:SetScale(1, 1)
|
||||||
self._area_fz_list:SetScale(1,1)
|
self._area_fz_list:SetScale(1, 1)
|
||||||
|
elseif _data.size == 2 then
|
||||||
elseif _data.size==2 then
|
self._area_handcard_list:SetScale(0.8, 0.8)
|
||||||
self._area_handcard_list:SetScale(0.8,0.8)
|
self._area_fz_list:SetScale(0.8, 0.8)
|
||||||
self._area_fz_list:SetScale(0.8,0.8)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:setHandCardPos(btn_card, i, getcard)
|
function M:setHandCardPos(btn_card, i, getcard)
|
||||||
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
|
||||||
|
|
||||||
function M:UpdateHandCard(getcard,mp)
|
function M:UpdateHandCard(getcard, mp)
|
||||||
|
print("======================main", getcard, mp)
|
||||||
if self.outcard_button then
|
if self.outcard_button then
|
||||||
self.outcard_button:Dispose()
|
self.outcard_button:Dispose()
|
||||||
self.outcard_button = nil
|
self.outcard_button = nil
|
||||||
end
|
end
|
||||||
getcard = getcard or false
|
getcard = getcard or false
|
||||||
mp = mp or false
|
mp = mp or false
|
||||||
local pv = self
|
local pv = self
|
||||||
local _carViewList = self._carViewList
|
local _carViewList = self._carViewList
|
||||||
|
|
||||||
local _lit = pv._area_handcard_list
|
local _lit = pv._area_handcard_list
|
||||||
for i=1,#_carViewList do
|
for i = 1, #_carViewList do
|
||||||
_carViewList[i].card:Dispose()
|
_carViewList[i].card:Dispose()
|
||||||
end
|
end
|
||||||
_carViewList = {}
|
_carViewList = {}
|
||||||
local _dragCom = self._dragCom
|
local _dragCom = self._dragCom
|
||||||
if (_dragCom == nil) then
|
if (_dragCom == nil) then
|
||||||
_dragCom = UIPackage.CreateObject("Common","UIPanel")
|
_dragCom = UIPackage.CreateObject("Common", "UIPanel")
|
||||||
_dragCom.size = Vector2(1,1)
|
_dragCom.size = Vector2(1, 1)
|
||||||
pv._view:AddChild(_dragCom)
|
pv._view:AddChild(_dragCom)
|
||||||
end
|
end
|
||||||
_dragCom.xy = pv._area_handcard_list.xy
|
_dragCom.xy = pv._area_handcard_list.xy
|
||||||
self._dragCom = _dragCom
|
self._dragCom = _dragCom
|
||||||
|
|
@ -91,61 +91,60 @@ function M:UpdateHandCard(getcard,mp)
|
||||||
|
|
||||||
local cards = DataManager.CurrenRoom.self_player.card_list
|
local cards = DataManager.CurrenRoom.self_player.card_list
|
||||||
if (not mp) then
|
if (not mp) then
|
||||||
for i=0,(#cards)-1 do
|
for i = 0, (#cards) - 1 do
|
||||||
local tem_card = cards[i+1]
|
local tem_card = cards[i + 1]
|
||||||
|
|
||||||
|
|
||||||
local btn_card = UIPackage.CreateObject(self:GetCardObjPack(), "Btn_Card"..b3d)
|
local btn_card = UIPackage.CreateObject(self:GetCardObjPack(), "Btn_Card" .. b3d)
|
||||||
btn_card:SetScale(1.05,1.05)
|
btn_card:SetScale(1.05, 1.05)
|
||||||
-- btn_card.icon = UIPackage.GetItemURL("Main_Majiang", "201_" .. tem_card)
|
-- btn_card.icon = UIPackage.GetItemURL("Main_Majiang", "201_" .. tem_card)
|
||||||
self:fillCard(btn_card,"201_",tem_card)
|
self:fillCard(btn_card, "201_", tem_card)
|
||||||
self:setHandCardPos(btn_card, i, i == #cards - 1 and getcard)
|
self:setHandCardPos(btn_card, i, i == #cards - 1 and getcard)
|
||||||
local c_v = NewCardView(btn_card, tem_card)
|
local c_v = NewCardView(btn_card, tem_card)
|
||||||
c_v.index = i
|
c_v.index = i
|
||||||
c_v.old_postion = btn_card.xy
|
c_v.old_postion = btn_card.xy
|
||||||
_carViewList[#_carViewList+1] = c_v
|
_carViewList[#_carViewList + 1] = c_v
|
||||||
|
|
||||||
_lit:AddChild(btn_card)
|
_lit:AddChild(btn_card)
|
||||||
|
|
||||||
if (not self._player.auto_out_card) then
|
if (not self._player.auto_out_card) then
|
||||||
btn_card.data = c_v
|
btn_card.data = c_v
|
||||||
-- btn_card.draggable = true;
|
-- btn_card.draggable = true;
|
||||||
-- btn_card.onDragStart:Set(function(evt)
|
-- btn_card.onDragStart:Set(function(evt)
|
||||||
-- local _agent = evt.sender
|
-- local _agent = evt.sender
|
||||||
-- _agent:RemoveFromParent()
|
-- _agent:RemoveFromParent()
|
||||||
-- _dragCom:AddChild(_agent)
|
-- _dragCom:AddChild(_agent)
|
||||||
-- if self.__OnDragStart then
|
-- if self.__OnDragStart then
|
||||||
-- self:__OnDragStart(evt)
|
-- self:__OnDragStart(evt)
|
||||||
-- end
|
-- end
|
||||||
-- _agent.onDragEnd:Set(self.__OnDragEnd,self)
|
-- _agent.onDragEnd:Set(self.__OnDragEnd,self)
|
||||||
-- end)
|
-- end)
|
||||||
btn_card.onTouchBegin:Set(handler(self, self.onTouchBegin))
|
btn_card.onTouchBegin:Set(handler(self, self.onTouchBegin))
|
||||||
btn_card.onTouchMove:Set(handler(self, self.onTouchMove))
|
btn_card.onTouchMove:Set(handler(self, self.onTouchMove))
|
||||||
btn_card.onTouchEnd:Set(handler(self, self.__OnDragEnd))
|
btn_card.onTouchEnd:Set(handler(self, self.__OnDragEnd))
|
||||||
btn_card.onClick:Set(self.__OnClickHandCard,self)
|
btn_card.onClick:Set(self.__OnClickHandCard, self)
|
||||||
else
|
else
|
||||||
btn_card:GetChild("icon").color = Color(0.5,0.5,0.5)
|
btn_card:GetChild("icon").color = Color(0.5, 0.5, 0.5)
|
||||||
btn_card.touchable = false
|
btn_card.touchable = false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
for i=0,(#cards)-1 do
|
for i = 0, (#cards) - 1 do
|
||||||
|
local mp_card = UIPackage.CreateObject("Main_Majiang", "Mp_self_card" .. b3d)
|
||||||
local mp_card = UIPackage.CreateObject("Main_Majiang", "Mp_self_card"..b3d)
|
-- mp_card.icon = UIPackage.GetItemURL("Main_Majiang", "202_" .. cards[i+1])
|
||||||
-- mp_card.icon = UIPackage.GetItemURL("Main_Majiang", "202_" .. cards[i+1])
|
self:fillCard(mp_card, "202_", cards[i + 1])
|
||||||
self:fillCard(mp_card,"202_",cards[i+1])
|
mp_card:SetScale(1.05, 1.05)
|
||||||
mp_card:SetScale(1.05,1.05)
|
-- mp_card.x = i * mp_card.width + (i == #cards - 1 and getcard and 20 or 0)
|
||||||
-- 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)
|
||||||
self:setHandCardPos(mp_card, i, i == #cards - 1 and getcard)
|
_lit:AddChild(mp_card)
|
||||||
_lit:AddChild(mp_card)
|
end
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:onTouchBegin(context)
|
function M:onTouchBegin(context)
|
||||||
local button = context.sender
|
local button = context.sender
|
||||||
local card = button.data
|
local card = button.data
|
||||||
local xy = self._area_handcard_list:GlobalToLocal(Vector2.New(context.inputEvent.x,context.inputEvent.y))
|
local xy = self._area_handcard_list:GlobalToLocal(Vector2.New(context.inputEvent.x, context.inputEvent.y))
|
||||||
card.touch_pos = xy - button.xy
|
card.touch_pos = xy - button.xy
|
||||||
if self.__OnDragStart then
|
if self.__OnDragStart then
|
||||||
self:__OnDragStart(card.card_item)
|
self:__OnDragStart(card.card_item)
|
||||||
|
|
@ -155,7 +154,7 @@ end
|
||||||
function M:onTouchMove(context)
|
function M:onTouchMove(context)
|
||||||
local button = context.sender
|
local button = context.sender
|
||||||
local card = button.data
|
local card = button.data
|
||||||
local xy = self._area_handcard_list:GlobalToLocal(Vector2.New(context.inputEvent.x,context.inputEvent.y))
|
local xy = self._area_handcard_list:GlobalToLocal(Vector2.New(context.inputEvent.x, context.inputEvent.y))
|
||||||
button.xy = xy - card.touch_pos
|
button.xy = xy - card.touch_pos
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -164,37 +163,37 @@ function M:__OnDragEnd(context)
|
||||||
self.outcard_button:Dispose()
|
self.outcard_button:Dispose()
|
||||||
self.outcard_button = nil
|
self.outcard_button = nil
|
||||||
end
|
end
|
||||||
local button = context.sender
|
local button = context.sender
|
||||||
-- button.onDragEnd:Set(nil)
|
-- button.onDragEnd:Set(nil)
|
||||||
--button:RemoveFromParent()
|
--button:RemoveFromParent()
|
||||||
local card = button.data
|
local card = button.data
|
||||||
local _room = DataManager.CurrenRoom
|
local _room = DataManager.CurrenRoom
|
||||||
if not _room or _room:GetReloadStatus() then return end
|
if not _room or _room:GetReloadStatus() then return end
|
||||||
|
|
||||||
-- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat)
|
-- 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
|
if (button.y < -150 and _room.curren_outcard_seat == _room.self_player.seat) then
|
||||||
self._mainView:OutCard(card.card_item)
|
self._mainView:OutCard(card.card_item)
|
||||||
button.touchable = false
|
button.touchable = false
|
||||||
self.outcard_button = buttond
|
self.outcard_button = buttond
|
||||||
else
|
else
|
||||||
self._area_handcard_list:AddChildAt(button, card.index)
|
self._area_handcard_list:AddChildAt(button, card.index)
|
||||||
button:TweenMove(card.old_postion, 0.2)
|
button:TweenMove(card.old_postion, 0.2)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:__OnClickHandCard(context)
|
function M:__OnClickHandCard(context)
|
||||||
local button = context.sender
|
local button = context.sender
|
||||||
local _carViewList = self._carViewList
|
local _carViewList = self._carViewList
|
||||||
for i=1,#_carViewList do
|
for i = 1, #_carViewList do
|
||||||
if (_carViewList[i].card ~= button) then
|
if (_carViewList[i].card ~= button) then
|
||||||
_carViewList[i].card.selected = false
|
_carViewList[i].card.selected = false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local _room = DataManager.CurrenRoom
|
local _room = DataManager.CurrenRoom
|
||||||
if (Utils.IsDoubleClick(context) and _room.curren_outcard_seat == _room.self_player.seat) then
|
if (Utils.IsDoubleClick(context) and _room.curren_outcard_seat == _room.self_player.seat) then
|
||||||
local card = button.data
|
local card = button.data
|
||||||
self._mainView:OutCard(card.card_item)
|
self._mainView:OutCard(card.card_item)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 获取手牌资源位置,可以在扩展中复写
|
-- 获取手牌资源位置,可以在扩展中复写
|
||||||
|
|
@ -204,7 +203,7 @@ end
|
||||||
|
|
||||||
function M:Clear()
|
function M:Clear()
|
||||||
MJPlayerCardInfoView.Clear(self)
|
MJPlayerCardInfoView.Clear(self)
|
||||||
for i=1,#self._carViewList do
|
for i = 1, #self._carViewList do
|
||||||
self._carViewList[i].card:Dispose()
|
self._carViewList[i].card:Dispose()
|
||||||
end
|
end
|
||||||
self._carViewList = {}
|
self._carViewList = {}
|
||||||
|
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.5 MiB After Width: | Height: | Size: 1.5 MiB |
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue