changhong/lua_probject/extend_project/extend/zipai/runbeard/EXGameInfo.lua

383 lines
15 KiB
Lua
Raw Normal View History

2025-05-24 14:29:14 +08:00
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/zipai/runbeard/ui/Extend_Poker_RunBeard')
UIPackage.AddPackage('extend/zipai/runbeard/ui/Info_Poker_RunBeard')
return self
end
function M:FillData()
2025-06-19 23:51:18 +08:00
self._maxPlayer = 3 -- 默认玩家人数
2025-05-24 14:29:14 +08:00
self._roundChoice = 3 -- 回合选项数
self._config = UIPackage.CreateObjectFromURL('ui://Extend_Poker_RunBeard/Cgm_create_room')
2025-06-19 23:51:18 +08:00
if oldGameVersion == 1 then
--self._config:GetChild("xipai").visible=false
end
if oldGameVersion == 2 then
self._config:GetController("xipai").selectedIndex = 1
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)
2025-05-24 14:29:14 +08:00
end
2025-06-19 23:51:18 +08:00
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, 3, 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
2025-05-24 14:29:14 +08:00
local btn_jia = self._config:GetChild('btn_jia')
local btn_jian = self._config:GetChild('btn_jian')
local btn_jia1 = self._config:GetChild('btn_jia1')
local btn_jian1 = self._config:GetChild('btn_jian1')
--local btn_jia2 = self._config:GetChild('btn_jia2')
local btn_jian2 = self._config:GetChild('btn_jian2')
2025-06-19 23:51:18 +08:00
-- local fS=self._config:GetChild('btn_round8'):GetChild("title")
-- fS.text="1局"
-- fS=self._config:GetChild('btn_round16'):GetChild("title")
-- fS.text="8局"
2025-05-24 14:29:14 +08:00
btn_jia.onClick:Set(
function()
if self._config:GetController('tun').selectedIndex ~= 5 then
self._config:GetController('tun').selectedIndex = self._config:GetController('tun').selectedIndex + 1
end
if self._config:GetController('tun').selectedIndex == 5 then
btn_jia.touchable = false
btn_jia.grayed = true
end
if self._config:GetController('tun').selectedIndex > 0 then
btn_jian.touchable = true
btn_jian.grayed = false
end
end
)
btn_jian.onClick:Set(
function()
if self._config:GetController('tun').selectedIndex ~= 0 then
self._config:GetController('tun').selectedIndex = self._config:GetController('tun').selectedIndex - 1
end
if self._config:GetController('tun').selectedIndex == 0 then
btn_jian.touchable = false
btn_jian.grayed = true
end
if self._config:GetController('tun').selectedIndex < 5 then
btn_jia.touchable = true
btn_jia.grayed = false
end
end
)
btn_jia1.onClick:Set(
function()
if self._config:GetController('tun').selectedIndex ~= 5 then
self._config:GetController('tun').selectedIndex = self._config:GetController('tun').selectedIndex + 1
end
if self._config:GetController('tun').selectedIndex == 5 then
btn_jia1.touchable = false
btn_jia1.grayed = true
end
if self._config:GetController('tun').selectedIndex > 0 then
btn_jian1.touchable = true
btn_jian1.grayed = false
end
end
)
btn_jian1.onClick:Set(
function()
if self._config:GetController('tun').selectedIndex ~= 0 then
self._config:GetController('tun').selectedIndex = self._config:GetController('tun').selectedIndex - 1
end
if self._config:GetController('tun').selectedIndex == 0 then
btn_jian1.touchable = false
btn_jian1.grayed = true
end
if self._config:GetController('tun').selectedIndex < 5 then
btn_jia1.touchable = true
btn_jia1.grayed = false
end
end
)
2025-06-19 23:51:18 +08:00
2025-05-24 14:29:14 +08:00
--btn_jia2.onClick:Set(
2025-06-19 23:51:18 +08:00
-- function()
-- if self._config:GetController('tun').selectedIndex ~= 5 then
-- self._config:GetController('tun').selectedIndex = self._config:GetController('tun').selectedIndex + 1
-- end
-- if self._config:GetController('tun').selectedIndex == 5 then
-- btn_jia2.touchable = false
-- btn_jia2.grayed = true
-- end
-- if self._config:GetController('tun').selectedIndex > 0 then
-- btn_jian2.touchable = true
-- btn_jian2.grayed = false
-- end
-- end
-- )
-- btn_jian2.onClick:Set(
-- function()
-- if self._config:GetController('tun').selectedIndex ~= 0 then
-- self._config:GetController('tun').selectedIndex = self._config:GetController('tun').selectedIndex - 1
-- end
-- if self._config:GetController('tun').selectedIndex == 0 then
-- btn_jian2.touchable = false
-- btn_jian2.grayed = true
-- end
-- if self._config:GetController('tun').selectedIndex < 5 then
-- btn_jia2.touchable = true
-- btn_jia2.grayed = false
-- end
-- end
-- )
2025-05-24 14:29:14 +08:00
end
2025-06-19 23:51:18 +08:00
2025-05-24 14:29:14 +08:00
local _help_url = 'ui://Info_Poker_RunBeard/Com_help'
function M:GetHelpUrl()
return _help_url
end
local _icon_url = "ui://Info_Poker_RunBeard/icon"
function M:GetIconUrl()
return _icon_url
end
local _icon_url1 = "ui://Info_Poker_RunBeard/icon1"
function M:GetIconUrl1()
return _icon_url1
end
2025-06-19 23:51:18 +08:00
local _play_list = { "多红多番", "红黑点", "全名堂" }
2025-05-24 14:29:14 +08:00
function M:GetPlayList()
return _play_list
end
function M:SelectedConfigData()
local _config = self._config
local wanfa_C = _config:GetController('btn_Controller').selectedIndex
2025-06-19 23:51:18 +08:00
local round = _config:GetController('round').selectedIndex + 1 --== 0 and 1 or 2
2025-05-24 14:29:14 +08:00
local Cost = _config:GetController('Cost').selectedIndex
local tun = _config:GetController('tun').selectedIndex
local fengding = _config:GetController('fengding').selectedIndex
--local choupai = _config:GetController('choupai').selectedIndex
local tuanyuan = _config:GetController('tuanyuan').selectedIndex
local hanghangxi = _config:GetController('hanghangxi').selectedIndex
local siqi = _config:GetController('siqi').selectedIndex
local shuahou = _config:GetController('shuahou').selectedIndex
local huangfan = _config:GetController('huangfan').selectedIndex
local jiaxingxing = _config:GetController('jiaxingxing').selectedIndex
local tinghu = _config:GetController('tinghu').selectedIndex
local duizifu = _config:GetController('duizifu').selectedIndex
local back = _config:GetController('Back').selectedIndex
local yuan = _config:GetController('yuan').selectedIndex
local tianhu = _config:GetController('tianhu').selectedIndex
local dihu = _config:GetController('dihu').selectedIndex
local haihu = _config:GetController('haihu').selectedIndex
local renshu = _config:GetController('renshu').selectedIndex == 0 and 2 or 3
2025-06-19 23:51:18 +08:00
local qixihu = _config:GetController('qixihu').selectedIndex --起息胡
local weipai = _config:GetController('weipai').selectedIndex --偎牌
2025-05-24 14:29:14 +08:00
local xidouble30 = _config:GetController('xidouble30').selectedIndex --30息胡翻倍
2025-06-19 23:51:18 +08:00
local zimo = _config:GetController('zimo').selectedIndex --自摸加3
local daxiaozi = _config:GetController('daxiaozi').selectedIndex --大小胡
local hongheihu = _config:GetController('hongheihu').selectedIndex --红黑胡
local yidianhu = _config:GetController('yidianhu').selectedIndex --一点红
local qupai = 0
if renshu == 2 then
qupai = _config:GetController('qupai').selectedIndex
end
2025-05-24 14:29:14 +08:00
-- local qupai = _config:GetController('qupai').selectedIndex == 1 and true or false
local _data = {}
--wanfa_C=2
2025-06-19 23:51:18 +08:00
_data['opt'] = round -- 1 2 8局 16 局
2025-05-24 14:29:14 +08:00
_data['mode'] = wanfa_C + 1 -- 1 全名堂 2 红黑点 3 多红多番
_data['AA'] = Cost
_data['maxPlayers'] = renshu
if wanfa_C == 0 then
_data['tun'] = tun -- 充囤 0 1 2 3 4 5 分别是 0 1 2 3 4 5
_data['tianhu'] = tianhu
_data['dihu'] = dihu
_data['haihu'] = haihu
_data['tinghu'] = tinghu
_data['huangfan'] = huangfan
_data['fengding'] = fengding -- 封顶 0
_data['qupai'] = qupai
_data['qixihu'] = qixihu
_data['weipai'] = weipai
_data['xidouble30'] = xidouble30
_data['zimo'] = zimo
_data['daxiaozi'] = daxiaozi
_data['hongheihu'] = hongheihu
_data['yidianhu'] = yidianhu
elseif wanfa_C == 1 then
2025-06-19 23:51:18 +08:00
_data['tun'] = tun -- 充囤 0 1 2 3 4 5 分别是 0 1 2 3 4 5
_data['fengding'] = fengding -- 封顶 0 1 2 红黑点分别是 不封顶 单局20封顶 单局 40封顶
_data['duizifu'] = duizifu -- 对子胡 0 不选 1 选
2025-05-24 14:29:14 +08:00
elseif wanfa_C == 2 then
2025-06-19 23:51:18 +08:00
_data['tun'] = tun -- 充囤 0 1 2 3 4 分别是 1 2 3 4 5
_data['fengding'] = fengding -- 封顶 0 1 2 全名堂分别是 不封顶 100封顶 200封顶
_data['tuanyuan'] = tuanyuan -- 大团圆 0 不选 1 选
_data['hanghangxi'] = hanghangxi -- 行行息 0 不选 1 选
_data['shuahou'] = shuahou -- 耍猴 0 不选 1 选
_data['huangfan'] = huangfan -- 黄番 0 不选 1 选
2025-05-24 14:29:14 +08:00
_data['jiaxingxing'] = jiaxingxing -- 假行行 0 不选 1 选
2025-06-19 23:51:18 +08:00
_data['tinghu'] = tinghu -- 听胡 0 不选 1 选
_data['siqi'] = siqi -- 四七红 0 不选 1 选
_data['back'] = back -- 四七红 0 不选 1 选
_data['yuan'] = yuan -- 四七红 0 不选 1 选
end
-- if renshu == 2 then
-- _data['qupai'] = false
-- end
local xi_pai = false
if oldGameVersion == 2 then
if _config:GetChild("xipai") then
xi_pai = _config:GetChild("xipai").selected
end
2025-05-24 14:29:14 +08:00
end
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:LoadConfigData(data)
local _config = self._config
2025-06-19 23:51:18 +08:00
-- data.mode=3
2025-05-24 14:29:14 +08:00
_config:GetController('btn_Controller').selectedIndex = data.mode - 1
_config:GetController('round').selectedIndex = data.opt - 1 --== 1 and 0 or 1
_config:GetController('Cost').selectedIndex = data.AA
_config:GetController('renshu').selectedIndex = data.maxPlayers == 2 and 0 or 1
2025-06-19 23:51:18 +08:00
2025-05-24 14:29:14 +08:00
if data.mode == 1 then
_config:GetController('haihu').selectedIndex = 0
_config:GetController('tinghu').selectedIndex = 0
_config:GetController('tianhu').selectedIndex = data.tianhu
_config:GetController('dihu').selectedIndex = 0
_config:GetController('huangfan').selectedIndex = 0
_config:GetController('tun').selectedIndex = data.tun
_config:GetController('fengding').selectedIndex = data.fengding
_config:GetController('qupai').selectedIndex = data.qupai
_config:GetController('qixihu').selectedIndex = data.qixihu
_config:GetController('weipai').selectedIndex = data.weipai
_config:GetController('xidouble30').selectedIndex = data.xidouble30
_config:GetController('zimo').selectedIndex = data.zimo
_config:GetController('daxiaozi').selectedIndex = data.daxiaozi
_config:GetController('hongheihu').selectedIndex = data.hongheihu
_config:GetController('yidianhu').selectedIndex = data.yidianhu
elseif data.mode == 2 then
_config:GetController('tun').selectedIndex = data.tun
_config:GetController('fengding').selectedIndex = data.fengding
_config:GetController('duizifu').selectedIndex = data.duizifu
elseif data.mode == 3 then
_config:GetController('tun').selectedIndex = data.tun
_config:GetController('fengding').selectedIndex = data.fengding
_config:GetController('tuanyuan').selectedIndex = data.tuanyuan
_config:GetController('hanghangxi').selectedIndex = data.hanghangxi
_config:GetController('siqi').selectedIndex = data.siqi
_config:GetController('shuahou').selectedIndex = data.shuahou
_config:GetController('huangfan').selectedIndex = data.huangfan
_config:GetController('jiaxingxing').selectedIndex = data.jiaxingxing
_config:GetController('tinghu').selectedIndex = data.tinghu
_config:GetController('Back').selectedIndex = data.back
_config:GetController('yuan').selectedIndex = data.yuan
end
if data.maxPlayers == 2 then
--_config:GetController('qupai').selectedIndex = data.qupai == true and 1 or 0
end
2025-06-19 23:51:18 +08:00
if _config:GetChild("xipai") then
_config:GetChild("xipai").selected = data.xi_pai
end
2025-05-24 14:29:14 +08:00
2025-06-19 23:51:18 +08:00
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
2025-06-19 23:51:18 +08:00
2025-05-24 14:29:14 +08:00
function M:OnChangeOption(ctype)
IGameInfo.OnChangeOption(self, ctype)
local people = self._config:GetController('renshu')
people.onChanged:Set(
function()
self._maxPlayer = people.selectedIndex == 0 and 2 or 3
self:ShowVariablePrice(ctype)
end
)
end
2025-06-19 23:51:18 +08:00
2025-05-24 14:29:14 +08:00
return M