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

189 lines
6.7 KiB
Lua
Raw Permalink 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/chaoshan/ui/Info_MJ_ChaoShan")
return self
end
function M:FillData()
self._maxPlayer = 4 -- 默认玩家人数
self._roundChoice = 3 -- 回合选项数
self._config = UIPackage.CreateObjectFromURL("ui://Info_MJ_ChaoShan/Cgm_create_room")
end
local _help_url= "ui://Info_MJ_ChaoShan/Com_help"
function M:GetHelpUrl()
return _help_url
end
local _icon_url = "ui://Info_MJ_ChaoShan/icon"
function M:GetIconUrl()
return _icon_url
end
local _icon_url1 = "ui://Info_MJ_ChaoShan/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("play_list").selectedIndex+2
local laizi=_config:GetController("GuiType").selectedIndex
local zhama=_config:GetController("zhama").selectedIndex
local niao=0
local niao_opt=0
local magengdifen=false
local magenggang=false
if zhama>0 and zhama<4 then
niao=1
niao_opt=zhama
magengdifen=_config:GetChild("btn_magengdifen").selected and true or false
magenggang=_config:GetChild("btn_magenggang").selected and true or false
elseif zhama==4 then
niao=3
--local baozhama=_config:GetController("baozhama").selectedIndex
niao_opt=0
end
local dianpao=_config:GetChild("btn_paohu").selected and true or false
local pengpenghu=_config:GetChild("btn_pengpenghu").selected and true or false
local qidui=_config:GetChild("btn_qixiaodui").selected and true or false
local qiangganghu=_config:GetChild("btn_qiangganghu").selected and true or false
local hunyise=_config:GetChild("btn_hunyise").selected and true or false
local qingyise=_config:GetChild("btn_qingyise").selected and true or false
local gangshangkaihua=_config:GetChild("btn_gangshangkahua").selected and true or false
local haohua_qidui=_config:GetChild("btn_haohua").selected and true or false
local shishanyao=_config:GetChild("btn_shisanyao").selected and true or false
local tiandihu=_config:GetChild("btn_tiandihu").selected and true or false
local haohua2_qidui=_config:GetChild("btn_shuanghaohua").selected and true or false
local haohua3_qidui=_config:GetChild("btn_sanhaohua").selected and true or false
local shibaluohan=_config:GetChild("btn_shibaluohan").selected and true or false
local xiaoshanyuan=_config:GetChild("btn_xiaosanyuan").selected and true or false
local xiaosixi=_config:GetChild("btn_xiaosixi").selected and true or false
local dashanyuan=_config:GetChild("btn_dasanyuan").selected and true or false
local dasixi=_config:GetChild("btn_dasixi").selected and true or false
local must_hu=_config:GetChild("btn_bihu").selected and true or false
local guopeng=_config:GetChild("btn_guopengbupeng").selected and true or false
local guogang=_config:GetChild("btn_guogangbugang").selected and true or false
local zi_dong_hu=_config:GetChild("btn_zidonghu").selected and true or false
------
local _data = {}
_data["opt"] = round
_data["maxPlayers"] = people
_data["laizi"] = laizi
_data["niao"] = niao
_data["niao_opt"] = niao_opt
_data["ma_gen_di_fen"] = magengdifen
_data["ma_gen_gong"] = magenggang
_data["dianpao"] = dianpao
_data["pengpenghu"] = pengpenghu
_data["qidui"] = qidui
_data["qiangkong_2bei"] = qiangganghu
_data["hunyise"] = hunyise
_data["qingyise"] = qingyise
_data["gangshangkaihua"] = gangshangkaihua
_data["haohua_qidui"] = haohua_qidui
_data["shishanyao"] = shishanyao
_data["tiandihu"] = tiandihu
_data["haohua2_qidui"] = haohua2_qidui
_data["haohua3_qidui"] = haohua3_qidui
_data["shibaluohan"] = shibaluohan
_data["xiaoshanyuan"] = xiaoshanyuan
_data["xiaosixi"] = xiaosixi
_data["dashanyuan"] = dashanyuan
_data["dasixi"] = dasixi
_data["must_hu"] = must_hu
_data["guopeng"] = guopeng
_data["guogang"] = guogang
_data["zi_dong_hu"] = zi_dong_hu
--printlog("上传房间配置==========>>>")
--pt(_data)
return _data
end
function M:LoadConfigData(data)
--printlog("加载房间配置=========>>>")
--pt(data)
local _config = self._config
_config:GetController("round").selectedIndex = data.opt-1
_config:GetController("play_list").selectedIndex = data.maxPlayers-2
_config:GetController("GuiType").selectedIndex = data.laizi
_config:GetChild("btn_magengdifen").selected = false
_config:GetChild("btn_magenggang").selected = false
local GuiTypeValue=0
if data.niao ==0 then
GuiTypeValue=0
elseif data.niao ==1 then
GuiTypeValue=data.niao_opt
_config:GetChild("btn_magengdifen").selected = data.ma_gen_di_fen
_config:GetChild("btn_magenggang").selected = data.ma_gen_gong
elseif data.niao ==3 then
GuiTypeValue=4
--_config:GetController("baozhama").selectedIndex = data.niao_opt
end
_config:GetController("zhama").selectedIndex = GuiTypeValue
_config:GetChild("btn_paohu").selected = data.dianpao or false
_config:GetChild("btn_pengpenghu").selected = data.pengpenghu or false
_config:GetChild("btn_qixiaodui").selected = data.qidui or false
_config:GetChild("btn_qiangganghu").selected = data.qiangganghu or false
_config:GetChild("btn_hunyise").selected = data.hunyise or false
_config:GetChild("btn_qingyise").selected = data.qingyise or false
_config:GetChild("btn_gangshangkahua").selected = data.gangshangkaihua or false
_config:GetChild("btn_haohua").selected = data.haohua_qidui or false
_config:GetChild("btn_shisanyao").selected = data.shishanyao or false
_config:GetChild("btn_tiandihu").selected = data.tiandihu or false
_config:GetChild("btn_shuanghaohua").selected = data.haohua2_qidui or false
_config:GetChild("btn_sanhaohua").selected = data.haohua3_qidui or false
_config:GetChild("btn_shibaluohan").selected = data.shibaluohan or false
_config:GetChild("btn_xiaosanyuan").selected = data.xiaoshanyuan or false
_config:GetChild("btn_xiaosixi").selected = data.xiaosixi or false
_config:GetChild("btn_dasanyuan").selected = data.dashanyuan or false
_config:GetChild("btn_dasixi").selected = data.dasixi or false
_config:GetChild("btn_bihu").selected = data.must_hu or false
_config:GetChild("btn_guopengbupeng").selected = data.guopeng or false
_config:GetChild("btn_guogangbugang").selected = data.guogang or false
_config:GetChild("btn_qiangganghu").selected= data.qiangkong_2bei or false
_config:GetChild("btn_zidonghu").selected= data.zi_dong_hu or false
end
return M