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

333 lines
11 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/hongzhong/ui/Info_MJ_HongZhong")
return self
end
function M:FillData()
self._maxPlayer = 4 -- 默认玩家人数
self._roundChoice = 3 -- 回合选项数
self._config = UIPackage.CreateObjectFromURL("ui://Info_MJ_HongZhong/Label_Detail_83")
local com_editSetting = self._config:GetChild("com_editSetting")
com_editSetting:GetController("cGps").selectedIndex = 2
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)
end
local _help_url = "ui://Info_MJ_HongZhong/Com_help"
function M:GetHelpUrl()
return _help_url
end
local _icon_url = "ui://Info_MJ_HongZhong/icon"
function M:GetIconUrl()
return "ui://Lobby/hongzhongmajiang2", "ui://Lobby/hongzhongmajiang1"
end
local _icon_url1 = "ui://Info_MJ_HongZhong/icon1"
function M:GetIconUrl1()
return _icon_url1
end
local _play_list = {}
function M:GetPlayList()
return _play_list
end
function M:GetPageURL()
return "ui://Info_MJ_HongZhong/Label_Detail_83"
end
function M:SelectedConfigData()
local _config = self._config
local round = _config:GetController("round").selectedIndex + 1
local people = _config:GetController("play_list").selectedIndex + 2
local qiangkong = _config:GetChild("btn_qgh").selected and true or false
local qiangkong_niao = _config:GetChild("btn_qghjm").selected and true or false
local seven_pair = _config:GetChild("btn_qidui").selected and true or false
local niao_type = _config:GetController("NiaoType").selectedIndex + 1
local zha_ma = _config:GetController("zha").selectedIndex + 1
local wo_niao = _config:GetController("wowoniao").selectedIndex + 1
local laizi = _config:GetChild("btn_laizi").selected and true or false
local aa = _config:GetController("Cost").selectedIndex
-- local zhuangxian = _config:GetChild("btn_zhuangxian").selected and true or false
local piao_niao = _config:GetChild("btn_piao_niao").selected
local jiangma = _config:GetController("jiangma").selectedIndex
local wuguizhuopaojiabei = _config:GetChild("btn_wuhongzhongzuobaofanbei").selected
----------
local piao_niao1 = 0
if _config:GetController('piao') then
piao_niao1 = _config:GetController('piao').selectedIndex
end
local piao1 = false
local piao2 = false
local piao3 = false
local piao_niao_opt = 0
if piao_niao1 == 2 then
piao_niao_opt = _config:GetController("piaofen").selectedIndex
end
local laizi4_hu = false
if _config:GetChild("btn_sihongzhong") then
laizi4_hu = _config:GetChild("btn_sihongzhong").selected
end
local hz_hu = false
if _config:GetChild("btn_wuhongzhong") then
hz_hu = _config:GetChild("btn_wuhongzhong").selected
end
local wuguijiabei = false
if _config:GetChild("btn_wuhongzhongzimo") then
wuguijiabei = _config:GetChild("btn_wuhongzhongzimo").selected
end
local dianpaohu = false
if _config:GetChild("btn_dianpaohu") then
dianpaohu = _config:GetChild("btn_dianpaohu").selected
end
local di_fen = false
if _config:GetController('difen') then
di_fen = _config:GetController('difen').selectedIndex
end
local xi_pai = false
if _config:GetChild("xipai") then
xi_pai = _config:GetChild("xipai").selected
end
local fengding_score = 0
if _config:GetController("fengding") then
fengding_score = _config:GetController("fengding").selectedIndex
end
----------
local _data = {}
_data["opt"] = round
_data["maxPlayers"] = people
-- _data["maxPlayers"] = 2
-- _data["zhuangxian"] = zhuangxian
_data["qidui"] = seven_pair
_data["qiangkong"] = qiangkong
_data["qiangkong_niao"] = not qiangkong and false or qiangkong_niao
_data["niao"] = niao_type
if oldGameVersion == 1 then
_data["niao_opt"] = niao_type == 2 and 1 or (niao_type == 3 and wo_niao or zha_ma)
else
_data["niao_opt"] = niao_type == 2 and 1 or (niao_type == 3 and wo_niao or zha_ma)
end
_data["niao_opt_score"] = wo_niao
_data["laizi8"] = laizi
_data["AA"] = aa
if oldGameVersion == 1 then
_data["piao_niao"] = piao_niao
else
_data["piao_niao"] = piao_niao1
end
_data["jiangma"] = jiangma
_data['piao1'] = piao1
_data['piao2'] = piao2
_data['piao3'] = piao3
_data['laizi4_hu'] = laizi4_hu
_data['hz_hu'] = hz_hu
_data['wuguijiabei'] = wuguijiabei
_data['di_fen'] = di_fen
_data['xi_pai'] = xi_pai
auto_piao = false
if piao_niao == 2 then
if piao1 or piao2 or piao3 then
auto_piao = true
end
end
_data['auto_piao'] = auto_piao
_data['piao_niao_opt'] = piao_niao_opt
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
-- _data["fengding_score"] = fengding_score
-- _data["wuguizhuopaojiabei"] = wuguizhuopaojiabei
-- _data["dianpaohu"] = dianpaohu
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("ShaoZhuang").selectedIndex = data.shaozhuang
-- _config:GetController("FengDing").selectedIndex = data.fengding
-- _config:GetController("TianDiHu").selectedIndex = data.Tiandihu
-- _config:GetController("ZiKeChengShun").selectedIndex = data.zikechengshun
-- _config:GetController('ZhuangFenFanBei').selectedIndex = data.zhuangfenfanbei
-- _config:GetChild("n92").value = data.jiangma
-- self._config:GetChild("n93").text = string.format("奖%s马", data.jiangma * 2)
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.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炮")
-- else
-- returnString = string.format(matString, returnString, ",不封顶")
-- end
-- end
-- if configData.TianDiHu then
-- returnString = string.format("%s%s", returnString, configData.TianDiHu == 0 and ",天地胡玩法" or ",没有天地胡")
-- end
-- if configData.jiangma then
-- returnString = string.format("%s,%s马", returnString,
-- configData.jiangma == 0 and "不奖" or string.format("奖%s", configData.jiangma * 2))
-- end
-- if configData.zikechengshun then
-- returnString = string.format("%s%s", returnString, configData.zikechengshun == 0 and ",字可成顺" or ",字不可成顺")
-- end
-- if configData.zhuangfenfanbei then
-- returnString = string.format("%s%s", returnString, configData.zhuangfenfanbei == 0 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.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炮")
-- else
-- returnString = string.format(matString, returnString, ",不封顶")
-- end
-- end
-- if configData.TianDiHu then
-- returnString = string.format("%s%s", returnString, configData.TianDiHu == 0 and ",天地胡玩法" or ",没有天地胡")
-- end
-- if configData.jiangma then
-- returnString = string.format("%s,%s马", returnString,
-- configData.jiangma == 0 and "不奖" or string.format("奖%s", configData.jiangma * 2))
-- end
-- if configData.zikechengshun then
-- returnString = string.format("%s%s", returnString, configData.zikechengshun == 0 and ",字可成顺" or ",字不可成顺")
-- end
-- if configData.zhuangfenfanbei then
-- returnString = string.format("%s%s", returnString, configData.zhuangfenfanbei == 0 and ",庄家积分翻倍" or ",庄家积分不翻倍")
-- end
-- returnString = returnString .. IGameInfo.LoadConfigToDetail(self, configData, hpData)
return returnString
end
return M