按下是清楚移动状态
parent
a65f0fe437
commit
ec89eae095
|
|
@ -213,7 +213,7 @@ function M:InitPoker(pokerList, isPlayAni, open)
|
||||||
-- -- print(vardump(self.card_list))
|
-- -- print(vardump(self.card_list))
|
||||||
self.cor_init_poker = nil
|
self.cor_init_poker = nil
|
||||||
self.card_list = {}
|
self.card_list = {}
|
||||||
|
self._ctr_canSendCard.selectedIndex = 0
|
||||||
self._view_handCard:RemoveChildren(0, -1, true)
|
self._view_handCard:RemoveChildren(0, -1, true)
|
||||||
if isPlayAni == true then
|
if isPlayAni == true then
|
||||||
self.cor_init_poker =
|
self.cor_init_poker =
|
||||||
|
|
@ -1074,7 +1074,6 @@ function M:BtnEvent()
|
||||||
function()
|
function()
|
||||||
--printlog("wwwwwwwwwww111111111111111111111111")
|
--printlog("wwwwwwwwwww111111111111111111111111")
|
||||||
--pt(self.tips_card_list)
|
--pt(self.tips_card_list)
|
||||||
self._ctr_canSendCard.selectedIndex = 1
|
|
||||||
if self.tips_card_list ~= nil and #self.tips_card_list ~= 0 then
|
if self.tips_card_list ~= nil and #self.tips_card_list ~= 0 then
|
||||||
local index = self.tips_click_count % #self.tips_card_list + 1
|
local index = self.tips_click_count % #self.tips_card_list + 1
|
||||||
self:ShowTipsCard(index)
|
self:ShowTipsCard(index)
|
||||||
|
|
@ -1126,6 +1125,8 @@ function M:ShowTipsCard(index)
|
||||||
end
|
end
|
||||||
if isExsit == false then
|
if isExsit == false then
|
||||||
self:UpdateCardMove(card.btn_card, false, false)
|
self:UpdateCardMove(card.btn_card, false, false)
|
||||||
|
else
|
||||||
|
self._ctr_canSendCard.selectedIndex = 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
@ -0,0 +1,61 @@
|
||||||
|
---
|
||||||
|
--- 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/poker/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_RunFastNew/Label_Detail_Play")
|
||||||
|
|
||||||
|
local jiangmaSlider = self._config:GetChild("slider_people")
|
||||||
|
jiangmaSlider.onChanged:Set(function()
|
||||||
|
self._config:GetChild("text_people").text = string.format("共%s人", Mathf.Round(jiangmaSlider.value))
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:LoadConfigData(data)
|
||||||
|
local _config = self._config
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:SelectedConfigData()
|
||||||
|
local _config = self._config
|
||||||
|
local round = _config:GetController("round").selectedIndex
|
||||||
|
|
||||||
|
local peopleNum = Mathf.Round(_config:GetChild("slider_people").value)
|
||||||
|
|
||||||
|
local _data = {}
|
||||||
|
_data["account_id"] = DataManager.SelfUser.Id
|
||||||
|
|
||||||
|
_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
|
||||||
|
|
||||||
|
return _data
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:LoadConfigToDetail(data)
|
||||||
|
local configData = json.decode(data)
|
||||||
|
local returnString = string.format("人数%s人", configData.maxPlayers)
|
||||||
|
return returnString
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
local PlayerInfoView = require("Game.View.PlayerInfoView_copy")
|
||||||
|
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
function M.new(view, mainView)
|
||||||
|
setmetatable(M, { __index = PlayerInfoView })
|
||||||
|
local self = setmetatable({}, { __index = M })
|
||||||
|
self._view = view
|
||||||
|
self._main_view = mainView
|
||||||
|
self:init()
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:FillData(player)
|
||||||
|
PlayerInfoView.FillData(self, player)
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
---
|
||||||
|
--- Created by 谌建军.
|
||||||
|
--- DateTime: 2017/12/13 11:28
|
||||||
|
---
|
||||||
|
|
||||||
|
local ExProtocol = import(".ExProtocol")
|
||||||
|
local ExGameEvent = import(".ExGameEvent")
|
||||||
|
local CardType = import(".CardType")
|
||||||
|
|
||||||
|
|
||||||
|
local ExGameController = {}
|
||||||
|
|
||||||
|
local M = ExGameController
|
||||||
|
|
||||||
|
function M.new()
|
||||||
|
setmetatable(M, { __index = GameController })
|
||||||
|
local self = setmetatable({}, { __index = M })
|
||||||
|
self:init("跑得快")
|
||||||
|
self.class = "ExGameController"
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:init(name)
|
||||||
|
GameController.init(self, name)
|
||||||
|
self:RegisterEvt()
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 事件注册
|
||||||
|
function M:RegisterEvt()
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
---
|
||||||
|
--- Created by 谌建军.
|
||||||
|
--- DateTime: 2017/12/13 10:55
|
||||||
|
---
|
||||||
|
local ExGameEvent = {
|
||||||
|
|
||||||
|
}
|
||||||
|
return ExGameEvent
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,440 @@
|
||||||
|
---
|
||||||
|
--- Created by 谌建军.
|
||||||
|
--- DateTime: 2017/12/25 13:52
|
||||||
|
---
|
||||||
|
local PKPlayBackView = require('main.poker.PKPlayBackView')
|
||||||
|
local ExPlayerCardInfoView = import('.ExPlayerPokerInfoView')
|
||||||
|
local ExPlayerSelfCardInfoView = import('.ExPlayerSelfPokerInfoView')
|
||||||
|
local PlayerInfoView = import('.EXPlayerInfoView')
|
||||||
|
local ExRightPanelView = import(".ExRightPanelView")
|
||||||
|
local ExResultView = import(".ExResultView")
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
local ExRecord_Event = {
|
||||||
|
Evt_OutCard = 'OutCard',
|
||||||
|
Evt_Pass = 'pass',
|
||||||
|
Evt_NewRound = 'newindex',
|
||||||
|
Evt_result = 'result',
|
||||||
|
Evt_Result = 'Result'
|
||||||
|
}
|
||||||
|
|
||||||
|
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' }
|
||||||
|
}
|
||||||
|
|
||||||
|
--- Create a new
|
||||||
|
function M.new()
|
||||||
|
setmetatable(M, { __index = PKPlayBackView })
|
||||||
|
local self = setmetatable({}, { __index = M })
|
||||||
|
self.class = 'ExPlayBackView'
|
||||||
|
self:init()
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:InitView(url)
|
||||||
|
local room = self._room
|
||||||
|
if not room.self_player then
|
||||||
|
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,
|
||||||
|
default_bg, bg_config)
|
||||||
|
self._tex_round = self._view:GetChild('round')
|
||||||
|
self._player_card_info = {}
|
||||||
|
local _player_card_info = self._player_card_info
|
||||||
|
for i = 1, room.room_config.people_num do
|
||||||
|
local tem = self._view:GetChild('player_card_info_' .. i)
|
||||||
|
self._player_card_info[i] = self:NewPlayerPokerInfoView(tem, i)
|
||||||
|
end
|
||||||
|
local rightpanel = self._view:GetChild("right_panel")
|
||||||
|
if self._rightPanelView ~= nil then
|
||||||
|
self._rightPanelView:Destroy()
|
||||||
|
end
|
||||||
|
|
||||||
|
self._rightPanelView = ExRightPanelView.new(self, rightpanel)
|
||||||
|
rightpanel:GetChild("btn_setting").onClick:Clear()
|
||||||
|
|
||||||
|
self._player_info = {}
|
||||||
|
local _player_info = self._player_info
|
||||||
|
for i = 1, self._room.room_config.people_num do
|
||||||
|
local tem = self._view:GetChild('player_info' .. i)
|
||||||
|
_player_info[i] = PlayerInfoView.new(tem, self)
|
||||||
|
end
|
||||||
|
local list = self._room.player_list
|
||||||
|
for i = 1, #list do
|
||||||
|
local p = list[i]
|
||||||
|
local info = _player_info[self:GetPos(p.seat)]
|
||||||
|
info._view.visible = true
|
||||||
|
info:FillData(p)
|
||||||
|
end
|
||||||
|
if self._room.hpOnOff == 1 and self._room.score_times ~= 1 then
|
||||||
|
-- body
|
||||||
|
self._view:GetChild('roominfo_panel1'):GetChild('tex_beishu').text = self._room.score_times .. '倍'
|
||||||
|
else
|
||||||
|
self._view:GetChild('roominfo_panel1'):GetChild('tex_beishu').text = ''
|
||||||
|
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
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:NewPlayerPokerInfoView(view, index)
|
||||||
|
if index == 1 then
|
||||||
|
return ExPlayerSelfCardInfoView.new(view, self)
|
||||||
|
end
|
||||||
|
return ExPlayerCardInfoView.new(view, self)
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:FillRoomData(data)
|
||||||
|
-- print("hidezhanji 1111")
|
||||||
|
self._currentStep = 1
|
||||||
|
local room = DataManager.CurrenRoom
|
||||||
|
local _player_card_info = self._player_card_info
|
||||||
|
local roominfo_panel = self._view:GetChild('roominfo_panel1')
|
||||||
|
|
||||||
|
roominfo_panel:GetChild('tex_roomid').text = data.info.roomid
|
||||||
|
roominfo_panel:GetChild('tex_gametype').text = room.room_config:GetGameName()
|
||||||
|
|
||||||
|
for i = 1, #room.player_list do
|
||||||
|
local p = room.player_list[i]
|
||||||
|
local card_info = _player_card_info[self:GetPos(p.seat)]
|
||||||
|
local head_info = self._player_info[self:GetPos(p.seat)]
|
||||||
|
|
||||||
|
if p.total_hp then
|
||||||
|
-- print("hidezhanji 2222")
|
||||||
|
|
||||||
|
head_info._view:GetChild('zhanji').visible = false
|
||||||
|
|
||||||
|
if room.hpOnOff == 1 or room:checkHpNonnegative() then
|
||||||
|
head_info._view:GetChild('zhanji').visible = true
|
||||||
|
head_info._view:GetChild('text_score').text = d2ad(p.total_hp)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
head_info:FillData(p)
|
||||||
|
head_info:UnmarkTuoguan()
|
||||||
|
head_info:UpdateScore()
|
||||||
|
if p.seat ~= room.self_player.seat then
|
||||||
|
card_info:UpdateHandPoker(p.hand_list, false, true)
|
||||||
|
end
|
||||||
|
head_info:UpdatePiao(p.piao)
|
||||||
|
end
|
||||||
|
|
||||||
|
self:UpdateRound()
|
||||||
|
|
||||||
|
self:GenerateAllStepData(data)
|
||||||
|
self:ShowStep(1)
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:ShowStep(index)
|
||||||
|
local step = self._step[index]
|
||||||
|
if step == nil then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
for i = 1, #step.player_card_data do
|
||||||
|
local p = self._room:GetPlayerBySeat(i)
|
||||||
|
|
||||||
|
local info = self._player_card_info[self:GetPos(i)]
|
||||||
|
p.hand_list = step.player_card_data[i].hand_list
|
||||||
|
p.out_card_list = step.player_card_data[i].out_card_list
|
||||||
|
p.hand_left_count = #p.hand_list
|
||||||
|
|
||||||
|
if p.seat ~= self._room.self_player.seat then
|
||||||
|
info:UpdateHandPoker(p.hand_list, false, true)
|
||||||
|
else
|
||||||
|
info:InitPoker(p.hand_list, false)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
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)]
|
||||||
|
local card = step.out_card_list
|
||||||
|
local card_list = self._gamectr:ChangeCodeByFrom(card, true)
|
||||||
|
info:SetOutCardInfo(card_list, false)
|
||||||
|
self:ClearNextSeatOutCard(seat)
|
||||||
|
end
|
||||||
|
|
||||||
|
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
|
||||||
|
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
|
||||||
|
local result = step.result
|
||||||
|
for i = 1, #result do
|
||||||
|
local card_info = self._player_card_info[self:GetPos(result[i].seat)]
|
||||||
|
|
||||||
|
if result[i].entrust ~= nil and result[i].entrust == true then
|
||||||
|
local head_info = self._player_info[self:GetPos(result[i].seat)]
|
||||||
|
head_info:MarkTuoguan()
|
||||||
|
end
|
||||||
|
-- head_info:UpdateScore(result[i].score)
|
||||||
|
card_info:PlayScore(result[i].score, false, step.win_seat == result[i].seat)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
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,
|
||||||
|
Result.winseat, 0, Result.remaincards)
|
||||||
|
local num = self._view:GetChildIndex(self._view:GetChild("panel_record"))
|
||||||
|
self._view:AddChildAt(self.result_view._view, num)
|
||||||
|
else
|
||||||
|
if self.result_view then
|
||||||
|
self.result_view:Dispose()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:GenerateAllStepData(data)
|
||||||
|
local cmdList = self.cmdList
|
||||||
|
self._step = {}
|
||||||
|
local step = {}
|
||||||
|
local info = data.info
|
||||||
|
step.cmd = ''
|
||||||
|
|
||||||
|
step.win = 0
|
||||||
|
step.player_card_data = {}
|
||||||
|
for i = 1, #self._room.player_list do
|
||||||
|
local p = info.playerData[i]
|
||||||
|
local u = {}
|
||||||
|
u.seat = p.seat
|
||||||
|
u.hand_list = p.hand_card
|
||||||
|
u.hand_count = #u.hand_list
|
||||||
|
u.out_card_list = {}
|
||||||
|
step.player_card_data[u.seat] = u
|
||||||
|
end
|
||||||
|
self._step[#self._step + 1] = step
|
||||||
|
for i = 1, #cmdList do
|
||||||
|
local tem = cmdList[i]
|
||||||
|
self._cmdmap[tem.cmd](self, tem, i)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:CmdOutCard(cmd, index)
|
||||||
|
local data = self:CopyLastStep(index)
|
||||||
|
data.cmd = cmd.cmd
|
||||||
|
data.current_out_seat = cmd.seat
|
||||||
|
local u = data.player_card_data[cmd.seat]
|
||||||
|
u.card_list = cmd.data.card
|
||||||
|
data.out_card_list = cmd.data.card_list
|
||||||
|
for i = 1, #data.out_card_list do
|
||||||
|
local out_card = data.out_card_list[i]
|
||||||
|
for j = 1, #u.hand_list do
|
||||||
|
if u.hand_list[j] == out_card then
|
||||||
|
list_remove(u.hand_list, out_card)
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:CmdNewRound(cmd, index)
|
||||||
|
local data = self:CopyLastStep(index)
|
||||||
|
data.cmd = cmd.cmd
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:CmdPass(cmd, index)
|
||||||
|
local data = self:CopyLastStep(index)
|
||||||
|
data.cmd = cmd.cmd
|
||||||
|
data.current_out_seat = cmd.seat
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:Cmdresult(cmd, index)
|
||||||
|
local data = self:CopyLastStep(index)
|
||||||
|
data.cmd = cmd.cmd
|
||||||
|
data.result = cmd.data.result
|
||||||
|
data.win_seat = cmd.seat
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:CmdResult(cmd, index)
|
||||||
|
local data = self:CopyLastStep(index)
|
||||||
|
data.cmd = cmd.cmd
|
||||||
|
data.Result = cmd.data
|
||||||
|
for i = 1, #data.Result.info do
|
||||||
|
local p = data.Result.info[i]
|
||||||
|
p.nick = self._room:GetPlayerBySeat(p.seat).self_user.nick_name
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:CopyLastStep(index)
|
||||||
|
local step = {}
|
||||||
|
local last_step = self._step[index]
|
||||||
|
step = membe_clone(last_step)
|
||||||
|
step.player_card_data = {}
|
||||||
|
local card_data = step.player_card_data
|
||||||
|
for i = 1, #last_step.player_card_data do
|
||||||
|
card_data[i] = {}
|
||||||
|
card_data[i].hand_list = membe_clone(last_step.player_card_data[i].hand_list)
|
||||||
|
card_data[i].out_card_list = membe_clone(last_step.player_card_data[i].out_card_list)
|
||||||
|
end
|
||||||
|
step.Result = nil
|
||||||
|
self._step[#self._step + 1] = step
|
||||||
|
return step
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:ClearNextSeatOutCard(currenOutCardSeat)
|
||||||
|
local people_num = self._room.room_config.people_num
|
||||||
|
local next_seat = currenOutCardSeat + 1
|
||||||
|
if next_seat > people_num then
|
||||||
|
next_seat = next_seat - people_num
|
||||||
|
end
|
||||||
|
local p = self._room:GetPlayerBySeat(next_seat)
|
||||||
|
local card_info = self._player_card_info[self:GetPos(p.seat)]
|
||||||
|
card_info:SetOutCardInfo(nil, false)
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:UpdateRound()
|
||||||
|
local round = self._room.curren_round
|
||||||
|
self._tex_round.text = string.format('第 %d 局', round)
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:NextRecordPlay()
|
||||||
|
self._totalRound = tonumber(self._totalRound)
|
||||||
|
local result = PlayBackView.NextRecordPlay(self)
|
||||||
|
if not result then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
self:ChangePlayState(false)
|
||||||
|
self._speed = 1
|
||||||
|
self._playFoward = true
|
||||||
|
self:ChangeTextSpeed()
|
||||||
|
if self.result_view then
|
||||||
|
self.result_view:Dispose()
|
||||||
|
self.result_view = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:LastRecordPlay()
|
||||||
|
local result = PlayBackView.LastRecordPlay(self)
|
||||||
|
if not result then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
self:ChangePlayState(false)
|
||||||
|
self._speed = 1
|
||||||
|
self._playFoward = true
|
||||||
|
self:ChangeTextSpeed()
|
||||||
|
if self.result_view then
|
||||||
|
self.result_view:Dispose()
|
||||||
|
self.result_view = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:Play()
|
||||||
|
self:ChangeAlpha()
|
||||||
|
self:ChangePlayState(not self._play)
|
||||||
|
if not self._play then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if (self._currentStep == #self.cmdList and self._playFoward) or (self._currentStep == 0 and not self._playFoward) then
|
||||||
|
self._currentStep = 0
|
||||||
|
self._speed = 1
|
||||||
|
self._playFoward = true
|
||||||
|
self:ChangeTextSpeed()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:ChangePlayState(state)
|
||||||
|
self._play = state
|
||||||
|
self:ChangeTextSpeed()
|
||||||
|
local btn_play = self._view:GetChild('panel_record'):GetChild('btn_play')
|
||||||
|
if self._play then
|
||||||
|
btn_play:GetController('state').selectedIndex = 1
|
||||||
|
else
|
||||||
|
btn_play:GetController('state').selectedIndex = 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:ChangeTextSpeed()
|
||||||
|
local str1 = self._play and self._speed or ''
|
||||||
|
self._view:GetChild('panel_record'):GetChild('tex_speed').text = str1
|
||||||
|
local str2 =
|
||||||
|
not self._play and (self._playFoward and '播放暂停' or '回退暂停') or
|
||||||
|
self._playFoward and (self._speed == 1 and '播放' or '快进') or
|
||||||
|
(self._speed == 1 and '回退' or '快退')
|
||||||
|
self._view:GetChild('panel_record'):GetChild('tex_2').text = str2
|
||||||
|
local str3 = self._play and '倍速度' or ''
|
||||||
|
self._view:GetChild('panel_record'):GetChild('tex_1').text = str3
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:CmdLeftArrows()
|
||||||
|
self:ChangeAlpha()
|
||||||
|
self:ChangePlayState(true)
|
||||||
|
if not self._playFoward then
|
||||||
|
if self._speed < 16 then
|
||||||
|
self._speed = self._speed * 2
|
||||||
|
else
|
||||||
|
self._speed = 1
|
||||||
|
end
|
||||||
|
self:ChangeTextSpeed()
|
||||||
|
else
|
||||||
|
self._speed = 1
|
||||||
|
self._playFoward = false
|
||||||
|
self:ChangeTextSpeed()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:CmdRightArrows()
|
||||||
|
self:ChangeAlpha()
|
||||||
|
self:ChangePlayState(true)
|
||||||
|
if self._playFoward then
|
||||||
|
if self._speed < 16 then
|
||||||
|
self._speed = self._speed * 2
|
||||||
|
else
|
||||||
|
self._speed = 1
|
||||||
|
end
|
||||||
|
self:ChangeTextSpeed()
|
||||||
|
else
|
||||||
|
self._speed = 1
|
||||||
|
self._playFoward = true
|
||||||
|
self:ChangeTextSpeed()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:OnUpdate()
|
||||||
|
if self._play then
|
||||||
|
if (self._currentStep == #self.cmdList + 1 and self._playFoward) then
|
||||||
|
self:ChangePlayState(false)
|
||||||
|
ViewUtil.ErrorTip(nil, '当前已是录像结尾了,再次点击播放按钮可重新播放')
|
||||||
|
return
|
||||||
|
elseif (self._currentStep == 0 and not self._playFoward) then
|
||||||
|
self:ChangePlayState(false)
|
||||||
|
ViewUtil.ErrorTip(nil, '当前已是录像开头了,再次点击播放按钮可重新播放')
|
||||||
|
return
|
||||||
|
end
|
||||||
|
self._timer = self._timer + Time.deltaTime
|
||||||
|
if self._timer >= 1 / self._speed then
|
||||||
|
self._timer = 0
|
||||||
|
local step = self._playFoward and 1 or -1
|
||||||
|
self._currentStep = self._currentStep + step
|
||||||
|
if self._currentStep > 0 then
|
||||||
|
self:ShowStep(self._currentStep)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:Destroy()
|
||||||
|
UpdateBeat:Remove(self.OnUpdate, self)
|
||||||
|
PlayBackView.Destroy(self)
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
|
|
@ -0,0 +1,40 @@
|
||||||
|
---
|
||||||
|
--- Created by 谌建军.
|
||||||
|
--- DateTime: 2017/12/13 16:35
|
||||||
|
---
|
||||||
|
local ExPlayerPokerInfoView = {
|
||||||
|
_view = nil,
|
||||||
|
_mainView = nil,
|
||||||
|
_mask_liangpai = nil,
|
||||||
|
}
|
||||||
|
|
||||||
|
local M = ExPlayerPokerInfoView
|
||||||
|
|
||||||
|
function M.new(view, mainView)
|
||||||
|
local self = {}
|
||||||
|
setmetatable(self, { __index = M })
|
||||||
|
self._view = view
|
||||||
|
self._mainView = mainView
|
||||||
|
self:init()
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:init()
|
||||||
|
local view = self._view
|
||||||
|
self._gameCtr = ControllerManager.GetController(GameController)
|
||||||
|
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()
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,9 @@
|
||||||
|
---
|
||||||
|
--- Created by 谌建军.
|
||||||
|
--- DateTime: 2017/12/13 10:51
|
||||||
|
---
|
||||||
|
local ExProtocol = {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return ExProtocol
|
||||||
|
|
@ -0,0 +1,113 @@
|
||||||
|
---
|
||||||
|
--- Created by 谌建军.
|
||||||
|
--- DateTime: 2017/12/19 11:05
|
||||||
|
---
|
||||||
|
require("Game.View.ResultView")
|
||||||
|
|
||||||
|
local ExResultView = {}
|
||||||
|
|
||||||
|
local M = ExResultView
|
||||||
|
|
||||||
|
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._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)
|
||||||
|
print("=======================lingmengresult", data, roomid, over, win_seat, dissolve, remaincards)
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:init(url, data, roomid, over, win_seat, dissolve, remaincards)
|
||||||
|
ResultView.init(self, url, true)
|
||||||
|
|
||||||
|
local room = DataManager.CurrenRoom
|
||||||
|
self._view:GetController('over').selectedIndex = 0
|
||||||
|
|
||||||
|
--按钮功能全部未开放
|
||||||
|
self._view:GetChild('btn_shareRecord').onClick:Set(function()
|
||||||
|
ViewUtil.ErrorMsg(self._view, "", "该功能还未开放")
|
||||||
|
end)
|
||||||
|
self._view:GetChild('btn_copyRecord').onClick:Set(function()
|
||||||
|
ViewUtil.ErrorMsg(self._view, "", "该功能还未开放")
|
||||||
|
end)
|
||||||
|
------------------
|
||||||
|
|
||||||
|
--只有一人直接退,有两人才进正常结算
|
||||||
|
if not over and #data == 1 then
|
||||||
|
ViewManager.ChangeView(ViewManager.View_Family)
|
||||||
|
end
|
||||||
|
|
||||||
|
if over == 0 then
|
||||||
|
self._view:GetChild('btn_nextRound').onClick:Set(function()
|
||||||
|
self:Destroy()
|
||||||
|
local _gamectr = ControllerManager.GetController(GameController)
|
||||||
|
_gamectr:ConformToNextGame()
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
self._view:GetChild('btn_closeRound').onClick:Set(function()
|
||||||
|
ViewManager.ChangeView(ViewManager.View_Family)
|
||||||
|
end)
|
||||||
|
|
||||||
|
self._view:GetController('win').selectedIndex = win_seat == room.self_player.seat and 1 or 0
|
||||||
|
|
||||||
|
local over0List = self._view:GetChild('list_over0')
|
||||||
|
over0List:SetVirtual()
|
||||||
|
over0List.itemRenderer = function(index, obj)
|
||||||
|
local info = data[index + 1]
|
||||||
|
local playerInfo = room:GetPlayerBySeat(info.seat)
|
||||||
|
obj:GetChild('name').text = playerInfo.self_user.nick_name
|
||||||
|
obj:GetChild('residue').text = #info.handCards
|
||||||
|
obj:GetChild('bomb').text = info.thisboomnum
|
||||||
|
obj:GetChild('score').text = info.winscore > 0 and string.format("+%d", info.winscore) or info.winscore
|
||||||
|
end
|
||||||
|
over0List.numItems = #data
|
||||||
|
|
||||||
|
if over == 1 or (not over and #data == 2) then
|
||||||
|
self._view:GetChild('text_roomID').text = room.room_id
|
||||||
|
self._view:GetChild('text_time').text = os.date('%m-%d %H:%M', os.time())
|
||||||
|
self._view:GetChild('text_groupID').text = room.group_id or 0
|
||||||
|
for i = 1, #data do
|
||||||
|
local info = data[i]
|
||||||
|
local playerInfo = room:GetPlayerBySeat(info.seat)
|
||||||
|
self:FillPlayerInfoEnd(self._view:GetChild(string.format("comp_playerInfo%d_over1", i)), info, playerInfo)
|
||||||
|
end
|
||||||
|
coroutine.start(function()
|
||||||
|
coroutine.wait(2)
|
||||||
|
self._view:GetController('over').selectedIndex = 1
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:FillPlayerInfoEnd(view, info, playerInfo)
|
||||||
|
local room = DataManager.CurrenRoom
|
||||||
|
|
||||||
|
self:FillPlayerHead(view:GetChild('comp_playerInfo'), playerInfo)
|
||||||
|
|
||||||
|
local detailList = view:GetChild('list_detail')
|
||||||
|
|
||||||
|
self:FillDetailChild(detailList:AddItemFromPool(), "单局最高得分", info.settle_log.maxscore)
|
||||||
|
self:FillDetailChild(detailList:AddItemFromPool(), "打出炸弹数", info.settle_log.boomnum)
|
||||||
|
self:FillDetailChild(detailList:AddItemFromPool(), "胜负局数",
|
||||||
|
string.format("%d赢%d输", info.settle_log.winnum, room.room_config.Times - info.settle_log.winnum))
|
||||||
|
self:FillDetailChild(detailList:AddItemFromPool(), "总积分", info.total_score)
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:FillPlayerHead(view, playerInfo)
|
||||||
|
ImageLoad.Load(playerInfo.self_user.head_url, view:GetChild('btn_head')._iconObject)
|
||||||
|
view:GetChild('text_name').text = playerInfo.self_user.nick_name
|
||||||
|
view:GetChild('text|_ID').text = playerInfo.self_user.account_id
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:FillDetailChild(view, title, value)
|
||||||
|
view:GetChild('text_title').text = title
|
||||||
|
view:GetChild('text_value').text = value
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
|
|
@ -0,0 +1,258 @@
|
||||||
|
---
|
||||||
|
--- Created by 谌建军.
|
||||||
|
--- DateTime: 2017/12/13 10:57
|
||||||
|
---
|
||||||
|
|
||||||
|
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 ExtendConfig = {}
|
||||||
|
|
||||||
|
local M = ExtendConfig
|
||||||
|
|
||||||
|
|
||||||
|
function ExtendConfig.new()
|
||||||
|
setmetatable(M, { __index = IExtendConfig })
|
||||||
|
local self = setmetatable({}, { __index = M })
|
||||||
|
self.class = "ExtendConfig"
|
||||||
|
self.extend_id = 14
|
||||||
|
self._viewMap = {}
|
||||||
|
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")
|
||||||
|
self:UnAssets()
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:UnAssets()
|
||||||
|
UIPackage.RemovePackage("extend/poker/runfast/ui/Extend_Poker_RunFastNew")
|
||||||
|
ResourcesManager.UnLoadGroup("RunFase_PK")
|
||||||
|
end
|
||||||
|
|
||||||
|
local _gameInfo = nil
|
||||||
|
function M:GetGameInfo()
|
||||||
|
if not _gameInfo then
|
||||||
|
_gameInfo = EXGameInfo.new()
|
||||||
|
end
|
||||||
|
return _gameInfo
|
||||||
|
end
|
||||||
|
|
||||||
|
local _ctr_game = nil
|
||||||
|
function M:GetGameController()
|
||||||
|
if _ctr_game == nil then
|
||||||
|
_ctr_game = ExGameController.new()
|
||||||
|
end
|
||||||
|
return _ctr_game
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:NewRoom()
|
||||||
|
return ExRoom.new()
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:GetIconUrl()
|
||||||
|
return "ui://Extend_Poker_RunFastNew/icon"
|
||||||
|
--
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:FillRoomConfig(room, _config)
|
||||||
|
room.room_config = ExRoomConfig.new(_config)
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:FillRoomData(s2croom)
|
||||||
|
local room = DataManager.CurrenRoom
|
||||||
|
if _ctr_game == nil then
|
||||||
|
self:GetGameController()
|
||||||
|
end
|
||||||
|
|
||||||
|
local reload = s2croom["reload"]
|
||||||
|
|
||||||
|
local _tableInfo = s2croom["tableInfo"]
|
||||||
|
|
||||||
|
room.xipaiScore = _tableInfo["xipai_score"]
|
||||||
|
|
||||||
|
local _config = _tableInfo["config"]
|
||||||
|
room.room_config = ExRoomConfig.new(_config)
|
||||||
|
|
||||||
|
room.curren_round = _tableInfo["round"]
|
||||||
|
if room.curren_round == 0 and reload then
|
||||||
|
room.curren_round = 1
|
||||||
|
end
|
||||||
|
|
||||||
|
local playerList = _tableInfo["playerData"]
|
||||||
|
for i = 1, #playerList do
|
||||||
|
local _jp = playerList[i]
|
||||||
|
|
||||||
|
local p = ExPlayer.new()
|
||||||
|
p.seat = _jp["seat"]
|
||||||
|
local online = _jp["online"]
|
||||||
|
p.line_state = online
|
||||||
|
p.ready = _jp["ready"] == 1 and true or false
|
||||||
|
local pid = _jp["aid"]
|
||||||
|
if (DataManager.SelfUser.account_id == pid) then
|
||||||
|
room.self_player = p
|
||||||
|
p.self_user = DataManager.SelfUser
|
||||||
|
else
|
||||||
|
local u = User.new()
|
||||||
|
u.account_id = pid
|
||||||
|
p.self_user = u
|
||||||
|
u.nick_name = _jp["nick"]
|
||||||
|
u.head_url = _jp["portrait"]
|
||||||
|
u.sex = _jp["sex"]
|
||||||
|
end
|
||||||
|
p.self_user.location = Location.new(_jp["pos"] or "")
|
||||||
|
p.self_user.host_ip = _jp["ip"]
|
||||||
|
p.total_score = _jp["score"] or 0
|
||||||
|
if _jp.hp_info then
|
||||||
|
p.cur_hp = _jp.hp_info.cur_hp
|
||||||
|
end
|
||||||
|
p.hp_info = _jp["hp_info"]
|
||||||
|
|
||||||
|
if _jp["entrust"] then
|
||||||
|
p.entrust = _jp.entrust
|
||||||
|
end
|
||||||
|
room:AddPlayer(p)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
local owner = s2croom["owner"]
|
||||||
|
room.owner_id = owner
|
||||||
|
room.game_status = 0
|
||||||
|
if reload then
|
||||||
|
local reloadInfo = s2croom["reloadInfo"]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
local playing = reloadInfo["playing"]
|
||||||
|
|
||||||
|
room.curren_turn_seat = reloadInfo["active_seat"]
|
||||||
|
local info_list = reloadInfo["info_list"]
|
||||||
|
if playing == true then
|
||||||
|
room.CurnrenState = StateType.Palying
|
||||||
|
room.game_status = 1
|
||||||
|
|
||||||
|
|
||||||
|
for i = 1, #info_list do
|
||||||
|
local p = room:GetPlayerById(info_list[i]["playerid"])
|
||||||
|
|
||||||
|
if p == room.self_player then
|
||||||
|
p.hand_list = reloadInfo["hand_card"]
|
||||||
|
p.open = reloadInfo["open"]
|
||||||
|
end
|
||||||
|
|
||||||
|
p.hand_count = info_list[i]["card_size"]
|
||||||
|
p.piao = info_list[i]["piao"]
|
||||||
|
p.handCards = info_list[i]["handCards"]
|
||||||
|
p.outCards = info_list[i]["outCards"]
|
||||||
|
local last_outcard = info_list[i]["last_outcard"]
|
||||||
|
if last_outcard ~= nil and last_outcard[1] ~= 0 then
|
||||||
|
local out_card_list = _ctr_game:ChangeCodeByFrom(last_outcard.card_list, true)
|
||||||
|
local card_type, number, length, plan_three_count = _ctr_game:GetCardListInfo(out_card_list)
|
||||||
|
p.out_card_list = _ctr_game:GetSortOutCardList(out_card_list, card_type, number, plan_three_count)
|
||||||
|
else
|
||||||
|
p.out_card_list = { 0 }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
-- -- print("aaaaaaaaaaaaaaaa1111111111111111111111111")
|
||||||
|
--pt(s2croom)
|
||||||
|
room.game_status = 1
|
||||||
|
|
||||||
|
room.CurnrenState = StateType.PalyingWait
|
||||||
|
|
||||||
|
room.winseat = reloadInfo["winseat"]
|
||||||
|
room.remaincards = reloadInfo["remaincards"]
|
||||||
|
|
||||||
|
for i = 1, #info_list do
|
||||||
|
local playerData = info_list[i]
|
||||||
|
local p = room:GetPlayerById(playerData["playerid"])
|
||||||
|
|
||||||
|
p.ready = playerData["certainseat"] == 1 and true or false
|
||||||
|
|
||||||
|
local last_outcard = info_list[i]["last_outcard"]
|
||||||
|
if last_outcard ~= nil and last_outcard[1] ~= 0 then
|
||||||
|
local out_card_list = _ctr_game:ChangeCodeByFrom(last_outcard.card_list, true)
|
||||||
|
local card_type, number, length, plan_three_count = _ctr_game:GetCardListInfo(out_card_list)
|
||||||
|
p.out_card_list = _ctr_game:GetSortOutCardList(out_card_list, card_type, number, plan_three_count)
|
||||||
|
else
|
||||||
|
p.out_card_list = { 0 }
|
||||||
|
end
|
||||||
|
|
||||||
|
p.hand_list = info_list[i]["cards"]
|
||||||
|
p.winscore = info_list[i]["winscore"]
|
||||||
|
p.piao = info_list[i]["piao"]
|
||||||
|
p.hand_count = info_list[i]["card_size"]
|
||||||
|
p.thisboomnum = info_list[i]["thisboomnum"]
|
||||||
|
p.open = info_list[i]["open"]
|
||||||
|
|
||||||
|
p.handCards = info_list[i]["handCards"]
|
||||||
|
p.outCards = info_list[i]["outCards"]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
room.CurnrenState = StateType.Ready
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:FillPlayBackData(pd_data)
|
||||||
|
local room = DataManager.CurrenRoom
|
||||||
|
local _tableInfo = pd_data["info"]
|
||||||
|
|
||||||
|
local _config = _tableInfo["config"]
|
||||||
|
room.room_id = _tableInfo.room_id
|
||||||
|
room.room_config = ExRoomConfig.new(_config)
|
||||||
|
room.owner_id = _config["ownerid"]
|
||||||
|
local active_seat = _tableInfo["active_seat"]
|
||||||
|
local bank_seat = _tableInfo["banker_seat"]
|
||||||
|
room.banker_seat = bank_seat
|
||||||
|
room.curren_turn_seat = active_seat
|
||||||
|
room.curren_round = _tableInfo["round"]
|
||||||
|
local _info_list = _tableInfo["playerData"]
|
||||||
|
for i = 1, #_info_list do
|
||||||
|
local _jp = _info_list[i]
|
||||||
|
local p = ExPlayer.new()
|
||||||
|
p.seat = _jp["seat"]
|
||||||
|
p.aid = _jp["aid"]
|
||||||
|
local pid = _jp["aid"]
|
||||||
|
if p.aid == DataManager.SelfUser.account_id then
|
||||||
|
room.self_player = p
|
||||||
|
end
|
||||||
|
local u = User.new()
|
||||||
|
u.account_id = pid
|
||||||
|
p.self_user = u
|
||||||
|
u.nick_name = _jp["nick"]
|
||||||
|
u.head_url = _jp["portrait"]
|
||||||
|
u.sex = _jp["sex"]
|
||||||
|
-- end
|
||||||
|
p.self_user.host_ip = p.self_user.host_ip
|
||||||
|
local _hand_card = _jp["hand_card"]
|
||||||
|
p.hand_list = _hand_card
|
||||||
|
p.hand_count = #_hand_card
|
||||||
|
p.total_score = _jp["score"]
|
||||||
|
p.piao = _jp["piao"]
|
||||||
|
p.open = _jp["open"]
|
||||||
|
p.hp_info = _jp["hp_info"]
|
||||||
|
if _jp['hp_info'] then
|
||||||
|
p.cur_hp = _jp.hp_info.cur_hp
|
||||||
|
p.total_hp = _jp.hp_info.total_hp
|
||||||
|
end
|
||||||
|
room:AddPlayer(p)
|
||||||
|
end
|
||||||
|
room.cmdList = pd_data["cmdList"]
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:LoadConfigToDetail(data)
|
||||||
|
return data
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
---
|
||||||
|
--- Created by 谌建军.
|
||||||
|
--- DateTime: 2017/12/13 10:42
|
||||||
|
---
|
||||||
|
local ExPlayer = {
|
||||||
|
-- 手牌列表
|
||||||
|
hand_count = 0,
|
||||||
|
out_card_list = {},
|
||||||
|
hand_list = {},
|
||||||
|
isOneCard = false, -- 报单
|
||||||
|
}
|
||||||
|
|
||||||
|
local M = ExPlayer
|
||||||
|
|
||||||
|
--- Create a new EXPlayer
|
||||||
|
function M.new()
|
||||||
|
setmetatable(M, { __index = Player })
|
||||||
|
local self = setmetatable({}, { __index = M })
|
||||||
|
self.hand_count = 0
|
||||||
|
self.out_card_list = {}
|
||||||
|
self.hand_list = {}
|
||||||
|
self.isOneCard = false
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 清理玩家数据
|
||||||
|
function M:Clear()
|
||||||
|
Player.Clear(self)
|
||||||
|
self.hand_count = 0
|
||||||
|
self.out_card_list = {}
|
||||||
|
self.hand_list = {}
|
||||||
|
self.isOneCard = false
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
|
|
@ -0,0 +1,94 @@
|
||||||
|
local MainRightPanelView = require("Game.View.MainRightPanelView")
|
||||||
|
local ExRightPanelView = {}
|
||||||
|
local M = ExRightPanelView
|
||||||
|
local function __init(self, mainView, view)
|
||||||
|
local right_panel = view
|
||||||
|
|
||||||
|
local btn_setting = mainView._view:GetChild("Btn_Setting")
|
||||||
|
btn_setting.onClick:Set(function()
|
||||||
|
print("lingmengmainview", mainView.dismiss_room_cd_time)
|
||||||
|
local _settingView = mainView:NewSettingView()
|
||||||
|
_settingView:Show()
|
||||||
|
end)
|
||||||
|
-- btn_setting.onClick:Set(function()
|
||||||
|
-- local _settingView = mainView:NewSettingView()
|
||||||
|
-- _settingView.stateIndex = (mainView._room.curren_round >= 1 and mainView._allow_dissmiss) and 2 or 1
|
||||||
|
-- _settingView.cd_time = mainView.dismiss_room_cd_time
|
||||||
|
-- _settingView:Show()
|
||||||
|
|
||||||
|
-- local room = DataManager.CurrenRoom
|
||||||
|
-- _settingView.onCallback:Add(function(context)
|
||||||
|
-- local _gamectr = ControllerManager.GetController(GameController)
|
||||||
|
-- if (room.CurnrenState == StateType.Ready) then
|
||||||
|
-- _gamectr:LevelRoom(function(response)
|
||||||
|
-- if (response.ReturnCode == 0) then
|
||||||
|
-- ViewManager.ChangeView(ViewManager.View_Lobby)
|
||||||
|
-- GameApplication.Instance:ShowTips("房间已解散!")
|
||||||
|
-- end
|
||||||
|
-- end)
|
||||||
|
-- else
|
||||||
|
-- -- print("mainView.dismiss_room_cd_time"..mainView.dismiss_room_cd_time)
|
||||||
|
-- if mainView.dismiss_room_cd_time > 0 then
|
||||||
|
-- GameApplication.Instance:ShowTips("您还处于解散冷却时间当中,请稍后重试!")
|
||||||
|
-- else
|
||||||
|
-- _gamectr:AskDismissRoom()
|
||||||
|
-- end
|
||||||
|
-- end
|
||||||
|
-- end)
|
||||||
|
-- end)
|
||||||
|
|
||||||
|
-- self._tex_data = right_panel:GetChild("tex_data")
|
||||||
|
self._tex_time = mainView._view:GetChild("Text_Time")
|
||||||
|
self._pb_batteryLevel = mainView._view:GetChild("PB_Battery")
|
||||||
|
-- self._xinhao = right_panel:GetController("xinhao")
|
||||||
|
-- self.ctr_xh = right_panel:GetChild("gcm_xinhao"):GetController("c1")
|
||||||
|
-- self.ctr_wifi = right_panel:GetChild("gcm_wifi"):GetController("c1")
|
||||||
|
-- self._tex_ping = right_panel:GetChild("gcm_xinhao"):GetChild("n7")
|
||||||
|
|
||||||
|
-- self.ctr_log = right_panel:GetController("log")
|
||||||
|
-- local btn_log = right_panel:GetChild("btn_log")
|
||||||
|
-- btn_log.onClick:Set(function()
|
||||||
|
-- if self.onLogCallback then
|
||||||
|
-- self.onLogCallback()
|
||||||
|
-- end
|
||||||
|
-- end)
|
||||||
|
|
||||||
|
self._total_time = 0
|
||||||
|
self:__UpdateTime()
|
||||||
|
|
||||||
|
-- self._timer = Timer.New(handler(self,self.__UpdateTime),10,-1,true)
|
||||||
|
-- self._timer:Start()
|
||||||
|
end
|
||||||
|
function ExRightPanelView.new(mainView, view)
|
||||||
|
setmetatable(M, { __index = MainRightPanelView })
|
||||||
|
local self = setmetatable({}, { __index = M })
|
||||||
|
self.class = "ExRightPanelView"
|
||||||
|
__init(self, mainView, view)
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:__UpdateTime()
|
||||||
|
-- self._tex_data.text = os.date("%Y-%m-%d")
|
||||||
|
self._tex_time.text = os.date("%H:%M")
|
||||||
|
if Application.platform == RuntimePlatform.IPhonePlayer or Application.platform == RuntimePlatform.Android then
|
||||||
|
self._pb_batteryLevel.value = GameApplication.Instance:GetBatteryLevel()
|
||||||
|
end
|
||||||
|
|
||||||
|
-- local NetworkReachability = UnityEngine.NetworkReachability
|
||||||
|
-- local _client = ControllerManager.GameNetClinet
|
||||||
|
-- if not _client then return end
|
||||||
|
-- local ping = _client:getAveragePingTime()
|
||||||
|
-- if not ping then return end
|
||||||
|
-- ping = math.floor(ping / 2)
|
||||||
|
-- if ping > 300 then ping = 300 end
|
||||||
|
-- if ping <= 100 then
|
||||||
|
-- self.ctr_xh.selectedIndex = 0
|
||||||
|
-- elseif ping <= 300 then
|
||||||
|
-- self.ctr_xh.selectedIndex = 1
|
||||||
|
-- else
|
||||||
|
-- self.ctr_xh.selectedIndex = 2
|
||||||
|
-- end
|
||||||
|
-- self._tex_ping.text = ping .. "ms"
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
---
|
||||||
|
--- Created by 谌建军.
|
||||||
|
--- DateTime: 2017/12/19 14:36
|
||||||
|
---
|
||||||
|
local ExPlayer = import(".ExPlayer")
|
||||||
|
|
||||||
|
local ExRoom = {
|
||||||
|
}
|
||||||
|
|
||||||
|
local M = ExRoom
|
||||||
|
|
||||||
|
--- Create a new EXPlayer
|
||||||
|
function M.new()
|
||||||
|
setmetatable(M, { __index = Room })
|
||||||
|
local self = setmetatable({}, { __index = M })
|
||||||
|
self:init()
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:NewPlayer()
|
||||||
|
return ExPlayer.new()
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
|
|
@ -0,0 +1,490 @@
|
||||||
|
---
|
||||||
|
--- Created by 谌建军.
|
||||||
|
--- DateTime: 2017/12/19 10:54
|
||||||
|
---
|
||||||
|
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
|
||||||
|
|
||||||
|
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 self.isNonnegative == nil then
|
||||||
|
self.isNonnegative = 0
|
||||||
|
end
|
||||||
|
self.energyTab = config.energyTab
|
||||||
|
|
||||||
|
if self.energyTab == nil then
|
||||||
|
self.energyTab = 0
|
||||||
|
end
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--[[function M:GetDes(sp)
|
||||||
|
sp = sp or " "
|
||||||
|
local str = ""
|
||||||
|
-- str = str.. self.Times.."局"..sp
|
||||||
|
str = str .. RoomConfig.GetDes(self, sp).." "
|
||||||
|
local count=1
|
||||||
|
if self.Leaf == 1 then
|
||||||
|
str = str.. "15张玩法"
|
||||||
|
count=count+1
|
||||||
|
if count%2==0 then
|
||||||
|
str = str .."\n"
|
||||||
|
else
|
||||||
|
sp1=""
|
||||||
|
local strL=2
|
||||||
|
for i=1,strL do
|
||||||
|
sp1=sp1.." "
|
||||||
|
end
|
||||||
|
str = str .. sp1..sp
|
||||||
|
end
|
||||||
|
else
|
||||||
|
str = str.. "16张玩法"
|
||||||
|
count=count+1
|
||||||
|
if count%2==0 then
|
||||||
|
str = str .."\n"
|
||||||
|
else
|
||||||
|
sp1=""
|
||||||
|
local strL=2
|
||||||
|
for i=1,strL do
|
||||||
|
sp1=sp1.." "
|
||||||
|
end
|
||||||
|
str = str .. sp1..sp
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.Rule == 1 then
|
||||||
|
str = str.. "第一局黑桃3先出,随后赢家先出".."\n"
|
||||||
|
else
|
||||||
|
str = str.. "第一局系统随机选一张先出,随后赢家先出".."\n"
|
||||||
|
end
|
||||||
|
count=0
|
||||||
|
|
||||||
|
if self.WillBeOut == 1 then
|
||||||
|
str = str.. "能出必出"
|
||||||
|
count=count+1
|
||||||
|
if count%2==0 then
|
||||||
|
str = str .."\n"
|
||||||
|
else
|
||||||
|
sp1=""
|
||||||
|
local strL=2
|
||||||
|
for i=1,strL do
|
||||||
|
sp1=sp1.." "
|
||||||
|
end
|
||||||
|
str = str .. sp1..sp
|
||||||
|
end
|
||||||
|
else
|
||||||
|
str = str.. "可不必出"
|
||||||
|
count=count+1
|
||||||
|
if count%2==0 then
|
||||||
|
str = str .."\n"
|
||||||
|
else
|
||||||
|
sp1=""
|
||||||
|
local strL=2
|
||||||
|
for i=1,strL do
|
||||||
|
sp1=sp1.." "
|
||||||
|
end
|
||||||
|
str = str .. sp1..sp
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if self.showlength == 1 then
|
||||||
|
str = str.. "显示剩余牌"
|
||||||
|
count=count+1
|
||||||
|
if count%2==0 then
|
||||||
|
str = str .."\n"
|
||||||
|
else
|
||||||
|
sp1=""
|
||||||
|
local strL=1
|
||||||
|
for i=1,strL do
|
||||||
|
sp1=sp1.." "
|
||||||
|
end
|
||||||
|
str = str .. sp1..sp
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if self.fourBeltThree == 3 then
|
||||||
|
str = str.. "四带三"
|
||||||
|
count=count+1
|
||||||
|
if count%2==0 then
|
||||||
|
str = str .."\n"
|
||||||
|
else
|
||||||
|
sp1=""
|
||||||
|
local strL=3
|
||||||
|
for i=1,strL do
|
||||||
|
sp1=sp1.." "
|
||||||
|
end
|
||||||
|
str = str .. sp1..sp
|
||||||
|
end
|
||||||
|
elseif self.fourBeltThree == 2 then
|
||||||
|
str = str.. "四带二"
|
||||||
|
count=count+1
|
||||||
|
if count%2==0 then
|
||||||
|
str = str .."\n"
|
||||||
|
else
|
||||||
|
sp1=""
|
||||||
|
local strL=3
|
||||||
|
for i=1,strL do
|
||||||
|
sp1=sp1.." "
|
||||||
|
end
|
||||||
|
str = str .. sp1..sp
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if self.Heart10 == 1 then
|
||||||
|
str = str.. "红桃10分数翻倍"
|
||||||
|
count=count+1
|
||||||
|
if count%2==0 then
|
||||||
|
str = str .."\n"
|
||||||
|
else
|
||||||
|
sp1=""
|
||||||
|
local strL=0
|
||||||
|
for i=1,strL do
|
||||||
|
sp1=sp1.." "
|
||||||
|
end
|
||||||
|
str = str .. sp1..sp
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.BombSpring == 1 then
|
||||||
|
str = str.. "\n4个3 或者3个A 1个2 春天\n"
|
||||||
|
end
|
||||||
|
if self.demolition == 1 then
|
||||||
|
str = str.. "炸弹不能拆"
|
||||||
|
count=count+1
|
||||||
|
if count%2==0 then
|
||||||
|
str = str .."\n"
|
||||||
|
else
|
||||||
|
sp1=""
|
||||||
|
local strL=1
|
||||||
|
for i=1,strL do
|
||||||
|
sp1=sp1.." "
|
||||||
|
end
|
||||||
|
str = str .. sp1..sp
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if self.fangzuobi == 1 and self.PlayerNum==3 then
|
||||||
|
str = str.. "防作弊"
|
||||||
|
count=count+1
|
||||||
|
if count%2==0 then
|
||||||
|
str = str .."\n"
|
||||||
|
else
|
||||||
|
sp1=""
|
||||||
|
local strL=3
|
||||||
|
for i=1,strL do
|
||||||
|
sp1=sp1.." "
|
||||||
|
end
|
||||||
|
str = str .. sp1..sp
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.sandaidan == 1 then
|
||||||
|
str = str.. "\n三张飞机带单或者对子\n"
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.ba == 1 then
|
||||||
|
str = str.. "炸弹分数算赢家"
|
||||||
|
count=count+1
|
||||||
|
if count%2==0 then
|
||||||
|
str = str .."\n"
|
||||||
|
else
|
||||||
|
sp1=""
|
||||||
|
local strL=0
|
||||||
|
for i=1,strL do
|
||||||
|
sp1=sp1.." "
|
||||||
|
end
|
||||||
|
str = str .. sp1..sp
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.fs == 1 then
|
||||||
|
str = str.. "反春天"
|
||||||
|
count=count+1
|
||||||
|
if count%2==0 then
|
||||||
|
str = str .."\n"
|
||||||
|
else
|
||||||
|
sp1=""
|
||||||
|
local strL=3
|
||||||
|
for i=1,strL do
|
||||||
|
sp1=sp1.." "
|
||||||
|
end
|
||||||
|
str = str .. sp1..sp
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
if self.planelack == 1 then
|
||||||
|
str = str.. "飞机少带可接完"
|
||||||
|
count=count+1
|
||||||
|
if count%2==0 then
|
||||||
|
str = str .."\n"
|
||||||
|
else
|
||||||
|
sp1=""
|
||||||
|
local strL=0
|
||||||
|
for i=1,strL do
|
||||||
|
sp1=sp1.." "
|
||||||
|
end
|
||||||
|
str = str .. sp1..sp
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if self.threelack == 1 then
|
||||||
|
str = str.. "三张少带可接完"
|
||||||
|
count=count+1
|
||||||
|
if count%2==0 then
|
||||||
|
str = str .."\n"
|
||||||
|
else
|
||||||
|
sp1=""
|
||||||
|
local strL=0
|
||||||
|
for i=1,strL do
|
||||||
|
sp1=sp1.." "
|
||||||
|
end
|
||||||
|
str = str .. sp1..sp
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if self.threeA ==1 then
|
||||||
|
str = str.. "三张A算炸弹"
|
||||||
|
count=count+1
|
||||||
|
if count%2==0 then
|
||||||
|
str = str .."\n"
|
||||||
|
else
|
||||||
|
sp1=""
|
||||||
|
local strL=0
|
||||||
|
for i=1,strL do
|
||||||
|
sp1=sp1.." "
|
||||||
|
end
|
||||||
|
str = str .. sp1..sp
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.piao == 0 then
|
||||||
|
|
||||||
|
elseif self.piao == 1 then
|
||||||
|
str = str.. "飘123"
|
||||||
|
count=count+1
|
||||||
|
if count%2==0 then
|
||||||
|
str = str .."\n"
|
||||||
|
else
|
||||||
|
sp1=""
|
||||||
|
local strL=3
|
||||||
|
for i=1,strL do
|
||||||
|
sp1=sp1.." "
|
||||||
|
end
|
||||||
|
str = str .. sp1..sp
|
||||||
|
end
|
||||||
|
elseif self.piao == 2 then
|
||||||
|
str = str.. "飘235"
|
||||||
|
count=count+1
|
||||||
|
if count%2==0 then
|
||||||
|
str = str .."\n"
|
||||||
|
else
|
||||||
|
sp1=""
|
||||||
|
local strL=3
|
||||||
|
for i=1,strL do
|
||||||
|
sp1=sp1.." "
|
||||||
|
end
|
||||||
|
str = str .. sp1..sp
|
||||||
|
end
|
||||||
|
elseif self.piao == 3 then
|
||||||
|
str = str.. "飘258"
|
||||||
|
count=count+1
|
||||||
|
if count%2==0 then
|
||||||
|
str = str .."\n"
|
||||||
|
else
|
||||||
|
sp1=""
|
||||||
|
local strL=3
|
||||||
|
for i=1,strL do
|
||||||
|
sp1=sp1.." "
|
||||||
|
end
|
||||||
|
str = str .. sp1..sp
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.daniao == 1 then
|
||||||
|
str = str.. "打鸟+10"
|
||||||
|
count=count+1
|
||||||
|
if count%2==0 then
|
||||||
|
str = str .."\n"
|
||||||
|
else
|
||||||
|
sp1=""
|
||||||
|
local strL=3
|
||||||
|
for i=1,strL do
|
||||||
|
sp1=sp1.." "
|
||||||
|
end
|
||||||
|
str = str .. sp1..sp
|
||||||
|
end
|
||||||
|
elseif self.daniao == 2 then
|
||||||
|
str = str.. "打鸟+20"
|
||||||
|
count=count+1
|
||||||
|
if count%2==0 then
|
||||||
|
str = str .."\n"
|
||||||
|
else
|
||||||
|
sp1=""
|
||||||
|
local strL=3
|
||||||
|
for i=1,strL do
|
||||||
|
sp1=sp1.." "
|
||||||
|
end
|
||||||
|
str = str .. sp1..sp
|
||||||
|
end
|
||||||
|
elseif self.daniao == 3 then
|
||||||
|
str = str.. "打鸟+50"
|
||||||
|
count=count+1
|
||||||
|
if count%2==0 then
|
||||||
|
str = str .."\n"
|
||||||
|
else
|
||||||
|
sp1=""
|
||||||
|
local strL=3
|
||||||
|
for i=1,strL do
|
||||||
|
sp1=sp1.." "
|
||||||
|
end
|
||||||
|
str = str .. sp1..sp
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return str
|
||||||
|
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
|
||||||
|
|
||||||
|
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.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.ba == 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.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
|
||||||
|
|
||||||
|
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
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:GetGameJS()
|
||||||
|
local gamerulepanel = UIPackage.CreateObjectFromURL("ui://Extend_Poker_RunFastNew/gamerule")
|
||||||
|
return gamerulepanel
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:GetGameSMSize()
|
||||||
|
return 467, 500
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:GetGameName()
|
||||||
|
return "跑得快"
|
||||||
|
end
|
||||||
|
|
||||||
|
--function M:GetIsShowCardNumber()
|
||||||
|
-- return self.ShowNumber == 1
|
||||||
|
--end
|
||||||
|
|
||||||
|
return M
|
||||||
|
|
@ -94,7 +94,7 @@ function M:UpdateHandCard(getcard, mp)
|
||||||
else
|
else
|
||||||
btn_card = self._view_handCardList:AddItemFromPool()
|
btn_card = self._view_handCardList:AddItemFromPool()
|
||||||
end
|
end
|
||||||
self:FillHandCard(i, btn_card, tem_card)
|
self:FillHandCard(i, btn_card, tem_card, true)
|
||||||
-- btn_card.onClick:Set(handler(self, self.__OnClickHandCard))
|
-- btn_card.onClick:Set(handler(self, self.__OnClickHandCard))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -104,134 +104,155 @@ function M:UpdateHandCard(getcard, mp)
|
||||||
self._ctr_getCard.selectedIndex = 0
|
self._ctr_getCard.selectedIndex = 0
|
||||||
end
|
end
|
||||||
self._view_handCardList.onClickItem:Set(function(context)
|
self._view_handCardList.onClickItem:Set(function(context)
|
||||||
print("lingemng_view_handCardList")
|
|
||||||
self:__OnClickHandCard(context)
|
self:__OnClickHandCard(context)
|
||||||
end)
|
end)
|
||||||
self._ctr_seletedGet.selectedIndex = 1
|
|
||||||
self._view_handCardList.selectedIndex = -1
|
self:ClearMove()
|
||||||
self._click_index = self._view_handCardList.selectedIndex
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:FillHandCard(i, btn_card, tem_card)
|
function M:FillHandCard(i, btn_card, tem_card, event)
|
||||||
local handCardName = self._viewText_cardInfo['Hand_Card']
|
local handCardName = self._viewText_cardInfo['Hand_Card']
|
||||||
|
|
||||||
self:fillCard2(btn_card, handCardName, tem_card)
|
self:fillCard2(btn_card, handCardName, tem_card)
|
||||||
local c_v = NewCardView(btn_card, tem_card)
|
local c_v = NewCardView(btn_card, tem_card)
|
||||||
c_v.index = i
|
c_v.index = i
|
||||||
c_v.old_postion = btn_card.xy
|
c_v.old_postion = btn_card.xy
|
||||||
|
c_v.touch_pos = Vector2.New(btn_card.width / 2, btn_card.height / 2)
|
||||||
btn_card.data = c_v
|
btn_card.data = c_v
|
||||||
btn_card.onTouchBegin:Set(handler(self, self.onTouchBegin))
|
if event then
|
||||||
btn_card.onTouchMove:Set(handler(self, self.onTouchMove))
|
btn_card.onTouchBegin:Set(handler(self, self.onTouchBegin))
|
||||||
btn_card.onTouchEnd:Set(handler(self, self.__OnDragEnd))
|
btn_card.onTouchMove:Set(handler(self, self.onTouchMove))
|
||||||
|
btn_card.onTouchEnd:Set(handler(self, self.__OnDragEnd))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:onTouchBegin(context)
|
function M:onTouchBegin(context)
|
||||||
-- self.touch = true
|
self.touch = true
|
||||||
local button = context.sender
|
local button = context.sender
|
||||||
self._touchPos = button.xy
|
self.touchPos = Vector2.New(context.inputEvent.x, context.inputEvent.y)
|
||||||
local card = button.data
|
self:ClearMove()
|
||||||
self._touchIndex = card.index
|
|
||||||
|
|
||||||
card.touch_pos = Vector2.New(button.width / 2, button.height / 2)
|
|
||||||
|
|
||||||
local xy_event = Vector2.New(context.inputEvent.x, context.inputEvent.y)
|
|
||||||
local xy_btnCard = self._view_getCard:GlobalToLocal(Vector2.New(context.inputEvent.x, context.inputEvent.y))
|
|
||||||
if self.__OnDragStart then
|
|
||||||
self:__OnDragStart(button, xy_event, xy_btnCard.x >= 0)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:onTouchMove(context)
|
function M:onTouchMove(context)
|
||||||
local button = context.sender
|
local button = context.sender
|
||||||
|
local xy = self._view_handCardList:GlobalToLocal(Vector2.New(context.inputEvent.x, context.inputEvent.y))
|
||||||
|
self.touchStart = true
|
||||||
|
if xy.y <= -35 or self.isMoive then
|
||||||
|
self.isMoive = true
|
||||||
|
if self.touch then
|
||||||
|
if self.ischoose then
|
||||||
|
if self._ctr_seletedGet.selectedIndex == 0 then
|
||||||
|
button = self._view_getCard:GetChildAt(0)
|
||||||
|
else
|
||||||
|
button = self._view_handCardList:GetChildAt(self._view_handCardList.selectedIndex)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local xy_event = Vector2.New(context.inputEvent.x, context.inputEvent.y)
|
||||||
|
local xy_btnCard = self._view_getCard:GlobalToLocal(Vector2.New(context.inputEvent.x, context.inputEvent.y))
|
||||||
|
if self.__OnDragStart then
|
||||||
|
self:__OnDragStart(button, xy_event)
|
||||||
|
end
|
||||||
|
self.touch = false
|
||||||
|
end
|
||||||
|
self:outCardMove(context)
|
||||||
|
else
|
||||||
|
self.ischoose = true
|
||||||
|
local touchPos = self._view_handCardList:GetChildAt(0):GlobalToLocal(Vector2.New(context.inputEvent.x,
|
||||||
|
context.inputEvent.y))
|
||||||
|
local cardWidth = button.width;
|
||||||
|
local grap = self._view_handCardList.columnGap
|
||||||
|
local chooseIndex = math.floor(touchPos.x / (cardWidth + grap))
|
||||||
|
|
||||||
-- if self.touch then
|
if chooseIndex >= self._view_handCardList.numItems then
|
||||||
-- local xy_event = Vector2.New(context.inputEvent.x, context.inputEvent.y)
|
if touchPos.x > cardWidth + (cardWidth + grap) * (self._view_handCardList.numItems - 1) and self.getcard then
|
||||||
-- local xy_btnCard = self._view_getCard:GlobalToLocal(Vector2.New(context.inputEvent.x, context.inputEvent.y))
|
self:ChooseOut()
|
||||||
-- if self.__OnDragStart then
|
else
|
||||||
-- self:__OnDragStart(button, xy_event, xy_btnCard.x >= 0)
|
if self._view_handCardList.selectedIndex ~= self._view_handCardList.numItems - 1 then
|
||||||
-- end
|
self:ChooseHand(self._view_handCardList.numItems - 1)
|
||||||
-- self.touch = false
|
end
|
||||||
-- end
|
end
|
||||||
|
else
|
||||||
|
if self._view_handCardList.selectedIndex ~= chooseIndex then
|
||||||
|
self:ChooseHand(chooseIndex)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local card = button.data
|
-- local card = button.data
|
||||||
local xy = GRoot.inst:GlobalToLocal(Vector2.New(context.inputEvent.x, context.inputEvent.y))
|
-- local xy = GRoot.inst:GlobalToLocal(Vector2.New(context.inputEvent.x, context.inputEvent.y))
|
||||||
button.xy = xy - card.touch_pos
|
-- button.xy = xy - card.touch_pos
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:__OnDragStart(button, xy_event, isGet)
|
function M:__OnDragStart(button, xy_event, isGet)
|
||||||
-- self.touchStart = true
|
button:GetController('move').selectedIndex = 1
|
||||||
local card = button.data
|
|
||||||
|
|
||||||
|
local card = button.data
|
||||||
--复制一个按钮
|
--复制一个按钮
|
||||||
|
|
||||||
if isGet then
|
local btn_card = self._view_getCard:GetFromPool(nil)
|
||||||
local btn_card = self._view_getCard:AddItemFromPool()
|
self._outCardMove = btn_card
|
||||||
|
|
||||||
self:FillHandCard(card.index, btn_card, card.card_item)
|
|
||||||
btn_card:GetController('move').selectedIndex = 1
|
|
||||||
self._ctr_seletedGet.selectedIndex = 0
|
|
||||||
self._view_handCardList.selectedIndex = -1
|
|
||||||
else
|
|
||||||
local btn_card = self._view_handCardList:GetFromPool("")
|
|
||||||
|
|
||||||
self:FillHandCard(card.index, btn_card, card.card_item)
|
|
||||||
btn_card:GetController('move').selectedIndex = 1
|
|
||||||
self._view_handCardList:AddChildAt(btn_card, card.index)
|
|
||||||
self._view_handCardList.selectedIndex = card.index
|
|
||||||
self._ctr_seletedGet.selectedIndex = 1
|
|
||||||
end
|
|
||||||
|
|
||||||
|
self:FillHandCard(card.index, btn_card, card.card_item, false)
|
||||||
|
|
||||||
local xy = GRoot.inst:GlobalToLocal(xy_event)
|
local xy = GRoot.inst:GlobalToLocal(xy_event)
|
||||||
|
|
||||||
--将虚影按钮替换移动的按钮
|
--将虚影按钮替换移动的按钮
|
||||||
-- GRoot.inst:BringToFront(button)
|
-- GRoot.inst:BringToFront(button)
|
||||||
GRoot.inst:AddChild(button)
|
GRoot.inst:AddChild(btn_card)
|
||||||
button.xy = xy - card.touch_pos
|
self._outCardMove.data = card
|
||||||
|
self._outCardMove.xy = xy - card.touch_pos
|
||||||
|
--设置弹起
|
||||||
|
-- if isGet then
|
||||||
|
-- self._view_handCardList.selectedIndex = -1
|
||||||
|
-- self._ctr_seletedGet.selectedIndex = 0
|
||||||
|
-- else
|
||||||
|
-- self._view_handCardList.selectedIndex = card.index
|
||||||
|
-- self._ctr_seletedGet.selectedIndex = 1
|
||||||
|
-- end
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:__OnDragEnd(context)
|
function M:__OnDragEnd(context)
|
||||||
-- if not self.touchStart then
|
if not self.touchStart then
|
||||||
-- return
|
return
|
||||||
-- end
|
end
|
||||||
-- self.touchStart = false
|
|
||||||
local button = context.sender
|
local button = context.sender
|
||||||
|
if self.ischoose then
|
||||||
|
if self._ctr_seletedGet.selectedIndex == 0 then
|
||||||
|
button = self._view_getCard:GetChildAt(0)
|
||||||
|
else
|
||||||
|
button = self._view_handCardList:GetChildAt(self._view_handCardList.selectedIndex)
|
||||||
|
end
|
||||||
|
end
|
||||||
local card = button.data
|
local card = button.data
|
||||||
local _room = DataManager.CurrenRoom
|
local _room = DataManager.CurrenRoom
|
||||||
if not _room or _room:GetReloadStatus() then return end
|
if not _room or _room:GetReloadStatus() then return end
|
||||||
|
|
||||||
local xy = self._view_handCardList:GlobalToLocal(Vector2.New(context.inputEvent.x, context.inputEvent.y))
|
local xy = self._view_handCardList:GlobalToLocal(Vector2.New(context.inputEvent.x, context.inputEvent.y))
|
||||||
local buttonHeight = button.height
|
local cardHeight = button.height
|
||||||
|
if ((xy.y < -35 or (self.ischoose and self._ctr_seletedGet.selectedIndex == 0) or (context.inputEvent.y - self.touchPos.y < -cardHeight * 0.2)) and _room.curren_outcard_seat == _room.self_player.seat) then
|
||||||
local temp_button = self._view_handCardList:GetChildAt(card.index)
|
|
||||||
|
|
||||||
if (xy.y < 0 - buttonHeight and _room.curren_outcard_seat == _room.self_player.seat) then
|
|
||||||
self._mainView:OutCard(card.card_item)
|
self._mainView:OutCard(card.card_item)
|
||||||
self.outcard_button = button
|
self.outcard_button = button
|
||||||
|
self:ClearChoose()
|
||||||
else
|
else
|
||||||
|
button:GetController('move').selectedIndex = 0
|
||||||
end
|
end
|
||||||
-- self:UpdateHandCard(self.getcard)
|
|
||||||
-- if self.getcard then
|
if self._outCardMove then
|
||||||
-- self._ctr_seletedGet.selectedIndex = 0
|
self._outCardMove:Dispose()
|
||||||
-- self._view_handCardList.selectedIndex = -1
|
end
|
||||||
-- self._click_index = self._view_handCardList.selectedIndex
|
self.isMoive = false
|
||||||
-- else
|
self.touch = false
|
||||||
-- self._ctr_seletedGet.selectedIndex = 1
|
self.ischoose = false
|
||||||
-- self._view_handCardList.selectedIndex = card.index
|
self.touchStart = false
|
||||||
-- self._click_index = self._view_handCardList.selectedIndex
|
|
||||||
-- end
|
|
||||||
temp_button:GetController('move').selectedIndex = 0
|
|
||||||
button:Dispose()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:outCardMove(context)
|
function M:outCardMove(context)
|
||||||
|
local card = self._outCardMove.data
|
||||||
|
local xy = GRoot.inst:GlobalToLocal(Vector2.New(context.inputEvent.x, context.inputEvent.y))
|
||||||
|
self._outCardMove.xy = xy - card.touch_pos
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:__OnClickHandCard(context)
|
function M:__OnClickHandCard(context)
|
||||||
print("lingmeng__OnClickHandCard")
|
|
||||||
self._ctr_seletedGet.selectedIndex = 1
|
self._ctr_seletedGet.selectedIndex = 1
|
||||||
self._flag_seletedGet = 0
|
self._flag_seletedGet = 0
|
||||||
local button = context.data
|
local button = context.data
|
||||||
|
|
@ -240,15 +261,12 @@ function M:__OnClickHandCard(context)
|
||||||
if ((Utils.IsDoubleClick(context) or self._click_index == self._view_handCardList.selectedIndex) and _room.curren_outcard_seat == _room.self_player.seat) then
|
if ((Utils.IsDoubleClick(context) or self._click_index == self._view_handCardList.selectedIndex) and _room.curren_outcard_seat == _room.self_player.seat) then
|
||||||
local card = button.data
|
local card = button.data
|
||||||
self._mainView:OutCard(card.card_item)
|
self._mainView:OutCard(card.card_item)
|
||||||
self._view_handCardList.selectedIndex = -1
|
self:ClearChoose()
|
||||||
self._click_index = self._view_handCardList.selectedIndex
|
|
||||||
self._ctr_seletedGet.selectedIndex = 1
|
|
||||||
end
|
end
|
||||||
self._click_index = self._view_handCardList.selectedIndex
|
self._click_index = self._view_handCardList.selectedIndex
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:__OnClickGetCard(context, flag)
|
function M:__OnClickGetCard(context, flag)
|
||||||
print("lingmeng__OnClickGetCard")
|
|
||||||
self._view_handCardList.selectedIndex = -1
|
self._view_handCardList.selectedIndex = -1
|
||||||
self._click_index = self._view_handCardList.selectedIndex
|
self._click_index = self._view_handCardList.selectedIndex
|
||||||
local button = context.sender
|
local button = context.sender
|
||||||
|
|
@ -256,48 +274,43 @@ function M:__OnClickGetCard(context, flag)
|
||||||
if ((Utils.IsDoubleClick(context) or self._flag_seletedGet == 1) and _room.curren_outcard_seat == _room.self_player.seat) then
|
if ((Utils.IsDoubleClick(context) or self._flag_seletedGet == 1) and _room.curren_outcard_seat == _room.self_player.seat) then
|
||||||
local card = button.data
|
local card = button.data
|
||||||
self._mainView:OutCard(card.card_item)
|
self._mainView:OutCard(card.card_item)
|
||||||
self._ctr_seletedGet.selectedIndex = 1
|
self:ClearChoose()
|
||||||
self._flag_seletedGet = 0
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
self._flag_seletedGet = 1
|
self._flag_seletedGet = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
-- function M:UpdateFzList(fz, index, show_card)
|
function M:ChooseHand(index)
|
||||||
-- -- local FZame = self._viewText_cardInfo['FZ_Card']
|
self._click_index = index
|
||||||
-- local FZame = "202_"
|
self._view_handCardList.selectedIndex = index
|
||||||
-- index = index or 0
|
self._ctr_seletedGet.selectedIndex = 1
|
||||||
-- show_card = show_card or nil
|
self._flag_seletedGet = 0
|
||||||
|
end
|
||||||
|
|
||||||
-- local outCard
|
function M:ChooseOut()
|
||||||
|
self._click_index = -1
|
||||||
|
self._view_handCardList.selectedIndex = -1
|
||||||
|
self._ctr_seletedGet.selectedIndex = 0
|
||||||
|
self._flag_seletedGet = 1
|
||||||
|
end
|
||||||
|
|
||||||
-- outCard = self._view_FZList:AddItemFromPool()
|
function M:ClearChoose()
|
||||||
|
self._click_index = -1
|
||||||
|
self._view_handCardList.selectedIndex = -1
|
||||||
|
self._ctr_seletedGet.selectedIndex = 1
|
||||||
|
self._flag_seletedGet = 0
|
||||||
|
end
|
||||||
|
|
||||||
-- if fz.type == FZType.Chi then
|
function M:ClearMove()
|
||||||
-- for i = 1, 3 do
|
self:ClearChoose()
|
||||||
-- local FZCard = outCard:GetChild(string.format("Comp_Card%d", i))
|
if self._outCardMove then
|
||||||
-- self:fillCard2(FZCard, FZame, fz.opcard[i])
|
self._outCardMove:Dispose()
|
||||||
-- end
|
end
|
||||||
-- else
|
self.isMoive = false
|
||||||
-- local ctr_Four = outCard:GetController("isFour")
|
self.touch = false
|
||||||
-- for i = 1, 3 do
|
self.ischoose = false
|
||||||
-- local FZCard = outCard:GetChild(string.format("Comp_Card%d", i))
|
self.touchStart = false
|
||||||
-- self:fillCard2(FZCard, FZame, fz.card)
|
end
|
||||||
-- end
|
|
||||||
-- if fz.type == FZType.Peng then
|
|
||||||
-- ctr_Four.selectedIndex = 0
|
|
||||||
-- else
|
|
||||||
-- ctr_Four.selectedIndex = 1
|
|
||||||
-- local FZCard = outCard:GetChild(string.format("Comp_Card%d", 4))
|
|
||||||
-- self:fillCard2(FZCard, FZame, fz.card)
|
|
||||||
-- if fz.type == FZType.Gang_An then
|
|
||||||
-- self:fillCard2(FZCard, FZame, '00')
|
|
||||||
-- elseif fz.type == FZType.Gang_Peng then
|
|
||||||
-- self._view_FZList:RemoveChildAt(self._view_FZList.numItems - 2)
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
|
|
||||||
-- 获取手牌资源位置,可以在扩展中复写
|
-- 获取手牌资源位置,可以在扩展中复写
|
||||||
function M:GetCardObjPack()
|
function M:GetCardObjPack()
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,157 @@
|
||||||
|
local TableBG = import('Game.Data.TableBG')
|
||||||
|
local PKSettingView = import('.PKSettingView')
|
||||||
|
local MainRightPanelView = import('Game.View.MainRightPanelView')
|
||||||
|
|
||||||
|
---
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
setmetatable(M, { __index = MainView })
|
||||||
|
|
||||||
|
local pk_default_bg = 1
|
||||||
|
local pk_bg_config = {
|
||||||
|
{ id = 1, url = 'base/main_poker/bg/bg3', thumb = 'ui://Main_Poker/bg3' },
|
||||||
|
{ id = 2, url = 'base/main_poker/bg/bg2', thumb = 'ui://Main_Poker/bg2' },
|
||||||
|
{ id = 3, url = 'base/main_poker/bg/bg1', thumb = 'ui://Main_Poker/bg1' }
|
||||||
|
}
|
||||||
|
|
||||||
|
-- settingViewType:1跑得快:显示换牌,隐藏返回和解散 2超级拼十:隐藏解散和换牌 3其他:隐藏换牌,根据是否观战显示解散和返回
|
||||||
|
-- ex_defaultbg 自定义默认背景编号
|
||||||
|
-- ex_bgconfig 自定义的背景
|
||||||
|
function M:InitView(url, isHideIpAdds, settingViewType, ex_defaultbg, ex_bgconfig, isHideJiesan, settingUrl)
|
||||||
|
UIPackage.AddPackage('base/main_poker/ui/Main_Poker')
|
||||||
|
MainView.InitView(self, url, isHideIpAdds)
|
||||||
|
|
||||||
|
local default_bg = ex_defaultbg or pk_default_bg
|
||||||
|
local bg_config = ex_bgconfig or pk_bg_config
|
||||||
|
-- 设置界面初始化方法
|
||||||
|
self.NewSettingView = function(self)
|
||||||
|
-- -- 根据settingViewType和self._state判断界面按钮功能显示
|
||||||
|
-- local stype = 0
|
||||||
|
-- local room = DataManager.CurrenRoom
|
||||||
|
-- local ispanguangzhe = room.self_player.seat == 0
|
||||||
|
-- if self._state.selectedIndex == 3 then
|
||||||
|
-- stype = 0
|
||||||
|
-- elseif settingViewType < 2 then
|
||||||
|
-- stype = settingViewType
|
||||||
|
-- elseif settingViewType == 2 then
|
||||||
|
-- if (ispanguangzhe or self._state.selectedIndex == 0) then
|
||||||
|
-- stype = 2
|
||||||
|
-- else
|
||||||
|
-- stype = 3
|
||||||
|
-- end
|
||||||
|
-- elseif settingViewType == 3 then
|
||||||
|
-- if not ispanguangzhe and self._state.selectedIndex > 0 then
|
||||||
|
-- stype = 3
|
||||||
|
-- else
|
||||||
|
-- stype = 2
|
||||||
|
-- end
|
||||||
|
-- end--self._root_view
|
||||||
|
print("lingmengmainview2", self.dismiss_room_cd_time)
|
||||||
|
local settingView = PKSettingView.new(self, 0, isHideJiesan, settingUrl,
|
||||||
|
handler(self, self.UpdateCardSize))
|
||||||
|
-- 获取MainView界面state控制器选项
|
||||||
|
-- settingView.__checkMainViewState = function()
|
||||||
|
-- return self._state.selectedIndex
|
||||||
|
-- end
|
||||||
|
-- -- 设置界面换牌功能回调
|
||||||
|
-- if settingViewType == 1 then
|
||||||
|
-- settingView.__changePokerCallBack = handler(self, self.UpdateCard)
|
||||||
|
-- settingView.__changePokerSizeCallBack = handler(self, self.UpdateCardSize)
|
||||||
|
-- end
|
||||||
|
-- settingView:FillBgSection(
|
||||||
|
-- function(url)
|
||||||
|
-- LoadGameBg(url, self._root_view)
|
||||||
|
-- end,
|
||||||
|
-- self._room.game_id,
|
||||||
|
-- default_bg,
|
||||||
|
-- bg_config
|
||||||
|
-- )
|
||||||
|
return settingView
|
||||||
|
end
|
||||||
|
|
||||||
|
local _view = self._view
|
||||||
|
TableBG.LoadTableBG(default_bg, self._room.game_id, self._root_view, bg_config)
|
||||||
|
local rightpanel = self._view:GetChild('right_panel')
|
||||||
|
if rightpanel then
|
||||||
|
self._rightPanelView = MainRightPanelView.new(self, rightpanel)
|
||||||
|
end
|
||||||
|
self:InitXiPai()
|
||||||
|
self:InitXiPai1()
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:InitXiPai()
|
||||||
|
self._xipaiPanel = UIPackage.CreateObjectFromURL("ui://Common/panel_handPoke")
|
||||||
|
self._root_view:AddChild(self._xipaiPanel)
|
||||||
|
|
||||||
|
local offset = get_offset(self._full_offset)
|
||||||
|
|
||||||
|
self._xipaiPanel.width = GRoot.inst.width - (offset * 2)
|
||||||
|
self._xipaiPanel.height = GRoot.inst.height
|
||||||
|
self._xipaiPanel.x = offset
|
||||||
|
|
||||||
|
self._xipaiPanel.visible = false
|
||||||
|
self._handAnimCtr = self._xipaiPanel:GetController("anim")
|
||||||
|
self._handAnimCtr.selectedIndex = 0
|
||||||
|
--self:PlayXiPai()
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:PlayXiPai(xipaiCallBack)
|
||||||
|
if self._xipaiPanel then
|
||||||
|
coroutine.start(function()
|
||||||
|
self._xipaiPanel.visible = true
|
||||||
|
self._xipaiPanel:GetTransition("XiPai"):Play()
|
||||||
|
self._handAnimCtr.selectedIndex = 1
|
||||||
|
coroutine.wait(3.5)
|
||||||
|
self._handAnimCtr.selectedIndex = 0
|
||||||
|
self._xipaiPanel.visible = false
|
||||||
|
if xipaiCallBack then
|
||||||
|
xipaiCallBack()
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:InitXiPai1()
|
||||||
|
self._xipaiPanel1 = UIPackage.CreateObjectFromURL("ui://Common/panel_handPoke02")
|
||||||
|
self._root_view:AddChild(self._xipaiPanel1)
|
||||||
|
|
||||||
|
local offset = get_offset(self._full_offset)
|
||||||
|
|
||||||
|
self._xipaiPanel1.width = GRoot.inst.width - (offset * 2)
|
||||||
|
self._xipaiPanel1.height = GRoot.inst.height
|
||||||
|
self._xipaiPanel1.x = offset
|
||||||
|
|
||||||
|
self._xipaiPanel1.visible = false
|
||||||
|
self._handAnimCtr1 = self._xipaiPanel1:GetController("anim")
|
||||||
|
self._handAnimCtr1.selectedIndex = 0
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:PlayXiPai1(xipaiCallBack)
|
||||||
|
if self._xipaiPanel1 then
|
||||||
|
coroutine.start(function()
|
||||||
|
self._xipaiPanel1.visible = true
|
||||||
|
self._xipaiPanel1:GetTransition("XiPai"):Play()
|
||||||
|
self._handAnimCtr1.selectedIndex = 1
|
||||||
|
coroutine.wait(3.5)
|
||||||
|
self._handAnimCtr1.selectedIndex = 0
|
||||||
|
self._xipaiPanel1.visible = false
|
||||||
|
if xipaiCallBack then
|
||||||
|
xipaiCallBack()
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 设置界面的换牌回调,需要换牌的玩法settingViewType传1,重写这个方法
|
||||||
|
function M:UpdateCard(index)
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:UpdateCardSize(index)
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:Destroy()
|
||||||
|
UIPackage.RemovePackage('base/main_poker/ui/Main_Poker')
|
||||||
|
MainView.Destroy(self)
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
|
|
@ -0,0 +1,135 @@
|
||||||
|
local TableBG = import('Game.Data.TableBG')
|
||||||
|
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
setmetatable(M,{__index = PlayBackView})
|
||||||
|
|
||||||
|
local pk_default_bg = 1
|
||||||
|
local pk_bg_config = {
|
||||||
|
{id = 1, url = "base/main_poker/bg/bg1", thumb = "ui://Main_Poker/bg1"},
|
||||||
|
{id = 2, url = "base/main_poker/bg/bg2", thumb = "ui://Main_Poker/bg2"},
|
||||||
|
{id = 3, url = "base/main_poker/bg/bg3", thumb = "ui://Main_Poker/bg3"},
|
||||||
|
}
|
||||||
|
|
||||||
|
function M:InitView(url, ex_defaultbg, ex_bgconfig)
|
||||||
|
UIPackage.AddPackage("base/main_poker/ui/Main_Poker")
|
||||||
|
PlayBackView.InitView(self,url)
|
||||||
|
local _view = self._view
|
||||||
|
|
||||||
|
local default_bg = ex_defaultbg or pk_default_bg
|
||||||
|
local bg_config = ex_bgconfig or pk_bg_config
|
||||||
|
TableBG.LoadTableBG(default_bg, self._room.game_id, self._root_view, bg_config)
|
||||||
|
UpdateBeat:Add(self.OnUpdate,self)
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:NextRecordPlay()
|
||||||
|
local result = PlayBackView.NextRecordPlay(self)
|
||||||
|
if not result then return end
|
||||||
|
self:ChangePlayState(false)
|
||||||
|
self._speed = 1
|
||||||
|
self._playFoward = true
|
||||||
|
self:ChangeTextSpeed()
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:LastRecordPlay()
|
||||||
|
local result = PlayBackView.LastRecordPlay(self)
|
||||||
|
if not result then return end
|
||||||
|
self:ChangePlayState(false)
|
||||||
|
self._speed = 1
|
||||||
|
self._playFoward = true
|
||||||
|
self:ChangeTextSpeed()
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:Play()
|
||||||
|
self:ChangeAlpha()
|
||||||
|
self:ChangePlayState(not self._play)
|
||||||
|
if not self._play then return end
|
||||||
|
if (self._currentStep == #self.cmdList and self._playFoward) or (self._currentStep == 0 and not self._playFoward) then
|
||||||
|
self._currentStep = 0
|
||||||
|
self._speed = 1
|
||||||
|
self._playFoward = true
|
||||||
|
self:ChangeTextSpeed()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:ChangePlayState(state)
|
||||||
|
self._play = state
|
||||||
|
self:ChangeTextSpeed()
|
||||||
|
local btn_play = self._view:GetChild("panel_record"):GetChild("btn_play")
|
||||||
|
if self._play then
|
||||||
|
btn_play:GetController("state").selectedIndex = 1
|
||||||
|
else
|
||||||
|
btn_play:GetController("state").selectedIndex = 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:ChangeTextSpeed()
|
||||||
|
local str1 = self._play and self._speed or ""
|
||||||
|
self._view:GetChild("panel_record"):GetChild("tex_speed").text = str1
|
||||||
|
local str2 = not self._play and (self._playFoward and "播放暂停" or "回退暂停") or self._playFoward and (self._speed == 1 and "播放" or "快进") or (self._speed == 1 and "回退" or "快退")
|
||||||
|
self._view:GetChild("panel_record"):GetChild("tex_2").text = str2
|
||||||
|
local str3 = self._play and "倍速度" or ""
|
||||||
|
self._view:GetChild("panel_record"):GetChild("tex_1").text = str3
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:CmdLeftArrows()
|
||||||
|
self:ChangeAlpha()
|
||||||
|
self:ChangePlayState(true)
|
||||||
|
if not self._playFoward then
|
||||||
|
if self._speed < 16 then
|
||||||
|
self._speed = self._speed * 2
|
||||||
|
else
|
||||||
|
self._speed = 1
|
||||||
|
end
|
||||||
|
self:ChangeTextSpeed()
|
||||||
|
else
|
||||||
|
self._speed = 1
|
||||||
|
self._playFoward = false
|
||||||
|
self:ChangeTextSpeed()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:CmdRightArrows()
|
||||||
|
self:ChangeAlpha()
|
||||||
|
self:ChangePlayState(true)
|
||||||
|
if self._playFoward then
|
||||||
|
if self._speed < 16 then
|
||||||
|
self._speed = self._speed * 2
|
||||||
|
else
|
||||||
|
self._speed = 1
|
||||||
|
end
|
||||||
|
self:ChangeTextSpeed()
|
||||||
|
else
|
||||||
|
self._speed = 1
|
||||||
|
self._playFoward = true
|
||||||
|
self:ChangeTextSpeed()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:OnUpdate()
|
||||||
|
if self._play then
|
||||||
|
if (self._currentStep == #self.cmdList and self._playFoward) then
|
||||||
|
self:ChangePlayState(false)
|
||||||
|
ViewUtil.ErrorTip(nil,"当前已是录像结尾了,再次点击播放按钮可重新播放")
|
||||||
|
return
|
||||||
|
elseif (self._currentStep == 0 and not self._playFoward) then
|
||||||
|
self:ChangePlayState(false)
|
||||||
|
ViewUtil.ErrorTip(nil,"当前已是录像开头了,再次点击播放按钮可重新播放")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
self._timer = self._timer + Time.deltaTime
|
||||||
|
if self._timer >= 1 / self._speed then
|
||||||
|
self._timer = 0
|
||||||
|
local step = self._playFoward and 1 or -1
|
||||||
|
self._currentStep = self._currentStep + step
|
||||||
|
self:ShowStep(self._currentStep)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:Destroy()
|
||||||
|
UpdateBeat:Remove(self.OnUpdate,self)
|
||||||
|
PlayBackView.Destroy(self)
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
|
|
@ -0,0 +1,175 @@
|
||||||
|
--local EXMainView = import(".EXMainView")
|
||||||
|
|
||||||
|
local SettingView = require('Game.View.SettingView')
|
||||||
|
local PKSettingView = {
|
||||||
|
__checkMainViewState = nil,
|
||||||
|
__changePokerCallBack = nil,
|
||||||
|
__changePokerSizeCallBack = nil,
|
||||||
|
}
|
||||||
|
local M = PKSettingView
|
||||||
|
function PKSettingView.new(blur_view, show_type, isjiesan, url, cardSizeHandle)
|
||||||
|
setmetatable(SettingView, { __index = BaseWindow })
|
||||||
|
setmetatable(M, { __index = SettingView })
|
||||||
|
local self = setmetatable({}, { __index = M })
|
||||||
|
self.class = 'PKSettingView'
|
||||||
|
self._currenIndex = 0
|
||||||
|
self._blur_view = blur_view
|
||||||
|
self.onCallback = event('onCallback', true)
|
||||||
|
self.stateIndex = 0
|
||||||
|
self.cd_time = 0
|
||||||
|
self._btn_dismiss_room_enable = true
|
||||||
|
self._close_destroy = true
|
||||||
|
self._show_type = show_type
|
||||||
|
self.isjiesan = isjiesan
|
||||||
|
self.__changePokerSizeCallBack = cardSizeHandle
|
||||||
|
if url ~= nil then
|
||||||
|
self:init(url)
|
||||||
|
else
|
||||||
|
self:init('ui://Main_Poker/Setting')
|
||||||
|
end
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:init(url)
|
||||||
|
SettingView.init(self, url)
|
||||||
|
-- -- show_type:1隐藏所有 2隐藏解散和换牌 3隐藏返回和换牌
|
||||||
|
-- -- 设置界面有换牌功能的,需要在mainview中重写方法UpdateCard
|
||||||
|
-- self._view:GetController('type').selectedIndex = self._show_type
|
||||||
|
-- -- show_type1玩法的换牌功能
|
||||||
|
-- if self._show_type == 1 then
|
||||||
|
-- local room = DataManager.CurrenRoom
|
||||||
|
-- local c1 = self._view:GetController('paimian')
|
||||||
|
-- local user_id = DataManager.SelfUser.account_id
|
||||||
|
-- local json_data = Utils.LoadLocalFile(user_id .. room.game_id .. 'pai')
|
||||||
|
-- if json_data == nil then
|
||||||
|
-- local _gamectr = self._gamectr
|
||||||
|
-- c1.selectedIndex = 0
|
||||||
|
-- else
|
||||||
|
-- local _data = json.decode(json_data)
|
||||||
|
-- local pai = _data['pai']
|
||||||
|
|
||||||
|
-- c1.selectedIndex = pai
|
||||||
|
-- end
|
||||||
|
|
||||||
|
|
||||||
|
-- c1.onChanged:Set(
|
||||||
|
-- function()
|
||||||
|
-- if self.__changePokerCallBack then
|
||||||
|
-- self.__changePokerCallBack(c1.selectedIndex)
|
||||||
|
-- end
|
||||||
|
-- --点击换牌按钮后保存当前游戏的牌
|
||||||
|
-- local user_id = DataManager.SelfUser.account_id
|
||||||
|
-- local _data = {}
|
||||||
|
-- _data['pai'] = c1.selectedIndex
|
||||||
|
-- local key = user_id .. room.game_id .. 'pai'
|
||||||
|
-- Utils.SaveLocalFile(key, json.encode(_data))
|
||||||
|
-- end
|
||||||
|
-- )
|
||||||
|
|
||||||
|
-- local card_size = self._view:GetController('card_size')
|
||||||
|
-- json_data = Utils.LoadLocalFile(user_id .. room.game_id .. 'cardsize')
|
||||||
|
-- if json_data == nil then
|
||||||
|
-- local _gamectr = self._gamectr
|
||||||
|
-- card_size.selectedIndex = 1
|
||||||
|
-- else
|
||||||
|
-- local _data = json.decode(json_data)
|
||||||
|
-- local cardsize = _data['cardsize']
|
||||||
|
|
||||||
|
-- card_size.selectedIndex = cardsize
|
||||||
|
-- end
|
||||||
|
|
||||||
|
-- card_size.onChanged:Set(
|
||||||
|
-- function()
|
||||||
|
-- if self.__changePokerSizeCallBack then
|
||||||
|
-- self.__changePokerSizeCallBack(card_size.selectedIndex)
|
||||||
|
-- end
|
||||||
|
-- --点击换牌按钮后保存当前游戏的牌
|
||||||
|
-- local user_id = DataManager.SelfUser.account_id
|
||||||
|
-- local _data = {}
|
||||||
|
-- _data['cardsize'] = card_size.selectedIndex
|
||||||
|
-- local key = user_id .. room.game_id .. 'cardsize'
|
||||||
|
-- Utils.SaveLocalFile(key, json.encode(_data))
|
||||||
|
-- end
|
||||||
|
-- )
|
||||||
|
|
||||||
|
-- self._view:GetChild('btn_close').onClick:Add(
|
||||||
|
-- function(...)
|
||||||
|
-- self:Destroy()
|
||||||
|
-- end
|
||||||
|
-- )
|
||||||
|
-- end
|
||||||
|
-- if self.isjiesan then
|
||||||
|
-- self._view:GetChild('n82').visible = false
|
||||||
|
-- end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- function M:Show()
|
||||||
|
-- SettingView.Show(self)
|
||||||
|
-- -- self:showSettingOption()
|
||||||
|
-- end
|
||||||
|
|
||||||
|
-- 显示设置界面按钮
|
||||||
|
function M:showSettingOption()
|
||||||
|
local btn_back = self._view:GetChild('btn_back')
|
||||||
|
if btn_back ~= nil then
|
||||||
|
btn_back.onClick:Set(
|
||||||
|
function()
|
||||||
|
local room = DataManager.CurrenRoom
|
||||||
|
local ispanguangzhe = room.self_player.seat == 0
|
||||||
|
local tip_owner = '您是否退出房间?\n(退出房间后房间将解散)'
|
||||||
|
local tip = '您是否退出房间?'
|
||||||
|
local tipStr = ''
|
||||||
|
if room.agent then
|
||||||
|
tipStr = '您是否返回?'
|
||||||
|
else
|
||||||
|
tipStr =
|
||||||
|
(not ispanguangzhe and room.owner_id == room.self_player.self_user.account_id) and tip_owner or
|
||||||
|
tip
|
||||||
|
end
|
||||||
|
local _curren_msg = MsgWindow.new(self._root_view, tipStr, MsgWindow.MsgMode.OkAndCancel)
|
||||||
|
_curren_msg.onOk:Add(
|
||||||
|
function()
|
||||||
|
-- 如果游戏已经开始,是旁观者发出退出协议,否则的话不能离开
|
||||||
|
-- 如果没开始,发出退出协议
|
||||||
|
-- 不用考虑回放,回放不会显示返回按钮
|
||||||
|
local state = self.__checkMainViewState()
|
||||||
|
local _gamectr = ControllerManager.GetController(GameController)
|
||||||
|
if state > 0 and state < 3 then
|
||||||
|
if ispanguangzhe then
|
||||||
|
ViewUtil.ShowModalWait(self._root_view)
|
||||||
|
_gamectr:LevelRoom(
|
||||||
|
function(res)
|
||||||
|
ViewUtil.CloseModalWait()
|
||||||
|
if res.ReturnCode == 0 then
|
||||||
|
ViewManager.ChangeView(ViewManager.View_Lobby)
|
||||||
|
else
|
||||||
|
ViewUtil.ErrorTip(res.ReturnCode)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
)
|
||||||
|
else
|
||||||
|
ViewUtil.ErrorTip(nil, '房间已开始,无法退出游戏。')
|
||||||
|
end
|
||||||
|
else
|
||||||
|
ViewUtil.ShowModalWait(self._root_view)
|
||||||
|
_gamectr:LevelRoom(
|
||||||
|
function(res)
|
||||||
|
ViewUtil.CloseModalWait()
|
||||||
|
if res.ReturnCode == 0 then
|
||||||
|
ViewManager.ChangeView(ViewManager.View_Lobby)
|
||||||
|
else
|
||||||
|
ViewUtil.ErrorTip(res.ReturnCode)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
)
|
||||||
|
_curren_msg:Show()
|
||||||
|
end
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
Binary file not shown.
Loading…
Reference in New Issue