同步亲友圈查看成员
parent
2964f26fe4
commit
901df13ef6
|
|
@ -14,7 +14,7 @@ end
|
|||
|
||||
local _LocalConfigAllGame = {
|
||||
10, 33,
|
||||
-- 90,
|
||||
90,
|
||||
66, 86, 87, 88, 89
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@ function FamilyInviteFamilyView.new(root)
|
|||
setmetatable(M, { __index = root })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
local numbers = self._group.members
|
||||
print("lingmengFamilyInviteFamilyView", self._group.lev)
|
||||
pt(self._group)
|
||||
|
||||
self._viewList_allNumbers = self._view:GetChild('list_number')
|
||||
self._btn_numberSearch = self._view:GetChild('btn_search')
|
||||
|
|
@ -21,9 +23,9 @@ 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])
|
||||
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
|
||||
|
|
@ -48,8 +50,8 @@ function M:FillList(numbers)
|
|||
|
||||
obj.onClick:Set(function()
|
||||
print("lingmengtextBtn_detail")
|
||||
fgCtr:FG_FindMember(self._group.id,numbers[i].uid,function(res)
|
||||
local familyNumberDetail = FamilyNumberDetail.new(self._group.id,res)
|
||||
fgCtr:FG_FindMember(self._group.id, numbers[i].uid, function(res)
|
||||
local familyNumberDetail = FamilyNumberDetail.new(self._group.id, self._group.lev, res)
|
||||
familyNumberDetail:SetTickCallback(self.TickNumberCallback)
|
||||
familyNumberDetail:Show()
|
||||
end)
|
||||
|
|
|
|||
|
|
@ -5,27 +5,31 @@ local FamilyNumberDetail = {}
|
|||
local M = FamilyNumberDetail
|
||||
setmetatable(M, { __index = BaseWindow })
|
||||
|
||||
function FamilyNumberDetail.new(groupId,res)
|
||||
function FamilyNumberDetail.new(groupId, lev, res)
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = 'FamilyNumberDetail'
|
||||
self._close_destroy = true
|
||||
self.groupId = groupId
|
||||
|
||||
self:init('ui://Family/NumberDetail',res)
|
||||
self:init('ui://Family/NumberDetail', lev, res)
|
||||
return self
|
||||
end
|
||||
|
||||
function M:init(url,res)
|
||||
function M:init(url, lev, res)
|
||||
local fgCtr = ControllerManager.GetController(NewGroupController)
|
||||
|
||||
BaseWindow.init(self, url)
|
||||
local info = res.Data.members[1]
|
||||
self._view:GetChild('name').text = string.format("%s(%s)",info.nick,info.uid)
|
||||
local flag_assistant = info.lev == 2 and 1 or 0
|
||||
|
||||
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:GetController('isAssistant').selectedIndex = info.lev == 1 and 0 or (lev == 2 and 1 or 2)
|
||||
|
||||
self._view:GetChild('btn_changeTag').onClick:Set(function()
|
||||
ViewUtil.ShowOneChooose("该功能还未开放")
|
||||
end)
|
||||
|
|
@ -39,19 +43,35 @@ function M:init(url,res)
|
|||
end)
|
||||
|
||||
self._view:GetChild('btn_tick').onClick:Set(function()
|
||||
ViewUtil.ShowTwoChooose(string.format("是否将用户(%s)踢出",info.nick),function()
|
||||
fgCtr:FG_GroupRemoveMember(self.groupId,info.uid,self._callback_tick)
|
||||
ViewUtil.ShowTwoChooose(string.format("是否将用户(%s)踢出", info.nick), function()
|
||||
fgCtr:FG_GroupRemoveMember(self.groupId, info.uid, self._callback_tick)
|
||||
self:Destroy()
|
||||
end)
|
||||
end)
|
||||
|
||||
self._view:GetChild('btn_band').onClick:Set(function()
|
||||
ViewUtil.ShowTwoChooose(string.format("是否禁止用户(%s)进入房间",info.nick),function()
|
||||
fgCtr:FG_GroupRemoveMember(self.groupId,info.uid,function()
|
||||
ViewUtil.ShowOneChooose("用户(%s)已禁止进入房间",info.nick)
|
||||
ViewUtil.ShowTwoChooose(string.format("是否禁止用户(%s)进入房间", info.nick), function()
|
||||
fgCtr:FG_GroupRemoveMember(self.groupId, info.uid, function()
|
||||
ViewUtil.ShowOneChooose(string.format("用户(%s)已禁止进入房间", info.nick))
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
|
||||
self._view:GetChild('btn_makeOver').onClick:Set(function()
|
||||
ViewUtil.ShowOneChooose("该功能还未开放")
|
||||
end)
|
||||
|
||||
self._view:GetChild('btn_assistant'):GetController('isAssistant').selectedIndex = flag_assistant
|
||||
self._view:GetChild('btn_assistant').onClick:Set(function()
|
||||
ViewUtil.ShowTwoChooose(
|
||||
string.format("是否%s用户(%s)%s", flag_assistant == 1 and "取消" or "将", info.nick,
|
||||
flag_assistant == 1 and "助理身份" or "设置为助理"), function()
|
||||
fgCtr:FG_SetManager(self.groupId, info.uid, flag_assistant + 1, function(res)
|
||||
flag_assistant = 1 - flag_assistant
|
||||
self._view:GetChild('btn_assistant'):GetController('isAssistant').selectedIndex = flag_assistant
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
end
|
||||
|
||||
function M:SetTickCallback(callback)
|
||||
|
|
|
|||
|
|
@ -833,7 +833,8 @@ function M:OnFangziAction(...)
|
|||
local fs_info = _player_card_info[self:GetPos(fz.from_seat)]
|
||||
fs_info:UpdateOutCardList()
|
||||
end
|
||||
info:UpdateFzList(fz, index, true, player.seat)
|
||||
local seat = (self._room.room_config.people_num == 2 and fz.from_seat == 2) and 2 or fz.from_seat - 1
|
||||
info:UpdateFzList(fz, index, true, seat)
|
||||
local getcard = fz.type == FZType.Peng or fz.type == FZType.Chi
|
||||
printlog(getcard)
|
||||
info:UpdateHandCard(getcard)
|
||||
|
|
|
|||
|
|
@ -834,7 +834,8 @@ function M:OnFangziAction(...)
|
|||
local fs_info = _player_card_info[self:GetPos(fz.from_seat)]
|
||||
fs_info:UpdateOutCardList()
|
||||
end
|
||||
info:UpdateFzList(fz, index, true)
|
||||
local seat = (self._room.room_config.people_num == 2 and fz.from_seat == 2) and 2 or fz.from_seat - 1
|
||||
info:UpdateFzList(fz, index, true, seat)
|
||||
local getcard = fz.type == FZType.Peng or fz.type == FZType.Chi
|
||||
printlog(getcard)
|
||||
info:UpdateHandCard(getcard)
|
||||
|
|
|
|||
|
|
@ -660,20 +660,16 @@ function M:__FangziTip(tip, weight)
|
|||
local info = self._player_card_info[1]
|
||||
local _chipeng_tip = info._view_FZTips
|
||||
local _ctr_tips = info._ctr_tip
|
||||
printlog("__FangziTip1q")
|
||||
|
||||
local _lit_fanzi = _chipeng_tip:GetChild("list")
|
||||
_lit_fanzi:SetVirtual()
|
||||
local _tlist = tip.tip_map_id
|
||||
printlog("__FangziTip1")
|
||||
|
||||
_lit_fanzi.itemRenderer = function(index, obj)
|
||||
local type = obj:GetController('type')
|
||||
if index == tip.tip_num then
|
||||
type.selectedIndex = 0
|
||||
obj.onClick:Set(function()
|
||||
--测试暂时取消过提示
|
||||
|
||||
-- local guo_msg = MsgWindow.new(self._root_view, "确定要点过吗?", MsgWindow.MsgMode.OkAndCancel)
|
||||
-- guo_msg.onOk:Add(function()
|
||||
_gamectr:SendAction(0)
|
||||
|
|
@ -840,7 +836,8 @@ function M:OnFangziAction(...)
|
|||
local fs_info = _player_card_info[self:GetPos(fz.from_seat)]
|
||||
fs_info:UpdateOutCardList()
|
||||
end
|
||||
info:UpdateFzList(fz, index, true)
|
||||
local seat = (self._room.room_config.people_num == 2 and fz.from_seat == 2) and 2 or fz.from_seat - 1
|
||||
info:UpdateFzList(fz, index, true, seat)
|
||||
local getcard = fz.type == FZType.Peng or fz.type == FZType.Chi
|
||||
printlog(getcard)
|
||||
info:UpdateHandCard(getcard)
|
||||
|
|
|
|||
|
|
@ -836,7 +836,8 @@ function M:OnFangziAction(...)
|
|||
local fs_info = _player_card_info[self:GetPos(fz.from_seat)]
|
||||
fs_info:UpdateOutCardList()
|
||||
end
|
||||
info:UpdateFzList(fz, index, true)
|
||||
local seat = (self._room.room_config.people_num == 2 and fz.from_seat == 2) and 2 or fz.from_seat - 1
|
||||
info:UpdateFzList(fz, index, true, seat)
|
||||
local getcard = fz.type == FZType.Peng or fz.type == FZType.Chi
|
||||
print(getcard)
|
||||
info:UpdateHandCard(getcard)
|
||||
|
|
@ -844,18 +845,14 @@ function M:OnFangziAction(...)
|
|||
end
|
||||
|
||||
function M:RunNiao(list, start_seat)
|
||||
print("lingmengniao1")
|
||||
local _room = self._room
|
||||
--local _niao_View = self._niao_View
|
||||
self._niao_View = UIPackage.CreateObject("Extend_MJ_NanCheng", "Panel_Birds")
|
||||
print("lingmengniao2")
|
||||
|
||||
self._view:AddChild(self._niao_View)
|
||||
self._niao_View:Center()
|
||||
local _niao_View = self._niao_View
|
||||
local list_niao_card = self._niao_View:GetChild("Lst_birds")
|
||||
print("lingmengniao3")
|
||||
|
||||
list_niao_card:RemoveChildrenToPool()
|
||||
for i = 1, #list do
|
||||
--添加背面的麻將
|
||||
|
|
@ -863,8 +860,6 @@ function M:RunNiao(list, start_seat)
|
|||
item.icon = UIPackage.GetItemURL("Main_Majiang", "202_00")
|
||||
item:GetChild("tex_score").text = "+" .. list[i].score
|
||||
end
|
||||
print("lingmengniao4")
|
||||
|
||||
for i = 1, #list do
|
||||
--顯示正面
|
||||
local item = list_niao_card:GetChildAt(i - 1)
|
||||
|
|
@ -874,8 +869,6 @@ function M:RunNiao(list, start_seat)
|
|||
item.icon = UIPackage.GetItemURL("Main_Majiang", "201_" .. card)
|
||||
if list[i].score > 0 then item:GetController("bg").selectedIndex = 1 end
|
||||
end
|
||||
print("lingmengniao5")
|
||||
|
||||
coroutine.start(function()
|
||||
coroutine.wait(1)
|
||||
_niao_View:Dispose()
|
||||
|
|
@ -1029,10 +1022,12 @@ 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
|
||||
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
|
||||
|
|
|
|||
|
|
@ -0,0 +1,645 @@
|
|||
local CardCheck = {
|
||||
|
||||
cardList = {},
|
||||
cardListSord = {},
|
||||
cardNum = 0,
|
||||
cardSize = 0,
|
||||
long = false,
|
||||
planeNoBelt = false,
|
||||
threeNoBelt = false,
|
||||
planelack = false,
|
||||
threelack = false,
|
||||
fourDaiThree = false,
|
||||
fristCard = true,
|
||||
tipCardList = {},
|
||||
touchCardSet = {},
|
||||
touchCardMao = {}
|
||||
}
|
||||
|
||||
local CardType = {
|
||||
one = 1,
|
||||
long = 2,
|
||||
dui = 3,
|
||||
duiLong = 10,
|
||||
threeAndTwo = 4,
|
||||
normolPlant = 5,
|
||||
zha = 6,
|
||||
onlyThree = 7,
|
||||
onlyPlant = 8,
|
||||
zhaAndThreee = 9
|
||||
}
|
||||
|
||||
local M = CardCheck
|
||||
|
||||
function M:InitFlag()
|
||||
local config = DataManager.CurrenRoom.room_config.config
|
||||
self.planeNoBelt = config.planeNoBelt == 1
|
||||
self.threeNoBelt = config.threeNoBelt == 1
|
||||
self.planelack = config.planelack == 1
|
||||
self.threelack = config.threelack == 1
|
||||
self.fourDaiThree = config.fourDaiThree
|
||||
self._flag_fristCard = true
|
||||
print("==============================lingmengcheckinitFlag")
|
||||
pt(config)
|
||||
pt(self)
|
||||
return self
|
||||
end
|
||||
|
||||
function M:InitLastCard(cardList, mustPutMaxCard)
|
||||
self._flag_fristCard = false
|
||||
self:Clear()
|
||||
self._flag_mustMax = mustPutMaxCard
|
||||
self.type = 0
|
||||
self.lastCardNum = #cardList
|
||||
self._flag_allCards = false
|
||||
self._flag_checkLst = true
|
||||
if #cardList == 0 then
|
||||
self._flag_fristCard = true
|
||||
return
|
||||
end
|
||||
table.sort(cardList)
|
||||
pt(cardList)
|
||||
self.lastMinCard = math.floor(cardList[1] / 10)
|
||||
local temp_long = 0
|
||||
for i = 1, #cardList do
|
||||
local number = math.floor(cardList[i] / 10)
|
||||
if self.cardList[number] then
|
||||
self.cardList[number] = self.cardList[number] + 1
|
||||
else
|
||||
self.cardList[number] = 1
|
||||
self.cardSize = self.cardSize + 1
|
||||
table.insert(self.cardListSord, number)
|
||||
end
|
||||
self.cardNum = self.cardNum + 1
|
||||
if i == 1 then
|
||||
temp_long = 1
|
||||
elseif temp_long == i - 1 then
|
||||
if math.abs(math.floor(cardList[i - 1] / 10) - number) == 1 then
|
||||
temp_long = i
|
||||
end
|
||||
end
|
||||
end
|
||||
self.long = temp_long == self.cardNum and self.cardNum >= 5
|
||||
print("lingmengCheckAloneOrLong2")
|
||||
if self:CheckAloneOrLong() then
|
||||
self.type = self:CheckAloneOrLong()
|
||||
return
|
||||
end
|
||||
print("lingmengCheckDuiZi2")
|
||||
if self:CheckDuiZi() then
|
||||
self.type = self:CheckDuiZi()
|
||||
return
|
||||
end
|
||||
print("lingmengCheckSanDai2")
|
||||
|
||||
if self:CheckSanDai() then
|
||||
self.type = self:CheckSanDai()
|
||||
return
|
||||
end
|
||||
print("lingmengCheckZha2")
|
||||
|
||||
if self:CheckZha() then
|
||||
self.type = self:CheckZha()
|
||||
return
|
||||
end
|
||||
if self.type == 0 then
|
||||
ViewUtil.ErrorTip(-1, "上一份牌型判断错误")
|
||||
end
|
||||
end
|
||||
|
||||
function M:initCards(cardList, flag, flag_allCards)
|
||||
print("lingmenginitCards")
|
||||
pt(cardList)
|
||||
local temp_long = 0
|
||||
self:Clear()
|
||||
self._flag_allCards = flag_allCards or false
|
||||
if flag then
|
||||
for i = 1, #cardList do
|
||||
local number = math.floor(cardList[i][1].card_code_number / 10)
|
||||
if self.cardList[number] then
|
||||
self.cardList[number] = self.cardList[number] + 1
|
||||
else
|
||||
self.cardList[number] = 1
|
||||
self.cardSize = self.cardSize + 1
|
||||
table.insert(self.cardListSord, number)
|
||||
end
|
||||
self.cardNum = self.cardNum + 1
|
||||
if i == 1 then
|
||||
temp_long = 1
|
||||
elseif temp_long == i - 1 then
|
||||
if math.abs(math.floor(cardList[i - 1][1].card_code_number / 10) - number) == 1 then
|
||||
temp_long = i
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
for i = 1, #cardList do
|
||||
local number = math.floor(cardList[i].card_code_number / 10)
|
||||
if self.cardList[number] then
|
||||
self.cardList[number] = self.cardList[number] + 1
|
||||
else
|
||||
self.cardList[number] = 1
|
||||
self.cardSize = self.cardSize + 1
|
||||
table.insert(self.cardListSord, number)
|
||||
end
|
||||
self.cardNum = self.cardNum + 1
|
||||
if i == 1 then
|
||||
temp_long = 1
|
||||
elseif temp_long == i - 1 then
|
||||
if math.abs(math.floor(cardList[i - 1].card_code_number / 10) - number) == 1 then
|
||||
temp_long = i
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
print(self.cardNum, self.cardSize, temp_long)
|
||||
pt(self.cardList)
|
||||
self.long = temp_long == self.cardNum and self.cardNum >= 5
|
||||
end
|
||||
|
||||
function M:CheckCards()
|
||||
if self.cardNum ~= 4 and self.cardNum ~= self.lastCardNum and not self._flag_fristCard then
|
||||
return
|
||||
end
|
||||
if self.cardNum == 1 and self._flag_mustMax and self.maxCard ~= self.cardListSord[1] then
|
||||
return
|
||||
end
|
||||
if self.cardNum == 0 then
|
||||
return
|
||||
end
|
||||
|
||||
print("lingmengCheckAloneOrLong")
|
||||
if self:CheckAloneOrLong() then
|
||||
return true
|
||||
end
|
||||
print("lingmengCheckDuiZi")
|
||||
|
||||
if self:CheckDuiZi() then
|
||||
return true
|
||||
end
|
||||
print("lingmengCheckSanDai")
|
||||
|
||||
if self:CheckSanDai() then
|
||||
return true
|
||||
end
|
||||
print("lingmengCheckZha")
|
||||
|
||||
if self:CheckZha() then
|
||||
return true
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
function M:CheckOutCard(cardList)
|
||||
print("lingmengCheckOutCard===============")
|
||||
pt(cardList)
|
||||
self.tipCardList = {}
|
||||
self.touchCardSet = {}
|
||||
self.touchCardMao = {}
|
||||
local cardMap = {}
|
||||
local cardSet = {}
|
||||
local temp_long = 0
|
||||
local temp_longList = {}
|
||||
local longList = {}
|
||||
local lastCard = -1
|
||||
|
||||
local flag_threeOrFour = false
|
||||
for i = 1, #cardList do
|
||||
local number = math.floor(cardList[i].card_code_number / 10)
|
||||
if cardMap[number] then
|
||||
cardMap[number].value = cardMap[number].value + 1
|
||||
table.insert(cardMap[number].cardList, cardList[i])
|
||||
else
|
||||
cardMap[number] = {}
|
||||
cardMap[number].value = 1
|
||||
cardMap[number].cardList = {}
|
||||
table.insert(cardMap[number].cardList, cardList[i])
|
||||
table.insert(cardSet, number)
|
||||
end
|
||||
if cardMap[number].value >= 3 then
|
||||
flag_threeOrFour = true
|
||||
end
|
||||
if lastCard ~= number then
|
||||
if lastCard - number ~= 1 then
|
||||
if temp_long >= 5 then
|
||||
table.insert(longList, temp_longList)
|
||||
end
|
||||
temp_long = 1
|
||||
temp_longList = {}
|
||||
else
|
||||
temp_long = temp_long + 1
|
||||
end
|
||||
lastCard = number
|
||||
table.insert(temp_longList, number)
|
||||
end
|
||||
end
|
||||
if temp_long >= 4 then
|
||||
table.insert(longList, temp_longList)
|
||||
end
|
||||
|
||||
table.sort(cardSet)
|
||||
self.maxCard = cardSet[#cardSet]
|
||||
|
||||
if self._flag_fristCard then
|
||||
if self._flag_mustMax then
|
||||
self:CheckOutCardGetMustMax(cardSet, cardMap, flag_threeOrFour, longList)
|
||||
else
|
||||
self:CheckOutCardGetFristTipList(cardSet, cardMap)
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
local cardType, only, longLength = self:CheckOutCardGetType()
|
||||
|
||||
|
||||
local tipCardSet = self:CheckOutCardGetTouchSet(cardSet, cardMap, cardType, longLength)
|
||||
|
||||
self:CheckOutCardSetTipList(tipCardSet, longLength, cardMap, cardType)
|
||||
|
||||
if cardType >= 3 and only == 0 then
|
||||
self:CheckOutCardGetAllCardSetAndMap()
|
||||
end
|
||||
end
|
||||
|
||||
function M:CheckOutCardGetAllCardSetAndMap()
|
||||
self.touchCardSet = {}
|
||||
self.touchCardMao = {}
|
||||
for i = 3, 15 do
|
||||
table.insert(self.touchCardSet, i)
|
||||
self.touchCardMao[i] = 1
|
||||
end
|
||||
end
|
||||
|
||||
function M:CheckOutCardGetFristTipList(cardSet, cardMap)
|
||||
for i = 1, #cardSet do
|
||||
local card = cardSet[i]
|
||||
table.insert(self.touchCardSet, card)
|
||||
self.touchCardMao[card] = 1
|
||||
local temp = {}
|
||||
table.insert(temp, cardMap[card].cardList[1])
|
||||
table.insert(self.tipCardList, temp)
|
||||
end
|
||||
end
|
||||
|
||||
function M:CheckOutCardGetMustMax(cardSet, cardMap, flag_threeOrFour, longList)
|
||||
if flag_threeOrFour then
|
||||
for i = 3, 15 do
|
||||
if cardMap[i] then
|
||||
if i == cardSet[#cardSet] then
|
||||
table.insert(self.touchCardSet, i)
|
||||
self.touchCardMao[i] = 1
|
||||
table.insert(self.tipCardList, cardMap[i].cardList)
|
||||
elseif cardMap[i].value >= 2 then
|
||||
table.insert(self.touchCardSet, i)
|
||||
self.touchCardMao[i] = 1
|
||||
table.insert(self.tipCardList, cardMap[i].cardList)
|
||||
else
|
||||
table.insert(self.touchCardSet, i)
|
||||
self.touchCardMao[i] = 1
|
||||
end
|
||||
else
|
||||
table.insert(self.touchCardSet, i)
|
||||
self.touchCardMao[i] = 1
|
||||
end
|
||||
end
|
||||
else
|
||||
for i = 1, #cardSet do
|
||||
local card = cardSet[i]
|
||||
if i == #cardSet then
|
||||
table.insert(self.touchCardSet, card)
|
||||
self.touchCardMao[card] = 1
|
||||
table.insert(self.tipCardList, cardMap[card].cardList)
|
||||
elseif cardMap[card].value >= 2 then
|
||||
table.insert(self.touchCardSet, card)
|
||||
self.touchCardMao[card] = 1
|
||||
table.insert(self.tipCardList, cardMap[card].cardList)
|
||||
end
|
||||
end
|
||||
end
|
||||
---单数顺另外添加到提示和现实
|
||||
for i = 1, #longList do
|
||||
local tempTipList = {}
|
||||
for j = 1, #longList[i] do
|
||||
local card = longList[i][j]
|
||||
if not self.touchCardMao[card] then
|
||||
table.insert(self.touchCardSet, card)
|
||||
self.touchCardMao[card] = 1
|
||||
end
|
||||
table.insert(tempTipList, cardMap[card].cardList[1])
|
||||
end
|
||||
table.insert(self.tipCardList, tempTipList)
|
||||
end
|
||||
end
|
||||
|
||||
function M:CheckOutCardGetType()
|
||||
local cardType = 0
|
||||
local only = 0
|
||||
local longLength = 1
|
||||
if self.type == 0 then
|
||||
return cardType, only, longLength
|
||||
end
|
||||
if self.type == CardType.one or self.type == CardType.long then
|
||||
cardType = 1
|
||||
if self.type == CardType.long then
|
||||
longLength = self.lastCardNum
|
||||
end
|
||||
elseif self.type == CardType.dui or self.type == CardType.duiLong then
|
||||
cardType = 2
|
||||
if self.lastCardNum > 2 then
|
||||
longLength = self.lastCardNum / 2
|
||||
end
|
||||
elseif self.type == CardType.threeAndTwo or self.type == CardType.onlyThree or self.type == CardType.normolPlant or self.type == CardType.onlyPlant then
|
||||
cardType = 3
|
||||
if self.type == CardType.onlyThree or self.type == CardType.onlyPlant then
|
||||
only = 1
|
||||
if self.type == CardType.onlyPlant then
|
||||
longLength = self.lastCardNum / 3
|
||||
end
|
||||
end
|
||||
if self.type == CardType.normolPlant then
|
||||
longLength = self.lastCardNum / 5
|
||||
end
|
||||
elseif self.type == CardType.zha or self.type == CardType.zhaAndThreee then
|
||||
cardType = 4
|
||||
if self.type == CardType.zha then
|
||||
only = 1
|
||||
end
|
||||
end
|
||||
return cardType, only, longLength
|
||||
end
|
||||
|
||||
function M:CheckOutCardGetTouchSet(cardSet, cardMap, cardType, longLength)
|
||||
print("lingmengCheckOutCardGetTouchSet", cardType, longLength, self.lastMinCard)
|
||||
pt(cardSet)
|
||||
pt(cardMap)
|
||||
local tempLong = 0
|
||||
local lastCard = 0
|
||||
local tempCardSet = {}
|
||||
local tipCardSet = {}
|
||||
for i = 1, #cardSet do
|
||||
local card = cardSet[i]
|
||||
if cardMap[card].value >= cardType and card > self.lastMinCard then
|
||||
if tempLong == 0 then
|
||||
tempLong = 1
|
||||
else
|
||||
if lastCard - card == -1 then
|
||||
tempLong = tempLong + 1
|
||||
else
|
||||
if tempLong >= longLength then
|
||||
for j = 1, tempLong do
|
||||
table.insert(self.touchCardSet, tempCardSet[j])
|
||||
self.touchCardMao[tempCardSet[j]] = 1
|
||||
end
|
||||
end
|
||||
table.insert(tipCardSet, tempCardSet)
|
||||
tempLong = 1
|
||||
tempCardSet = {}
|
||||
end
|
||||
end
|
||||
table.insert(tempCardSet, card)
|
||||
lastCard = card
|
||||
end
|
||||
if cardMap[card].value == 4 then
|
||||
table.insert(self.touchCardSet, card)
|
||||
self.touchCardMao[card] = 1
|
||||
table.insert(tipCardSet, card)
|
||||
end
|
||||
end
|
||||
if tempLong >= longLength then
|
||||
for j = 1, tempLong do
|
||||
table.insert(self.touchCardSet, tempCardSet[j])
|
||||
self.touchCardMao[tempCardSet[j]] = 1
|
||||
end
|
||||
end
|
||||
table.insert(tipCardSet, tempCardSet)
|
||||
return tipCardSet
|
||||
end
|
||||
|
||||
function M:CheckOutCardSetTipList(tipCardSet, longLength, cardMap, cardType)
|
||||
print("lingmengCheckOutCardSetTipList", longLength, cardMap, cardType)
|
||||
pt(tipCardSet)
|
||||
for i = 1, #tipCardSet do
|
||||
if type(tipCardSet[i]) == 'number' then
|
||||
table.insert(self.tipCardList, cardMap[tipCardSet[i]].cardList)
|
||||
else
|
||||
local tipCardSetLen = #tipCardSet[i]
|
||||
if tipCardSetLen == longLength then
|
||||
local tempList = {}
|
||||
for j = 1, tipCardSetLen do
|
||||
local card = tipCardSet[i][j]
|
||||
local minNum = Mathf.Min(cardMap[card].value, cardType)
|
||||
for k = 1, minNum do
|
||||
table.insert(tempList, cardMap[card].cardList[k])
|
||||
end
|
||||
end
|
||||
table.insert(self.tipCardList, tempList)
|
||||
else
|
||||
for j = 1, tipCardSetLen do
|
||||
if j + longLength - 1 <= tipCardSetLen then
|
||||
local tempList = {}
|
||||
for k = j, j + longLength - 1 do
|
||||
local card = tipCardSet[i][k]
|
||||
local minNum = Mathf.Min(cardMap[card].value, cardType)
|
||||
for l = 1, minNum do
|
||||
table.insert(tempList, cardMap[card].cardList[l])
|
||||
end
|
||||
end
|
||||
table.insert(self.tipCardList, tempList)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function M:CheckAloneOrLong()
|
||||
if self.cardNum == 1 and M:CheckType(CardType.one) then
|
||||
return CardType.one
|
||||
end
|
||||
if self.long and M:CheckType(CardType.long) then
|
||||
return CardType.long
|
||||
end
|
||||
end
|
||||
|
||||
function M:CheckDuiZi()
|
||||
if self.cardNum == 2 and self.cardSize == 1 and M:CheckType(CardType.dui) then
|
||||
return CardType.dui
|
||||
end
|
||||
if self.cardNum % 2 == 0 and M:CheckType(CardType.duiLong) then
|
||||
local last_k
|
||||
for i = 1, self.cardSize do
|
||||
local k = self.cardListSord[i]
|
||||
local v = self.cardList[k]
|
||||
if v == 2 then
|
||||
if not last_k then
|
||||
last_k = k
|
||||
else
|
||||
if math.abs(last_k - k) ~= 1 then
|
||||
return
|
||||
end
|
||||
last_k = k
|
||||
end
|
||||
else
|
||||
return
|
||||
end
|
||||
end
|
||||
return CardType.duiLong
|
||||
end
|
||||
end
|
||||
|
||||
function M:CheckSanDai()
|
||||
--三张
|
||||
if self.cardNum == 5 and M:CheckType(CardType.threeAndTwo) then
|
||||
for i = 1, self.cardSize do
|
||||
local k = self.cardListSord[i]
|
||||
local v = self.cardList[k]
|
||||
if v >= 3 then
|
||||
return CardType.threeAndTwo
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if self.threelack and self.cardNum == 4 and self.cardSize == 2 and self._flag_allCards and M:CheckType(CardType.threeAndTwo) then
|
||||
return CardType.threeAndTwo
|
||||
end
|
||||
|
||||
if self.threeNoBelt and self.cardNum == 3 and self.cardSize == 1 and M:CheckType(CardType.onlyThree) then
|
||||
return CardType.onlyThree
|
||||
end
|
||||
|
||||
|
||||
--飞机
|
||||
local temp_normol_feiji
|
||||
if self.cardNum % 5 == 0 then
|
||||
temp_normol_feiji = self.cardNum / 5
|
||||
end
|
||||
|
||||
if temp_normol_feiji and M:CheckType(CardType.normolPlant) then
|
||||
local last_k
|
||||
local num_san = 0
|
||||
for i = 1, self.cardSize do
|
||||
local k = self.cardListSord[i]
|
||||
local v = self.cardList[k]
|
||||
if v >= 3 then
|
||||
num_san = num_san + 1
|
||||
if not last_k then
|
||||
last_k = k
|
||||
else
|
||||
if math.abs(last_k - k) ~= 1 then
|
||||
return
|
||||
end
|
||||
last_k = k
|
||||
end
|
||||
end
|
||||
end
|
||||
if num_san >= temp_normol_feiji then
|
||||
return CardType.normolPlant
|
||||
else
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
print("liengmengCheckthreelack", self.threelack, self._flag_allCards)
|
||||
|
||||
if self.threelack and self._flag_allCards and M:CheckType(CardType.normolPlant) then
|
||||
local last_k
|
||||
local num_san = 0
|
||||
for k, v in pairs(self.cardList) do
|
||||
if v >= 3 then
|
||||
num_san = num_san + 1
|
||||
print("liengmengCheckthreelack2", last_k, k)
|
||||
|
||||
if not last_k then
|
||||
last_k = k
|
||||
else
|
||||
if math.abs(last_k - k) ~= 1 then
|
||||
return
|
||||
end
|
||||
last_k = k
|
||||
end
|
||||
end
|
||||
end
|
||||
print("liengmengCheckthreelack4", num_san, self.cardNum - num_san * 3 < num_san * 2)
|
||||
|
||||
if self.cardNum - num_san * 3 < num_san * 2 then
|
||||
return CardType.normolPlant
|
||||
else
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
print("liengmengCheckplaneNoBelt", self.planeNoBelt, self.cardNum % 3)
|
||||
|
||||
if self.planeNoBelt and self.cardNum % 3 == 0 and M:CheckType(CardType.onlyPlant) then
|
||||
local last_k
|
||||
for i = 1, self.cardSize do
|
||||
local k = self.cardListSord[i]
|
||||
local v = self.cardList[k]
|
||||
if v == 3 then
|
||||
if not last_k then
|
||||
last_k = k
|
||||
else
|
||||
if math.abs(last_k - k) ~= 1 then
|
||||
return
|
||||
end
|
||||
last_k = k
|
||||
end
|
||||
else
|
||||
return
|
||||
end
|
||||
end
|
||||
return CardType.onlyPlant
|
||||
end
|
||||
end
|
||||
|
||||
function M:CheckZha()
|
||||
if self.cardNum == 4 and self.cardSize == 1 then
|
||||
return CardType.zha
|
||||
end
|
||||
|
||||
if self.fourDaiThree and self.cardNum == 7 and M:CheckType(CardType.zhaAndThreee) then
|
||||
local flag_four
|
||||
for i = 1, self.cardSize do
|
||||
local k = self.cardListSord[i]
|
||||
local v = self.cardList[k]
|
||||
if v == 4 then
|
||||
return CardType.zhaAndThreee
|
||||
end
|
||||
end
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
function M:CheckType(type)
|
||||
if type == CardType.duiLong then
|
||||
print()
|
||||
return self._flag_checkLst or self._flag_fristCard or (type == self.type and self.cardNum == self.lastCardNum)
|
||||
else
|
||||
return self._flag_checkLst or self._flag_fristCard or type == self.type
|
||||
end
|
||||
end
|
||||
|
||||
function M:GetTipsList()
|
||||
return self.tipCardList
|
||||
end
|
||||
|
||||
function M:GetTouchSet()
|
||||
return self.touchCardSet
|
||||
end
|
||||
|
||||
function M:GetTouchCardMap()
|
||||
return self.touchCardMao
|
||||
end
|
||||
|
||||
function M:Clear()
|
||||
self.cardList = {}
|
||||
self.cardListSord = {}
|
||||
self.cardNum = 0
|
||||
self.cardSize = 0
|
||||
self.long = false
|
||||
self._flag_checkLst = false
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
---
|
||||
--- Created by 谌建军.
|
||||
--- DateTime: 2017/12/18 11:30
|
||||
---
|
||||
|
||||
local ExCardType = {
|
||||
None = 0,
|
||||
OneCard = 1, --一张
|
||||
OnePair = 2, --一对
|
||||
Three = 3, --三张
|
||||
Pairs = 4, --连对
|
||||
ThreeAndTwo = 5, --三带二
|
||||
ThreeAndOne = 6, --三带一
|
||||
Plane = 7, --飞机
|
||||
PlaneAndTwo = 8, --飞机带二
|
||||
PlaneAndOne = 9, --飞机带一
|
||||
Straight = 10, --顺子
|
||||
|
||||
Bomb = 11, --炸
|
||||
FourAndtThree = 12, --四代三
|
||||
|
||||
}
|
||||
|
||||
return ExCardType
|
||||
|
|
@ -6,12 +6,11 @@ local EXGameInfo = {}
|
|||
|
||||
local M = EXGameInfo
|
||||
|
||||
local roundTable = { 10, 15, 20 }
|
||||
function EXGameInfo.new(blur_view)
|
||||
setmetatable(M, { __index = IGameInfo })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "EXGameInfo"
|
||||
UIPackage.AddPackage("extend/poker/suoha/ui/Info_Poker_SuoHa")
|
||||
UIPackage.AddPackage("extend/poker2/suoha/ui/Info_Poker_SuoHa")
|
||||
return self
|
||||
end
|
||||
|
||||
|
|
@ -19,39 +18,294 @@ function M:FillData(view, index)
|
|||
self._maxPlayer = 2 -- 默认玩家人数
|
||||
self._roundChoice = 5 -- 回合选项数
|
||||
|
||||
self._config = UIPackage.CreateObjectFromURL("ui://Info_Poker_RunFastNew/Label_Detail_Play")
|
||||
-- if oldGameVersion == 1 then
|
||||
self._config = UIPackage.CreateObjectFromURL("ui://Info_Poker_SuoHa/Label_Detail_Play")
|
||||
-- else
|
||||
-- self._config = UIPackage.CreateObjectFromURL("ui://Info_Poker_SuoHa/Creat_EXyueyang")
|
||||
-- end
|
||||
|
||||
local jiangmaSlider = self._config:GetChild("slider_people")
|
||||
jiangmaSlider.onChanged:Set(function()
|
||||
self._config:GetChild("text_people").text = string.format("共%s人", Mathf.Round(jiangmaSlider.value))
|
||||
|
||||
if oldGameVersion == 2 then
|
||||
self._config:GetController("xipai").selectedIndex = 0
|
||||
|
||||
self.xipaiValueText = self._config:GetChild('xipaifen')
|
||||
self.xipaiValueText.text = 1
|
||||
self.xipaiValue = 1
|
||||
|
||||
self.anchouValueText = self._config:GetChild('anchoufen')
|
||||
self.anchouValueText.text = 1
|
||||
self.anchouValue = 1
|
||||
|
||||
local btn_cr = self._config:GetChild('sdsrbtn')
|
||||
btn_cr.onClick:Set(
|
||||
function()
|
||||
local gniv = GroupNumberInputView_Game.new(nil, function(num)
|
||||
local value = limit
|
||||
if otype == 1 then
|
||||
value = value + ad2d(num)
|
||||
elseif otype == -1 then
|
||||
value = value - ad2d(num)
|
||||
else
|
||||
value = ad2d(num)
|
||||
end
|
||||
|
||||
if value < 0 then
|
||||
ViewUtil.ErrorTip(1, "输入数据异常!")
|
||||
end
|
||||
|
||||
self.xipaiValueText.text = value / 1000
|
||||
self.xipaiValue = value / 1000
|
||||
end, 0, nil)
|
||||
gniv:Show()
|
||||
end
|
||||
)
|
||||
|
||||
|
||||
local btn_cr2 = self._config:GetChild('anchoubtn')
|
||||
btn_cr2.onClick:Set(
|
||||
function()
|
||||
local gniv = GroupNumberInputView_Game.new(nil, function(num)
|
||||
local value = limit
|
||||
if otype == 1 then
|
||||
value = value + ad2d(num)
|
||||
elseif otype == -1 then
|
||||
value = value - ad2d(num)
|
||||
else
|
||||
value = ad2d(num)
|
||||
end
|
||||
|
||||
if value < 0 then
|
||||
ViewUtil.ErrorTip(1, "输入数据异常!")
|
||||
end
|
||||
|
||||
self.anchouValueText.text = value / 1000
|
||||
self.anchouValue = value / 1000
|
||||
end, 3, nil)
|
||||
gniv:Show()
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
|
||||
|
||||
self._config:GetChild("people_2").onClick:Set(function()
|
||||
self._config:GetController("rule").selectedIndex = 0
|
||||
end)
|
||||
|
||||
local piao = self._config:GetController("piao")
|
||||
local daniao = self._config:GetController("daniao")
|
||||
|
||||
piao.onChanged:Add(function()
|
||||
if piao.selectedIndex ~= 0 then
|
||||
daniao.selectedIndex = 0
|
||||
end
|
||||
end)
|
||||
|
||||
daniao.onChanged:Add(function()
|
||||
if daniao.selectedIndex ~= 0 then
|
||||
piao.selectedIndex = 0
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
local _help_url = "ui://Info_Poker_SuoHa/Com_help"
|
||||
function M:GetHelpUrl()
|
||||
return _help_url
|
||||
end
|
||||
|
||||
local _icon_url = "ui://Info_Poker_SuoHa/icon"
|
||||
function M:GetIconUrl()
|
||||
return _icon_url
|
||||
end
|
||||
|
||||
local _icon_url1 = "ui://Info_Poker_SuoHa/icon1"
|
||||
function M:GetIconUrl1()
|
||||
return _icon_url1
|
||||
end
|
||||
|
||||
local _play_list = { "15张玩法", "16张玩法" }
|
||||
function M:GetPlayList()
|
||||
return _play_list
|
||||
end
|
||||
|
||||
function M:LoadConfigData(data)
|
||||
local _config = self._config
|
||||
_config:GetController("round").selectedIndex = data.opt - 1
|
||||
_config:GetController("rule").selectedIndex = data.rule == 2 and 0 or 1
|
||||
_config:GetController("play_list").selectedIndex = data.leaf - 1
|
||||
_config:GetController("willBeOut").selectedIndex = data.willBeOut - 1
|
||||
_config:GetController("heart10").selectedIndex = data.heartten - 1
|
||||
_config:GetController("bombSpring").selectedIndex = data.minboom - 1
|
||||
_config:GetController("player_num").selectedIndex = data.maxPlayers == 2 and 0 or 1
|
||||
_config:GetController("Cost").selectedIndex = data.AA == 0 and 0 or 1
|
||||
_config:GetController("showlength").selectedIndex = data.showlength
|
||||
_config:GetController("fourBeltThree").selectedIndex = data.fourBeltThree
|
||||
_config:GetController("demolition").selectedIndex = data.demolition
|
||||
_config:GetController("fangzuobi").selectedIndex = data.fangzuobi
|
||||
|
||||
local sandaidan = data.sandaidan
|
||||
if sandaidan ~= nil and sandaidan == 1 then
|
||||
_config:GetChild("sandaidan").selected = true
|
||||
|
||||
_config:GetChild("planelack").selected = false
|
||||
_config:GetChild("Threelack").selected = false
|
||||
else
|
||||
_config:GetChild("sandaidan").selected = false
|
||||
|
||||
_config:GetChild("planelack").selected = data.planelack == 1 and true or false
|
||||
_config:GetChild("Threelack").selected = data.threelack == 1 and true or false
|
||||
end
|
||||
|
||||
local fs = data.fs
|
||||
if fs ~= nil and fs == 1 then
|
||||
_config:GetChild("fan_sprint").selected = true
|
||||
else
|
||||
_config:GetChild("fan_sprint").selected = false
|
||||
end
|
||||
|
||||
local ba = data.ba
|
||||
if ba ~= nil and ba == 1 then
|
||||
_config:GetChild("boom_add").selected = true
|
||||
else
|
||||
_config:GetChild("boom_add").selected = false
|
||||
end
|
||||
|
||||
_config:GetChild("ThreeA").selected = data.threeA == 1 and true or false
|
||||
|
||||
if data.piao ~= nil then
|
||||
_config:GetController("piao").selectedIndex = data.piao
|
||||
end
|
||||
|
||||
if data.daniao ~= nil then
|
||||
_config:GetController("daniao").selectedIndex = data.daniao
|
||||
end
|
||||
|
||||
if _config:GetChild("fourBeltThree") then
|
||||
_config:GetChild("fourBeltThree").selected = data.fourDaiTwo
|
||||
end
|
||||
|
||||
if _config:GetChild("fourBeltTwo") then
|
||||
_config:GetChild("fourBeltTwo").selected = data.fourDaiThree
|
||||
end
|
||||
|
||||
if _config:GetChild("xipai") then
|
||||
_config:GetChild("xipai").selected = data.xi_pai
|
||||
end
|
||||
|
||||
|
||||
if oldGameVersion == 2 then
|
||||
self.xipaiValueText.text = data.xi_pai_score / 1000
|
||||
self.xipaiValue = data.xi_pai_score / 1000
|
||||
|
||||
self.anchouValueText.text = data.an_chou_score / 1000
|
||||
self.anchouValue = data.an_chou_score / 1000
|
||||
end
|
||||
end
|
||||
|
||||
function M:SelectedConfigData()
|
||||
local _config = self._config
|
||||
local round = _config:GetController("round").selectedIndex
|
||||
local rule = _config:GetController("rule").selectedIndex
|
||||
local leaf = _config:GetController("play_list").selectedIndex
|
||||
local willBeOut = _config:GetController("willBeOut").selectedIndex
|
||||
local bombSpring = _config:GetController("bombSpring").selectedIndex
|
||||
local heart10 = _config:GetController("heart10").selectedIndex
|
||||
local player_num = _config:GetController("player_num").selectedIndex
|
||||
local AA = _config:GetController("Cost").selectedIndex
|
||||
local showlength = _config:GetController("showlength").selectedIndex
|
||||
local fourBeltThree = _config:GetController("fourBeltThree").selectedIndex
|
||||
local demolition = _config:GetController("demolition").selectedIndex
|
||||
local fangzuobi = _config:GetController("fangzuobi").selectedIndex
|
||||
local planelack = _config:GetChild("planelack").selected and 1 or 0
|
||||
local threelack = _config:GetChild("Threelack").selected and 1 or 0
|
||||
local ThreeA = _config:GetChild("ThreeA").selected and 1 or 0
|
||||
local piao = _config:GetController("piao").selectedIndex
|
||||
local daniao = _config:GetController("daniao").selectedIndex
|
||||
local sandaidan = _config:GetController("sandaidan").selectedIndex
|
||||
local ba = _config:GetChild("boom_add").selected and 1 or 0
|
||||
local fs = _config:GetChild("fan_sprint").selected and 1 or 0
|
||||
|
||||
local peopleNum = Mathf.Round(_config:GetChild("slider_people").value)
|
||||
-----
|
||||
local fourDaiTwo = false
|
||||
if _config:GetChild("fourBeltThree") then
|
||||
fourDaiTwo = _config:GetChild("fourBeltThree").selected
|
||||
end
|
||||
|
||||
local fourDaiThree = false
|
||||
if _config:GetChild("fourBeltTwo") then
|
||||
fourDaiThree = _config:GetChild("fourBeltTwo").selected
|
||||
end
|
||||
|
||||
local xi_pai = false
|
||||
if _config:GetChild("xipai") then
|
||||
xi_pai = _config:GetChild("xipai").selected
|
||||
end
|
||||
|
||||
----
|
||||
local _data = {}
|
||||
_data["account_id"] = DataManager.SelfUser.Id
|
||||
_data["opt"] = round + 1
|
||||
_data["rule"] = rule == 0 and 2 or 1
|
||||
_data["leaf"] = leaf + 1
|
||||
_data["AA"] = AA
|
||||
_data["willBeOut"] = willBeOut + 1
|
||||
_data["showlength"] = showlength
|
||||
_data["heartten"] = willBeOut == 0 and heart10 + 1 or 2
|
||||
_data["minboom"] = (willBeOut == 0 and leaf == 1 and player_num == 1) and bombSpring + 1 or 2
|
||||
_data["maxPlayers"] = player_num + 2
|
||||
_data["fourBeltThree"] = fourBeltThree
|
||||
_data["demolition"] = demolition
|
||||
_data["fangzuobi"] = fangzuobi
|
||||
_data["threeA"] = ThreeA
|
||||
_data["piao"] = piao
|
||||
_data["daniao"] = daniao
|
||||
_data["sandaidan"] = sandaidan
|
||||
_data["ba"] = ba
|
||||
_data["fs"] = fs
|
||||
|
||||
_data["opt"] = round + 1 --局数
|
||||
_data["maxPlayers"] = peopleNum --人数为peopleNum
|
||||
_data["min_score"] = 0
|
||||
_data["max_score"] = 0
|
||||
_data["max_bet"] = 0
|
||||
_data["join_score"] = 0
|
||||
_data["min_player"] = 0
|
||||
_data["base_score"] = 0
|
||||
_data["fourDaiTwo"] = fourDaiTwo
|
||||
_data["fourDaiThree"] = fourDaiThree
|
||||
|
||||
|
||||
if willBeOut == 1 then
|
||||
-- body
|
||||
_data["planelack"] = 0
|
||||
_data["threelack"] = 0
|
||||
else
|
||||
if sandaidan == 1 then
|
||||
_data["planelack"] = 0
|
||||
_data["threelack"] = 0
|
||||
else
|
||||
_data["planelack"] = planelack
|
||||
_data["threelack"] = threelack
|
||||
end
|
||||
end
|
||||
|
||||
_data['xi_pai'] = xi_pai
|
||||
|
||||
local xi_pai_score = 0
|
||||
local an_chou_score = 0
|
||||
|
||||
if oldGameVersion == 2 then
|
||||
xi_pai_score = self.xipaiValue
|
||||
an_chou_score = self.anchouValue
|
||||
end
|
||||
|
||||
_data['xi_pai_score'] = xi_pai_score * 1000
|
||||
_data['an_chou_score'] = an_chou_score * 1000
|
||||
|
||||
return _data
|
||||
end
|
||||
|
||||
function M:OnChangeOption(ctype, pay_obj)
|
||||
IGameInfo.OnChangeOption(self, ctype, pay_obj)
|
||||
local people = self._config:GetController("player_num")
|
||||
people.onChanged:Set(function()
|
||||
self._maxPlayer = people.selectedIndex + 2
|
||||
self:ShowVariablePrice(ctype, pay_obj)
|
||||
end)
|
||||
end
|
||||
|
||||
function M:LoadConfigToDetail(data)
|
||||
local configData = json.decode(data)
|
||||
local returnString = string.format("人数%s人", configData.maxPlayers)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,83 @@
|
|||
---
|
||||
--- Created by 谌建军.
|
||||
--- DateTime: 2017/12/18 15:19
|
||||
---
|
||||
local EXGameInfo = {}
|
||||
|
||||
local M = EXGameInfo
|
||||
|
||||
local roundTable = { 10, 15, 20 }
|
||||
function EXGameInfo.new(blur_view)
|
||||
setmetatable(M, { __index = IGameInfo })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "EXGameInfo"
|
||||
UIPackage.AddPackage("extend/poker2/suoha/ui/Info_Poker_SuoHa")
|
||||
return self
|
||||
end
|
||||
|
||||
function M:FillData(view, index)
|
||||
self._maxPlayer = 2 -- 默认玩家人数
|
||||
self._roundChoice = 5 -- 回合选项数
|
||||
|
||||
self._config = UIPackage.CreateObjectFromURL("ui://Info_Poker_SuoHa/Label_Detail_Play")
|
||||
|
||||
self.peopleSlider = self._config:GetChild("slider_people")
|
||||
self.peopleSlider.onChanged:Set(function()
|
||||
self._config:GetChild("text_people").text = string.format("共%s牛马", Mathf.Round(self.peopleSlider.value) + 1)
|
||||
end)
|
||||
end
|
||||
|
||||
local _help_url = "ui://Info_Poker_RunFastNew/Com_help"
|
||||
function M:GetHelpUrl()
|
||||
return _help_url
|
||||
end
|
||||
|
||||
local _icon_url = "ui://Info_Poker_RunFastNew/icon"
|
||||
function M:GetIconUrl()
|
||||
return _icon_url
|
||||
end
|
||||
|
||||
local _icon_url1 = "ui://Info_Poker_RunFastNew/icon1"
|
||||
function M:GetIconUrl1()
|
||||
return _icon_url1
|
||||
end
|
||||
|
||||
function M:LoadConfigData(data)
|
||||
local _config = self._config
|
||||
end
|
||||
|
||||
function M:SelectedConfigData()
|
||||
local _config = self._config
|
||||
local round = _config:GetController("round").selectedIndex
|
||||
|
||||
|
||||
local _data = {}
|
||||
_data["round"] = round
|
||||
_data["peopleNum"] = Mathf.Round(self.peopleSlider.value) + 1
|
||||
_data["min_score"] = 0
|
||||
_data["max_score"] = 0
|
||||
_data["max_bet"] = 0
|
||||
_data["join_score"] = 0
|
||||
_data["min_player"] = 0
|
||||
_data["base_score"] = 0
|
||||
|
||||
return _data
|
||||
end
|
||||
|
||||
-- function M:OnChangeOption(ctype, pay_obj)
|
||||
-- IGameInfo.OnChangeOption(self, ctype, pay_obj)
|
||||
-- local peopleNum = self._config:GetController("peopleNum")
|
||||
-- peopleNum.onChanged:Set(function()
|
||||
-- self._maxPlayer = peopleNum.selectedIndex == 1 and 2 or 3
|
||||
-- self:ShowVariablePrice(ctype, pay_obj)
|
||||
-- end)
|
||||
-- end
|
||||
|
||||
function M:LoadConfigToDetail(data)
|
||||
local configData = json.decode(data)
|
||||
local returnString = string.format("人数%s人", configData.maxPlayers)
|
||||
|
||||
return returnString
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
--- Created by 谌建军.
|
||||
--- DateTime: 2017/12/13 10:42
|
||||
---
|
||||
local ExPlayer = {
|
||||
local EXPlayer = {
|
||||
-- 手牌列表
|
||||
hand_count = 0,
|
||||
out_card_list = {},
|
||||
|
|
@ -10,7 +10,7 @@ local ExPlayer = {
|
|||
isOneCard = false, -- 报单
|
||||
}
|
||||
|
||||
local M = ExPlayer
|
||||
local M = EXPlayer
|
||||
|
||||
--- Create a new EXPlayer
|
||||
function M.new()
|
||||
|
|
@ -13,6 +13,33 @@ end
|
|||
|
||||
function M:FillData(player)
|
||||
PlayerInfoView.FillData(self, player)
|
||||
-- if player.cur_hp ~= nil then
|
||||
-- self:UpdateScore(d2ad(player.cur_hp))
|
||||
-- else
|
||||
-- local rt = 1
|
||||
-- if self._main_view._room.hpOnOff == 1 then
|
||||
-- rt = self._main_view._room.score_times
|
||||
-- end
|
||||
-- self:UpdateScore(player.total_score * rt)
|
||||
-- end
|
||||
end
|
||||
|
||||
function M:UpdatePiao(piao)
|
||||
if piao == nil or piao == -1 then
|
||||
self._view:GetChild("piao").text = ""
|
||||
elseif piao == 0 then
|
||||
self._view:GetChild("piao").text = "不飘"
|
||||
elseif piao == 1 then
|
||||
self._view:GetChild("piao").text = "飘1分"
|
||||
elseif piao == 2 then
|
||||
self._view:GetChild("piao").text = "飘2分"
|
||||
elseif piao == 3 then
|
||||
self._view:GetChild("piao").text = "飘3分"
|
||||
elseif piao == 5 then
|
||||
self._view:GetChild("piao").text = "飘5分"
|
||||
elseif piao == 8 then
|
||||
self._view:GetChild("piao").text = "飘8分"
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
|||
|
|
@ -2,12 +2,12 @@
|
|||
--- Created by 谌建军.
|
||||
--- DateTime: 2017/12/19 14:36
|
||||
---
|
||||
local ExPlayer = import(".ExPlayer")
|
||||
local EXPlayer = import(".EXPlayer")
|
||||
|
||||
local ExRoom = {
|
||||
local EXRoom = {
|
||||
}
|
||||
|
||||
local M = ExRoom
|
||||
local M = EXRoom
|
||||
|
||||
--- Create a new EXPlayer
|
||||
function M.new()
|
||||
|
|
@ -18,7 +18,7 @@ function M.new()
|
|||
end
|
||||
|
||||
function M:NewPlayer()
|
||||
return ExPlayer.new()
|
||||
return EXPlayer.new()
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
@ -7,57 +7,57 @@ local M = {}
|
|||
|
||||
--- Create a new RoomConfig
|
||||
function M.new(config)
|
||||
setmetatable(M, { __index = RoomConfig })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
RoomConfig.init(self, config)
|
||||
self.class = "ExRoomConfig"
|
||||
self.config = config
|
||||
self.Leaf = config.leaf
|
||||
self.Rule = config.rule
|
||||
self.Times = config.times
|
||||
self.WillBeOut = config.willBeOut
|
||||
self.Heart10 = config.heartten
|
||||
self.BombSpring = config.minboom
|
||||
self.AA = config.aa
|
||||
self.PlayerNum = config.maxPlayers
|
||||
self.showlength = config.showlength
|
||||
self.fourBeltThree = config.fourBeltThree
|
||||
self.demolition = config.demolition
|
||||
self.fangzuobi = config.fangzuobi
|
||||
self.planelack = config.planelack
|
||||
self.threelack = config.threelack
|
||||
self.threeA = config.threeA
|
||||
self.tuoguan_active_time = config.tuoguan_active_time
|
||||
self.tuoguan = config.tuoguan
|
||||
self.tuoguan_result_type = config.tuoguan_result_type
|
||||
self.isNonnegative = config.isNonnegative
|
||||
self.sandaidan = config.sandaidan
|
||||
self.isHidden = config.isHidden
|
||||
self.ba = config.ba
|
||||
self.fs = config.fs
|
||||
setmetatable(M, { __index = RoomConfig })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
RoomConfig.init(self, config)
|
||||
self.class = "EXRoomConfig"
|
||||
self.config = config
|
||||
self.Leaf = config.leaf
|
||||
self.Rule = config.rule
|
||||
self.Times = config.times
|
||||
self.WillBeOut = config.willBeOut
|
||||
self.Heart10 = config.heartten
|
||||
self.BombSpring = config.minboom
|
||||
self.AA = config.aa
|
||||
self.PlayerNum = config.maxPlayers
|
||||
self.showlength = config.showlength
|
||||
self.fourBeltThree = config.fourBeltThree
|
||||
self.demolition = config.demolition
|
||||
self.fangzuobi = config.fangzuobi
|
||||
self.planelack = config.planelack
|
||||
self.threelack = config.threelack
|
||||
self.threeA = config.threeA
|
||||
self.tuoguan_active_time = config.tuoguan_active_time
|
||||
self.tuoguan = config.tuoguan
|
||||
self.tuoguan_result_type = config.tuoguan_result_type
|
||||
self.isNonnegative = config.isNonnegative
|
||||
self.sandaidan = config.sandaidan
|
||||
self.isHidden = config.isHidden
|
||||
self.ba = config.ba
|
||||
self.fs = config.fs
|
||||
|
||||
if config.piao ~= nil then
|
||||
self.piao = config.piao
|
||||
else
|
||||
self.piao = 0
|
||||
end
|
||||
if config.piao ~= nil then
|
||||
self.piao = config.piao
|
||||
else
|
||||
self.piao = 0
|
||||
end
|
||||
|
||||
if config.daniao ~= nil then
|
||||
self.daniao = config.daniao
|
||||
else
|
||||
self.daniao = 0
|
||||
end
|
||||
if config.daniao ~= nil then
|
||||
self.daniao = config.daniao
|
||||
else
|
||||
self.daniao = 0
|
||||
end
|
||||
|
||||
if self.isNonnegative == nil then
|
||||
self.isNonnegative = 0
|
||||
end
|
||||
self.energyTab = config.energyTab
|
||||
if self.isNonnegative == nil then
|
||||
self.isNonnegative = 0
|
||||
end
|
||||
self.energyTab = config.energyTab
|
||||
|
||||
if self.energyTab == nil then
|
||||
self.energyTab = 0
|
||||
end
|
||||
if self.energyTab == nil then
|
||||
self.energyTab = 0
|
||||
end
|
||||
|
||||
return self
|
||||
return self
|
||||
end
|
||||
|
||||
--[[function M:GetDes(sp)
|
||||
|
|
@ -383,104 +383,104 @@ end--]]
|
|||
|
||||
|
||||
function M:GetDes(sp)
|
||||
sp = sp or " "
|
||||
local str = ""
|
||||
-- str = str.. self.Times.."局"..sp
|
||||
str = str .. RoomConfig.GetDes(self, sp)
|
||||
if self.Leaf == 1 then
|
||||
str = str .. "15张玩法" .. sp
|
||||
else
|
||||
str = str .. "16张玩法" .. sp
|
||||
end
|
||||
sp = sp or " "
|
||||
local str = ""
|
||||
-- str = str.. self.Times.."局"..sp
|
||||
str = str .. RoomConfig.GetDes(self, sp)
|
||||
if self.Leaf == 1 then
|
||||
str = str .. "15张玩法" .. sp
|
||||
else
|
||||
str = str .. "16张玩法" .. sp
|
||||
end
|
||||
|
||||
if self.Rule == 1 then
|
||||
str = str .. "第一局黑桃3先出,随后赢家先出" .. sp
|
||||
else
|
||||
str = str .. "第一局系统随机选一张先出,随后赢家先出" .. sp
|
||||
end
|
||||
if self.Rule == 1 then
|
||||
str = str .. "第一局黑桃3先出,随后赢家先出" .. sp
|
||||
else
|
||||
str = str .. "第一局系统随机选一张先出,随后赢家先出" .. sp
|
||||
end
|
||||
|
||||
if self.WillBeOut == 1 then
|
||||
str = str .. "能出必出" .. sp
|
||||
else
|
||||
str = str .. "可不必出" .. sp
|
||||
end
|
||||
if self.showlength == 1 then
|
||||
str = str .. "显示剩余牌" .. sp
|
||||
end
|
||||
if self.fourBeltThree == 3 then
|
||||
str = str .. "四带三" .. sp
|
||||
elseif self.fourBeltThree == 2 then
|
||||
str = str .. "四带二" .. sp
|
||||
end
|
||||
if self.Heart10 == 1 then
|
||||
str = str .. "红桃10分数翻倍" .. sp
|
||||
end
|
||||
if self.WillBeOut == 1 then
|
||||
str = str .. "能出必出" .. sp
|
||||
else
|
||||
str = str .. "可不必出" .. sp
|
||||
end
|
||||
if self.showlength == 1 then
|
||||
str = str .. "显示剩余牌" .. sp
|
||||
end
|
||||
if self.fourBeltThree == 3 then
|
||||
str = str .. "四带三" .. sp
|
||||
elseif self.fourBeltThree == 2 then
|
||||
str = str .. "四带二" .. sp
|
||||
end
|
||||
if self.Heart10 == 1 then
|
||||
str = str .. "红桃10分数翻倍" .. sp
|
||||
end
|
||||
|
||||
if self.BombSpring == 1 then
|
||||
str = str .. "4个3 或者3个A 1个2 春天" .. sp
|
||||
end
|
||||
if self.demolition == 1 then
|
||||
str = str .. "炸弹不能拆" .. sp
|
||||
end
|
||||
if self.fangzuobi == 1 and self.PlayerNum == 3 then
|
||||
str = str .. "防作弊" .. sp
|
||||
end
|
||||
if self.BombSpring == 1 then
|
||||
str = str .. "4个3 或者3个A 1个2 春天" .. sp
|
||||
end
|
||||
if self.demolition == 1 then
|
||||
str = str .. "炸弹不能拆" .. sp
|
||||
end
|
||||
if self.fangzuobi == 1 and self.PlayerNum == 3 then
|
||||
str = str .. "防作弊" .. sp
|
||||
end
|
||||
|
||||
if self.sandaidan == 1 then
|
||||
str = str .. "三张飞机带单或者对子" .. sp
|
||||
end
|
||||
if self.sandaidan == 1 then
|
||||
str = str .. "三张飞机带单或者对子" .. sp
|
||||
end
|
||||
|
||||
if self.ba == 1 then
|
||||
str = str .. "炸弹分数算赢家" .. sp
|
||||
end
|
||||
if self.ba == 1 then
|
||||
str = str .. "炸弹分数算赢家" .. sp
|
||||
end
|
||||
|
||||
if self.fs == 1 then
|
||||
str = str .. "反春天" .. sp
|
||||
end
|
||||
if self.fs == 1 then
|
||||
str = str .. "反春天" .. sp
|
||||
end
|
||||
|
||||
|
||||
if self.planelack == 1 then
|
||||
str = str .. "飞机少带可接完" .. sp
|
||||
end
|
||||
if self.threelack == 1 then
|
||||
str = str .. "三张少带可接完" .. sp
|
||||
end
|
||||
if self.threeA == 1 then
|
||||
str = str .. "三张A算炸弹" .. sp
|
||||
end
|
||||
if self.planelack == 1 then
|
||||
str = str .. "飞机少带可接完" .. sp
|
||||
end
|
||||
if self.threelack == 1 then
|
||||
str = str .. "三张少带可接完" .. sp
|
||||
end
|
||||
if self.threeA == 1 then
|
||||
str = str .. "三张A算炸弹" .. sp
|
||||
end
|
||||
|
||||
if self.piao == 0 then
|
||||
if self.piao == 0 then
|
||||
|
||||
elseif self.piao == 1 then
|
||||
str = str .. "飘123" .. sp
|
||||
elseif self.piao == 2 then
|
||||
str = str .. "飘235" .. sp
|
||||
elseif self.piao == 3 then
|
||||
str = str .. "飘258" .. sp
|
||||
end
|
||||
elseif self.piao == 1 then
|
||||
str = str .. "飘123" .. sp
|
||||
elseif self.piao == 2 then
|
||||
str = str .. "飘235" .. sp
|
||||
elseif self.piao == 3 then
|
||||
str = str .. "飘258" .. sp
|
||||
end
|
||||
|
||||
if self.daniao == 1 then
|
||||
str = str .. "打鸟+10" .. sp
|
||||
elseif self.daniao == 2 then
|
||||
str = str .. "打鸟+20" .. sp
|
||||
elseif self.daniao == 3 then
|
||||
str = str .. "打鸟+50" .. sp
|
||||
end
|
||||
if self.daniao == 1 then
|
||||
str = str .. "打鸟+10" .. sp
|
||||
elseif self.daniao == 2 then
|
||||
str = str .. "打鸟+20" .. sp
|
||||
elseif self.daniao == 3 then
|
||||
str = str .. "打鸟+50" .. sp
|
||||
end
|
||||
|
||||
return str
|
||||
return str
|
||||
end
|
||||
|
||||
function M:GetGameJS()
|
||||
local gamerulepanel = UIPackage.CreateObjectFromURL("ui://Extend_Poker_RunFastNew/gamerule")
|
||||
return gamerulepanel
|
||||
local gamerulepanel = UIPackage.CreateObjectFromURL("ui://Extend_Poker_SuoHa/gamerule")
|
||||
return gamerulepanel
|
||||
end
|
||||
|
||||
function M:GetGameSMSize()
|
||||
return 467, 500
|
||||
return 467, 500
|
||||
end
|
||||
|
||||
function M:GetGameName()
|
||||
return "跑得快"
|
||||
return "跑得快"
|
||||
end
|
||||
|
||||
--function M:GetIsShowCardNumber()
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
---
|
||||
--- Created by 谌建军.
|
||||
--- DateTime: 2017/12/18 11:30
|
||||
---
|
||||
|
||||
local EXCardType = {
|
||||
None = 0,
|
||||
OneCard = 1, --一张
|
||||
OnePair = 2, --一对
|
||||
Three = 3, --三张
|
||||
Pairs = 4, --连对
|
||||
ThreeAndTwo = 5, --三带二
|
||||
ThreeAndOne = 6, --三带一
|
||||
Plane = 7, --飞机
|
||||
PlaneAndTwo = 8, --飞机带二
|
||||
PlaneAndOne = 9, --飞机带一
|
||||
Straight = 10, --顺子
|
||||
|
||||
Bomb = 11, --炸
|
||||
FourAndtThree = 12, --四代三
|
||||
|
||||
}
|
||||
|
||||
return EXCardType
|
||||
|
|
@ -3,20 +3,25 @@
|
|||
--- DateTime: 2017/12/13 11:28
|
||||
---
|
||||
|
||||
local ExProtocol = import(".ExProtocol")
|
||||
local ExGameEvent = import(".ExGameEvent")
|
||||
local CardType = import(".CardType")
|
||||
local EXProtocol = import(".EXProtocol")
|
||||
local EXGameEvent = import(".EXGameEvent")
|
||||
local EXCardType = import(".EXCardType")
|
||||
local EXPutError = {
|
||||
"必须先出最小的牌",
|
||||
"出牌不符合规定牌型 ",
|
||||
"下家报单,请出最大的牌 ",
|
||||
"炸弹不能拆"
|
||||
}
|
||||
|
||||
local EXGameController = {}
|
||||
|
||||
local ExGameController = {}
|
||||
|
||||
local M = ExGameController
|
||||
local M = EXGameController
|
||||
|
||||
function M.new()
|
||||
setmetatable(M, { __index = GameController })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self:init("跑得快")
|
||||
self.class = "ExGameController"
|
||||
self.class = "EXGameController"
|
||||
return self
|
||||
end
|
||||
|
||||
|
|
@ -27,7 +32,639 @@ end
|
|||
|
||||
-- 事件注册
|
||||
function M:RegisterEvt()
|
||||
self._eventmap[EXProtocol.GAME_EVT_PLAYER_DEAL] = self.OnSendCard
|
||||
self._eventmap[EXProtocol.GAME_EVT_ACTION] = self.OnTipAction
|
||||
self._eventmap[EXProtocol.GAME_EVT_RESULT1] = self.OnResult1
|
||||
self._eventmap[EXProtocol.GAME_EVT_RESULT2] = self.OnResult2
|
||||
self._eventmap[EXProtocol.GAME_EVT_CHANGE_ACTIVE_PLAYER] = self.OnTurnAction
|
||||
end
|
||||
|
||||
-- function M:SendXiPaiAction(callBack)
|
||||
-- local _data = {}
|
||||
-- local _client = ControllerManager.GameNetClinet
|
||||
-- _client:send(EXProtocol.GAME_XIPAI, _data)
|
||||
-- self.XiPaiCallBack = callBack
|
||||
-- end
|
||||
|
||||
-- function M:OnEventXiPai(evt_data)
|
||||
-- if evt_data["result"] == 0 then
|
||||
-- if self.XiPaiCallBack then
|
||||
-- self.XiPaiCallBack()
|
||||
-- end
|
||||
-- else
|
||||
-- ViewUtil.ErrorTip(1000000, "申请洗牌失败")
|
||||
-- end
|
||||
-- end
|
||||
|
||||
-- function M:OnEventXiPaiAnim(evt_data)
|
||||
-- printlog("洗牌动画===》》》》")
|
||||
-- pt(evt_data)
|
||||
-- local playeridList = evt_data["list"]
|
||||
-- local my_isXiPai = false
|
||||
-- local other_isXiPai = false
|
||||
-- if playeridList and #playeridList > 0 then
|
||||
-- for i = 1, #playeridList do
|
||||
-- local p = self._room:GetPlayerById(playeridList[i])
|
||||
-- if p == self._room.self_player then
|
||||
-- my_isXiPai = true
|
||||
-- else
|
||||
-- other_isXiPai = true
|
||||
-- end
|
||||
-- end
|
||||
-- end
|
||||
|
||||
-- self._cacheEvent:Enqueue(function()
|
||||
-- DispatchEvent(self._dispatcher, EXGameEvent.EventXiPai, my_isXiPai, other_isXiPai)
|
||||
-- end)
|
||||
-- end
|
||||
|
||||
--我发出的协议
|
||||
|
||||
--绑定协议为事件
|
||||
function M:OnSendCard(evt_data)
|
||||
self._cacheEvent:Enqueue(
|
||||
function()
|
||||
DispatchEvent(self._dispatcher, EXGameEvent.OnSendCard, evt_data)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
function M:OnTipAction(evt_data)
|
||||
self._cacheEvent:Enqueue(
|
||||
function()
|
||||
DispatchEvent(self._dispatcher, EXGameEvent.OnTipAction, evt_data)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
function M:OnResult1(evt_data)
|
||||
self._cacheEvent:Enqueue(
|
||||
function()
|
||||
DispatchEvent(self._dispatcher, EXGameEvent.OnResult1, evt_data)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
function M:OnResult2(evt_data)
|
||||
self._cacheEvent:Enqueue(
|
||||
function()
|
||||
DispatchEvent(self._dispatcher, EXGameEvent.OnResult2, evt_data)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
function M:OnTurnAction(evt_data)
|
||||
self._cacheEvent:Enqueue(
|
||||
function()
|
||||
DispatchEvent(self._dispatcher, EXGameEvent.OnTurnAction, evt_data)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
--
|
||||
function M:OnMingCard(evt_data)
|
||||
if ViewManager.GetCurrenView().dview_class == LobbyView then
|
||||
self:ReturnToRoom()
|
||||
return
|
||||
end
|
||||
|
||||
local card = evt_data["mingpai"]
|
||||
self._cacheEvent:Enqueue(
|
||||
function()
|
||||
self._room.ming_card = card
|
||||
DispatchEvent(self._dispatcher, EXGameEvent.OnMingCard, card)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
function M:OnInitCard(evt_data)
|
||||
if ViewManager.GetCurrenView().dview_class == LobbyView then
|
||||
self:ReturnToRoom()
|
||||
return
|
||||
end
|
||||
|
||||
local cardlist = evt_data["cards"]
|
||||
local round = evt_data["round"]
|
||||
self._cacheEvent:Enqueue(
|
||||
function()
|
||||
for _, player in ipairs(self._room.player_list) do
|
||||
player:Clear()
|
||||
player.hand_count = #cardlist
|
||||
end
|
||||
|
||||
self._room.curren_round = round
|
||||
DispatchEvent(self._dispatcher, EXGameEvent.OnInitCard, round, cardlist)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
function M:OnBombScore(evt_data)
|
||||
local scoreList = evt_data["gold_list"]
|
||||
self._cacheEvent:Enqueue(
|
||||
function()
|
||||
for i = 1, #scoreList do
|
||||
local score = scoreList[i].bom_score
|
||||
local player = self._room:GetPlayerById(scoreList[i].aid)
|
||||
player.total_score = player.total_score + score
|
||||
end
|
||||
DispatchEvent(self._dispatcher, EXGameEvent.OnBombScore, scoreList)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
function M:OnPlaySucc(evt_data)
|
||||
if pcall(
|
||||
self.OnPlaySuccCheck, self, evt_data
|
||||
) then
|
||||
|
||||
else
|
||||
printlog("数据异常OnPlaySucc==>>>")
|
||||
end
|
||||
end
|
||||
|
||||
function M:OnPlaySuccCheck(evt_data)
|
||||
local seat = evt_data["player"]
|
||||
local card_obj = evt_data["card_obj"]
|
||||
local cards = card_obj["card_list"]
|
||||
local remain = evt_data["remain"] -- 报单
|
||||
self._cacheEvent:Enqueue(
|
||||
function()
|
||||
local otherList = self:GetOtherSeatList(seat)
|
||||
local player = self._room:GetPlayerBySeat(seat)
|
||||
local out_card_list = self:ChangeCodeByFrom(cards, true)
|
||||
player.hand_count = remain
|
||||
local card_type, number, length, plan_three_count = self:GetCardListInfo(out_card_list)
|
||||
player.out_card_list = self:GetSortOutCardList(out_card_list, card_type, number, plan_three_count)
|
||||
DispatchEvent(self._dispatcher, EXGameEvent.OnPlaySucc, player, remain, card_type, number, otherList,
|
||||
length)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
function M:OnPlaySuccCheckHandCard(evt_data)
|
||||
local seat = evt_data["player"]
|
||||
local cards = evt_data["handCards"]
|
||||
self._cacheEvent:Enqueue(
|
||||
function()
|
||||
DispatchEvent(self._dispatcher, EXGameEvent.OnPassSuccCheckCard, seat, cards)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
function M:OnPassSucc(evt_data)
|
||||
local seat = evt_data["seat"]
|
||||
self._cacheEvent:Enqueue(
|
||||
function()
|
||||
local p = self._room:GetPlayerBySeat(seat)
|
||||
p.out_card_list = { 0 }
|
||||
DispatchEvent(self._dispatcher, EXGameEvent.OnPassSucc, p)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
function M:OnPutError(evt_data)
|
||||
local code = evt_data["error"]
|
||||
self._cacheEvent:Enqueue(
|
||||
function()
|
||||
local error_str = self:GetErrorStr(code)
|
||||
DispatchEvent(self._dispatcher, EXGameEvent.OnErrorTip, error_str)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
function M:TuoGuan(isTuo)
|
||||
local _data = {}
|
||||
_data["tuoguan"] = isTuo
|
||||
local _client = ControllerManager.GameNetClinet
|
||||
_client:send(EXProtocol.SEND_TUOGUAN, _data)
|
||||
end
|
||||
|
||||
function M:Game_TuoGuan(evt_data)
|
||||
local tuoguan = evt_data["tuoguan"]
|
||||
local seat = evt_data["seat"]
|
||||
self._cacheEvent:Enqueue(function()
|
||||
DispatchEvent(self._dispatcher, EXGameEvent.Game_TuoGuan, tuoguan, seat)
|
||||
end)
|
||||
end
|
||||
|
||||
function M:OnIndexMove(evt_data)
|
||||
local seat = evt_data["index"]
|
||||
self._cacheEvent:Enqueue(
|
||||
function()
|
||||
self._room.curren_turn_seat = seat
|
||||
self._room.is_new_bout = self:GetIsNewBout(seat)
|
||||
DispatchEvent(self._dispatcher, EXGameEvent.OnIndexMove, seat)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
function M:OnOptions(evt_data)
|
||||
local play = evt_data["play"]
|
||||
local pass = evt_data["pass"]
|
||||
|
||||
self._cacheEvent:Enqueue(
|
||||
function()
|
||||
local lastCardList = self:GetLastCardList(self._room.self_player.seat)
|
||||
local cardType, cardNum, cardLength = self:GetCardListInfo(lastCardList)
|
||||
DispatchEvent(self._dispatcher, EXGameEvent.OnOptions, play, cardType, cardNum, cardLength, pass,
|
||||
lastCardList)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
function M:OnPiaoTip(evt_data)
|
||||
if ViewManager.GetCurrenView().dview_class == LobbyView then
|
||||
self:ReturnToRoom()
|
||||
return
|
||||
end
|
||||
|
||||
local piao = evt_data["piao"]
|
||||
local reload = evt_data["reload"]
|
||||
self._cacheEvent:Enqueue(
|
||||
function()
|
||||
DispatchEvent(self._dispatcher, EXGameEvent.OnPiaoTips, piao, reload)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
function M:OnPiaoAction(evt_data)
|
||||
local seat = evt_data["seat"]
|
||||
local piao = evt_data["piao"]
|
||||
|
||||
self._cacheEvent:Enqueue(
|
||||
function()
|
||||
DispatchEvent(self._dispatcher, EXGameEvent.OnPiaoAction, seat, piao)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
function M:OnResult(evt_data)
|
||||
local result_type = evt_data["type"]
|
||||
|
||||
local info = evt_data["info"]
|
||||
local winseat = evt_data["winseat"]
|
||||
local remaincards = evt_data["remaincards"]
|
||||
DataManager.CurrenRoom.xipaiScore = evt_data["xipai_score"]
|
||||
--printlog("wwwwwwwwwwwwwwwwwwwww1111111 ",result_type)
|
||||
--pt(evt_data)
|
||||
if result_type == 1 then
|
||||
local over = 1
|
||||
ControllerManager.SetGameNetClient(nil, true)
|
||||
self._cacheEvent:Enqueue(
|
||||
function()
|
||||
for i = 1, #info do
|
||||
local p = self._room:GetPlayerBySeat(info[i]["seat"])
|
||||
p.total_score = info[i]["score"]
|
||||
info[i]["self_user"] = p.self_user
|
||||
end
|
||||
|
||||
DispatchEvent(self._dispatcher, EXGameEvent.OnResult, over, info, winseat, remaincards)
|
||||
end
|
||||
)
|
||||
elseif result_type == 0 then
|
||||
local over = 0
|
||||
self._cacheEvent:Enqueue(
|
||||
function()
|
||||
for i = 1, #info do
|
||||
local p = self._room:GetPlayerBySeat(info[i]["seat"])
|
||||
p.total_score = info[i]["score"]
|
||||
info[i]["self_user"] = p.self_user
|
||||
end
|
||||
DispatchEvent(self._dispatcher, EXGameEvent.OnResult, over, info, winseat, remaincards)
|
||||
end
|
||||
)
|
||||
else
|
||||
local dissolve = 1
|
||||
ControllerManager.SetGameNetClient(nil, true)
|
||||
for i = 1, #info do
|
||||
local p = self._room:GetPlayerBySeat(info[i]["seat"])
|
||||
p.total_score = info[i]["score"]
|
||||
info[i]["self_user"] = p.self_user
|
||||
end
|
||||
-- ControllerManager.ChangeController(LoddyController)
|
||||
DispatchEvent(self._dispatcher, EXGameEvent.OnResultByDissolve, over, info, winseat, dissolve)
|
||||
end
|
||||
end
|
||||
|
||||
function M:OnConfrimToNextGameSucc(evt_data)
|
||||
local aid = evt_data["aid"]
|
||||
self._cacheEvent:Enqueue(
|
||||
function()
|
||||
DispatchEvent(self._dispatcher, EXGameEvent.OnConfrimToNextGameSucc, aid)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
function M:Game_TuoGuan(evt_data)
|
||||
local tuoguan = evt_data["tuoguan"]
|
||||
local seat = evt_data["seat"]
|
||||
self._cacheEvent:Enqueue(function()
|
||||
DispatchEvent(self._dispatcher, EXGameEvent.Game_TuoGuan, tuoguan, seat)
|
||||
end)
|
||||
end
|
||||
|
||||
function M:ChangeCodeByFrom(cardList, isSort)
|
||||
isSort = isSort or false
|
||||
local new_card_list = {}
|
||||
for i = 1, #cardList do
|
||||
local flower = math.floor(cardList[i] / 100)
|
||||
local number = cardList[i] % 100
|
||||
if number == 2 then
|
||||
number = 15
|
||||
end
|
||||
local card = number * 10 + flower
|
||||
new_card_list[#new_card_list + 1] = card
|
||||
end
|
||||
return isSort == true and table.sort(new_card_list) or new_card_list
|
||||
end
|
||||
|
||||
function M:GetOtherSeatList(seat)
|
||||
local list = {}
|
||||
for i = 1, self._room.room_config.people_num do
|
||||
if seat ~= i then
|
||||
list[#list + 1] = i
|
||||
end
|
||||
end
|
||||
return list
|
||||
end
|
||||
|
||||
--
|
||||
function M:GetIsNewBout(seat)
|
||||
local passCount = 0
|
||||
for i = 1, #self._room.player_list do
|
||||
local player = self._room.player_list[i]
|
||||
if seat ~= player.seat then
|
||||
local isPass = self:GetIsPass(player.out_card_list)
|
||||
if isPass then
|
||||
passCount = passCount + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
if passCount == self._room.room_config.people_num - 1 then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
function M:GetLastSeat(seat)
|
||||
local last_seat = seat - 1
|
||||
if last_seat < 1 then
|
||||
last_seat = last_seat + self._room.room_config.people_num
|
||||
end
|
||||
return last_seat
|
||||
end
|
||||
|
||||
function M:GetLastCardList(seat)
|
||||
local last_seat = self:GetLastSeat(seat)
|
||||
local player = self._room:GetPlayerBySeat(last_seat)
|
||||
local isPass = self:GetIsPass(player.out_card_list)
|
||||
if isPass then
|
||||
if self._room.room_config.people_num == 2 then
|
||||
return {}
|
||||
end
|
||||
local last_seat_2 = self:GetLastSeat(last_seat)
|
||||
local player_2 = self._room:GetPlayerBySeat(last_seat_2)
|
||||
local isPass_2 = self:GetIsPass(player_2.out_card_list)
|
||||
if isPass_2 then
|
||||
return {}
|
||||
else
|
||||
return player_2.out_card_list
|
||||
end
|
||||
else
|
||||
return player.out_card_list
|
||||
end
|
||||
end
|
||||
|
||||
function M:GetErrorStr(code)
|
||||
return EXPutError[code + 1]
|
||||
end
|
||||
|
||||
function M:GetSortOutCardList(outCardList, cardType, cardNumber, plan_three_count)
|
||||
if cardType == 3 or cardType == 5 or cardType == 6 then
|
||||
local removeList = {}
|
||||
for i = #outCardList, 1, -1 do
|
||||
local card = outCardList[i]
|
||||
if math.floor(card / 10) == cardNumber then
|
||||
removeList[#removeList + 1] = card
|
||||
table.remove(outCardList, i)
|
||||
end
|
||||
end
|
||||
for i = 1, #removeList do
|
||||
table.insert(outCardList, 1, removeList[i])
|
||||
end
|
||||
elseif cardType >= 7 and cardType <= 9 then
|
||||
local removeList = {}
|
||||
for i = #outCardList, 1, -1 do
|
||||
local card = outCardList[i]
|
||||
if math.floor(card / 10) <= cardNumber and math.floor(card / 10) > cardNumber - plan_three_count then
|
||||
removeList[#removeList + 1] = card
|
||||
table.remove(outCardList, i)
|
||||
end
|
||||
end
|
||||
for i = 1, #removeList do
|
||||
table.insert(outCardList, 1, removeList[i])
|
||||
end
|
||||
end
|
||||
return outCardList
|
||||
end
|
||||
|
||||
--None = 0,
|
||||
--OneCard = 1,
|
||||
--OnePair = 2,
|
||||
--Three = 3,
|
||||
--Pairs = 4,
|
||||
--ThreeAndTwo = 5,
|
||||
--ThreeAndOne = 6,
|
||||
--Plane = 7,
|
||||
--PlaneAndTwo = 8,
|
||||
--PlaneAndOne = 9,
|
||||
--Straight = 10,
|
||||
--Bomb = 11
|
||||
-- 牌型,大小, 长度
|
||||
function M:GetCardListInfo(cardlist)
|
||||
if #cardlist == 0 then
|
||||
return 0, 0, 0, 0
|
||||
end
|
||||
-- 检测牌型
|
||||
local card_type, card_num, card_length, plan_three_count = EXCardType.None, 0, #cardlist, 0
|
||||
local card_map = self:GetCardMapByList(cardlist)
|
||||
|
||||
if #cardlist == 1 then
|
||||
card_type = EXCardType.OneCard
|
||||
card_num = math.floor(cardlist[1] / 10)
|
||||
elseif #cardlist == 2 then
|
||||
card_type = EXCardType.OnePair
|
||||
card_num = math.floor(cardlist[1] / 10)
|
||||
elseif #cardlist == 3 then
|
||||
card_num = math.floor(cardlist[1] / 10)
|
||||
if card_num == 14 and DataManager.CurrenRoom.room_config.threeA == 1 then
|
||||
-- body
|
||||
card_type = EXCardType.Bomb
|
||||
else
|
||||
card_type = EXCardType.Three
|
||||
end
|
||||
elseif #cardlist == 4 then
|
||||
local max_key = 0
|
||||
for k, v in pairs(card_map) do
|
||||
if #v == 4 then
|
||||
card_type = EXCardType.Bomb
|
||||
card_num = k
|
||||
elseif #v == 3 then
|
||||
card_type = EXCardType.ThreeAndOne
|
||||
card_num = k
|
||||
elseif #v == 2 then
|
||||
if k > max_key then
|
||||
max_key = k
|
||||
end
|
||||
card_type = EXCardType.Pairs
|
||||
card_num = max_key
|
||||
end
|
||||
end
|
||||
elseif #cardlist == 5 then
|
||||
local count, max_key = 0, 0
|
||||
for k, v in pairs(card_map) do
|
||||
if #v >= 3 then
|
||||
card_type = EXCardType.ThreeAndTwo
|
||||
card_num = k
|
||||
elseif #v == 1 then
|
||||
count = count + 1
|
||||
if k > max_key then
|
||||
max_key = k
|
||||
end
|
||||
if count == 5 then
|
||||
card_type = EXCardType.Straight
|
||||
card_num = max_key
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif #cardlist == 7 then
|
||||
local count, max_key = 0, 0
|
||||
for k, v in pairs(card_map) do
|
||||
if #v >= 4 then
|
||||
card_type = EXCardType.FourAndtThree
|
||||
card_num = k
|
||||
elseif #v == 1 then
|
||||
count = count + 1
|
||||
if k > max_key then
|
||||
max_key = k
|
||||
end
|
||||
if count == 7 then
|
||||
card_type = EXCardType.Straight
|
||||
card_num = max_key
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
local one_count, two_count, three_count = 0, 0, 0
|
||||
local max_one_key, max_two_key, max_three_key = 0, 0, 0
|
||||
|
||||
for k, v in pairs(card_map) do
|
||||
if #v == 2 then
|
||||
if k > max_two_key then
|
||||
max_two_key = k
|
||||
end
|
||||
two_count = two_count + 1
|
||||
if two_count == #cardlist / 2 then
|
||||
card_type = EXCardType.Pairs
|
||||
card_num = max_two_key
|
||||
end
|
||||
elseif #v == 1 then
|
||||
if k > max_one_key then
|
||||
max_one_key = k
|
||||
end
|
||||
one_count = one_count + 1
|
||||
if one_count == #cardlist then
|
||||
card_type = EXCardType.Straight
|
||||
card_num = max_one_key
|
||||
end
|
||||
elseif #v == 3 then
|
||||
if max_three_key == 0 then
|
||||
max_three_key = k
|
||||
three_count = three_count + 1
|
||||
elseif k > max_three_key and k == max_three_key + 1 then
|
||||
max_three_key = k
|
||||
three_count = three_count + 1
|
||||
elseif k < max_three_key and k == max_three_key - 1 then
|
||||
max_three_key = k
|
||||
three_count = three_count + 1
|
||||
-- else
|
||||
-- max_three_key = k
|
||||
end
|
||||
|
||||
--three_count = three_count + 1
|
||||
end
|
||||
end
|
||||
-- plan_three_count = three_count
|
||||
-- if three_count * 5 >= #cardlist then
|
||||
-- card_type = EXCardType.PlaneAndTwo
|
||||
-- card_num = max_three_key
|
||||
-- elseif three_count * 4 >= #cardlist then
|
||||
-- card_type = EXCardType.PlaneAndOne
|
||||
-- card_num = max_three_key
|
||||
-- elseif three_count * 3 >= #cardlist then
|
||||
-- card_type = EXCardType.Plane
|
||||
-- card_num = max_three_key
|
||||
-- end
|
||||
plan_three_count = three_count
|
||||
|
||||
if three_count * 3 == #cardlist then
|
||||
card_type = EXCardType.Plane
|
||||
card_num = max_three_key
|
||||
elseif three_count * 4 >= #cardlist and #cardlist % 4 == 0 then
|
||||
card_type = EXCardType.PlaneAndOne
|
||||
card_num = max_three_key
|
||||
elseif three_count * 5 >= #cardlist and #cardlist % 5 == 0 then
|
||||
card_type = EXCardType.PlaneAndTwo
|
||||
card_num = max_three_key
|
||||
end
|
||||
end
|
||||
|
||||
return card_type, card_num, card_length, plan_three_count
|
||||
end
|
||||
|
||||
function M:GetCardMapByList(cardlist)
|
||||
local card_map = {}
|
||||
for i = 1, #cardlist do
|
||||
local card = cardlist[i]
|
||||
local card_num = math.floor(cardlist[i] / 10)
|
||||
if card_map[card_num] == nil then
|
||||
card_map[card_num] = { card }
|
||||
else
|
||||
card_map[card_num][#card_map[card_num] + 1] = card
|
||||
end
|
||||
end
|
||||
return card_map
|
||||
end
|
||||
|
||||
function M:GetIsPass(cardlist)
|
||||
if #cardlist == 0 then
|
||||
return true
|
||||
end
|
||||
if cardlist[1] ~= nil and cardlist[1] == 0 then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
--请求离开房间
|
||||
function M:LevelRoom(callBack)
|
||||
local _client = ControllerManager.GameNetClinet
|
||||
if not _client then
|
||||
return
|
||||
end
|
||||
_client:send(
|
||||
Protocol.GAME_EXIT_ROOM,
|
||||
nil,
|
||||
function(res)
|
||||
if res.ReturnCode == 0 then
|
||||
ControllerManager.ChangeController(LoddyController)
|
||||
elseif res.ReturnCode == 27 then
|
||||
ViewUtil.ErrorTip(res.ReturnCode, "退出房间失败!")
|
||||
end
|
||||
callBack(res)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
|||
|
|
@ -2,7 +2,11 @@
|
|||
--- Created by 谌建军.
|
||||
--- DateTime: 2017/12/13 10:55
|
||||
---
|
||||
local ExGameEvent = {
|
||||
|
||||
local EXGameEvent = {
|
||||
OnSendCard = "OnSendCard",
|
||||
OnTipAction = "OnTipAction",
|
||||
OnResult1 = "OnResult1",
|
||||
OnResult2 = "OnResult2",
|
||||
OnTurnAction = "OnTurnAction"
|
||||
}
|
||||
return ExGameEvent
|
||||
return EXGameEvent
|
||||
|
|
|
|||
|
|
@ -2,19 +2,19 @@
|
|||
--- Created by 谌建军.
|
||||
--- DateTime: 2017/12/18 9:41
|
||||
---
|
||||
local PKMainView = import("main.poker.PKMainView")
|
||||
local ExPlayerPokerInfoView = import(".ExPlayerPokerInfoView")
|
||||
local ExPlayerSelfPokerInfoView = import(".ExPlayerSelfPokerInfoView")
|
||||
local ExGameEvent = import(".ExGameEvent")
|
||||
local ExResultView = import(".ExResultView")
|
||||
local ExRightPanelView = import(".ExRightPanelView")
|
||||
local PKMainView = import("main.poker2.PKMainView")
|
||||
local EXPlayerPokerInfoView = import(".EXPlayerPokerInfoView")
|
||||
local EXPlayerSelfPokerInfoView = import(".EXPlayerSelfPokerInfoView")
|
||||
local EXGameEvent = import(".EXGameEvent")
|
||||
local EXResultView = import(".EXResultView")
|
||||
local EXRightPanelView = import(".EXRightPanelView")
|
||||
local PlayerInfoView = import(".EXPlayerInfoView")
|
||||
local TableBG = import('Game.Data.TableBG')
|
||||
local M = {}
|
||||
function M.new()
|
||||
setmetatable(M, { __index = PKMainView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "ExMainView"
|
||||
self.class = "EXMainView"
|
||||
self:init()
|
||||
self._gamectr = ControllerManager.GetController(GameController)
|
||||
return self
|
||||
|
|
@ -22,15 +22,15 @@ end
|
|||
|
||||
local default_bg = 1
|
||||
local bg_config = {
|
||||
{ id = 1, url = 'extend/poker/runfast/bg/bg1', thumb = 'ui://Extend_Poker_RunFastNew/table_bg1' },
|
||||
{ id = 2, url = 'extend/poker/runfast/bg/bg2', thumb = 'ui://Extend_Poker_RunFastNew/table_bg2' },
|
||||
{ id = 3, url = 'extend/poker/runfast/bg/bg3', thumb = 'ui://Extend_Poker_RunFastNew/table_bg3' }
|
||||
{ id = 1, url = 'extend/poker2/suoha/bg/bg1', thumb = 'ui://Extend_Poker_SuoHa/table_bg1' },
|
||||
{ id = 2, url = 'extend/poker2/suoha/bg/bg2', thumb = 'ui://Extend_Poker_SuoHa/table_bg2' },
|
||||
{ id = 3, url = 'extend/poker2/suoha/bg/bg3', thumb = 'ui://Extend_Poker_SuoHa/table_bg3' }
|
||||
}
|
||||
|
||||
function M:InitView(url)
|
||||
local room = self._room
|
||||
UIPackage.AddPackage("extend/poker/runfast/ui/Extend_Poker_RunFastNew")
|
||||
PKMainView.InitView(self, "ui://Extend_Poker_RunFastNew/ExMain_New_" .. room.room_config.people_num, nil, 1,
|
||||
UIPackage.AddPackage("extend/poker2/suoha/ui/Extend_Poker_SuoHa")
|
||||
PKMainView.InitView(self, "ui://Extend_Poker_SuoHa/EXMain_New_" .. room.room_config.people_num, nil, 1,
|
||||
default_bg, bg_config, nil)
|
||||
local _room = DataManager.CurrenRoom
|
||||
local user_id = DataManager.SelfUser.account_id
|
||||
|
|
@ -76,7 +76,7 @@ function M:InitView(url)
|
|||
self._rightPanelView:Destroy()
|
||||
end
|
||||
|
||||
self._rightPanelView = ExRightPanelView.new(self, rightpanel)
|
||||
self._rightPanelView = EXRightPanelView.new(self, rightpanel)
|
||||
for i = 1, #self._room.player_list do
|
||||
if self._room.self_player.seat == self._room.player_list[i].seat and self._room.self_player.self_user.account_id ~= self._room.player_list[i].self_user.account_id then
|
||||
-- body
|
||||
|
|
@ -125,22 +125,9 @@ function M:InitView(url)
|
|||
_player_card_info[i] = self:NewPlayerCardInfoView(tem, i)
|
||||
end
|
||||
|
||||
local list = room.player_list
|
||||
if not room.self_player.ready then
|
||||
local round = DataManager.CurrenRoom.room_config.config.times or 1
|
||||
local xpconfig = DataManager.CurrenRoom.room_config.config.xi_pai
|
||||
if xpconfig then
|
||||
if round > 1 then
|
||||
self._ctr_action.selectedIndex = 1
|
||||
else
|
||||
self._ctr_action.selectedIndex = 2
|
||||
end
|
||||
else
|
||||
self._ctr_action.selectedIndex = 1
|
||||
end
|
||||
else
|
||||
self._ctr_action.selectedIndex = 0
|
||||
end
|
||||
--默认直接展示准备按钮
|
||||
self._ctr_action.selectedIndex = 1
|
||||
|
||||
self._left_time = 0
|
||||
self.bgm_index = 1
|
||||
local state = self._room.CurnrenState
|
||||
|
|
@ -270,9 +257,9 @@ end
|
|||
|
||||
function M:NewPlayerCardInfoView(tem, index)
|
||||
if index == 1 then
|
||||
return ExPlayerSelfPokerInfoView.new(tem, self)
|
||||
return EXPlayerSelfPokerInfoView.new(tem, self)
|
||||
end
|
||||
return ExPlayerPokerInfoView.new(tem, self)
|
||||
return EXPlayerPokerInfoView.new(tem, self)
|
||||
end
|
||||
|
||||
function M:OnPlayerEnter(...)
|
||||
|
|
@ -286,9 +273,6 @@ function M:OnPlayerEnter(...)
|
|||
selecet_seat.visible = true
|
||||
end
|
||||
info:FillData(p)
|
||||
if self._room.banker_seat == self._room.self_player.seat and self._room.self_player.ready then
|
||||
self._ctr_action.selectedIndex = 0
|
||||
end
|
||||
end
|
||||
|
||||
function M:OnPlayerReady(...)
|
||||
|
|
@ -296,44 +280,11 @@ function M:OnPlayerReady(...)
|
|||
local p = arg[1]
|
||||
local _room = self._room
|
||||
local _player_info = self._player_info
|
||||
if p.seat == _room.self_player.seat then
|
||||
self._ctr_action.selectedIndex = 0
|
||||
end
|
||||
local info = _player_info[self:GetPos(p.seat)]
|
||||
info:Ready(true)
|
||||
--local readyNum = 0
|
||||
--for i = 1, #_room.player_list do
|
||||
-- local player = _room.player_list[i]
|
||||
-- if player.ready then readyNum = readyNum + 1 end
|
||||
--end
|
||||
--if _room.banker_seat == _room.self_player.seat and readyNum > 1 and readyNum == _room.room_config.people_num then
|
||||
-- if self._state.selectedIndex == 2 then
|
||||
-- local _gamectr = ControllerManager.GetController(GameController)
|
||||
-- _gamectr:StartGame()
|
||||
-- end
|
||||
-- --self._ctr_action.selectedIndex = 2
|
||||
--end
|
||||
end
|
||||
|
||||
function M:OnPlayerLeave(...)
|
||||
MainView.OnPlayerLeave(self, ...)
|
||||
local _room = self._room
|
||||
if not _room.self_player.ready then
|
||||
--self._ctr_action.selectedIndex = 1
|
||||
local round = DataManager.CurrenRoom.room_config.config.times or 1
|
||||
local xpconfig = DataManager.CurrenRoom.room_config.config.xi_pai
|
||||
if xpconfig then
|
||||
if round > 1 then
|
||||
self._ctr_action.selectedIndex = 1
|
||||
else
|
||||
self._ctr_action.selectedIndex = 2
|
||||
end
|
||||
else
|
||||
self._ctr_action.selectedIndex = 1
|
||||
end
|
||||
else
|
||||
self._ctr_action.selectedIndex = 0
|
||||
end
|
||||
end
|
||||
|
||||
function M:EventInit()
|
||||
|
|
@ -343,694 +294,24 @@ function M:EventInit()
|
|||
local _player_card_info = self._player_card_info
|
||||
local _room = self._room
|
||||
|
||||
|
||||
_gamectr:AddEventListener(ExGameEvent.EventXiPai, function(...)
|
||||
if self.result_view ~= nil then
|
||||
self.result_view:Destroy()
|
||||
self.result_view = nil
|
||||
end
|
||||
|
||||
self._player_card_info[1]:HidePiao()
|
||||
|
||||
if self._room.room_config.people_num == 3 and self._room.room_config.fangzuobi == 1 then
|
||||
-- body
|
||||
self.MypokerList = cardlist
|
||||
end
|
||||
local otherpoker_list = self._view:GetChild("otherpoker_list")
|
||||
|
||||
if otherpoker_list ~= nil then
|
||||
-- body
|
||||
otherpoker_list.visible = false
|
||||
otherpoker_list:RemoveChildrenToPool()
|
||||
end
|
||||
self.ctr_state.selectedIndex = 1
|
||||
self.ctr_card_eff.selectedIndex = 0
|
||||
if self.rank_view ~= nil then
|
||||
self.rank_view:Dispose()
|
||||
self.rank_view = nil
|
||||
end
|
||||
|
||||
local list = _room.player_list
|
||||
for i = 1, #list do
|
||||
local p = list[i]
|
||||
local head_info = self._player_info[self:GetPos(p.seat)]
|
||||
if head_info._view:GetChild("shengyu") ~= nil and head_info._view:GetController("shengyu") ~= nil then
|
||||
-- body
|
||||
|
||||
if self._room.room_config.showlength == 1 then
|
||||
-- body
|
||||
head_info._view:GetController("shengyu").selectedIndex = 1
|
||||
else
|
||||
head_info._view:GetController("shengyu").selectedIndex = 0
|
||||
end
|
||||
|
||||
-- body
|
||||
head_info._view:GetChild("shengyu"):GetChild("shengyu").text = "剩" .. p.hand_count .. "张"
|
||||
end
|
||||
p:Clear()
|
||||
head_info:FillData(p)
|
||||
local card_info = self._player_card_info[self:GetPos(p.seat)]
|
||||
card_info:Clear()
|
||||
head_info:Ready(false)
|
||||
end
|
||||
|
||||
|
||||
--[[if ( currentPlayer ) then
|
||||
self._popEvent = false
|
||||
local xipaiCB=function ()
|
||||
self._popEvent = true
|
||||
end
|
||||
self:PlayXiPai(xipaiCB)
|
||||
else
|
||||
ViewUtil.ShowModalWait(self._root_view,"等待其它玩家洗牌...")
|
||||
coroutine.start(function()
|
||||
coroutine.wait(3)
|
||||
ViewUtil.CloseModalWait()
|
||||
end)
|
||||
|
||||
|
||||
end--]]
|
||||
|
||||
|
||||
_gamectr:AddEventListener(EXGameEvent.OnSendCard, function(...)
|
||||
local arg = { ... }
|
||||
local currentPlayer1 = arg[1]
|
||||
local currentPlayer2 = arg[2]
|
||||
self._popEvent = false
|
||||
if (currentPlayer1) then
|
||||
local xipaiCB = function()
|
||||
self._popEvent = true
|
||||
end
|
||||
self:PlayXiPai(xipaiCB)
|
||||
end
|
||||
|
||||
|
||||
if (currentPlayer2) then
|
||||
--self._popEvent = false
|
||||
local xipaiCB2 = function()
|
||||
self._popEvent = true
|
||||
end
|
||||
self:PlayXiPai1(xipaiCB2)
|
||||
end
|
||||
end)
|
||||
|
||||
_gamectr:AddEventListener(ExGameEvent.OnMingCard, function(...)
|
||||
_gamectr:AddEventListener(EXGameEvent.OnTipAction, function(...)
|
||||
local arg = { ... }
|
||||
local card = arg[1]
|
||||
self.ctr_state.selectedIndex = 1
|
||||
self.ctr_card_eff.selectedIndex = 1
|
||||
self:PlayCardEff(card)
|
||||
end)
|
||||
|
||||
_gamectr:AddEventListener(ExGameEvent.OnInitCard, function(...)
|
||||
_gamectr:AddEventListener(EXGameEvent.OnResult1, function(...)
|
||||
local arg = { ... }
|
||||
local round = arg[1]
|
||||
local cardlist = arg[2]
|
||||
|
||||
|
||||
if self.result_view ~= nil then
|
||||
self.result_view:Destroy()
|
||||
self.result_view = nil
|
||||
end
|
||||
|
||||
self._player_card_info[1]:HidePiao()
|
||||
|
||||
if self._room.room_config.people_num == 3 and self._room.room_config.fangzuobi == 1 then
|
||||
-- body
|
||||
self.MypokerList = cardlist
|
||||
end
|
||||
local otherpoker_list = self._view:GetChild("otherpoker_list")
|
||||
|
||||
if otherpoker_list ~= nil then
|
||||
-- body
|
||||
otherpoker_list.visible = false
|
||||
otherpoker_list:RemoveChildrenToPool()
|
||||
end
|
||||
self.ctr_state.selectedIndex = 1
|
||||
self.ctr_card_eff.selectedIndex = 0
|
||||
if self.rank_view ~= nil then
|
||||
self.rank_view:Dispose()
|
||||
self.rank_view = nil
|
||||
end
|
||||
self:UpdateRound(round)
|
||||
ViewUtil.PlaySound("RunFastNew_PK", "extend/poker/runfast/sound/fapai.mp3")
|
||||
local list = _room.player_list
|
||||
for i = 1, #list do
|
||||
local p = list[i]
|
||||
local head_info = self._player_info[self:GetPos(p.seat)]
|
||||
if head_info._view:GetChild("shengyu") ~= nil and head_info._view:GetController("shengyu") ~= nil then
|
||||
-- body
|
||||
|
||||
if self._room.room_config.showlength == 1 then
|
||||
-- body
|
||||
head_info._view:GetController("shengyu").selectedIndex = 1
|
||||
else
|
||||
head_info._view:GetController("shengyu").selectedIndex = 0
|
||||
end
|
||||
|
||||
-- body
|
||||
head_info._view:GetChild("shengyu"):GetChild("shengyu").text = "剩" .. p.hand_count .. "张"
|
||||
end
|
||||
p:Clear()
|
||||
head_info:FillData(p)
|
||||
local card_info = self._player_card_info[self:GetPos(p.seat)]
|
||||
card_info:Clear()
|
||||
head_info:Ready(false)
|
||||
|
||||
if p.seat == self._room.self_player.seat then
|
||||
if self._room.room_config.people_num == 3 and self._room.room_config.fangzuobi == 1 then
|
||||
-- body
|
||||
card_info:InitPoker(cardlist, false, 1)
|
||||
else
|
||||
card_info:InitPoker(cardlist, false)
|
||||
end
|
||||
else
|
||||
--card_info:UpdateHandPoker(#cardlist,true,false) --todo
|
||||
--card_info:UpdateRemainCard(#cardlist,true)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
-- _gamectr:AddEventListener(ExGameEvent.Oener,function ( ... )
|
||||
-- local arg = {...}
|
||||
-- local seat = arg[1]
|
||||
-- local head_info = self._player_info[self:GetPos(seat)]
|
||||
-- head_info._view:GetController("Oener").selectedIndex=1
|
||||
-- end)
|
||||
_gamectr:AddEventListener(ExGameEvent.OnIndexMove, function(...)
|
||||
_gamectr:AddEventListener(EXGameEvent.OnResult2, function(...)
|
||||
local arg = { ... }
|
||||
local seat = arg[1]
|
||||
local isNewBout = arg[2]
|
||||
local index = self:GetPos(seat)
|
||||
|
||||
self.ctr_time.selectedIndex = index
|
||||
-- for i=1,#self._player_info do
|
||||
-- if index==i then
|
||||
-- -- body
|
||||
-- local head_info = self._player_info[index]
|
||||
-- head_info:MarkBank(true)
|
||||
-- else
|
||||
-- local head_info = self._player_info[i]
|
||||
-- head_info:MarkBank(false)
|
||||
-- end
|
||||
-- end
|
||||
|
||||
if index == 1 then
|
||||
local card_info = self._player_card_info[index]
|
||||
card_info:SetOutCardInfo(nil, false)
|
||||
-- if self.MypokerList ~= nil then
|
||||
-- -- body
|
||||
-- card_info:Clear()
|
||||
-- card_info:InitPoker(self.MypokerList, false)
|
||||
-- self.MypokerList = nil
|
||||
-- end
|
||||
end
|
||||
self._left_time = 20
|
||||
if self._room.ming_card ~= nil then
|
||||
self._view:GetTransition("t" .. index):Play()
|
||||
self._room.ming_card = nil
|
||||
if self.tween ~= nil then
|
||||
TweenUtils.Kill(self.tween)
|
||||
self.tween = nil
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
_gamectr:AddEventListener(ExGameEvent.OnBombScore, function(...)
|
||||
_gamectr:AddEventListener(EXGameEvent.OnTurnAction, function(...)
|
||||
local arg = { ... }
|
||||
local scoreList = arg[1]
|
||||
-- for i = 1, #scoreList do
|
||||
-- local player = self._room:GetPlayerBySeat(i)
|
||||
-- local card_info = self._player_card_info[self:GetPos(i)]
|
||||
-- local head_info = self._player_info[self:GetPos(i)]
|
||||
-- card_info:PlayScore(scoreList[i], true)
|
||||
-- head_info:UpdateScore(player.total_score)
|
||||
-- end
|
||||
end)
|
||||
|
||||
_gamectr:AddEventListener(ExGameEvent.OnPlaySucc, function(...)
|
||||
local arg = { ... }
|
||||
local p = arg[1]
|
||||
local card_number = arg[2]
|
||||
local cardstype = arg[3]
|
||||
local num = arg[4]
|
||||
local otherList = arg[5]
|
||||
local length = arg[6]
|
||||
self.ctr_time.selectedIndex = 0
|
||||
local index = self:GetPos(p.seat)
|
||||
if index == 1 then
|
||||
self.caozuo = 0
|
||||
end
|
||||
|
||||
local head_info = self._player_info[index]
|
||||
if head_info._view:GetChild("shengyu") ~= nil then
|
||||
-- body
|
||||
-- body
|
||||
if card_number ~= nil then
|
||||
-- body
|
||||
head_info._view:GetChild("shengyu"):GetChild("shengyu").text = "剩" .. card_number .. "张"
|
||||
end
|
||||
end
|
||||
|
||||
local card_info = self._player_card_info[index]
|
||||
card_info:SetOutCardInfo(p.out_card_list, false, true)
|
||||
|
||||
for i = 1, #otherList do
|
||||
local other_seat = otherList[i]
|
||||
local other_card_info = self._player_card_info[self:GetPos(other_seat)]
|
||||
other_card_info:SetOutCardBlack()
|
||||
end
|
||||
|
||||
if index == 1 then
|
||||
card_info:DeleteHandCards(p.out_card_list)
|
||||
else
|
||||
card_info:SetRemainCardNumber(card_number == 1)
|
||||
--card_info:UpdateHandPoker(card_number,false,false) -- todo
|
||||
end
|
||||
|
||||
if self._room.is_new_bout == true then
|
||||
for i = 1, #self._room.player_list do
|
||||
local player = self._room.player_list[i]
|
||||
local card_info_i = self._player_card_info[self:GetPos(player.seat)]
|
||||
if p.seat ~= player.seat then
|
||||
card_info_i:SetOutCardInfo(nil, false)
|
||||
end
|
||||
end
|
||||
-- card_info:PlayCardTypeEff(cardstype)
|
||||
-- if cardstype~=12 then
|
||||
-- -- body
|
||||
|
||||
|
||||
-- if cardstype==10 and length>=6 then
|
||||
-- -- card_info_i
|
||||
-- local chuan = UIPackage.CreateObject("Extend_Poker_RunFast", "chuan1")
|
||||
-- local card_info_i = self._player_card_info[self:GetPos(p.seat)]
|
||||
|
||||
-- card_info_i._mask_liangpai:AddChild(chuan)
|
||||
-- chuan:GetChild("n0").asMovieClip.playing = true
|
||||
-- ViewUtil.PlaySound("RunFastNew_PK", "extend/poker/paodekuai/sound/sunzi.mp3")
|
||||
-- coroutine.start(function()
|
||||
-- coroutine.wait(1.5)
|
||||
-- if chuan~=nil then
|
||||
-- -- body
|
||||
-- chuan:Dispose()
|
||||
-- end
|
||||
|
||||
-- end)
|
||||
|
||||
-- else
|
||||
-- self:_Effect(cardstype, p)
|
||||
-- end
|
||||
-- end
|
||||
self:_Effect(cardstype, p)
|
||||
else
|
||||
if cardstype == 11 and cardstype ~= 12 then
|
||||
self:_Effect(cardstype, p)
|
||||
end
|
||||
end
|
||||
|
||||
self:PlaySound(p.self_user.sex, self:GetSoundFileName(cardstype, num, self._room.is_new_bout))
|
||||
if card_number == 1 then
|
||||
--self:ChangeBgmMusic(2)
|
||||
self:ChangeBgmMusic(1)
|
||||
if self._cor_sound ~= nil then
|
||||
coroutine.stop(self._cor_sound)
|
||||
end
|
||||
self._cor_sound = nil
|
||||
self._cor_sound = coroutine.start(function()
|
||||
coroutine.wait(1)
|
||||
self:PlaySound(p.self_user.sex, "card_1")
|
||||
end)
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
_gamectr:AddEventListener(ExGameEvent.OnPassSuccCheckCard, function(...)
|
||||
self._popEvent = false
|
||||
local arg = { ... }
|
||||
local seat = arg[1]
|
||||
local cards = arg[2]
|
||||
--self.MypokerList=cards
|
||||
self.ctr_time.selectedIndex = 0
|
||||
local card_info = self._player_card_info[self:GetPos(seat)]
|
||||
if seat == self._room.self_player.seat then
|
||||
card_info:ClearCheck()
|
||||
card_info:InitPoker(cards, false)
|
||||
|
||||
--local player=self._room:GetPlayerBySeat(seat)
|
||||
--if player.out_card_list[1] == 0 then
|
||||
-- player_card_info:SetOutCardInfo(nil, true)
|
||||
--else
|
||||
--player:SetOutCardInfo({207}, false)
|
||||
-- end
|
||||
end
|
||||
|
||||
self._popEvent = true
|
||||
end)
|
||||
|
||||
_gamectr:AddEventListener(ExGameEvent.OnPassSucc, function(...)
|
||||
local arg = { ... }
|
||||
local p = arg[1]
|
||||
|
||||
self.ctr_time.selectedIndex = 0
|
||||
local card_info = self._player_card_info[self:GetPos(p.seat)]
|
||||
|
||||
--card_info:SetOutCardInfo(nil, false)
|
||||
if p.seat == self._room.self_player.seat and self.MypokerList ~= nil then
|
||||
-- body
|
||||
card_info:Clear()
|
||||
card_info:InitPoker(self.MypokerList, false)
|
||||
self.MypokerList = nil
|
||||
end
|
||||
card_info:SetOutCardInfo(nil, true)
|
||||
self:PlaySound(p.self_user.sex, "pass_" .. math.random(1, 4))
|
||||
end)
|
||||
|
||||
_gamectr:AddEventListener(ExGameEvent.OnErrorTip, function(...)
|
||||
local arg = { ... }
|
||||
local error_str = arg[1]
|
||||
self._player_card_info[1]:ErrorTip(error_str)
|
||||
-- self._player_card_info[1]:ResetPoker()
|
||||
end)
|
||||
|
||||
_gamectr:AddEventListener(ExGameEvent.OnPiaoTips, function(...)
|
||||
local arg = { ... }
|
||||
local piao = arg[1]
|
||||
local reload = arg[2]
|
||||
if reload == 0 then
|
||||
if self._room.room_config.people_num == 3 and self._room.room_config.fangzuobi == 1 then
|
||||
-- body
|
||||
self.MypokerList = cardlist
|
||||
end
|
||||
local otherpoker_list = self._view:GetChild("otherpoker_list")
|
||||
|
||||
if otherpoker_list ~= nil then
|
||||
-- body
|
||||
otherpoker_list.visible = false
|
||||
otherpoker_list:RemoveChildrenToPool()
|
||||
end
|
||||
self.ctr_state.selectedIndex = 1
|
||||
self.ctr_card_eff.selectedIndex = 0
|
||||
if self.rank_view ~= nil then
|
||||
self.rank_view:Dispose()
|
||||
self.rank_view = nil
|
||||
end
|
||||
self:UpdateRound(self._room.curren_round)
|
||||
|
||||
local list = _room.player_list
|
||||
for i = 1, #list do
|
||||
local p = list[i]
|
||||
local head_info = self._player_info[self:GetPos(p.seat)]
|
||||
|
||||
p:Clear()
|
||||
head_info:FillData(p)
|
||||
local card_info = self._player_card_info[self:GetPos(p.seat)]
|
||||
card_info:Clear()
|
||||
head_info:Ready(false)
|
||||
head_info:UpdatePiao(-1)
|
||||
end
|
||||
end
|
||||
|
||||
self._player_card_info[1]:ShowPiao(piao)
|
||||
end)
|
||||
|
||||
_gamectr:AddEventListener(ExGameEvent.OnPiaoAction, function(...)
|
||||
local arg = { ... }
|
||||
local seat = arg[1]
|
||||
local piao = arg[2]
|
||||
local head_info = self._player_info[self:GetPos(seat)]
|
||||
head_info:UpdatePiao(piao)
|
||||
end)
|
||||
|
||||
_gamectr:AddEventListener(ExGameEvent.OnOptions, function(...)
|
||||
local arg = { ... }
|
||||
local play = arg[1]
|
||||
local pass = arg[5]
|
||||
local card_type = arg[2]
|
||||
local card_number = arg[3]
|
||||
local card_length = arg[4]
|
||||
local ctr_number = pass == nil and 2 or 1
|
||||
self.caozuo = 1 --记录是否是自己出牌的阶段
|
||||
self.pass = pass
|
||||
local m = false
|
||||
local next_seat = self._room.self_player.seat + 1
|
||||
local card_info = self._player_card_info[1]
|
||||
--card_info:SetOutCardInfo(nil, false)
|
||||
if self.MypokerList ~= nil then
|
||||
-- body
|
||||
card_info:Clear()
|
||||
card_info:InitPoker(self.MypokerList, false)
|
||||
self.MypokerList = nil
|
||||
end
|
||||
if next_seat > self._room.room_config.people_num then
|
||||
next_seat = next_seat - self._room.room_config.people_num
|
||||
end
|
||||
if self._room:GetPlayerBySeat(next_seat).hand_count == 1 and self._room.room_config.WillBeOut == 1 then
|
||||
m = true
|
||||
end
|
||||
local zdts = self._view:GetController("zidongtishi").selectedIndex
|
||||
self._player_card_info[1]:ShowOutCardOption(ctr_number, card_type, card_number, card_length, m, play, zdts)
|
||||
end)
|
||||
-- 托管
|
||||
_gamectr:AddEventListener(ExGameEvent.Game_TuoGuan, function(...)
|
||||
local arg = { ... }
|
||||
local tuoguan = arg[1]
|
||||
local seat = arg[2]
|
||||
|
||||
local tuoguanzhong = self._view:GetChild("tuoguanzhong")
|
||||
local zhezhao = self._view:GetChild("n109")
|
||||
local head_info = self._player_info[self:GetPos(seat)]
|
||||
if (tuoguan == 1) then
|
||||
if (seat == self._room.self_player.seat) then
|
||||
tuoguanzhong.visible = true
|
||||
-- tuoguanzhong.sortingOrder = 2
|
||||
zhezhao.visible = true
|
||||
zhezhao.onClick:Set(function()
|
||||
_gamectr:TuoGuan(0)
|
||||
end)
|
||||
else
|
||||
head_info._view:GetController("tuoguan").selectedIndex = 1
|
||||
end
|
||||
-- if self.ispanguangzhe == true then
|
||||
-- -- body
|
||||
-- zhezhao.visible = false
|
||||
-- end
|
||||
else
|
||||
if (seat == self._room.self_player.seat) then
|
||||
tuoguanzhong.visible = false
|
||||
zhezhao.visible = false
|
||||
-- local btn_tuoguan = self._view:GetChild("n107")
|
||||
-- btn_tuoguan.onClick:Set(function()
|
||||
-- _gamectr:TuoGuan(1)
|
||||
-- -- self:ZhiNengtuoguan()
|
||||
-- end)
|
||||
else
|
||||
head_info._view:GetController("tuoguan").selectedIndex = 0
|
||||
end
|
||||
end
|
||||
end)
|
||||
_gamectr:AddEventListener(ExGameEvent.OnResult, function(...)
|
||||
local arg = { ... }
|
||||
local over = arg[1]
|
||||
local info = arg[2]
|
||||
local win_seat = arg[3]
|
||||
local remaincards = arg[4]
|
||||
-- local energyTab = arg[5]
|
||||
local otherpoker_list = self._view:GetChild("otherpoker_list")
|
||||
local card_info = self._player_card_info[self:GetPos(self._room.self_player.seat)]
|
||||
|
||||
if self.MypokerList ~= nil then
|
||||
-- body
|
||||
card_info:Clear()
|
||||
card_info:InitPoker(self.MypokerList, false)
|
||||
self.MypokerList = nil
|
||||
end
|
||||
if otherpoker_list ~= nil then
|
||||
-- body
|
||||
otherpoker_list:RemoveChildrenToPool()
|
||||
otherpoker_list.visible = true
|
||||
end
|
||||
|
||||
if self._cor_sound ~= nil then
|
||||
coroutine.stop(self._cor_sound)
|
||||
self._cor_sound = nil
|
||||
end
|
||||
|
||||
if self.destory_win ~= nil then
|
||||
coroutine.stop(self.destory_win)
|
||||
end
|
||||
|
||||
self.destory_win = nil
|
||||
self.destory_win = coroutine.start(function()
|
||||
-- -- print("11111111111111")
|
||||
-- coroutine.wait(1)
|
||||
coroutine.wait(1)
|
||||
if self._room.self_player.seat == win_seat then
|
||||
local sprint_seat_list = self:GetSpringSeats(info)
|
||||
if #sprint_seat_list > 0 then
|
||||
local url = "ui://Extend_Poker_RunFastNew/Spring"
|
||||
self.WinItem_view = UIPackage.CreateObjectFromURL(url)
|
||||
self._view:AddChild(self.WinItem_view)
|
||||
self.WinItem_view:Center()
|
||||
self.WinItem_view:GetTransition("t0"):Play()
|
||||
ViewUtil.PlaySound("RunFastNew_PK", "base/common/sound/win new.mp3")
|
||||
end
|
||||
-- local url = #sprint_seat_list > 0 and "ui://Extend_Poker_RunFastNew/Spring" or "ui://Extend_Poker_RunFastNew/Win_Mine"
|
||||
else
|
||||
local beigang = false
|
||||
if #self:GetSpringSeats(info) > 0 then
|
||||
for i = 1, #self:GetSpringSeats(info) do
|
||||
if self:GetSpringSeats(info)[i] == self._room.self_player.seat then
|
||||
local url = "ui://Extend_Poker_RunFastNew/spring2"
|
||||
self.WinItem_view = UIPackage.CreateObjectFromURL(url)
|
||||
self._view:AddChild(self.WinItem_view)
|
||||
self.WinItem_view:Center()
|
||||
self.WinItem_view:GetTransition("t0"):Play()
|
||||
beigang = true
|
||||
end
|
||||
end
|
||||
end
|
||||
-- if beigang == false then
|
||||
-- self:CreateRankEff()
|
||||
-- end
|
||||
end
|
||||
for i = 1, #info do
|
||||
local player = info[i]
|
||||
local p = self._room:GetPlayerBySeat(player.seat)
|
||||
local head_info = self._player_info[self:GetPos(player.seat)]
|
||||
local card_info = self._player_card_info[self:GetPos(player.seat)]
|
||||
if player.hp_info ~= nil and player.hp_info.cur_hp ~= nil then
|
||||
p.hp_info = player.hp_info
|
||||
head_info:UpdateScore(d2ad(player.hp_info.cur_hp))
|
||||
head_info._view:GetChild('zhanji').visible = true
|
||||
local num = player.hp_info.total_hp
|
||||
if num > 0 then
|
||||
head_info._view:GetController('text_color').selectedIndex = 0
|
||||
head_info._view:GetChild('text_score').text = "+" .. d2ad(player.hp_info.total_hp)
|
||||
else
|
||||
head_info._view:GetController('text_color').selectedIndex = 1
|
||||
head_info._view:GetChild('text_score').text = d2ad(player.hp_info.total_hp)
|
||||
end
|
||||
card_info:PlayScore(d2ad(player.hp_info.round_actual_hp), false, win_seat == player.seat)
|
||||
else
|
||||
local rt = 1
|
||||
if self._room.hpOnOff == 1 then
|
||||
rt = self._room.score_times
|
||||
end
|
||||
if over == 1 and self._room.hpOnOff == 1 then
|
||||
head_info:UpdateScore(player.score / 10) --不可负分
|
||||
else
|
||||
head_info:UpdateScore(player.score * rt)
|
||||
end
|
||||
card_info:PlayScore(player.winscore * rt, false, win_seat == player.seat)
|
||||
end
|
||||
|
||||
|
||||
if player.seat ~= self._room.self_player.seat then
|
||||
card_info:UpdateHandPoker(player.cards, false, true)
|
||||
card_info:SetRemainCardNumber(false)
|
||||
|
||||
card_info._view_resultOut:RemoveChildrenToPool()
|
||||
card_info._ctr_resultOut.selectedIndex = 1
|
||||
card_info.ctr_outpoker.selectedIndex = 0
|
||||
for i = 1, #player.handCards do
|
||||
local child_card = card_info._view_resultOut:AddItemFromPool()
|
||||
card_info:FillPoker(child_card, "", nil, player.handCards[i])
|
||||
coroutine.wait(0.2)
|
||||
end
|
||||
end
|
||||
end
|
||||
self:ChangeBgmMusic(1)
|
||||
-- if over == 0 then
|
||||
if #self:GetSpringSeats(info) > 0 then
|
||||
-- -- print("222222222222222222")
|
||||
coroutine.wait(1)
|
||||
else
|
||||
-- -- print("333333333333333333")
|
||||
-- coroutine.wait(2)
|
||||
end
|
||||
|
||||
self.result_view = ExResultView.new(self._root_view, info, self._room.room_id, over, win_seat, 0,
|
||||
remaincards)
|
||||
self.result_view:Show()
|
||||
if self.WinItem_view ~= nil then
|
||||
self.WinItem_view:Dispose()
|
||||
self.WinItem_view = nil
|
||||
end
|
||||
if self.rank_view ~= nil then
|
||||
self.rank_view:Dispose()
|
||||
self.rank_view = nil
|
||||
end
|
||||
|
||||
if self._room.self_player.entrust == true then
|
||||
local btn_confirm = self.result_view._view:GetChild("btn_confirm")
|
||||
btn_confirm.onClick:Call()
|
||||
end
|
||||
|
||||
-- local _actionView = UIPackage.CreateObject("Common", "Btn_Yellow")
|
||||
-- _actionView.icon = "ui://Common/btn_comfirm"
|
||||
-- _actionView.onClick:Set(function ()
|
||||
-- --local _gamectr = ControllerManager.GetController(GameController)
|
||||
-- _gamectr:ConformToNextGame()
|
||||
-- _actionView:Dispose()
|
||||
-- end)
|
||||
-- _actionView.xy = Vector2(900, 625)
|
||||
-- self._view:AddChild(_actionView)
|
||||
-- else
|
||||
-- coroutine.wait(4)
|
||||
-- self.result_view = ExResultView.new(self._root_view,info,self._room.room_id)
|
||||
-- self.result_view:Show()
|
||||
-- end
|
||||
end)
|
||||
if over == 1 then
|
||||
-- body
|
||||
self:UnmarkSelfTuoguan()
|
||||
ControllerManager.ChangeController(LoddyController)
|
||||
end
|
||||
end)
|
||||
|
||||
_gamectr:AddEventListener(ExGameEvent.OnResultByDissolve, function(...)
|
||||
local arg = { ... }
|
||||
local over = arg[1]
|
||||
local info = arg[2]
|
||||
local winseat = arg[3]
|
||||
local dissolve = arg[4]
|
||||
|
||||
self.result_view = ExResultView.new(self._root_view, info, self._room.room_id, over, winseat, dissolve, nil)
|
||||
self.result_view:Show()
|
||||
ControllerManager.ChangeController(LoddyController)
|
||||
self:UnmarkSelfTuoguan()
|
||||
end)
|
||||
|
||||
-- 确定开始下一局 成功
|
||||
_gamectr:AddEventListener(ExGameEvent.OnConfrimToNextGameSucc, function(...)
|
||||
local arg = { ... }
|
||||
local aid = arg[1]
|
||||
local p = self._room:GetPlayerById(aid)
|
||||
if p.seat == self._room.self_player.seat then
|
||||
if self.rank_view ~= nil then
|
||||
self.rank_view:Dispose()
|
||||
self.rank_view = nil
|
||||
end
|
||||
if self.destory_win ~= nil then
|
||||
coroutine.stop(self.destory_win)
|
||||
self.destory_win = nil
|
||||
end
|
||||
for _, player in ipairs(self._room.player_list) do
|
||||
local player_card_info = self._player_card_info[self:GetPos(player.seat)]
|
||||
local player_head = self._player_info[self:GetPos(player.seat)]
|
||||
player_card_info:Clear()
|
||||
local otherpoker_list = self._view:GetChild("otherpoker_list")
|
||||
if otherpoker_list ~= nil then
|
||||
-- body
|
||||
otherpoker_list.visible = false
|
||||
otherpoker_list:RemoveChildrenToPool()
|
||||
end
|
||||
--player_head._view:GetController("Oener").selectedIndex=0
|
||||
end
|
||||
end
|
||||
local player_info = self._player_info[self:GetPos(p.seat)]
|
||||
player_info:Ready(true)
|
||||
end)
|
||||
end
|
||||
|
||||
|
|
@ -1177,7 +458,7 @@ function M:ReconnectForClearing()
|
|||
coroutine.start(function()
|
||||
coroutine.wait(0.3)
|
||||
|
||||
self.result_view = ExResultView.new(self._root_view, self._room.player_list, self._room.room_id, 0,
|
||||
self.result_view = EXResultView.new(self._root_view, self._room.player_list, self._room.room_id, 0,
|
||||
win_seat, 0, remaincards)
|
||||
self.result_view:Show()
|
||||
local card_info = self._player_card_info[1]
|
||||
|
|
@ -1203,20 +484,20 @@ function M:ReconnectForClearing()
|
|||
local flow = newremaincards[i] % 10
|
||||
local num = (newremaincards[i] - (newremaincards[i] % 10)) / 10
|
||||
local card_n = flow * 100 + num
|
||||
local poker_item = UIPackage.CreateObject("Extend_Poker_RunFastNew", "poker6")
|
||||
local poker_item = UIPackage.CreateObject("Extend_Poker_SuoHa", "poker6")
|
||||
|
||||
--local code = self:ChangeCodeByTo(card_n)
|
||||
-- local card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_RunFast/" .. card_n)
|
||||
-- local card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_suoha/" .. card_n)
|
||||
-- local card_code_obj = UIPackage.CreateObjectFromURL("ui://Main_Poker/" .. card_n .. "_2")
|
||||
local card_code_obj
|
||||
if DataManager.CurrenRoom.pai == 0 then
|
||||
card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_RunFastNew/" .. card_n)
|
||||
card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_SuoHa/" .. card_n)
|
||||
else
|
||||
card_code_obj = UIPackage.CreateObjectFromURL("ui://Main_Poker/" .. card_n .. "_2")
|
||||
end
|
||||
if card_n == 310 and DataManager.CurrenRoom.room_config.Heart10 == 2 then
|
||||
-- body
|
||||
card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_RunFastNew/" .. card_n .. "_1")
|
||||
card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_SuoHa/" .. card_n .. "_1")
|
||||
end
|
||||
card_code_obj:SetScale(0.6, 0.6)
|
||||
poker_item:AddChild(card_code_obj)
|
||||
|
|
@ -1228,7 +509,7 @@ function M:ReconnectForClearing()
|
|||
end
|
||||
|
||||
function M:CreateRankEff()
|
||||
self.rank_view = UIPackage.CreateObjectFromURL("ui://Extend_Poker_RunFastNew/rank_eff")
|
||||
self.rank_view = UIPackage.CreateObjectFromURL("ui://Extend_Poker_SuoHa/rank_eff")
|
||||
self._view:AddChild(self.rank_view)
|
||||
self.rank_view:Center()
|
||||
self.rank_view:GetTransition("t0"):Play()
|
||||
|
|
@ -1256,8 +537,8 @@ function M:_Effect(type1, player)
|
|||
end
|
||||
local info = self._player_card_info[self:GetPos(player.seat)]
|
||||
local pNode = info._mask_liangpai
|
||||
local effect = UIPackage.CreateObjectFromURL("ui://Extend_Poker_RunFastNew/eff_" .. eff_code)
|
||||
-- local effect = UIPackage.CreateObjectFromURL("ui://Extend_Poker_RunFastNew/eff2_1")
|
||||
local effect = UIPackage.CreateObjectFromURL("ui://Extend_Poker_SuoHa/eff_" .. eff_code)
|
||||
-- local effect = UIPackage.CreateObjectFromURL("ui://Extend_Poker_SuoHa/eff2_1")
|
||||
effect.touchable = false
|
||||
effect:GetTransition("t0"):Play()
|
||||
-- effect:SetXY((self._view.width - effect.width) / 2,(self._view.hight - effect.hight) / 2)
|
||||
|
|
@ -1269,7 +550,7 @@ function M:_Effect(type1, player)
|
|||
|
||||
|
||||
if eff_code == 1 then
|
||||
self.eff_feiji = UIPackage.CreateObjectFromURL("ui://Extend_Poker_RunFastNew/eff_feiji")
|
||||
self.eff_feiji = UIPackage.CreateObjectFromURL("ui://Extend_Poker_SuoHa/eff_feiji")
|
||||
self._view:AddChild(self.eff_feiji)
|
||||
self.eff_feiji:Center()
|
||||
self.eff_feiji:GetTransition("t0"):Play()
|
||||
|
|
@ -1316,7 +597,7 @@ end
|
|||
-- end
|
||||
-- local info = self._player_card_info[self:GetPos(player.seat)]
|
||||
-- local pNode = info._mask_liangpai
|
||||
-- local effect = UIPackage.CreateObjectFromURL("ui://Extend_Poker_RunFast/MovieClip" .. eff_code)
|
||||
-- local effect = UIPackage.CreateObjectFromURL("ui://Extend_Poker_suoha/MovieClip" .. eff_code)
|
||||
|
||||
-- effect.touchable = false
|
||||
|
||||
|
|
@ -1417,14 +698,14 @@ function M:PlayCardEff(card)
|
|||
self.cor_card_eff = coroutine.start(function()
|
||||
self._popEvent = false
|
||||
local eff = self._view:GetChild("poker_eff")
|
||||
local poker_obj = eff:GetChild("poker")
|
||||
local poker_obj = eff:GetChild("poker2")
|
||||
local poker_back = eff:GetChild("di")
|
||||
poker_back.visible = false
|
||||
-- local card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_RunFast/" .. card)
|
||||
-- local card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_suoha/" .. card)
|
||||
-- local card_code_obj = UIPackage.CreateObjectFromURL("ui://Main_Poker/" .. card .. "_2")
|
||||
local card_code_obj
|
||||
if DataManager.CurrenRoom.pai == 0 then
|
||||
card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_RunFastNew/" .. card)
|
||||
card_code_obj = UIPackage.CreateObjectFromURL("ui://Extend_Poker_SuoHa/" .. card)
|
||||
else
|
||||
card_code_obj = UIPackage.CreateObjectFromURL("ui://Main_Poker/" .. card .. "_2")
|
||||
end
|
||||
|
|
@ -1460,8 +741,8 @@ end
|
|||
|
||||
function M:PlaySound(sex, path)
|
||||
local sex_path = ViewUtil.Sex_Chat[sex] -- 1 男 2 女
|
||||
local sound_path = string.format("extend/poker/runfast/sound/%s/%s.mp3", sex_path, path)
|
||||
ViewUtil.PlaySound("RunFastNew_PK", sound_path)
|
||||
local sound_path = string.format("extend/poker2/suoha/sound/%s/%s.mp3", sex_path, path)
|
||||
ViewUtil.PlaySound("SuoHa_PK", sound_path)
|
||||
end
|
||||
|
||||
function M:ChangeBgmMusic(bgm_index)
|
||||
|
|
@ -1470,7 +751,7 @@ function M:ChangeBgmMusic(bgm_index)
|
|||
else
|
||||
self.bgm_index = bgm_index
|
||||
end
|
||||
ViewUtil.PlayMuisc("RunFastNew_PK", string.format("extend/poker/runfast/sound/bgm%d.mp3", 1))
|
||||
ViewUtil.PlayMuisc("SuoHa_PK", string.format("extend/poker2/suoha/sound/bgm%d.mp3", 1))
|
||||
end
|
||||
|
||||
function M:OnPlayerEnter(...)
|
||||
|
|
@ -1526,7 +807,7 @@ function M:Destroy()
|
|||
end
|
||||
end
|
||||
PKMainView.Destroy(self)
|
||||
UIPackage.RemovePackage("extend/poker/runfast/ui/Extend_Poker_RunFastNew")
|
||||
UIPackage.RemovePackage("extend/poker2/suoha/ui/Extend_Poker_SuoHa")
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
|||
|
|
@ -2,15 +2,15 @@
|
|||
--- Created by 谌建军.
|
||||
--- DateTime: 2017/12/25 13:52
|
||||
---
|
||||
local PKPlayBackView = require('main.poker.PKPlayBackView')
|
||||
local ExPlayerCardInfoView = import('.ExPlayerPokerInfoView')
|
||||
local ExPlayerSelfCardInfoView = import('.ExPlayerSelfPokerInfoView')
|
||||
local PKPlayBackView = require('main.poker2.PKPlayBackView')
|
||||
local EXPlayerCardInfoView = import('.EXPlayerPokerInfoView')
|
||||
local EXPlayerSelfCardInfoView = import('.EXPlayerSelfPokerInfoView')
|
||||
local PlayerInfoView = import('.EXPlayerInfoView')
|
||||
local ExRightPanelView = import(".ExRightPanelView")
|
||||
local ExResultView = import(".ExResultView")
|
||||
local EXRightPanelView = import(".EXRightPanelView")
|
||||
local EXResultView = import(".EXResultView")
|
||||
local M = {}
|
||||
|
||||
local ExRecord_Event = {
|
||||
local EXRecord_Event = {
|
||||
Evt_OutCard = 'OutCard',
|
||||
Evt_Pass = 'pass',
|
||||
Evt_NewRound = 'newindex',
|
||||
|
|
@ -20,16 +20,16 @@ local ExRecord_Event = {
|
|||
|
||||
local default_bg = 1
|
||||
local bg_config = {
|
||||
{ id = 1, url = 'extend/poker/runfast/bg/bg1', thumb = 'ui://Extend_Poker_RunFastNew/table_bg1' },
|
||||
{ id = 2, url = 'extend/poker/runfast/bg/bg2', thumb = 'ui://Extend_Poker_RunFastNew/table_bg2' },
|
||||
{ id = 3, url = 'extend/poker/runfast/bg/bg3', thumb = 'ui://Extend_Poker_RunFastNew/table_bg3' }
|
||||
{ id = 1, url = 'extend/poker2/suoha/bg/bg1', thumb = 'ui://Extend_Poker_SuoHa/table_bg1' },
|
||||
{ id = 2, url = 'extend/poker2/suoha/bg/bg2', thumb = 'ui://Extend_Poker_SuoHa/table_bg2' },
|
||||
{ id = 3, url = 'extend/poker2/suoha/bg/bg3', thumb = 'ui://Extend_Poker_SuoHa/table_bg3' }
|
||||
}
|
||||
|
||||
--- Create a new
|
||||
function M.new()
|
||||
setmetatable(M, { __index = PKPlayBackView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = 'ExPlayBackView'
|
||||
self.class = 'EXPlayBackView'
|
||||
self:init()
|
||||
|
||||
return self
|
||||
|
|
@ -41,8 +41,8 @@ function M:InitView(url)
|
|||
room.self_player = room:GetPlayerBySeat(1)
|
||||
end
|
||||
self._gamectr = ControllerManager.GetController(GameController)
|
||||
UIPackage.AddPackage('extend/poker/runfast/ui/Extend_Poker_RunFastNew')
|
||||
PKPlayBackView.InitView(self, 'ui://Extend_Poker_RunFastNew/ExMain_' .. self._room.room_config.people_num,
|
||||
UIPackage.AddPackage('extend/poker2/suoha/ui/Extend_Poker_SuoHa')
|
||||
PKPlayBackView.InitView(self, 'ui://Extend_Poker_SuoHa/EXMain_' .. self._room.room_config.people_num,
|
||||
default_bg, bg_config)
|
||||
self._tex_round = self._view:GetChild('round')
|
||||
self._player_card_info = {}
|
||||
|
|
@ -56,7 +56,7 @@ function M:InitView(url)
|
|||
self._rightPanelView:Destroy()
|
||||
end
|
||||
|
||||
self._rightPanelView = ExRightPanelView.new(self, rightpanel)
|
||||
self._rightPanelView = EXRightPanelView.new(self, rightpanel)
|
||||
rightpanel:GetChild("btn_setting").onClick:Clear()
|
||||
|
||||
self._player_info = {}
|
||||
|
|
@ -80,18 +80,18 @@ function M:InitView(url)
|
|||
end
|
||||
self._eventmap = {}
|
||||
self._cmdmap = {}
|
||||
self._cmdmap[ExRecord_Event.Evt_OutCard] = self.CmdOutCard
|
||||
self._cmdmap[ExRecord_Event.Evt_Pass] = self.CmdPass
|
||||
self._cmdmap[ExRecord_Event.Evt_NewRound] = self.CmdNewRound
|
||||
self._cmdmap[ExRecord_Event.Evt_result] = self.Cmdresult
|
||||
self._cmdmap[ExRecord_Event.Evt_Result] = self.CmdResult
|
||||
self._cmdmap[EXRecord_Event.Evt_OutCard] = self.CmdOutCard
|
||||
self._cmdmap[EXRecord_Event.Evt_Pass] = self.CmdPass
|
||||
self._cmdmap[EXRecord_Event.Evt_NewRound] = self.CmdNewRound
|
||||
self._cmdmap[EXRecord_Event.Evt_result] = self.Cmdresult
|
||||
self._cmdmap[EXRecord_Event.Evt_Result] = self.CmdResult
|
||||
end
|
||||
|
||||
function M:NewPlayerPokerInfoView(view, index)
|
||||
if index == 1 then
|
||||
return ExPlayerSelfCardInfoView.new(view, self)
|
||||
return EXPlayerSelfCardInfoView.new(view, self)
|
||||
end
|
||||
return ExPlayerCardInfoView.new(view, self)
|
||||
return EXPlayerCardInfoView.new(view, self)
|
||||
end
|
||||
|
||||
function M:FillRoomData(data)
|
||||
|
|
@ -154,7 +154,7 @@ function M:ShowStep(index)
|
|||
end
|
||||
end
|
||||
|
||||
if step.cmd == ExRecord_Event.Evt_OutCard then
|
||||
if step.cmd == EXRecord_Event.Evt_OutCard then
|
||||
local seat = step.current_out_seat
|
||||
local p = self._room:GetPlayerBySeat(seat)
|
||||
local info = self._player_card_info[self:GetPos(seat)]
|
||||
|
|
@ -164,21 +164,21 @@ function M:ShowStep(index)
|
|||
self:ClearNextSeatOutCard(seat)
|
||||
end
|
||||
|
||||
if step.cmd == ExRecord_Event.Evt_Pass then
|
||||
if step.cmd == EXRecord_Event.Evt_Pass then
|
||||
local seat = step.current_out_seat
|
||||
local p = self._room:GetPlayerBySeat(seat)
|
||||
local info = self._player_card_info[self:GetPos(seat)]
|
||||
info:SetOutCardInfo(nil, true)
|
||||
self:ClearNextSeatOutCard(seat)
|
||||
end
|
||||
if step.cmd == ExRecord_Event.Evt_NewRound then
|
||||
if step.cmd == EXRecord_Event.Evt_NewRound then
|
||||
for i = 1, #self._room.player_list do
|
||||
local p = self._room:GetPlayerBySeat(i)
|
||||
local card_info = self._player_card_info[self:GetPos(p.seat)]
|
||||
card_info:SetOutCardInfo(nil, false)
|
||||
end
|
||||
end
|
||||
if step.cmd == ExRecord_Event.Evt_result then
|
||||
if step.cmd == EXRecord_Event.Evt_result then
|
||||
local result = step.result
|
||||
for i = 1, #result do
|
||||
local card_info = self._player_card_info[self:GetPos(result[i].seat)]
|
||||
|
|
@ -191,9 +191,9 @@ function M:ShowStep(index)
|
|||
card_info:PlayScore(result[i].score, false, step.win_seat == result[i].seat)
|
||||
end
|
||||
end
|
||||
if step.cmd == ExRecord_Event.Evt_Result then
|
||||
if step.cmd == EXRecord_Event.Evt_Result then
|
||||
local Result = step.Result
|
||||
self.result_view = ExResultView.new(self._root_view, Result.info, self._room.room_id, Result.type,
|
||||
self.result_view = EXResultView.new(self._root_view, Result.info, self._room.room_id, Result.type,
|
||||
Result.winseat, 0, Result.remaincards)
|
||||
local num = self._view:GetChildIndex(self._view:GetChild("panel_record"))
|
||||
self._view:AddChildAt(self.result_view._view, num)
|
||||
|
|
|
|||
|
|
@ -2,13 +2,13 @@
|
|||
--- Created by 谌建军.
|
||||
--- DateTime: 2017/12/13 16:35
|
||||
---
|
||||
local ExPlayerPokerInfoView = {
|
||||
local EXPlayerPokerInfoView = {
|
||||
_view = nil,
|
||||
_mainView = nil,
|
||||
_mask_liangpai = nil,
|
||||
}
|
||||
|
||||
local M = ExPlayerPokerInfoView
|
||||
local M = EXPlayerPokerInfoView
|
||||
|
||||
function M.new(view, mainView)
|
||||
local self = {}
|
||||
|
|
@ -22,16 +22,37 @@ end
|
|||
function M:init()
|
||||
local view = self._view
|
||||
self._gameCtr = ControllerManager.GetController(GameController)
|
||||
|
||||
self._view_handCardList = view:GetChild('list_handCard')
|
||||
end
|
||||
|
||||
function M:UpdateHandPoker(cardList)
|
||||
|
||||
end
|
||||
|
||||
function M:FillPoker(poker2, prefix, num, code)
|
||||
if num ~= nil then
|
||||
code = self:ChangeCodeByTo(num)
|
||||
end
|
||||
code = code == 1 and "00" or code
|
||||
if not poker2.icon then
|
||||
poker2:GetChild('icon').url = string.format("ui://Extend_Poker_SuoHa/%s%s", prefix, code)
|
||||
else
|
||||
poker2.icon = string.format("ui://Extend_Poker_SuoHa/%s%s", prefix, code)
|
||||
end
|
||||
end
|
||||
|
||||
function M:ChangeCodeByTo(card)
|
||||
local flower = card % 10
|
||||
local number = math.floor(card / 10)
|
||||
if number == 15 then
|
||||
number = 2
|
||||
end
|
||||
return flower * 100 + number
|
||||
end
|
||||
|
||||
function M:Clear()
|
||||
self:PlayScore(nil)
|
||||
self:SetRemainCardNumber(false)
|
||||
self:SetOutCardInfo(nil, false)
|
||||
self.hand_card_list:RemoveChildren(0, -1, true)
|
||||
self._mask_liangpai:RemoveChildren(0, -1, true)
|
||||
self._view_Out:RemoveChildren(0, -1, true)
|
||||
self._view_resultOut:RemoveChildren(0, -1, true)
|
||||
end
|
||||
|
||||
function M:Destroy()
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -2,8 +2,46 @@
|
|||
--- Created by 谌建军.
|
||||
--- DateTime: 2017/12/13 10:51
|
||||
---
|
||||
local ExProtocol = {
|
||||
local EXProtocol = {
|
||||
|
||||
--执行操作
|
||||
GAME_ACTION = "1011",
|
||||
|
||||
-- 发牌协议
|
||||
GAME_EVT_PLAYER_DEAL = "2010",
|
||||
|
||||
-- 下注提示协议
|
||||
GAME_EVT_ACTION = "2011",
|
||||
|
||||
-- 下注事件
|
||||
GAME_EVT_BET = "2012",
|
||||
|
||||
-- 跟注事件
|
||||
GAME_EVT_CALL = "2013",
|
||||
|
||||
-- 加注事件
|
||||
GAME_EVT_RAISE = "2014",
|
||||
|
||||
-- 梭哈事件
|
||||
GAME_EVT_ALL_IN = "2015",
|
||||
|
||||
-- 弃牌事件
|
||||
GAME_EVT_FOLD = "2016",
|
||||
|
||||
-- 过牌事件
|
||||
GAME_EVT_CHECK = "2017",
|
||||
|
||||
|
||||
-- 小结算
|
||||
GAME_EVT_RESULT1 = "2007",
|
||||
|
||||
-- 大结算
|
||||
GAME_EVT_RESULT2 = "2008",
|
||||
|
||||
|
||||
|
||||
-- 转盘指向事件
|
||||
GAME_EVT_CHANGE_ACTIVE_PLAYER = "2099",
|
||||
}
|
||||
|
||||
return ExProtocol
|
||||
return EXProtocol
|
||||
|
|
|
|||
|
|
@ -4,20 +4,20 @@
|
|||
---
|
||||
require("Game.View.ResultView")
|
||||
|
||||
local ExResultView = {}
|
||||
local EXResultView = {}
|
||||
|
||||
local M = ExResultView
|
||||
local M = EXResultView
|
||||
|
||||
function ExResultView.new(blur_view, data, roomid, over, win_seat, dissolve, remaincards)
|
||||
function EXResultView.new(blur_view, data, roomid, over, win_seat, dissolve, remaincards)
|
||||
setmetatable(M, { __index = ResultView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
|
||||
self.class = "ExResultView"
|
||||
self.class = "EXResultView"
|
||||
self._currenIndex = 0
|
||||
self._close_zone = false
|
||||
--self._blur_view = blur_view
|
||||
self._gamectr = ControllerManager.GetController(GameController)
|
||||
self:init("ui://Extend_Poker_RunFastNew/clearing_new", data, roomid, over, win_seat, dissolve, remaincards)
|
||||
self:init("ui://Extend_Poker_SuoHa/clearing_new", data, roomid, over, win_seat, dissolve, remaincards)
|
||||
print("=======================lingmengresult", data, roomid, over, win_seat, dissolve, remaincards)
|
||||
return self
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
local MainRightPanelView = require("Game.View.MainRightPanelView")
|
||||
local ExRightPanelView = {}
|
||||
local M = ExRightPanelView
|
||||
local EXRightPanelView = {}
|
||||
local M = EXRightPanelView
|
||||
local function __init(self, mainView, view)
|
||||
local right_panel = view
|
||||
|
||||
|
|
@ -59,10 +59,10 @@ local function __init(self, mainView, view)
|
|||
-- self._timer = Timer.New(handler(self,self.__UpdateTime),10,-1,true)
|
||||
-- self._timer:Start()
|
||||
end
|
||||
function ExRightPanelView.new(mainView, view)
|
||||
function EXRightPanelView.new(mainView, view)
|
||||
setmetatable(M, { __index = MainRightPanelView })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = "ExRightPanelView"
|
||||
self.class = "EXRightPanelView"
|
||||
__init(self, mainView, view)
|
||||
return self
|
||||
end
|
||||
|
|
|
|||
|
|
@ -5,12 +5,12 @@
|
|||
|
||||
local EXTEND_MODEL_NAME = ...
|
||||
local EXGameInfo = import(".EXGameInfo_jiangxi")
|
||||
local ExMainView = import(".ExMainView")
|
||||
local ExGameController = import(".ExGameController")
|
||||
local ExRoomConfig = import(".ExRoomConfig")
|
||||
local ExPlayer = import(".ExPlayer")
|
||||
local ExRoom = import(".ExRoom")
|
||||
local ExPlayerBackView = import(".ExPlayerBackView")
|
||||
local EXMainView = import(".EXMainView")
|
||||
local EXGameController = import(".EXGameController")
|
||||
local EXRoomConfig = import(".EXRoomConfig")
|
||||
local EXPlayer = import(".EXPlayer")
|
||||
local EXRoom = import(".EXRoom")
|
||||
local EXPlayerBackView = import(".EXPlayerBackView")
|
||||
|
||||
local ExtendConfig = {}
|
||||
|
||||
|
|
@ -23,19 +23,19 @@ function ExtendConfig.new()
|
|||
self.class = "ExtendConfig"
|
||||
self.extend_id = 14
|
||||
self._viewMap = {}
|
||||
self._viewMap[ViewManager.View_Main] = ExMainView
|
||||
self._viewMap[ViewManager.View_PlayBack] = ExPlayerBackView
|
||||
self._viewMap[ViewManager.View_Main] = EXMainView
|
||||
self._viewMap[ViewManager.View_PlayBack] = EXPlayerBackView
|
||||
return self
|
||||
end
|
||||
|
||||
--卸载资源
|
||||
function M:UnAllAssets()
|
||||
UIPackage.RemovePackage("extend/poker/runfast/ui/Info_Poker_RunFastNew")
|
||||
UIPackage.RemovePackage("extend/poker2/suoha/ui/Info_Poker_SuoHa")
|
||||
self:UnAssets()
|
||||
end
|
||||
|
||||
function M:UnAssets()
|
||||
UIPackage.RemovePackage("extend/poker/runfast/ui/Extend_Poker_RunFastNew")
|
||||
UIPackage.RemovePackage("extend/poker2/suoha/ui/Extend_Poker_SuoHa")
|
||||
ResourcesManager.UnLoadGroup("RunFase_PK")
|
||||
end
|
||||
|
||||
|
|
@ -50,22 +50,26 @@ end
|
|||
local _ctr_game = nil
|
||||
function M:GetGameController()
|
||||
if _ctr_game == nil then
|
||||
_ctr_game = ExGameController.new()
|
||||
_ctr_game = EXGameController.new()
|
||||
end
|
||||
return _ctr_game
|
||||
end
|
||||
|
||||
function M:NewRoom()
|
||||
return ExRoom.new()
|
||||
return EXRoom.new()
|
||||
end
|
||||
|
||||
function M:GetGameRule()
|
||||
return EXRuleView.new()
|
||||
end
|
||||
|
||||
function M:GetIconUrl()
|
||||
return "ui://Extend_Poker_RunFastNew/icon"
|
||||
return "ui://Extend_Poker_SuoHa/icon"
|
||||
--
|
||||
end
|
||||
|
||||
function M:FillRoomConfig(room, _config)
|
||||
room.room_config = ExRoomConfig.new(_config)
|
||||
room.room_config = EXRoomConfig.new(_config)
|
||||
end
|
||||
|
||||
function M:FillRoomData(s2croom)
|
||||
|
|
@ -81,7 +85,7 @@ function M:FillRoomData(s2croom)
|
|||
room.xipaiScore = _tableInfo["xipai_score"]
|
||||
|
||||
local _config = _tableInfo["config"]
|
||||
room.room_config = ExRoomConfig.new(_config)
|
||||
room.room_config = EXRoomConfig.new(_config)
|
||||
|
||||
room.curren_round = _tableInfo["round"]
|
||||
if room.curren_round == 0 and reload then
|
||||
|
|
@ -92,7 +96,7 @@ function M:FillRoomData(s2croom)
|
|||
for i = 1, #playerList do
|
||||
local _jp = playerList[i]
|
||||
|
||||
local p = ExPlayer.new()
|
||||
local p = EXPlayer.new()
|
||||
p.seat = _jp["seat"]
|
||||
local online = _jp["online"]
|
||||
p.line_state = online
|
||||
|
|
@ -210,7 +214,7 @@ function M:FillPlayBackData(pd_data)
|
|||
|
||||
local _config = _tableInfo["config"]
|
||||
room.room_id = _tableInfo.room_id
|
||||
room.room_config = ExRoomConfig.new(_config)
|
||||
room.room_config = EXRoomConfig.new(_config)
|
||||
room.owner_id = _config["ownerid"]
|
||||
local active_seat = _tableInfo["active_seat"]
|
||||
local bank_seat = _tableInfo["banker_seat"]
|
||||
|
|
@ -220,7 +224,7 @@ function M:FillPlayBackData(pd_data)
|
|||
local _info_list = _tableInfo["playerData"]
|
||||
for i = 1, #_info_list do
|
||||
local _jp = _info_list[i]
|
||||
local p = ExPlayer.new()
|
||||
local p = EXPlayer.new()
|
||||
p.seat = _jp["seat"]
|
||||
p.aid = _jp["aid"]
|
||||
local pid = _jp["aid"]
|
||||
|
|
|
|||
|
|
@ -45,6 +45,8 @@ end
|
|||
|
||||
function M:FillData(begin)
|
||||
if (begin) then
|
||||
print("lingmengResetFzList2")
|
||||
pt(self._player)
|
||||
for i = 1, #self._player.fz_list do
|
||||
self:UpdateFzList(self._player.fz_list[i], -1)
|
||||
end
|
||||
|
|
@ -218,11 +220,11 @@ local function getPos(my_seat, other_seat, total)
|
|||
end
|
||||
|
||||
function M:UpdateFzList(fz, index, show_card, seat)
|
||||
print("lingmengUpdateFzList", fz, index, show_card, seat)
|
||||
local FZame = self._viewText_cardInfo['FZ_Card']
|
||||
index = index or 0
|
||||
show_card = show_card or nil
|
||||
|
||||
|
||||
local outCard = self._view_FZList:AddItemFromPool()
|
||||
outCard:GetController("seat").selectedIndex = seat or 0
|
||||
if fz.type == FZType.Chi then
|
||||
|
|
@ -252,6 +254,8 @@ function M:UpdateFzList(fz, index, show_card, seat)
|
|||
elseif fz.type == FZType.Gang_Peng then
|
||||
for i = 1, self._view_FZList.numItems do
|
||||
if self._view_FZList:GetChildAt(i - 1).data and self._view_FZList:GetChildAt(i - 1).data == fz.card then
|
||||
outCard:GetController("seat").selectedIndex = self._view_FZList:GetChildAt(i - 1):GetController(
|
||||
"seat").selectedIndex
|
||||
self._view_FZList:RemoveChildrenToPool(i - 1, i - 1)
|
||||
return
|
||||
end
|
||||
|
|
@ -279,6 +283,8 @@ end
|
|||
|
||||
function M:ResetFzList()
|
||||
for i = 1, #self._player.fz_list do
|
||||
print("lingmengResetFzList")
|
||||
pt(self._player)
|
||||
local fz = self._player.fz_list[i]
|
||||
-- if fz.type ~= FZType.Gang_Peng then
|
||||
self:UpdateFzList(fz, -1)
|
||||
|
|
|
|||
|
|
@ -77,6 +77,13 @@ function M:InitView(url, isHideIpAdds, settingViewType, ex_defaultbg, ex_bgconfi
|
|||
end
|
||||
self:InitXiPai()
|
||||
self:InitXiPai1()
|
||||
|
||||
local Btn_Ready = _view:GetChild('Btn_Ready')
|
||||
if Btn_Ready ~= nil then
|
||||
Btn_Ready.onClick:Set(function()
|
||||
self._gamectr:PlayerReady()
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
function M:InitXiPai()
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 81 KiB |
Binary file not shown.
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: b017686c13763de4884a002b00999158
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: e2ff47366ab50d3458b6acd751b404bc
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 09c85cd6409c1224ba5057c80042bf88
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 568 KiB |
|
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 90b7612eae62bb949b77c5984e16ea76
|
||||
guid: eee093667666622428a5ecf81ea2bfda
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
|
|
@ -88,5 +88,5 @@ TextureImporter:
|
|||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName: extend/poker/suoha/1dd27af6cf16f29dd351e9912088b1d5
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 9cf040078a8b4b1468dad9cc95784ed8
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 22180c3e6d0d26848a8ca65c0c1ff971
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Loading…
Reference in New Issue