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 })
|
|
|
|
|
self.class = "EXGameInfo"
|
|
|
|
|
UIPackage.AddPackage("extend/majiang/gejiu/ui/Info_MJ_GeJiu")
|
|
|
|
|
return self
|
2025-05-24 14:29:14 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:FillData()
|
2025-06-19 23:51:18 +08:00
|
|
|
self._maxPlayer = 4 -- 默认玩家人数
|
|
|
|
|
self._roundChoice = 3 -- 回合选项数
|
|
|
|
|
self._config = UIPackage.CreateObjectFromURL("ui://Info_MJ_GeJiu/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
|
2025-05-24 14:29:14 +08:00
|
|
|
|
|
|
|
|
local btn_cr = self._config:GetChild('sdsrbtn')
|
2025-06-19 23:51:18 +08:00
|
|
|
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, 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
|
|
|
|
|
)
|
2025-05-24 14:29:14 +08:00
|
|
|
end
|
2025-06-19 23:51:18 +08:00
|
|
|
end
|
2025-05-24 14:29:14 +08:00
|
|
|
|
2025-06-19 23:51:18 +08:00
|
|
|
local _help_url = "ui://Info_MJ_GeJiu/Com_help"
|
2025-05-24 14:29:14 +08:00
|
|
|
function M:GetHelpUrl()
|
2025-06-19 23:51:18 +08:00
|
|
|
return _help_url
|
2025-05-24 14:29:14 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local _icon_url = "ui://Info_MJ_GeJiu/icon"
|
|
|
|
|
function M:GetIconUrl()
|
2025-06-19 23:51:18 +08:00
|
|
|
return _icon_url
|
2025-05-24 14:29:14 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local _icon_url1 = "ui://Info_MJ_GeJiu/icon1"
|
|
|
|
|
function M:GetIconUrl1()
|
2025-06-19 23:51:18 +08:00
|
|
|
return _icon_url1
|
2025-05-24 14:29:14 +08:00
|
|
|
end
|
|
|
|
|
|
2025-06-19 23:51:18 +08:00
|
|
|
local _play_list = {}
|
2025-05-24 14:29:14 +08:00
|
|
|
function M:GetPlayList()
|
2025-06-19 23:51:18 +08:00
|
|
|
return _play_list
|
2025-05-24 14:29:14 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:SelectedConfigData()
|
2025-06-19 23:51:18 +08:00
|
|
|
local _config = self._config
|
|
|
|
|
local round = _config:GetController("round").selectedIndex + 1
|
|
|
|
|
local people = _config:GetController("play_list").selectedIndex + 2
|
|
|
|
|
|
|
|
|
|
local fengding = _config:GetController("fengding").selectedIndex
|
|
|
|
|
local wanfa = _config:GetController("wanfa").selectedIndex
|
|
|
|
|
local qiduijiafan = _config:GetChild("btn_qidui").selected
|
|
|
|
|
local shoudailongjiafan = _config:GetChild("btn_shoudailong").selected
|
|
|
|
|
local loudilongjiafan = _config:GetChild("btn_loudilong").selected
|
|
|
|
|
local bunengchi = _config:GetChild("btn_bunengchi").selected
|
|
|
|
|
local doudizhu = _config:GetChild("btn_doudizhu").selected
|
|
|
|
|
local doudizhufanbei = _config:GetChild("btn_doudizhufanbei").selected
|
|
|
|
|
local xi_pai = false
|
|
|
|
|
local xi_paifen = 0
|
2025-05-24 14:29:14 +08:00
|
|
|
if _config:GetChild("xipai") then
|
2025-06-19 23:51:18 +08:00
|
|
|
xi_pai = _config:GetChild("xipai").selected
|
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
|
|
|
|
|
|
|
|
------
|
2025-06-19 23:51:18 +08:00
|
|
|
local _data = {}
|
|
|
|
|
_data["opt"] = round
|
|
|
|
|
_data["maxPlayers"] = people
|
|
|
|
|
|
2025-05-24 14:29:14 +08:00
|
|
|
_data["fengding"] = fengding
|
|
|
|
|
_data["wanfa"] = wanfa
|
|
|
|
|
_data["qiduijiafan"] = qiduijiafan
|
|
|
|
|
_data["shoudailongjiafan"] = shoudailongjiafan
|
|
|
|
|
_data["loudilongjiafan"] = loudilongjiafan
|
|
|
|
|
_data["bunengchi"] = bunengchi
|
|
|
|
|
_data["doudizhu"] = doudizhu
|
|
|
|
|
_data["doudizhufanbei"] = doudizhufanbei
|
|
|
|
|
_data['xi_pai'] = xi_pai
|
2025-06-19 23:51:18 +08:00
|
|
|
|
|
|
|
|
local xi_pai_score = 0
|
|
|
|
|
local an_chou_score = 0
|
|
|
|
|
if oldGameVersion == 2 then
|
|
|
|
|
xi_pai_score = self.xipaiValue
|
|
|
|
|
an_chou_score = self.anchouValue
|
2025-05-24 14:29:14 +08:00
|
|
|
end
|
|
|
|
|
|
2025-06-19 23:51:18 +08:00
|
|
|
_data['xi_pai_score'] = xi_pai_score * 100
|
|
|
|
|
_data['an_chou_score'] = an_chou_score * 100
|
2025-05-24 14:29:14 +08:00
|
|
|
|
|
|
|
|
|
2025-06-19 23:51:18 +08:00
|
|
|
return _data
|
|
|
|
|
end
|
2025-05-24 14:29:14 +08:00
|
|
|
|
|
|
|
|
function M:LoadConfigData(data)
|
|
|
|
|
--printlog("加载房间配置=========>>>")
|
|
|
|
|
--pt(data)
|
2025-06-19 23:51:18 +08:00
|
|
|
local _config = self._config
|
|
|
|
|
_config:GetController("round").selectedIndex = data.opt - 1
|
|
|
|
|
_config:GetController("play_list").selectedIndex = data.maxPlayers - 2
|
|
|
|
|
|
|
|
|
|
|
2025-05-24 14:29:14 +08:00
|
|
|
_config:GetController("fengding").selectedIndex = data.fengding
|
2025-06-19 23:51:18 +08:00
|
|
|
|
2025-05-24 14:29:14 +08:00
|
|
|
_config:GetController("wanfa").selectedIndex = data.wanfa
|
|
|
|
|
_config:GetChild("btn_qidui").selected = data.qiduijiafan
|
|
|
|
|
_config:GetChild("btn_shoudailong").selected = data.shoudailongjiafan
|
|
|
|
|
_config:GetChild("btn_loudilong").selected = data.loudilongjiafan
|
|
|
|
|
_config:GetChild("btn_bunengchi").selected = data.bunengchi
|
|
|
|
|
|
|
|
|
|
_config:GetChild("btn_doudizhu").selected = data.doudizhu
|
|
|
|
|
_config:GetChild("btn_doudizhufanbei").selected = data.doudizhufanbei
|
|
|
|
|
|
2025-06-19 23:51:18 +08:00
|
|
|
if _config:GetChild("xipai") then
|
|
|
|
|
_config:GetChild("xipai").selected = data.xi_pai
|
2025-05-24 14:29:14 +08:00
|
|
|
end
|
|
|
|
|
|
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
|
2025-05-24 14:29:14 +08:00
|
|
|
|
2025-06-19 23:51:18 +08:00
|
|
|
self.anchouValueText.text = data.an_chou_score / 100
|
|
|
|
|
self.anchouValue = data.an_chou_score / 100
|
2025-05-24 14:29:14 +08:00
|
|
|
end
|
2025-06-19 23:51:18 +08:00
|
|
|
end
|
2025-05-24 14:29:14 +08:00
|
|
|
|
2025-06-19 23:51:18 +08:00
|
|
|
return M
|