同步展示
|
|
@ -0,0 +1,64 @@
|
||||||
|
local FamilyNumberDetail = import(".FamilyNumberDetail")
|
||||||
|
|
||||||
|
local FamilyInviteFamilyView = {}
|
||||||
|
|
||||||
|
local M = FamilyInviteFamilyView
|
||||||
|
|
||||||
|
function FamilyInviteFamilyView.new(root)
|
||||||
|
setmetatable(M, { __index = root })
|
||||||
|
local self = setmetatable({}, { __index = M })
|
||||||
|
local numbers = self._group.members
|
||||||
|
|
||||||
|
self._viewList_allNumbers = self._view:GetChild('list_number')
|
||||||
|
self._btn_numberSearch = self._view:GetChild('btn_search')
|
||||||
|
self._input_numberSearch = self._view:GetChild('input_search')
|
||||||
|
|
||||||
|
self:initBtn()
|
||||||
|
self:FillList(numbers)
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:initBtn()
|
||||||
|
self._btn_numberSearch.onClick:Set(function()
|
||||||
|
local tempNumberList = {}
|
||||||
|
for i = 1,self._group.member_num do
|
||||||
|
if string.find(self._group.members[i].nick,self._input_numberSearch.text) then
|
||||||
|
table.insert(tempNumberList,self._group.members[i])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if #tempNumberList == 0 then
|
||||||
|
ViewUtil.ShowOneChooose("没有找到该成员")
|
||||||
|
else
|
||||||
|
self:FillList(tempNumberList)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:FillList(numbers)
|
||||||
|
local fgCtr = ControllerManager.GetController(NewGroupController)
|
||||||
|
|
||||||
|
self._viewList_allNumbers:SetVirtual()
|
||||||
|
self.familyType.selectedIndex = 4
|
||||||
|
self._viewList_allNumbers.itemRenderer = function(index, obj)
|
||||||
|
local i = index + 1
|
||||||
|
obj:GetController('lev').selectedIndex = numbers[i].lev - 1
|
||||||
|
obj:GetChild('name').text = numbers[i].nick
|
||||||
|
obj:GetChild('id').text = string.format("ID:%s", numbers[i].uid)
|
||||||
|
ImageLoad.Load(numbers[i].portrait, obj:GetChild('btn_head')._iconObject)
|
||||||
|
|
||||||
|
obj.onClick:Set(function()
|
||||||
|
print("lingmengtextBtn_detail")
|
||||||
|
fgCtr:FG_FindMember(self._group.id,numbers[i].uid,function(res)
|
||||||
|
local familyNumberDetail = FamilyNumberDetail.new(res)
|
||||||
|
familyNumberDetail:Show()
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
self._viewList_allNumbers.numItems = #numbers
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:FillNumberDetail()
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
|
|
@ -0,0 +1,49 @@
|
||||||
|
--设置窗口对象
|
||||||
|
|
||||||
|
local FamilyNumberDetail = {}
|
||||||
|
|
||||||
|
local M = FamilyNumberDetail
|
||||||
|
setmetatable(M, { __index = BaseWindow })
|
||||||
|
|
||||||
|
function FamilyNumberDetail.new(res)
|
||||||
|
local self = setmetatable({}, { __index = M })
|
||||||
|
self.class = 'FamilyNumberDetail'
|
||||||
|
self._close_destroy = true
|
||||||
|
|
||||||
|
self:init('ui://Family/NumberDetail',res)
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:init(url,res)
|
||||||
|
|
||||||
|
BaseWindow.init(self, url)
|
||||||
|
pt(res)
|
||||||
|
local info = res.Data.members[1]
|
||||||
|
self._view:GetChild('name').text = string.format("%s(%s)",info.nick,info.uid)
|
||||||
|
self._view:GetChild('text_allRounds').text = info.total_round
|
||||||
|
self._view:GetChild('text_joinTime').text = os.date('%Y-%m-%d %H:%M', info.join_time)
|
||||||
|
self._view:GetChild('text_score_majiang').text = 0
|
||||||
|
self._view:GetChild('text_score_poker').text = 0
|
||||||
|
|
||||||
|
self._view:GetChild('btn_changeTag').onClick:Set(function()
|
||||||
|
ViewUtil.ShowOneChooose("该功能还未开放")
|
||||||
|
end)
|
||||||
|
|
||||||
|
self._view:GetChild('btn_changeMJScore').onClick:Set(function()
|
||||||
|
ViewUtil.ShowOneChooose("该功能还未开放")
|
||||||
|
end)
|
||||||
|
|
||||||
|
self._view:GetChild('btn_changePokerScore').onClick:Set(function()
|
||||||
|
ViewUtil.ShowOneChooose("该功能还未开放")
|
||||||
|
end)
|
||||||
|
|
||||||
|
self._view:GetChild('btn_tick').onClick:Set(function()
|
||||||
|
|
||||||
|
end)
|
||||||
|
|
||||||
|
self._view:GetChild('btn_band').onClick:Set(function()
|
||||||
|
ViewUtil.ShowOneChooose("该功能还未开放")
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
|
|
@ -2,128 +2,13 @@ local FamilyInviteFamilyView = import('.Family.FamilyInviteFamilyView')
|
||||||
local CreatePlayView = import('.Family.CreatePlayView')
|
local CreatePlayView = import('.Family.CreatePlayView')
|
||||||
local GroupGameSettingView = import(".NewGroup.MngView.GroupGameSettingView_jaingxi")
|
local GroupGameSettingView = import(".NewGroup.MngView.GroupGameSettingView_jaingxi")
|
||||||
|
|
||||||
--设置窗口对象
|
---无窗口
|
||||||
|
local FamilyAllNumbers = import(".Family.FamilyAllNumbers")
|
||||||
|
---
|
||||||
FamilyView = {}
|
FamilyView = {}
|
||||||
|
|
||||||
local M = FamilyView
|
local M = FamilyView
|
||||||
|
|
||||||
local IDENTITY_LIST = {
|
|
||||||
{
|
|
||||||
level = 0, --圈主
|
|
||||||
|
|
||||||
},
|
|
||||||
{
|
|
||||||
level = 1, --副圈主
|
|
||||||
otherList = {
|
|
||||||
{
|
|
||||||
name = "邀请朋友",
|
|
||||||
Fct = M.ShareWx
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name = "游戏记录",
|
|
||||||
Fct = M.ShareWx
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name = "玩法管理",
|
|
||||||
Fct = M.PlayEdit
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name = "充值房卡",
|
|
||||||
Fct = M.ShareWx
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name = "申请消息",
|
|
||||||
Fct = M.ShareWx
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name = "查看成员",
|
|
||||||
Fct = M.ShareWx
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name = "创建亲友圈",
|
|
||||||
Fct = M.CreateFamily
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name = "高级选项",
|
|
||||||
Fct = M.CreateFamily
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name = "添加助理",
|
|
||||||
Fct = M.CreateFamily
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name = "加入亲友圈",
|
|
||||||
Fct = M.JoinFamily
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
|
||||||
{
|
|
||||||
level = 2, --管理员
|
|
||||||
otherList = {
|
|
||||||
{
|
|
||||||
name = "邀请朋友",
|
|
||||||
Fct = M.ShareWx
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name = "游戏记录",
|
|
||||||
Fct = M.ShareWx
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name = "玩法管理",
|
|
||||||
Fct = M.PlayEdit
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name = "充值房卡",
|
|
||||||
Fct = M.ShareWx
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name = "申请消息",
|
|
||||||
Fct = M.ShareWx
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name = "查看成员",
|
|
||||||
Fct = M.ShareWx
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name = "创建亲友圈",
|
|
||||||
Fct = M.CreateFamily
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name = "高级选项",
|
|
||||||
Fct = M.CreateFamily
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name = "添加助理",
|
|
||||||
Fct = M.CreateFamily
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name = "加入亲友圈",
|
|
||||||
Fct = M.JoinFamily
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
|
||||||
{
|
|
||||||
level = 3, --成员
|
|
||||||
otherList = {
|
|
||||||
{
|
|
||||||
name = "邀请朋友",
|
|
||||||
Fct = M.ShareWx
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name = "创建亲友圈",
|
|
||||||
Fct = M.CreateFamily
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name = "加入亲友圈",
|
|
||||||
Fct = M.JoinFamily
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
|
||||||
}
|
|
||||||
function FamilyView.new()
|
function FamilyView.new()
|
||||||
UIPackage.AddPackage("base/Family/ui/Family")
|
UIPackage.AddPackage("base/Family/ui/Family")
|
||||||
|
|
||||||
|
|
@ -241,27 +126,18 @@ function M:PlayEdit()
|
||||||
self.lastType = 1
|
self.lastType = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:ChangeOther(i)
|
function M:AllNumber()
|
||||||
local otherList = IDENTITY_LIST[i].otherList
|
self.lastType = 1
|
||||||
local list_other = self._view:GetChild('list_other')
|
local familyAllNumbers = FamilyAllNumbers.new(self)
|
||||||
self._lev = i
|
|
||||||
list_other:SetVirtual()
|
|
||||||
list_other.itemRenderer = function(index, obj)
|
|
||||||
obj:GetChild('text').text = otherList[index + 1].name
|
|
||||||
-- print("lingmengChangeOther", otherList[index + 1].name, otherList[index + 1].Fct,
|
|
||||||
-- typeof(otherList[index + 1].Fct))
|
|
||||||
obj.onClick:Add(handler(self, otherList[index + 1].Fct))
|
|
||||||
end
|
|
||||||
list_other.numItems = #otherList
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:ChangeNumber(fgCtr, group_id, limit, num, minus_only, sort_type)
|
function M:ChangeNumber(fgCtr, group_id, limit, num, minus_only, sort_type)
|
||||||
local list_familyNumber = self._view:GetChild('list_familyNumber')
|
local list_familyNumber = self._view:GetChild('list_familyNumber')
|
||||||
list_familyNumber:SetVirtual()
|
list_familyNumber:SetVirtual()
|
||||||
fgCtr:FG_GroupMembers(group_id, limit, num, minus_only, sort_type, function(res)
|
fgCtr:FG_GroupMembers(group_id, limit, num, minus_only, sort_type, function(res)
|
||||||
local members = res.Data.members
|
local members = self._group.members
|
||||||
-- print("==========================res.Data.members")
|
-- print("==========================res.Data.members")
|
||||||
pt(res.Data.members)
|
pt(self._group.members)
|
||||||
ViewUtil:CloseModalWait()
|
ViewUtil:CloseModalWait()
|
||||||
if res.ReturnCode ~= 0 then
|
if res.ReturnCode ~= 0 then
|
||||||
ViewUtil.ErrorTip(res.ReturnCode, "获取成员列表失败")
|
ViewUtil.ErrorTip(res.ReturnCode, "获取成员列表失败")
|
||||||
|
|
@ -527,4 +403,133 @@ function M:OnUpdate()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local IDENTITY_LIST = {
|
||||||
|
{
|
||||||
|
level = 0, --圈主
|
||||||
|
|
||||||
|
},
|
||||||
|
{
|
||||||
|
level = 1, --副圈主
|
||||||
|
otherList = {
|
||||||
|
{
|
||||||
|
name = "邀请朋友",
|
||||||
|
Fct = M.ShareWx
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name = "游戏记录",
|
||||||
|
Fct = M.ShareWx
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name = "玩法管理",
|
||||||
|
Fct = M.PlayEdit
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name = "充值房卡",
|
||||||
|
Fct = M.ShareWx
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name = "申请消息",
|
||||||
|
Fct = M.ShareWx
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name = "查看成员",
|
||||||
|
Fct = M.AllNumber
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name = "创建亲友圈",
|
||||||
|
Fct = M.CreateFamily
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name = "高级选项",
|
||||||
|
Fct = M.CreateFamily
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name = "添加助理",
|
||||||
|
Fct = M.CreateFamily
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name = "加入亲友圈",
|
||||||
|
Fct = M.JoinFamily
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
{
|
||||||
|
level = 2, --管理员
|
||||||
|
otherList = {
|
||||||
|
{
|
||||||
|
name = "邀请朋友",
|
||||||
|
Fct = M.ShareWx
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name = "游戏记录",
|
||||||
|
Fct = M.ShareWx
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name = "玩法管理",
|
||||||
|
Fct = M.PlayEdit
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name = "充值房卡",
|
||||||
|
Fct = M.ShareWx
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name = "申请消息",
|
||||||
|
Fct = M.ShareWx
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name = "查看成员",
|
||||||
|
Fct = M.AllNumber
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name = "创建亲友圈",
|
||||||
|
Fct = M.CreateFamily
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name = "高级选项",
|
||||||
|
Fct = M.CreateFamily
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name = "添加助理",
|
||||||
|
Fct = M.CreateFamily
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name = "加入亲友圈",
|
||||||
|
Fct = M.JoinFamily
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
{
|
||||||
|
level = 3, --成员
|
||||||
|
otherList = {
|
||||||
|
{
|
||||||
|
name = "邀请朋友",
|
||||||
|
Fct = M.ShareWx
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name = "创建亲友圈",
|
||||||
|
Fct = M.CreateFamily
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name = "加入亲友圈",
|
||||||
|
Fct = M.JoinFamily
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
function M:ChangeOther(i)
|
||||||
|
local otherList = IDENTITY_LIST[i].otherList
|
||||||
|
local list_other = self._view:GetChild('list_other')
|
||||||
|
self._lev = i
|
||||||
|
list_other:SetVirtual()
|
||||||
|
list_other.itemRenderer = function(index, obj)
|
||||||
|
obj:GetChild('text').text = otherList[index + 1].name
|
||||||
|
obj.onClick:Add(handler(self, otherList[index + 1].Fct))
|
||||||
|
end
|
||||||
|
list_other.numItems = #otherList
|
||||||
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
|
||||||
|
|
@ -318,3 +318,52 @@ function ViewUtil.ShowOneChooose(showText, btnType, callback)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function ViewUtil.ShowTwoChooose(showText, leftCallback,rightCallback)
|
||||||
|
local pop_twoChoose = UIPackage.CreateObjectFromURL("ui://Common/pop_twoChoose")
|
||||||
|
pop_twoChoose:GetChild('text_show').text = showText
|
||||||
|
GRoot.inst:AddChild(pop_twoChoose)
|
||||||
|
pop_twoChoose:Center()
|
||||||
|
local btn_left = pop_twoChoose:GetChild('btn_leftChoose')
|
||||||
|
|
||||||
|
btn_left.onClick:Add(function()
|
||||||
|
GRoot.inst:RemoveChild(pop_twoChoose)
|
||||||
|
if leftCallback then
|
||||||
|
leftCallback()
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
local btn_right = pop_twoChoose:GetChild('btn_rightChoose')
|
||||||
|
|
||||||
|
btn_right.onClick:Add(function()
|
||||||
|
GRoot.inst:RemoveChild(pop_twoChoose)
|
||||||
|
if rightCallback then
|
||||||
|
rightCallback()
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
function ViewUtil.ShowOneInput(showText, callback)
|
||||||
|
local pop_oneInput = UIPackage.CreateObjectFromURL("ui://Common/pop_oneInput")
|
||||||
|
pop_oneInput:GetChild('label_detial').title = showText
|
||||||
|
GRoot.inst:AddChild(pop_oneInput)
|
||||||
|
pop_oneInput:Center()
|
||||||
|
local btn_center = pop_oneInput:GetChild('btn_center')
|
||||||
|
-- if type(btnType) == "number" then
|
||||||
|
-- btn_center.icon = string.format("ui://Common/btn_%d", btnType)
|
||||||
|
-- else
|
||||||
|
-- btn_center.icon = btnType
|
||||||
|
-- end
|
||||||
|
btn_center.onClick:Add(function()
|
||||||
|
GRoot.inst:RemoveChild(pop_oneInput)
|
||||||
|
if callback then
|
||||||
|
callback(pop_oneInput:GetChild('input_oneInput').text)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
local btn_center = pop_oneInput:GetChild('btn_close')
|
||||||
|
btn_center.onClick:Add(function()
|
||||||
|
GRoot.inst:RemoveChild(pop_oneInput)
|
||||||
|
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
|
||||||
|
|
@ -36,13 +36,15 @@ function M:init(name)
|
||||||
|
|
||||||
self._eventmap[TX_Protocol.GAME_EVT_GANGZI] = self.OnEventGangCards
|
self._eventmap[TX_Protocol.GAME_EVT_GANGZI] = self.OnEventGangCards
|
||||||
self._eventmap[TX_Protocol.GAME_EVT_BUGANG] = self.OnEventBuGang
|
self._eventmap[TX_Protocol.GAME_EVT_BUGANG] = self.OnEventBuGang
|
||||||
|
|
||||||
|
self._eventmap[TX_Protocol.GAME_EVT_RESIDUE_CARD] = self.OnEventResidueCard
|
||||||
end
|
end
|
||||||
|
|
||||||
local __pre_delete_card = false
|
local __pre_delete_card = false
|
||||||
-- 发送出牌指令到服务器
|
-- 发送出牌指令到服务器
|
||||||
|
|
||||||
|
|
||||||
-------------------------lingmeng---------------------------
|
-------------------------展示牌---------------------------
|
||||||
function M:SendNextCard(card)
|
function M:SendNextCard(card)
|
||||||
local _data = {}
|
local _data = {}
|
||||||
_data["card"] = tonumber(card)
|
_data["card"] = tonumber(card)
|
||||||
|
|
@ -50,6 +52,13 @@ function M:SendNextCard(card)
|
||||||
_client:send(TX_Protocol.GAME_NEXT_CARD, _data)
|
_client:send(TX_Protocol.GAME_NEXT_CARD, _data)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M:ReqResidueCard()
|
||||||
|
local _data = {}
|
||||||
|
_data["card"] = 0
|
||||||
|
local _client = ControllerManager.GameNetClinet
|
||||||
|
_client:send(TX_Protocol.GAME_RESIDUE_CARD, _data)
|
||||||
|
end
|
||||||
|
|
||||||
------------------------------------------------------------
|
------------------------------------------------------------
|
||||||
|
|
||||||
function M:SendOutCard(card, callback)
|
function M:SendOutCard(card, callback)
|
||||||
|
|
@ -91,6 +100,15 @@ function M:OnEventBuGang(evt_data)
|
||||||
DispatchEvent(self._dispatcher, TX_GameEvent.EventBuGang, evt_data["info"], true)
|
DispatchEvent(self._dispatcher, TX_GameEvent.EventBuGang, evt_data["info"], true)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M:OnEventResidueCard(evt_data)
|
||||||
|
printlog("OnEventResidueCard")
|
||||||
|
pt(evt_data)
|
||||||
|
if evt_data.seat ~= DataManager.CurrenRoom.self_player.seat then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
DispatchEvent(self._dispatcher, TX_GameEvent.EventResidueCard, evt_data["residueCard"])
|
||||||
|
end
|
||||||
|
|
||||||
-- 发送放子选择到服务器
|
-- 发送放子选择到服务器
|
||||||
function M:SendAction(id)
|
function M:SendAction(id)
|
||||||
local _data = {}
|
local _data = {}
|
||||||
|
|
|
||||||
|
|
@ -69,41 +69,24 @@ function M:InitView(url)
|
||||||
self:UpdatePlayerInfoView()
|
self:UpdatePlayerInfoView()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local showNextCtr = self._view:GetController('showNext')
|
self.showNextCtr = self._view:GetController('showNext')
|
||||||
local ShowNextConfrimCtr = self._view:GetController('showNextConfrim')
|
self.showNextList = self._view:GetChild('list_showNext')
|
||||||
local showNextList = self._view:GetChild('list_showNext')
|
|
||||||
local pop_showNextConfrim = self._view:GetChild('pop_showNextConfrim')
|
|
||||||
self._view:GetChild('btn_showNext').onClick:Set(function()
|
self._view:GetChild('btn_showNext').onClick:Set(function()
|
||||||
showNextCtr.selectedIndex = 1
|
self:reqResidueCard()
|
||||||
end)
|
|
||||||
self._view:GetChild('btn_sendShow').onClick:Set(function()
|
|
||||||
self:SendShowNext(ShowNextConfrimCtr)
|
|
||||||
end)
|
end)
|
||||||
self._view:GetChild('btn_closeShow').onClick:Set(function()
|
self._view:GetChild('btn_closeShow').onClick:Set(function()
|
||||||
ShowNextConfrimCtr.selectedIndex = 0
|
self.showNextCtr.selectedIndex = 0
|
||||||
showNextCtr.selectedIndex = 0
|
self.showNextList.selectedIndex = -1
|
||||||
showNextList.selectedIndex = -1
|
|
||||||
self._showNextName = nil
|
self._showNextName = nil
|
||||||
end)
|
end)
|
||||||
showNextList.onClickItem:Set(function(context)
|
self.showNextList.onClickItem:Set(function(context)
|
||||||
local _gamectr = ControllerManager.GetController(GameController)
|
local _gamectr = ControllerManager.GetController(GameController)
|
||||||
_gamectr:SendNextCard(string.sub(context.data.name, -3))
|
_gamectr:SendNextCard(context.data.data.card)
|
||||||
showNextCtr.selectedIndex = 0
|
self.showNextCtr.selectedIndex = 0
|
||||||
showNextList.selectedIndex = -1
|
self.showNextList.selectedIndex = -1
|
||||||
self._showNextName = nil
|
|
||||||
-- self:ClickShowNext(context, ShowNextConfrimCtr)
|
|
||||||
end)
|
|
||||||
ShowNextConfrimCtr.onChanged:Set(function()
|
|
||||||
pop_showNextConfrim:GetChild("btn_ShowCard").icon = self._showNextName
|
|
||||||
end)
|
|
||||||
pop_showNextConfrim:GetChild("btn_center").onClick:Set(function()
|
|
||||||
local _gamectr = ControllerManager.GetController(GameController)
|
|
||||||
_gamectr:SendNextCard(string.sub(self._showNextName, -3))
|
|
||||||
ShowNextConfrimCtr.selectedIndex = 0
|
|
||||||
showNextCtr.selectedIndex = 0
|
|
||||||
showNextList.selectedIndex = -1
|
|
||||||
self._showNextName = nil
|
self._showNextName = nil
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local btn_closeRoom = self._view:GetChild("btn_setting")
|
local btn_closeRoom = self._view:GetChild("btn_setting")
|
||||||
|
|
||||||
self._view:GetChild('btn_closeRoom').onClick:Set(function()
|
self._view:GetChild('btn_closeRoom').onClick:Set(function()
|
||||||
|
|
@ -567,6 +550,31 @@ function M:EventInit()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
_gamectr:AddEventListener(TX_GameEvent.EventResidueCard, function(...)
|
||||||
|
local arg = { ... }
|
||||||
|
local residueCard = arg[1]
|
||||||
|
local cardMap = {}
|
||||||
|
local cardSet = {}
|
||||||
|
self.showNextCtr.selectedIndex = 1
|
||||||
|
for i = 1, #residueCard do
|
||||||
|
local cardNum = residueCard[i]
|
||||||
|
if not cardMap[cardNum] then
|
||||||
|
cardMap[cardNum] = 1
|
||||||
|
table.insert(cardSet, cardNum)
|
||||||
|
else
|
||||||
|
cardMap[cardNum] = cardMap[cardNum] + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
table.sort(cardSet)
|
||||||
|
self.showNextList:SetVirtual()
|
||||||
|
self.showNextList.itemRenderer = function(index, obj)
|
||||||
|
local card = cardSet[index + 1]
|
||||||
|
self:FillShowCards(obj, card, cardMap[card])
|
||||||
|
obj.data = { card = card }
|
||||||
|
end
|
||||||
|
self.showNextList.numItems = #cardSet
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:OutCard(card)
|
function M:OutCard(card)
|
||||||
|
|
@ -983,7 +991,13 @@ function M:UpdateCardBox(seat)
|
||||||
self._ctr_cardbox.selectedIndex = index
|
self._ctr_cardbox.selectedIndex = index
|
||||||
end
|
end
|
||||||
|
|
||||||
-----------------------lingmeng----------------------------
|
-----------------------展示牌----------------------------
|
||||||
|
|
||||||
|
function M:reqResidueCard()
|
||||||
|
local _gamectr = ControllerManager.GetController(GameController)
|
||||||
|
_gamectr:ReqResidueCard()
|
||||||
|
end
|
||||||
|
|
||||||
function M:SendShowNext(ShowNextConfrimCtr)
|
function M:SendShowNext(ShowNextConfrimCtr)
|
||||||
if not self._showNextName then
|
if not self._showNextName then
|
||||||
ViewUtil.ErrorTip(nil, "请先选择一个麻将牌")
|
ViewUtil.ErrorTip(nil, "请先选择一个麻将牌")
|
||||||
|
|
@ -1000,6 +1014,28 @@ function M:ClickShowNext(context, ShowNextConfrimCtr)
|
||||||
self._showNextName = context.data.name
|
self._showNextName = context.data.name
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M:FillShowCards(obj, card, num)
|
||||||
|
if DataManager.CurrenRoom.jing and obj:GetController('jing') then
|
||||||
|
if DataManager.CurrenRoom.jing and obj:GetController('jing') then
|
||||||
|
if card == DataManager.CurrenRoom.jing then
|
||||||
|
obj:GetController('jing').selectedIndex = 1
|
||||||
|
else
|
||||||
|
obj:GetController('jing').selectedIndex = 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if obj.icon then
|
||||||
|
obj.icon = 'ui://Main_Majiang/201_' .. card
|
||||||
|
else
|
||||||
|
obj:GetChild("icon").url = 'ui://Main_Majiang/201_' .. card
|
||||||
|
end
|
||||||
|
if obj.title then
|
||||||
|
obj.title = string.format("%d张", num)
|
||||||
|
else
|
||||||
|
obj:GetChild("title").text = string.format("%d张", num)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-----------------------------------------------------------
|
-----------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
local TX_GameEvent = {
|
local TX_GameEvent = {
|
||||||
-- 发牌
|
-- 发牌
|
||||||
SendCards = "SendCards",
|
SendCards = "SendCards",
|
||||||
|
|
@ -33,5 +32,7 @@ local TX_GameEvent = {
|
||||||
SendGangZi = "SendGangZi",
|
SendGangZi = "SendGangZi",
|
||||||
EventBuGang = "EventBuGang",
|
EventBuGang = "EventBuGang",
|
||||||
|
|
||||||
|
---
|
||||||
|
EventResidueCard = "EventResidueCard"
|
||||||
}
|
}
|
||||||
return TX_GameEvent
|
return TX_GameEvent
|
||||||
|
|
@ -49,7 +49,9 @@ local Protocol = {
|
||||||
GAME_EVT_DOGANG = "839",
|
GAME_EVT_DOGANG = "839",
|
||||||
|
|
||||||
--送牌
|
--送牌
|
||||||
GAME_NEXT_CARD = "888"
|
GAME_NEXT_CARD = "888",
|
||||||
|
GAME_RESIDUE_CARD = "613",
|
||||||
|
GAME_EVT_RESIDUE_CARD = "889"
|
||||||
}
|
}
|
||||||
|
|
||||||
return Protocol
|
return Protocol
|
||||||
|
|
@ -8,7 +8,7 @@ local M = {}
|
||||||
function M.new()
|
function M.new()
|
||||||
setmetatable(M, { __index = GameController })
|
setmetatable(M, { __index = GameController })
|
||||||
local self = setmetatable({}, { __index = M })
|
local self = setmetatable({}, { __index = M })
|
||||||
self:init("南城麻将")
|
self:init("金溪麻将")
|
||||||
self.class = "TX_GameController"
|
self.class = "TX_GameController"
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1016,8 +1016,14 @@ function M:ClickShowNext(context, ShowNextConfrimCtr)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:FillShowCards(obj, card, num)
|
function M:FillShowCards(obj, card, num)
|
||||||
if DataManager.CurrenRoom.jing and card == DataManager.CurrenRoom.jing and obj:GetController('jing') then
|
if DataManager.CurrenRoom.jing and obj:GetController('jing') then
|
||||||
|
if DataManager.CurrenRoom.jing and obj:GetController('jing') then
|
||||||
|
if card == DataManager.CurrenRoom.jing then
|
||||||
obj:GetController('jing').selectedIndex = 1
|
obj:GetController('jing').selectedIndex = 1
|
||||||
|
else
|
||||||
|
obj:GetController('jing').selectedIndex = 0
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
if obj.icon then
|
if obj.icon then
|
||||||
obj.icon = 'ui://Main_Majiang/201_' .. card
|
obj.icon = 'ui://Main_Majiang/201_' .. card
|
||||||
|
|
|
||||||
|
|
@ -36,13 +36,15 @@ function M:init(name)
|
||||||
|
|
||||||
self._eventmap[TX_Protocol.GAME_EVT_GANGZI] = self.OnEventGangCards
|
self._eventmap[TX_Protocol.GAME_EVT_GANGZI] = self.OnEventGangCards
|
||||||
self._eventmap[TX_Protocol.GAME_EVT_BUGANG] = self.OnEventBuGang
|
self._eventmap[TX_Protocol.GAME_EVT_BUGANG] = self.OnEventBuGang
|
||||||
|
|
||||||
|
self._eventmap[TX_Protocol.GAME_EVT_RESIDUE_CARD] = self.OnEventResidueCard
|
||||||
end
|
end
|
||||||
|
|
||||||
local __pre_delete_card = false
|
local __pre_delete_card = false
|
||||||
-- 发送出牌指令到服务器
|
-- 发送出牌指令到服务器
|
||||||
|
|
||||||
|
|
||||||
-------------------------lingmeng---------------------------
|
-------------------------展示牌---------------------------
|
||||||
function M:SendNextCard(card)
|
function M:SendNextCard(card)
|
||||||
local _data = {}
|
local _data = {}
|
||||||
_data["card"] = tonumber(card)
|
_data["card"] = tonumber(card)
|
||||||
|
|
@ -50,6 +52,13 @@ function M:SendNextCard(card)
|
||||||
_client:send(TX_Protocol.GAME_NEXT_CARD, _data)
|
_client:send(TX_Protocol.GAME_NEXT_CARD, _data)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M:ReqResidueCard()
|
||||||
|
local _data = {}
|
||||||
|
_data["card"] = 0
|
||||||
|
local _client = ControllerManager.GameNetClinet
|
||||||
|
_client:send(TX_Protocol.GAME_RESIDUE_CARD, _data)
|
||||||
|
end
|
||||||
|
|
||||||
------------------------------------------------------------
|
------------------------------------------------------------
|
||||||
|
|
||||||
function M:SendOutCard(card, callback)
|
function M:SendOutCard(card, callback)
|
||||||
|
|
@ -91,6 +100,15 @@ function M:OnEventBuGang(evt_data)
|
||||||
DispatchEvent(self._dispatcher, TX_GameEvent.EventBuGang, evt_data["info"], true)
|
DispatchEvent(self._dispatcher, TX_GameEvent.EventBuGang, evt_data["info"], true)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M:OnEventResidueCard(evt_data)
|
||||||
|
printlog("OnEventResidueCard")
|
||||||
|
pt(evt_data)
|
||||||
|
if evt_data.seat ~= DataManager.CurrenRoom.self_player.seat then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
DispatchEvent(self._dispatcher, TX_GameEvent.EventResidueCard, evt_data["residueCard"])
|
||||||
|
end
|
||||||
|
|
||||||
-- 发送放子选择到服务器
|
-- 发送放子选择到服务器
|
||||||
function M:SendAction(id)
|
function M:SendAction(id)
|
||||||
local _data = {}
|
local _data = {}
|
||||||
|
|
|
||||||
|
|
@ -69,41 +69,24 @@ function M:InitView(url)
|
||||||
self:UpdatePlayerInfoView()
|
self:UpdatePlayerInfoView()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local showNextCtr = self._view:GetController('showNext')
|
self.showNextCtr = self._view:GetController('showNext')
|
||||||
local ShowNextConfrimCtr = self._view:GetController('showNextConfrim')
|
self.showNextList = self._view:GetChild('list_showNext')
|
||||||
local showNextList = self._view:GetChild('list_showNext')
|
|
||||||
local pop_showNextConfrim = self._view:GetChild('pop_showNextConfrim')
|
|
||||||
self._view:GetChild('btn_showNext').onClick:Set(function()
|
self._view:GetChild('btn_showNext').onClick:Set(function()
|
||||||
showNextCtr.selectedIndex = 1
|
self:reqResidueCard()
|
||||||
end)
|
|
||||||
self._view:GetChild('btn_sendShow').onClick:Set(function()
|
|
||||||
self:SendShowNext(ShowNextConfrimCtr)
|
|
||||||
end)
|
end)
|
||||||
self._view:GetChild('btn_closeShow').onClick:Set(function()
|
self._view:GetChild('btn_closeShow').onClick:Set(function()
|
||||||
ShowNextConfrimCtr.selectedIndex = 0
|
self.showNextCtr.selectedIndex = 0
|
||||||
showNextCtr.selectedIndex = 0
|
self.showNextList.selectedIndex = -1
|
||||||
showNextList.selectedIndex = -1
|
|
||||||
self._showNextName = nil
|
self._showNextName = nil
|
||||||
end)
|
end)
|
||||||
showNextList.onClickItem:Set(function(context)
|
self.showNextList.onClickItem:Set(function(context)
|
||||||
local _gamectr = ControllerManager.GetController(GameController)
|
local _gamectr = ControllerManager.GetController(GameController)
|
||||||
_gamectr:SendNextCard(string.sub(context.data.name, -3))
|
_gamectr:SendNextCard(context.data.data.card)
|
||||||
showNextCtr.selectedIndex = 0
|
self.showNextCtr.selectedIndex = 0
|
||||||
showNextList.selectedIndex = -1
|
self.showNextList.selectedIndex = -1
|
||||||
self._showNextName = nil
|
|
||||||
-- self:ClickShowNext(context, ShowNextConfrimCtr)
|
|
||||||
end)
|
|
||||||
ShowNextConfrimCtr.onChanged:Set(function()
|
|
||||||
pop_showNextConfrim:GetChild("btn_ShowCard").icon = self._showNextName
|
|
||||||
end)
|
|
||||||
pop_showNextConfrim:GetChild("btn_center").onClick:Set(function()
|
|
||||||
local _gamectr = ControllerManager.GetController(GameController)
|
|
||||||
_gamectr:SendNextCard(string.sub(self._showNextName, -3))
|
|
||||||
ShowNextConfrimCtr.selectedIndex = 0
|
|
||||||
showNextCtr.selectedIndex = 0
|
|
||||||
showNextList.selectedIndex = -1
|
|
||||||
self._showNextName = nil
|
self._showNextName = nil
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local btn_closeRoom = self._view:GetChild("btn_setting")
|
local btn_closeRoom = self._view:GetChild("btn_setting")
|
||||||
|
|
||||||
self._view:GetChild('btn_closeRoom').onClick:Set(function()
|
self._view:GetChild('btn_closeRoom').onClick:Set(function()
|
||||||
|
|
@ -567,6 +550,31 @@ function M:EventInit()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
_gamectr:AddEventListener(TX_GameEvent.EventResidueCard, function(...)
|
||||||
|
local arg = { ... }
|
||||||
|
local residueCard = arg[1]
|
||||||
|
local cardMap = {}
|
||||||
|
local cardSet = {}
|
||||||
|
self.showNextCtr.selectedIndex = 1
|
||||||
|
for i = 1, #residueCard do
|
||||||
|
local cardNum = residueCard[i]
|
||||||
|
if not cardMap[cardNum] then
|
||||||
|
cardMap[cardNum] = 1
|
||||||
|
table.insert(cardSet, cardNum)
|
||||||
|
else
|
||||||
|
cardMap[cardNum] = cardMap[cardNum] + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
table.sort(cardSet)
|
||||||
|
self.showNextList:SetVirtual()
|
||||||
|
self.showNextList.itemRenderer = function(index, obj)
|
||||||
|
local card = cardSet[index + 1]
|
||||||
|
self:FillShowCards(obj, card, cardMap[card])
|
||||||
|
obj.data = { card = card }
|
||||||
|
end
|
||||||
|
self.showNextList.numItems = #cardSet
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:OutCard(card)
|
function M:OutCard(card)
|
||||||
|
|
@ -984,7 +992,13 @@ function M:UpdateCardBox(seat)
|
||||||
self._ctr_cardbox.selectedIndex = index
|
self._ctr_cardbox.selectedIndex = index
|
||||||
end
|
end
|
||||||
|
|
||||||
-----------------------lingmeng----------------------------
|
-----------------------展示牌----------------------------
|
||||||
|
|
||||||
|
function M:reqResidueCard()
|
||||||
|
local _gamectr = ControllerManager.GetController(GameController)
|
||||||
|
_gamectr:ReqResidueCard()
|
||||||
|
end
|
||||||
|
|
||||||
function M:SendShowNext(ShowNextConfrimCtr)
|
function M:SendShowNext(ShowNextConfrimCtr)
|
||||||
if not self._showNextName then
|
if not self._showNextName then
|
||||||
ViewUtil.ErrorTip(nil, "请先选择一个麻将牌")
|
ViewUtil.ErrorTip(nil, "请先选择一个麻将牌")
|
||||||
|
|
@ -1001,6 +1015,28 @@ function M:ClickShowNext(context, ShowNextConfrimCtr)
|
||||||
self._showNextName = context.data.name
|
self._showNextName = context.data.name
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M:FillShowCards(obj, card, num)
|
||||||
|
if DataManager.CurrenRoom.jing and obj:GetController('jing') then
|
||||||
|
if DataManager.CurrenRoom.jing and obj:GetController('jing') then
|
||||||
|
if card == DataManager.CurrenRoom.jing then
|
||||||
|
obj:GetController('jing').selectedIndex = 1
|
||||||
|
else
|
||||||
|
obj:GetController('jing').selectedIndex = 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if obj.icon then
|
||||||
|
obj.icon = 'ui://Main_Majiang/201_' .. card
|
||||||
|
else
|
||||||
|
obj:GetChild("icon").url = 'ui://Main_Majiang/201_' .. card
|
||||||
|
end
|
||||||
|
if obj.title then
|
||||||
|
obj.title = string.format("%d张", num)
|
||||||
|
else
|
||||||
|
obj:GetChild("title").text = string.format("%d张", num)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-----------------------------------------------------------
|
-----------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
local TX_GameEvent = {
|
local TX_GameEvent = {
|
||||||
-- 发牌
|
-- 发牌
|
||||||
SendCards = "SendCards",
|
SendCards = "SendCards",
|
||||||
|
|
@ -33,5 +32,7 @@ local TX_GameEvent = {
|
||||||
SendGangZi = "SendGangZi",
|
SendGangZi = "SendGangZi",
|
||||||
EventBuGang = "EventBuGang",
|
EventBuGang = "EventBuGang",
|
||||||
|
|
||||||
|
---
|
||||||
|
EventResidueCard = "EventResidueCard"
|
||||||
}
|
}
|
||||||
return TX_GameEvent
|
return TX_GameEvent
|
||||||
|
|
@ -49,7 +49,9 @@ local Protocol = {
|
||||||
GAME_EVT_DOGANG = "839",
|
GAME_EVT_DOGANG = "839",
|
||||||
|
|
||||||
--送牌
|
--送牌
|
||||||
GAME_NEXT_CARD = "888"
|
GAME_NEXT_CARD = "888",
|
||||||
|
GAME_RESIDUE_CARD = "613",
|
||||||
|
GAME_EVT_RESIDUE_CARD = "889"
|
||||||
}
|
}
|
||||||
|
|
||||||
return Protocol
|
return Protocol
|
||||||
|
|
|
||||||
|
|
@ -36,13 +36,15 @@ function M:init(name)
|
||||||
|
|
||||||
self._eventmap[TX_Protocol.GAME_EVT_GANGZI] = self.OnEventGangCards
|
self._eventmap[TX_Protocol.GAME_EVT_GANGZI] = self.OnEventGangCards
|
||||||
self._eventmap[TX_Protocol.GAME_EVT_BUGANG] = self.OnEventBuGang
|
self._eventmap[TX_Protocol.GAME_EVT_BUGANG] = self.OnEventBuGang
|
||||||
|
|
||||||
|
self._eventmap[TX_Protocol.GAME_EVT_RESIDUE_CARD] = self.OnEventResidueCard
|
||||||
end
|
end
|
||||||
|
|
||||||
local __pre_delete_card = false
|
local __pre_delete_card = false
|
||||||
-- 发送出牌指令到服务器
|
-- 发送出牌指令到服务器
|
||||||
|
|
||||||
|
|
||||||
-------------------------lingmeng---------------------------
|
-------------------------展示牌---------------------------
|
||||||
function M:SendNextCard(card)
|
function M:SendNextCard(card)
|
||||||
local _data = {}
|
local _data = {}
|
||||||
_data["card"] = tonumber(card)
|
_data["card"] = tonumber(card)
|
||||||
|
|
@ -50,6 +52,13 @@ function M:SendNextCard(card)
|
||||||
_client:send(TX_Protocol.GAME_NEXT_CARD, _data)
|
_client:send(TX_Protocol.GAME_NEXT_CARD, _data)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M:ReqResidueCard()
|
||||||
|
local _data = {}
|
||||||
|
_data["card"] = 0
|
||||||
|
local _client = ControllerManager.GameNetClinet
|
||||||
|
_client:send(TX_Protocol.GAME_RESIDUE_CARD, _data)
|
||||||
|
end
|
||||||
|
|
||||||
------------------------------------------------------------
|
------------------------------------------------------------
|
||||||
|
|
||||||
function M:SendOutCard(card, callback)
|
function M:SendOutCard(card, callback)
|
||||||
|
|
@ -91,6 +100,15 @@ function M:OnEventBuGang(evt_data)
|
||||||
DispatchEvent(self._dispatcher, TX_GameEvent.EventBuGang, evt_data["info"], true)
|
DispatchEvent(self._dispatcher, TX_GameEvent.EventBuGang, evt_data["info"], true)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M:OnEventResidueCard(evt_data)
|
||||||
|
printlog("OnEventResidueCard")
|
||||||
|
pt(evt_data)
|
||||||
|
if evt_data.seat ~= DataManager.CurrenRoom.self_player.seat then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
DispatchEvent(self._dispatcher, TX_GameEvent.EventResidueCard, evt_data["residueCard"])
|
||||||
|
end
|
||||||
|
|
||||||
-- 发送放子选择到服务器
|
-- 发送放子选择到服务器
|
||||||
function M:SendAction(id)
|
function M:SendAction(id)
|
||||||
local _data = {}
|
local _data = {}
|
||||||
|
|
|
||||||
|
|
@ -64,46 +64,28 @@ function M:InitView(url)
|
||||||
self._view:GetChild('wanfa_text').text = gamePlay
|
self._view:GetChild('wanfa_text').text = gamePlay
|
||||||
|
|
||||||
self.jing = self._view:GetChild('jing')
|
self.jing = self._view:GetChild('jing')
|
||||||
|
|
||||||
self._state.onChanged:Add(function()
|
self._state.onChanged:Add(function()
|
||||||
self:UpdatePlayerInfoView()
|
self:UpdatePlayerInfoView()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local showNextCtr = self._view:GetController('showNext')
|
self.showNextCtr = self._view:GetController('showNext')
|
||||||
local ShowNextConfrimCtr = self._view:GetController('showNextConfrim')
|
self.showNextList = self._view:GetChild('list_showNext')
|
||||||
local showNextList = self._view:GetChild('list_showNext')
|
|
||||||
local pop_showNextConfrim = self._view:GetChild('pop_showNextConfrim')
|
|
||||||
self._view:GetChild('btn_showNext').onClick:Set(function()
|
self._view:GetChild('btn_showNext').onClick:Set(function()
|
||||||
showNextCtr.selectedIndex = 1
|
self:reqResidueCard()
|
||||||
end)
|
|
||||||
self._view:GetChild('btn_sendShow').onClick:Set(function()
|
|
||||||
self:SendShowNext(ShowNextConfrimCtr)
|
|
||||||
end)
|
end)
|
||||||
self._view:GetChild('btn_closeShow').onClick:Set(function()
|
self._view:GetChild('btn_closeShow').onClick:Set(function()
|
||||||
ShowNextConfrimCtr.selectedIndex = 0
|
self.showNextCtr.selectedIndex = 0
|
||||||
showNextCtr.selectedIndex = 0
|
self.showNextList.selectedIndex = -1
|
||||||
showNextList.selectedIndex = -1
|
|
||||||
self._showNextName = nil
|
self._showNextName = nil
|
||||||
end)
|
end)
|
||||||
showNextList.onClickItem:Set(function(context)
|
self.showNextList.onClickItem:Set(function(context)
|
||||||
local _gamectr = ControllerManager.GetController(GameController)
|
local _gamectr = ControllerManager.GetController(GameController)
|
||||||
_gamectr:SendNextCard(string.sub(context.data.name, -3))
|
_gamectr:SendNextCard(context.data.data.card)
|
||||||
showNextCtr.selectedIndex = 0
|
self.showNextCtr.selectedIndex = 0
|
||||||
showNextList.selectedIndex = -1
|
self.showNextList.selectedIndex = -1
|
||||||
self._showNextName = nil
|
|
||||||
-- self:ClickShowNext(context, ShowNextConfrimCtr)
|
|
||||||
end)
|
|
||||||
ShowNextConfrimCtr.onChanged:Set(function()
|
|
||||||
pop_showNextConfrim:GetChild("btn_ShowCard").icon = self._showNextName
|
|
||||||
end)
|
|
||||||
pop_showNextConfrim:GetChild("btn_center").onClick:Set(function()
|
|
||||||
local _gamectr = ControllerManager.GetController(GameController)
|
|
||||||
_gamectr:SendNextCard(string.sub(self._showNextName, -3))
|
|
||||||
ShowNextConfrimCtr.selectedIndex = 0
|
|
||||||
showNextCtr.selectedIndex = 0
|
|
||||||
showNextList.selectedIndex = -1
|
|
||||||
self._showNextName = nil
|
self._showNextName = nil
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local btn_closeRoom = self._view:GetChild("btn_setting")
|
local btn_closeRoom = self._view:GetChild("btn_setting")
|
||||||
|
|
||||||
self._view:GetChild('btn_closeRoom').onClick:Set(function()
|
self._view:GetChild('btn_closeRoom').onClick:Set(function()
|
||||||
|
|
@ -570,6 +552,31 @@ function M:EventInit()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
_gamectr:AddEventListener(TX_GameEvent.EventResidueCard, function(...)
|
||||||
|
local arg = { ... }
|
||||||
|
local residueCard = arg[1]
|
||||||
|
local cardMap = {}
|
||||||
|
local cardSet = {}
|
||||||
|
self.showNextCtr.selectedIndex = 1
|
||||||
|
for i = 1, #residueCard do
|
||||||
|
local cardNum = residueCard[i]
|
||||||
|
if not cardMap[cardNum] then
|
||||||
|
cardMap[cardNum] = 1
|
||||||
|
table.insert(cardSet, cardNum)
|
||||||
|
else
|
||||||
|
cardMap[cardNum] = cardMap[cardNum] + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
table.sort(cardSet)
|
||||||
|
self.showNextList:SetVirtual()
|
||||||
|
self.showNextList.itemRenderer = function(index, obj)
|
||||||
|
local card = cardSet[index + 1]
|
||||||
|
self:FillShowCards(obj, card, cardMap[card])
|
||||||
|
obj.data = { card = card }
|
||||||
|
end
|
||||||
|
self.showNextList.numItems = #cardSet
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:OutCard(card)
|
function M:OutCard(card)
|
||||||
|
|
@ -996,7 +1003,13 @@ function M:UpdateCardBox(seat)
|
||||||
self._ctr_cardbox.selectedIndex = index
|
self._ctr_cardbox.selectedIndex = index
|
||||||
end
|
end
|
||||||
|
|
||||||
-----------------------lingmeng----------------------------
|
-----------------------展示牌----------------------------
|
||||||
|
|
||||||
|
function M:reqResidueCard()
|
||||||
|
local _gamectr = ControllerManager.GetController(GameController)
|
||||||
|
_gamectr:ReqResidueCard()
|
||||||
|
end
|
||||||
|
|
||||||
function M:SendShowNext(ShowNextConfrimCtr)
|
function M:SendShowNext(ShowNextConfrimCtr)
|
||||||
if not self._showNextName then
|
if not self._showNextName then
|
||||||
ViewUtil.ErrorTip(nil, "请先选择一个麻将牌")
|
ViewUtil.ErrorTip(nil, "请先选择一个麻将牌")
|
||||||
|
|
@ -1013,6 +1026,26 @@ function M:ClickShowNext(context, ShowNextConfrimCtr)
|
||||||
self._showNextName = context.data.name
|
self._showNextName = context.data.name
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M:FillShowCards(obj, card, num)
|
||||||
|
if DataManager.CurrenRoom.jing and obj:GetController('jing') then
|
||||||
|
if card == DataManager.CurrenRoom.jing then
|
||||||
|
obj:GetController('jing').selectedIndex = 1
|
||||||
|
else
|
||||||
|
obj:GetController('jing').selectedIndex = 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if obj.icon then
|
||||||
|
obj.icon = 'ui://Main_Majiang/201_' .. card
|
||||||
|
else
|
||||||
|
obj:GetChild("icon").url = 'ui://Main_Majiang/201_' .. card
|
||||||
|
end
|
||||||
|
if obj.title then
|
||||||
|
obj.title = string.format("%d张", num)
|
||||||
|
else
|
||||||
|
obj:GetChild("title").text = string.format("%d张", num)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-----------------------------------------------------------
|
-----------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,5 +33,7 @@ local TX_GameEvent = {
|
||||||
SendGangZi = "SendGangZi",
|
SendGangZi = "SendGangZi",
|
||||||
EventBuGang = "EventBuGang",
|
EventBuGang = "EventBuGang",
|
||||||
|
|
||||||
|
---
|
||||||
|
EventResidueCard = "EventResidueCard"
|
||||||
}
|
}
|
||||||
return TX_GameEvent
|
return TX_GameEvent
|
||||||
|
|
@ -49,7 +49,9 @@ local Protocol = {
|
||||||
GAME_EVT_DOGANG = "839",
|
GAME_EVT_DOGANG = "839",
|
||||||
|
|
||||||
--送牌
|
--送牌
|
||||||
GAME_NEXT_CARD = "888"
|
GAME_NEXT_CARD = "888",
|
||||||
|
GAME_RESIDUE_CARD = "613",
|
||||||
|
GAME_EVT_RESIDUE_CARD = "889"
|
||||||
}
|
}
|
||||||
|
|
||||||
return Protocol
|
return Protocol
|
||||||
|
Before Width: | Height: | Size: 1.4 MiB After Width: | Height: | Size: 1.3 MiB |
|
Before Width: | Height: | Size: 2.2 MiB After Width: | Height: | Size: 2.2 MiB |
|
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 1.2 MiB |
|
Before Width: | Height: | Size: 1.2 MiB After Width: | Height: | Size: 1.3 MiB |
|
Before Width: | Height: | Size: 995 KiB After Width: | Height: | Size: 1.2 MiB |
|
Before Width: | Height: | Size: 1.2 MiB After Width: | Height: | Size: 957 KiB |
|
Before Width: | Height: | Size: 1.2 MiB After Width: | Height: | Size: 1.3 MiB |
|
Before Width: | Height: | Size: 793 KiB After Width: | Height: | Size: 784 KiB |
|
Before Width: | Height: | Size: 614 KiB After Width: | Height: | Size: 586 KiB |
|
Before Width: | Height: | Size: 1.2 MiB After Width: | Height: | Size: 1.3 MiB |
|
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 1.1 MiB |
|
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 1.1 MiB |
|
Before Width: | Height: | Size: 1022 KiB After Width: | Height: | Size: 980 KiB |
|
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 1.2 MiB |
|
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 1.2 MiB |
|
Before Width: | Height: | Size: 1.2 MiB After Width: | Height: | Size: 1.1 MiB |