hengyang_client/lua_probject/extend_project/extend/majiang/nancheng/EXGameInfo.lua

243 lines
7.8 KiB
Lua
Raw Normal View History

2025-04-01 10:48:36 +08:00
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/majiang/nancheng/ui/Info_MJ_NanCheng")
return self
2025-04-01 10:48:36 +08:00
end
function M:FillData()
2025-04-29 15:48:04 +08:00
self._maxPlayer = 4 -- 默认玩家人数
self._roundChoice = 3 -- 回合选项数
self._config = UIPackage.CreateObjectFromURL("ui://Info_MJ_NanCheng/Label_Detail_83")
local jiangmaSlider = self._config:GetChild("n92")
jiangmaSlider.onChanged:Set(function()
self._config:GetChild("n93").text = string.format("奖%s马", Mathf.Round(jiangmaSlider.value) * 2)
end)
2025-09-12 15:36:45 +08:00
local com_editSetting = self._config:GetChild("com_editSetting")
com_editSetting:GetController("cGps").selectedIndex = 2
-- 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 / 1000
-- self.xipaiValue = value / 1000
-- 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 / 1000
-- self.anchouValue = value / 1000
-- end, 3, nil)
-- gniv:Show()
-- end
-- )
-- end
2025-04-01 10:48:36 +08:00
end
local _help_url = "ui://Info_MJ_NanCheng/Com_help"
function M:GetHelpUrl()
return _help_url
2025-04-01 10:48:36 +08:00
end
local _icon_url = "ui://Info_MJ_NanCheng/icon"
function M:GetIconUrl()
2025-07-04 02:06:24 +08:00
return "ui://Lobby/nanchengmajiang2", "ui://Lobby/nanchengmajiang1"
2025-04-01 10:48:36 +08:00
end
local _icon_url1 = "ui://Info_MJ_NanCheng/icon1"
function M:GetIconUrl1()
return _icon_url1
2025-04-01 10:48:36 +08:00
end
local _play_list = {}
function M:GetPlayList()
return _play_list
2025-04-01 10:48:36 +08:00
end
2025-09-12 15:36:45 +08:00
function M:SetDefault()
end
2025-04-01 10:48:36 +08:00
function M:SelectedConfigData()
local _config = self._config
local round = _config:GetController("round").selectedIndex + 1
local people = _config:GetController("peopleNum").selectedIndex + 2
2025-04-01 10:48:36 +08:00
local zimo = _config:GetController("ZiMo").selectedIndex
local shaozhuang = _config:GetController("ShaoZhuang").selectedIndex
local fengding = _config:GetController("FengDing").selectedIndex
local zuoma = _config:GetController("ZuoMa").selectedIndex
local zhuanwan = _config:GetController("ZhuanWan").selectedIndex
local jiahu = _config:GetController("JiaHu").selectedIndex
2025-04-01 10:48:36 +08:00
local jiangma = Mathf.Round(_config:GetChild("n92").value)
2025-04-01 10:48:36 +08:00
local xi_pai = false
local xi_paifen = 0
if _config:GetChild("xipai") then
xi_pai = _config:GetChild("xipai").selected
end
2025-04-01 10:48:36 +08:00
------
local _data = {}
_data["opt"] = round
_data["maxPlayers"] = people
2025-04-01 10:48:36 +08:00
_data["zimo"] = zimo
_data["shaozhuang"] = shaozhuang
_data["fengding"] = fengding
_data["zuoma"] = zuoma
_data["zhuanwan"] = zhuanwan
_data["jiahu"] = jiahu
2025-04-01 10:48:36 +08:00
_data["jiangma"] = jiangma
_data['xi_pai'] = xi_pai
2025-04-01 10:48:36 +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
-- end
2025-04-01 10:48:36 +08:00
_data['xi_pai_score'] = xi_pai_score * 1000
_data['an_chou_score'] = an_chou_score * 1000
2025-04-01 10:48:36 +08:00
return _data
2025-04-01 10:48:36 +08:00
end
function M:LoadConfigData(data)
--printlog("加载房间配置=========>>>")
--pt(data)
local _config = self._config
_config:GetController("round").selectedIndex = data.opt - 1
2025-07-04 19:36:00 +08:00
_config:GetController("peopleNum").selectedIndex = data.maxPlayers - 2
2025-04-01 10:48:36 +08:00
2025-07-04 19:36:00 +08:00
_config:GetController("ZiMo").selectedIndex = data.zimo
_config:GetController("ShaoZhuang").selectedIndex = data.shaozhuang
_config:GetController("FengDing").selectedIndex = data.fengding
_config:GetController("ZuoMa").selectedIndex = data.zuoma
_config:GetController("ZhuanWan").selectedIndex = data.zhuanwan
_config:GetController("JiaHu").selectedIndex = data.jiahu
2025-04-01 10:48:36 +08:00
2025-07-04 19:36:00 +08:00
_config:GetChild("n92").value = data.jiangma
self._config:GetChild("n93").text = string.format("奖%s马", data.jiangma * 2)
-- if oldGameVersion == 2 then
-- self.xipaiValueText.text = data.xi_pai_score / 1000
-- self.xipaiValue = data.xi_pai_score / 1000
2025-04-01 10:48:36 +08:00
-- self.anchouValueText.text = data.an_chou_score / 1000
-- self.anchouValue = data.an_chou_score / 1000
-- end
2025-04-01 10:48:36 +08:00
end
2025-09-01 16:18:56 +08:00
function M:LoadConfigToDetail(data, hpdata)
2025-08-06 22:42:31 +08:00
local configData = data
if type(data) == 'string' then
configData = json.decode(data)
end
2025-09-01 16:18:56 +08:00
pt("lingemng", data)
local hpData = configData.hpData or hpdata
2025-08-28 15:02:07 +08:00
if type(hpData) == 'string' then
hpData = json.decode(hpData)
end
2025-08-06 22:42:31 +08:00
2025-09-01 16:18:56 +08:00
local returnString = ""
if hpData then
returnString = string.format("%s倍,", hpData.times / 1000)
end
returnString = string.format("%s人数%s人", returnString, configData.maxPlayers)
2025-09-01 20:15:53 +08:00
returnString = string.format("%s,%s马%s%s%s%s%s%s,%s", returnString,
2025-04-29 15:48:04 +08:00
configData.jiangma and string.format("奖%d", configData.jiangma * 2) or "不奖",
2025-09-12 15:36:45 +08:00
configData.shaozhuang == 1 and ",有烧庄" or "",
configData.zuoma == 0 and ",庄家坐马" or "",
2025-09-13 20:41:59 +08:00
configData.zimo == 0 and ",可点炮,可自摸" or ",必须自摸",
configData.tuoguan and string.format(",%d秒后自动托管", configData.tuoguan_active_time) or ",不能托管",
2025-09-13 20:41:59 +08:00
configData.jiahu == 0 and ",可以假胡" or "", configData.fengding == 0 and ",封顶20炮" or "",
2025-09-12 15:36:45 +08:00
configData.zhuanwan == 0 and "大转弯" or "小转弯")
2025-08-06 22:42:31 +08:00
2025-08-23 22:23:17 +08:00
if configData.GPSDetection then
returnString = string.format("%s%s", returnString,
configData.GPSDetection == 0 and ",距离不限制" or string.format(",距离限制%s米", configData.GPSDetection))
end
if configData.tuoguan_active_time then
returnString = string.format("%s%s", returnString,
configData.tuoguan_active_time == 0 and ",不自动托管" or string.format(",%s秒托管", configData.tuoguan_active_time))
end
if hpData then
if hpData.JieShan then
returnString = string.format("%s%s", returnString,
hpData.JieShan == 1 and ",托管结束后不解散" or
string.format(",托管%s结束后强制解散", hpData.JieShan == 2 and "当局" or string.format("%s局", hpData.JieShan - 1)))
end
if hpData.BanChat then
returnString = string.format("%s%s", returnString, hpData.BanChat == 1 and ",不允许快捷聊天" or "")
end
if hpData.BanMissile then
returnString = string.format("%s%s", returnString, hpData.BanMissile == 1 and ",关闭互动表情" or "")
end
end
returnString = returnString .. IGameInfo.LoadConfigToDetail(self, data, hpData)
2025-08-06 22:42:31 +08:00
return returnString
2025-04-01 18:43:11 +08:00
end
2025-04-01 10:48:36 +08:00
return M