200 lines
6.4 KiB
Lua
200 lines
6.4 KiB
Lua
---
|
|
--- Created by 谌建军.
|
|
--- DateTime: 2017/12/18 15:19
|
|
---
|
|
local EXGameInfo = {}
|
|
|
|
local M = EXGameInfo
|
|
|
|
function EXGameInfo.new(blur_view)
|
|
setmetatable(M, { __index = IGameInfo })
|
|
local self = setmetatable({}, { __index = M })
|
|
self.class = "EXGameInfo"
|
|
UIPackage.AddPackage("extend/poker/chuntian/ui/Info_Poker_ChunTian")
|
|
return self
|
|
end
|
|
|
|
function M:FillData(view, index)
|
|
self._maxPlayer = 4 -- 默认玩家人数
|
|
self._roundChoice = 5 -- 回合选项数
|
|
|
|
|
|
self._config = UIPackage.CreateObjectFromURL("ui://Info_Poker_ChunTian/Cgm_create_room")
|
|
|
|
|
|
|
|
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 / 100
|
|
self.xipaiValue = value / 100
|
|
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 / 100
|
|
self.anchouValue = value / 100
|
|
end, 3, nil)
|
|
gniv:Show()
|
|
end
|
|
)
|
|
end
|
|
end
|
|
|
|
local _help_url = "ui://Info_Poker_ChunTian/Com_help"
|
|
function M:GetHelpUrl()
|
|
return _help_url
|
|
end
|
|
|
|
local _icon_url = "ui://Info_Poker_ChunTian/icon"
|
|
function M:GetIconUrl()
|
|
return _icon_url
|
|
end
|
|
|
|
local _icon_url1 = "ui://Info_Poker_ChunTian/icon1"
|
|
function M:GetIconUrl1()
|
|
return _icon_url1
|
|
end
|
|
|
|
local _play_list = { "单QKA2", "去掉234" }
|
|
function M:GetPlayList()
|
|
return _play_list
|
|
end
|
|
|
|
function M:LoadConfigData(data)
|
|
local _config = self._config
|
|
_config:GetController("round").selectedIndex = data.opt - 1
|
|
_config:GetController("Cost").selectedIndex = data.AA == 0 and 0 or 1
|
|
_config:GetController("player_num").selectedIndex = data.maxPlayers - 2
|
|
|
|
_config:GetController("selectDiqu").selectedIndex = data.selectDiqu
|
|
_config:GetController("youdabida").selectedIndex = data.youdabida
|
|
_config:GetController("baodanbida").selectedIndex = data.baodanbida
|
|
_config:GetController("sandaier").selectedIndex = data.sandaier
|
|
|
|
_config:GetController("sidaiyi").selectedIndex = data.sidaiyi
|
|
_config:GetController("fanchun").selectedIndex = data.fanchun
|
|
_config:GetController("shachunfanbei").selectedIndex = data.shachunfanbei
|
|
_config:GetController("ziranchunfanbei").selectedIndex = data.ziranchunfanbei
|
|
_config:GetController("sigeAziranchun").selectedIndex = data.sigeAziranchun
|
|
|
|
if _config:GetChild("xipai") then
|
|
_config:GetChild("xipai").selected = data.xi_pai
|
|
end
|
|
|
|
|
|
if oldGameVersion == 2 then
|
|
self.xipaiValueText.text = data.xi_pai_score / 100
|
|
self.xipaiValue = data.xi_pai_score / 100
|
|
|
|
self.anchouValueText.text = data.an_chou_score / 100
|
|
self.anchouValue = data.an_chou_score / 100
|
|
end
|
|
end
|
|
|
|
function M:SelectedConfigData()
|
|
local _config = self._config
|
|
local round = _config:GetController("round").selectedIndex
|
|
local player_num = _config:GetController("player_num").selectedIndex
|
|
local AA = _config:GetController("Cost").selectedIndex
|
|
local selectDiqu = _config:GetController("selectDiqu").selectedIndex
|
|
local youdabida = _config:GetController("youdabida").selectedIndex
|
|
local baodanbida = _config:GetController("baodanbida").selectedIndex
|
|
local sandaier = _config:GetController("sandaier").selectedIndex
|
|
local sidaiyi = _config:GetController("sidaiyi").selectedIndex
|
|
local fanchun = _config:GetController("fanchun").selectedIndex
|
|
local shachunfanbei = _config:GetController("shachunfanbei").selectedIndex
|
|
local ziranchunfanbei = _config:GetController("ziranchunfanbei").selectedIndex
|
|
local sigeAziranchun = _config:GetController("sigeAziranchun").selectedIndex
|
|
|
|
-----洗牌
|
|
|
|
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["AA"] = AA
|
|
_data["maxPlayers"] = player_num + 2
|
|
_data["selectDiqu"] = selectDiqu
|
|
_data["youdabida"] = youdabida
|
|
_data["baodanbida"] = baodanbida
|
|
_data["sandaier"] = sandaier
|
|
_data["sidaiyi"] = sidaiyi
|
|
_data["fanchun"] = fanchun
|
|
_data["shachunfanbei"] = shachunfanbei
|
|
_data["ziranchunfanbei"] = ziranchunfanbei
|
|
_data["sigeAziranchun"] = sigeAziranchun
|
|
|
|
_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 * 100
|
|
_data['an_chou_score'] = an_chou_score * 100
|
|
|
|
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
|
|
|
|
return M
|