255 lines
7.0 KiB
Lua
255 lines
7.0 KiB
Lua
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/lichuan/ui/Info_MJ_LiChuan")
|
|
return self
|
|
end
|
|
|
|
function M:FillData()
|
|
self._maxPlayer = 4 -- 默认玩家人数
|
|
self._roundChoice = 3 -- 回合选项数
|
|
self._config = UIPackage.CreateObjectFromURL("ui://Info_MJ_LiChuan/Label_Detail_83")
|
|
|
|
|
|
local com_editSetting = self._config:GetChild("com_editSetting")
|
|
|
|
com_editSetting:GetController("cGps").selectedIndex = 2
|
|
self._config:GetController("jingbibo").selectedIndex = 1
|
|
|
|
local ctr_round = self._config:GetController("round")
|
|
if ctr_round.selectedIndex == 0 then
|
|
com_editSetting:GetController("oneRound").selectedIndex = 1
|
|
else
|
|
com_editSetting:GetController("oneRound").selectedIndex = 0
|
|
end
|
|
self._config:GetController("round").onChanged:Set(function()
|
|
if ctr_round.selectedIndex == 0 then
|
|
com_editSetting:GetController("oneRound").selectedIndex = 1
|
|
else
|
|
com_editSetting:GetController("oneRound").selectedIndex = 0
|
|
end
|
|
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
|
|
end
|
|
|
|
local _help_url = "ui://Info_MJ_LiChuan/Com_help"
|
|
function M:GetHelpUrl()
|
|
return _help_url
|
|
end
|
|
|
|
local _icon_url = "ui://Info_MJ_LiChuan/icon"
|
|
function M:GetIconUrl()
|
|
return "ui://Lobby/liquanmajiang2", "ui://Lobby/liquanmajiang1"
|
|
end
|
|
|
|
local _icon_url1 = "ui://Info_MJ_LiChuan/icon1"
|
|
function M:GetIconUrl1()
|
|
return _icon_url1
|
|
end
|
|
|
|
local _play_list = {}
|
|
function M:GetPlayList()
|
|
return _play_list
|
|
end
|
|
|
|
function M:SelectedConfigData()
|
|
local _config = self._config
|
|
local round = _config:GetController("round").selectedIndex + 1
|
|
local people = _config:GetController("peopleNum").selectedIndex + 2
|
|
|
|
local zimo = _config:GetController("ZiMo").selectedIndex
|
|
local jingbibo = 1 - _config:GetController("jingbibo").selectedIndex
|
|
|
|
|
|
local xi_pai = false
|
|
local xi_paifen = 0
|
|
if _config:GetChild("xipai") then
|
|
xi_pai = _config:GetChild("xipai").selected
|
|
end
|
|
|
|
|
|
|
|
------
|
|
local _data = {}
|
|
_data["opt"] = round
|
|
_data["maxPlayers"] = people
|
|
|
|
_data["zimo"] = zimo
|
|
_data["jingbibo"] = jingbibo
|
|
_data["jiangma"] = 0
|
|
|
|
_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 * 1000
|
|
_data['an_chou_score'] = an_chou_score * 1000
|
|
|
|
|
|
return _data
|
|
end
|
|
|
|
function M:LoadConfigData(data)
|
|
--printlog("加载房间配置=========>>>")
|
|
--pt(data)
|
|
local _config = self._config
|
|
_config:GetController("round").selectedIndex = data.opt - 1
|
|
_config:GetController("peopleNum").selectedIndex = data.maxPlayers - 2
|
|
|
|
_config:GetController("ZiMo").selectedIndex = data.zimo
|
|
_config:GetController("jingbibo").selectedIndex = 1 - data.jingbibo
|
|
end
|
|
|
|
function M:LoadConfigToDetailOnlyPlay(data, hpdata)
|
|
local configData = data
|
|
if type(data) == 'string' then
|
|
configData = json.decode(data)
|
|
end
|
|
|
|
local hpData = configData.hpData or hpdata
|
|
if type(hpData) == 'string' then
|
|
if hpData == "null" then
|
|
hpData = nil
|
|
else
|
|
hpData = json.decode(hpData)
|
|
end
|
|
end
|
|
|
|
local returnString = ""
|
|
if hpData then
|
|
returnString = string.format("%s倍", hpData.times / 1000)
|
|
end
|
|
|
|
returnString = string.format("%s人数%s人", returnString, configData.maxPlayers)
|
|
|
|
if hpData then
|
|
returnString = string.format("%s %s局", returnString, hpData.maxRound)
|
|
end
|
|
|
|
if configData.zimo then
|
|
returnString = string.format("%s,%s", returnString, configData.zimo == 0 and "可点炮 可自摸" or "必须自摸")
|
|
end
|
|
if configData.jingbibo then
|
|
returnString = string.format("%s,%s", returnString, configData.jingbibo == 1 and "有精必博" or "有精可胡")
|
|
end
|
|
|
|
if hpData then
|
|
if hpData.BanChat then
|
|
returnString = string.format("%s%s", returnString, hpData.BanChat == 1 and ",不允许快捷聊天" or "")
|
|
end
|
|
end
|
|
|
|
return returnString
|
|
end
|
|
|
|
function M:LoadConfigToDetail(data, hpdata)
|
|
local configData = data
|
|
if type(data) == 'string' then
|
|
configData = json.decode(data)
|
|
end
|
|
|
|
local hpData = configData.hpData or hpdata
|
|
if type(hpData) == 'string' then
|
|
if hpData == "null" then
|
|
hpData = nil
|
|
else
|
|
hpData = json.decode(hpData)
|
|
end
|
|
end
|
|
|
|
local returnString = ""
|
|
if hpData then
|
|
returnString = string.format("%s倍,", hpData.times / 1000)
|
|
end
|
|
|
|
returnString = string.format("%s人数%s人", returnString, configData.maxPlayers)
|
|
|
|
if hpData then
|
|
returnString = string.format("%s %s局", returnString, hpData.maxRound)
|
|
end
|
|
|
|
if configData.zimo then
|
|
returnString = string.format("%s,%s", returnString, configData.zimo == 0 and "可点炮 可自摸" or "必须自摸")
|
|
end
|
|
if configData.jingbibo then
|
|
returnString = string.format("%s,%s", returnString, configData.jingbibo == 1 and "有精必博" or "有精可胡")
|
|
end
|
|
|
|
returnString = returnString .. IGameInfo.LoadConfigToDetail(self, configData, hpData)
|
|
|
|
return returnString
|
|
end
|
|
|
|
return M
|