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

218 lines
6.7 KiB
Lua
Raw Normal View History

2025-04-01 10:48:36 +08:00
local EXGameInfo = {}
local M = EXGameInfo
function EXGameInfo.new(blur_view)
2025-04-24 11:24:36 +08:00
setmetatable(M, { __index = IGameInfo })
local self = setmetatable({}, { __index = M })
self.class = "EXGameInfo"
UIPackage.AddPackage("extend/majiang/jinxi/ui/Info_MJ_JinXi")
return self
2025-04-01 10:48:36 +08:00
end
function M:FillData()
2025-04-26 14:19:35 +08:00
self._maxPlayer = 4 -- 默认玩家人数
2025-04-24 11:24:36 +08:00
self._roundChoice = 3 -- 回合选项数
self._config = UIPackage.CreateObjectFromURL("ui://Info_MJ_JinXi/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)
-- 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_JinXi/Com_help"
function M:GetHelpUrl()
2025-04-24 11:24:36 +08:00
return _help_url
2025-04-01 10:48:36 +08:00
end
local _icon_url = "ui://Info_MJ_JinXi/icon"
function M:GetIconUrl()
2025-07-04 02:06:24 +08:00
return "ui://Lobby/jinximajiang2", "ui://Lobby/jinximajiang1"
2025-04-01 10:48:36 +08:00
end
local _icon_url1 = "ui://Info_MJ_JinXi/icon1"
function M:GetIconUrl1()
2025-04-24 11:24:36 +08:00
return _icon_url1
2025-04-01 10:48:36 +08:00
end
local _play_list = {}
function M:GetPlayList()
2025-04-24 11:24:36 +08:00
return _play_list
2025-04-01 10:48:36 +08:00
end
function M:SelectedConfigData()
2025-04-24 11:24:36 +08:00
local _config = self._config
local round = _config:GetController("round").selectedIndex + 1
local people = _config:GetController("peopleNum").selectedIndex + 2
2025-04-08 20:02:47 +08:00
2025-04-24 11:24:36 +08:00
local zimo = _config:GetController("ZiMo").selectedIndex
local gangjiangma = _config:GetController("GangJiangMa").selectedIndex
local fengding = _config:GetController("FengDing").selectedIndex
local sanjingjiangma = _config:GetController("SanJingChengMa").selectedIndex
local zikechengshun = _config:GetController("ZiKeChengShun").selectedIndex
2025-04-08 20:02:47 +08:00
2025-04-24 11:24:36 +08:00
local jiangma = Mathf.Round(_config:GetChild("n92").value)
2025-04-08 20:02:47 +08:00
2025-04-24 11:24: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
2025-04-24 11:24:36 +08:00
------
local _data = {}
_data["opt"] = round
_data["maxPlayers"] = people
2025-04-01 10:48:36 +08:00
2025-04-24 11:24:36 +08:00
_data["zimo"] = zimo
_data["gangjiangma"] = gangjiangma
_data["fengding"] = fengding
_data["sanjingjiangma"] = sanjingjiangma
_data["zikechengshun"] = zikechengshun
2025-04-08 20:02:47 +08:00
2025-04-24 11:24:36 +08:00
_data["jiangma"] = jiangma
_data['xi_pai'] = xi_pai
2025-04-01 10:48:36 +08:00
2025-04-24 11:24: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
2025-04-24 11:24: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
2025-04-24 11:24:36 +08:00
return _data
2025-04-01 10:48:36 +08:00
end
function M:LoadConfigData(data)
2025-04-24 11:24:36 +08:00
--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("GangJiangMa").selectedIndex = data.gangjiangma
_config:GetController("FengDing").selectedIndex = data.fengding
_config:GetController("SanJingChengMa").selectedIndex = data.sanjingjiangma
_config:GetController("ZiKeChengShun").selectedIndex = data.zikechengshun
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)
2025-04-01 10:48:36 +08:00
end
2025-04-08 20:02:47 +08:00
function M:LoadConfigToDetail(data)
2025-08-06 22:42:31 +08:00
local configData = data
if type(data) == 'string' then
configData = json.decode(data)
end
2025-04-26 14:19:35 +08:00
local returnString = string.format("人数%s人", configData.maxPlayers)
if configData.jiangma then
returnString = string.format("%s,%s马", returnString,
2025-04-29 15:48:04 +08:00
configData.jiangma == 0 and "不奖" or string.format("奖%s", configData.jiangma * 2))
2025-04-26 14:19:35 +08:00
end
if configData.zimo then
2025-05-07 15:38:38 +08:00
returnString = string.format("%s,%s", returnString, configData.zimo == 0 and "可点炮,可自摸" or "必须自摸")
2025-04-26 14:19:35 +08:00
end
if configData.shaozhuang then
returnString = string.format("%s%s", returnString, configData.shaozhuang == 0 and "" or ",有烧庄")
end
if configData.fengding then
local matString = "%s,%s"
if configData.fengding == 0 then
returnString = string.format(matString, returnString, "封顶20炮")
elseif configData.fengding == 1 then
returnString = string.format(matString, returnString, "封顶10炮")
end
end
if configData.TianDiHu then
returnString = string.format("%s%s", returnString, configData.TianDiHu == 0 and ",有天地胡" or "")
end
if configData.zikechengshun then
returnString = string.format("%s%s", returnString, configData.zikechengshun == 0 and ",有字可成顺" or "")
end
if configData.gangjiangma then
returnString = string.format("%s%s", returnString, configData.gangjiangma == 0 and ",杠算奖马" or "")
end
if configData.sanjingjiangma then
returnString = string.format("%s%s", returnString, configData.sanjingjiangma == 0 and ",三精算奖马" or "")
end
2025-08-06 22:42:31 +08:00
returnString = returnString .. IGameInfo.LoadConfigToDetail(self, data)
2025-04-24 11:24:36 +08:00
return returnString
2025-04-08 20:02:47 +08:00
end
2025-04-01 10:48:36 +08:00
return M