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/zipai/hsrunbeard/ui/Info_Poker_HSRunBeard') return self end function M:FillData() self._maxPlayer = 3 -- 默认玩家人数 self._roundChoice = 2 -- 回合选项数 self._config = UIPackage.CreateObjectFromURL('ui://Info_Poker_HSRunBeard/Cgm_create_room') local btn_jia = self._config:GetChild('btn_jia') local btn_jian = self._config:GetChild('btn_jian') local btn_jia1 = self._config:GetChild('btn_jia1') local btn_jian1 = self._config:GetChild('btn_jian1') local btn_jia2 = self._config:GetChild('btn_jia2') local btn_jian2 = self._config:GetChild('btn_jian2') local fS = self._config:GetChild('btn_round8'):GetChild("title") fS.text = "1局" fS = self._config:GetChild('btn_round16'):GetChild("title") fS.text = "8局" btn_jia.onClick:Set( function() if self._config:GetController('tun').selectedIndex ~= 5 then self._config:GetController('tun').selectedIndex = self._config:GetController('tun').selectedIndex + 1 end if self._config:GetController('tun').selectedIndex == 5 then btn_jia.touchable = false btn_jia.grayed = true end if self._config:GetController('tun').selectedIndex > 0 then btn_jian.touchable = true btn_jian.grayed = false end end ) btn_jian.onClick:Set( function() if self._config:GetController('tun').selectedIndex ~= 0 then self._config:GetController('tun').selectedIndex = self._config:GetController('tun').selectedIndex - 1 end if self._config:GetController('tun').selectedIndex == 0 then btn_jian.touchable = false btn_jian.grayed = true end if self._config:GetController('tun').selectedIndex < 5 then btn_jia.touchable = true btn_jia.grayed = false end end ) btn_jia1.onClick:Set( function() local cur_tun = tonumber(self._config:GetChild("shu1").text) if cur_tun < 15 then cur_tun = cur_tun + 1 self._config:GetChild("shu1").text = tostring(cur_tun) if cur_tun == 15 then btn_jia1.touchable = false btn_jia1.grayed = true else btn_jian1.touchable = true btn_jian1.grayed = false end end end ) btn_jian1.onClick:Set( function() local cur_tun = tonumber(self._config:GetChild("shu1").text) if cur_tun > 1 then cur_tun = cur_tun - 1 self._config:GetChild("shu1").text = tostring(cur_tun) if cur_tun == 1 then btn_jian1.touchable = false btn_jian1.grayed = true else btn_jia1.touchable = true btn_jia1.grayed = false end end end ) btn_jia2.onClick:Set( function() if self._config:GetController('tun').selectedIndex ~= 5 then self._config:GetController('tun').selectedIndex = self._config:GetController('tun').selectedIndex + 1 end if self._config:GetController('tun').selectedIndex == 5 then btn_jia2.touchable = false btn_jia2.grayed = true end if self._config:GetController('tun').selectedIndex > 0 then btn_jian2.touchable = true btn_jian2.grayed = false end end ) btn_jian2.onClick:Set( function() if self._config:GetController('tun').selectedIndex ~= 0 then self._config:GetController('tun').selectedIndex = self._config:GetController('tun').selectedIndex - 1 end if self._config:GetController('tun').selectedIndex == 0 then btn_jian2.touchable = false btn_jian2.grayed = true end if self._config:GetController('tun').selectedIndex < 5 then btn_jia2.touchable = true btn_jia2.grayed = false end end ) if oldGameVersion == 1 then self._config:GetController("xipai").selectedIndex = 0 end if oldGameVersion == 2 then self._config:GetController("xipai").selectedIndex = 1 self.xipaiValueText = self._config:GetChild('xipaifen') self.xipaiValue = 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 / 100 self.xipaiValue = value / 100 end, 3, nil) gniv:Show() end ) end end local _help_url = 'ui://Info_Poker_HSRunBeard/Com_help' function M:GetHelpUrl() return _help_url end local _icon_url = "ui://Info_Poker_HSRunBeard/icon" function M:GetIconUrl() return _icon_url end local _icon_url1 = "ui://Info_Poker_HSRunBeard/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 wanfa_C = 1 local round = _config:GetController('round').selectedIndex == 0 and 1 or 2 local Cost = _config:GetController('Cost').selectedIndex local tun = tonumber(_config:GetChild("shu1").text) local fengding = _config:GetController('fengding').selectedIndex local tuanyuan = _config:GetController('tuanyuan').selectedIndex local hanghangxi = _config:GetController('hanghangxi').selectedIndex local siqi = _config:GetController('siqi').selectedIndex local shuahou = _config:GetController('shuahou').selectedIndex local huangfan = _config:GetController('huangfan').selectedIndex local jiaxingxing = _config:GetController('jiaxingxing').selectedIndex local tinghu = _config:GetController('tinghu').selectedIndex local duizifu = _config:GetController('duizifu').selectedIndex local back = _config:GetController('Back').selectedIndex local yuan = _config:GetController('yuan').selectedIndex local tianhu = _config:GetController('tianhu').selectedIndex local dihu = _config:GetController('dihu').selectedIndex local haihu = _config:GetController('haihu').selectedIndex local renshu = _config:GetController('play_list').selectedIndex + 2 local qupai = _config:GetController('qupai').selectedIndex local dhdf = 0 local _data = {} _data['opt'] = round -- 1 2 8局 16 局 _data['mode'] = 2 -- 1 全名堂 2 红黑点 3 多红多番 _data['AA'] = Cost _data['maxPlayers'] = renshu if wanfa_C == 0 then _data['tun'] = tun -- 充囤 0 1 2 3 4 分别是 1 2 3 4 5 _data['fengding'] = fengding -- 封顶 0 1 2 全名堂分别是 不封顶 100封顶 200封顶 _data['tuanyuan'] = tuanyuan -- 大团圆 0 不选 1 选 _data['hanghangxi'] = hanghangxi -- 行行息 0 不选 1 选 _data['shuahou'] = shuahou -- 耍猴 0 不选 1 选 _data['huangfan'] = huangfan -- 黄番 0 不选 1 选 _data['jiaxingxing'] = jiaxingxing -- 假行行 0 不选 1 选 _data['tinghu'] = tinghu -- 听胡 0 不选 1 选 _data['siqi'] = siqi -- 四七红 0 不选 1 选 _data['back'] = back -- 四七红 0 不选 1 选 _data['yuan'] = yuan -- 四七红 0 不选 1 选 elseif wanfa_C == 1 then _data['tun'] = tun -- 充囤 0 1 2 3 4 5 分别是 0 1 2 3 4 5 _data['fengding'] = fengding -- 封顶 0 1 2 红黑点分别是 不封顶 单局20封顶 单局 40封顶 _data['duizifu'] = duizifu -- 对子胡 0 不选 1 选 _data['hh'] = _config:GetController('hh').selectedIndex _data['dh'] = _config:GetController('dh').selectedIndex _data['hw'] = _config:GetController('hw').selectedIndex _data['wh'] = _config:GetController('wh').selectedIndex _data['hd'] = _config:GetController('hd').selectedIndex _data['wd'] = _config:GetController('wd').selectedIndex _data['jhd'] = _config:GetController('jhd').selectedIndex _data['dhdf'] = dhdf elseif wanfa_C == 2 then _data['tun'] = tun -- 充囤 0 1 2 3 4 5 分别是 0 1 2 3 4 5 _data['tianhu'] = tianhu _data['dihu'] = dihu _data['haihu'] = haihu _data['tinghu'] = tinghu _data['huangfan'] = huangfan _data['fengding'] = fengding -- 封顶 0 end if renshu == 2 then _data['qupai'] = qupai end local xi_pai = false if oldGameVersion == 2 then if _config:GetChild("xipai") then xi_pai = _config:GetChild("xipai").selected end end _data['xi_pai'] = xi_pai local xi_pai_score = 0 if oldGameVersion == 2 then xi_pai_score = self.xipaiValue end _data['xi_pai_score'] = xi_pai_score return _data end function M:LoadConfigData(data) local _config = self._config _config:GetController('play_list').selectedIndex = data.maxPlayers - 2 _config:GetController('round').selectedIndex = data.opt == 1 and 0 or 1 _config:GetController('Cost').selectedIndex = data.AA _config:GetController('renshu').selectedIndex = data.maxPlayers - 2 data.hh = data.hh == nil and 1 or data.hh data.dh = data.dh == nil and 1 or data.dh data.hw = data.hw == nil and 1 or data.hw data.wh = data.wh == nil and 1 or data.wh data.hd = data.hd == nil and 1 or data.hd data.wd = data.wd == nil and 1 or data.wd data.jhd = data.jhd == nil and 1 or data.jhd data.dhdf = data.dhdf or 0 if data.mode == 1 then _config:GetController('tun').selectedIndex = data.tun _config:GetController('fengding').selectedIndex = data.fengding _config:GetController('tuanyuan').selectedIndex = data.tuanyuan _config:GetController('hanghangxi').selectedIndex = data.hanghangxi _config:GetController('siqi').selectedIndex = data.siqi _config:GetController('shuahou').selectedIndex = data.shuahou _config:GetController('huangfan').selectedIndex = data.huangfan _config:GetController('jiaxingxing').selectedIndex = data.jiaxingxing _config:GetController('tinghu').selectedIndex = data.tinghu _config:GetController('Back').selectedIndex = data.back _config:GetController('yuan').selectedIndex = data.yuan elseif data.mode == 2 then _config:GetChild("shu1").text = tostring(data.tun) local btn_jian1 = _config:GetChild("btn_jian1") local btn_jia1 = _config:GetChild("btn_jia1") if data.tun == 1 then btn_jian1.touchable = false btn_jian1.grayed = true else btn_jian1.touchable = true btn_jian1.grayed = false end if data.tun == 15 then btn_jia1.touchable = false btn_jia1.grayed = true else btn_jia1.touchable = true btn_jia1.grayed = false end _config:GetController('fengding').selectedIndex = data.fengding _config:GetController('duizifu').selectedIndex = data.duizifu _config:GetController('hh').selectedIndex = data.hh _config:GetController('dh').selectedIndex = data.dh _config:GetController('hw').selectedIndex = data.hw _config:GetController('wh').selectedIndex = data.wh _config:GetController('hd').selectedIndex = data.hd _config:GetController('wd').selectedIndex = data.wd _config:GetController('jhd').selectedIndex = data.jhd _config:GetController('dhdf').selectedIndex = data.dhdf elseif data.mode == 3 then _config:GetController('haihu').selectedIndex = data.haihu _config:GetController('tinghu').selectedIndex = data.tinghu _config:GetController('tianhu').selectedIndex = data.tianhu _config:GetController('dihu').selectedIndex = data.dihu _config:GetController('huangfan').selectedIndex = data.huangfan _config:GetController('tun').selectedIndex = data.tun _config:GetController('fengding').selectedIndex = data.fengding end if data.maxPlayers == 2 then _config:GetController('qupai').selectedIndex = data.qupai end if _config:GetChild("xipai") then _config:GetChild("xipai").selected = data.xi_pai end if oldGameVersion == 2 then self.xipaiValueText.text = data.xi_pai_score self.xipaiValue = data.xi_pai_score end end function M:OnChangeOption(ctype) IGameInfo.OnChangeOption(self, ctype) local play_list = self._config:GetController('play_list') play_list.onChanged:Add( function() self._maxPlayer = play_list.selectedIndex + 2 self:ShowVariablePrice(ctype) end ) end return M