yunque9/lua_probject/extend_project/extend/poker/chuntian/EXGameInfo.lua

200 lines
6.4 KiB
Lua
Raw Normal View History

2025-05-24 14:29:14 +08:00
---
--- Created by 谌建军.
--- DateTime: 2017/12/18 15:19
---
local EXGameInfo = {}
local M = EXGameInfo
function EXGameInfo.new(blur_view)
2025-06-19 23:51:18 +08:00
setmetatable(M, { __index = IGameInfo })
local self = setmetatable({}, { __index = M })
2025-05-24 14:29:14 +08:00
self.class = "EXGameInfo"
UIPackage.AddPackage("extend/poker/chuntian/ui/Info_Poker_ChunTian")
return self
end
function M:FillData(view, index)
2025-06-19 23:51:18 +08:00
self._maxPlayer = 4 -- 默认玩家人数
2025-05-24 14:29:14 +08:00
self._roundChoice = 5 -- 回合选项数
2025-06-19 23:51:18 +08:00
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, "输入数据异常!")
2025-05-24 14:29:14 +08:00
end
2025-06-19 23:51:18 +08:00
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)
2025-05-24 14:29:14 +08:00
end
2025-06-19 23:51:18 +08:00
if value < 0 then
ViewUtil.ErrorTip(1, "输入数据异常!")
end
self.anchouValueText.text = value / 100
self.anchouValue = value / 100
end, 3, nil)
gniv:Show()
end
)
end
2025-05-24 14:29:14 +08:00
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
2025-06-19 23:51:18 +08:00
local _play_list = { "单QKA2", "去掉234" }
2025-05-24 14:29:14 +08:00
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
2025-06-19 23:51:18 +08:00
_config:GetController("selectDiqu").selectedIndex = data.selectDiqu
_config:GetController("youdabida").selectedIndex = data.youdabida
_config:GetController("baodanbida").selectedIndex = data.baodanbida
2025-05-24 14:29:14 +08:00
_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
2025-06-19 23:51:18 +08:00
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
2025-05-24 14:29:14 +08:00
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
2025-06-19 23:51:18 +08:00
local sidaiyi = _config:GetController("sidaiyi").selectedIndex
local fanchun = _config:GetController("fanchun").selectedIndex
local shachunfanbei = _config:GetController("shachunfanbei").selectedIndex
2025-05-24 14:29:14 +08:00
local ziranchunfanbei = _config:GetController("ziranchunfanbei").selectedIndex
local sigeAziranchun = _config:GetController("sigeAziranchun").selectedIndex
2025-06-19 23:51:18 +08:00
-----洗牌
local xi_pai = false
if _config:GetChild("xipai") then
xi_pai = _config:GetChild("xipai").selected
end
----
2025-05-24 14:29:14 +08:00
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
2025-06-19 23:51:18 +08:00
_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
2025-05-24 14:29:14 +08:00
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