yunque9/lua_probject/extend_project/extend/zipai/shihuka/EXGameInfo.lua

264 lines
9.6 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/zipai/shihuka/ui/Extend_Poker_ShiHuKa')
UIPackage.AddPackage('extend/zipai/shihuka/ui/Info_Poker_ShiHuKa')
return self
end
function M:FillData()
self._maxPlayer = 3 -- 默认玩家人数
self._roundChoice = 3 -- 回合选项数
self._config = UIPackage.CreateObjectFromURL('ui://Info_Poker_ShiHuKa/Cgm_create_room')
if oldGameVersion ==1 then
--self._config:GetChild("xipai").visible=false
end
if oldGameVersion==2 then
self._config:GetController("xipai").selectedIndex=1
self.xipaiValueText=self._config:GetChild('xipaifen')
self.xipaiValueText.text=1
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/1000
self.xipaiValue=value/1000
end, 3, nil)
gniv:Show()
end
)
end
end
local _help_url = 'ui://Info_Poker_ShiHuKa/Com_help'
function M:GetHelpUrl()
return _help_url
end
local _icon_url = "ui://Info_Poker_ShiHuKa/icon"
function M:GetIconUrl()
return _icon_url
end
local _icon_url1 = "ui://Info_Poker_ShiHuKa/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 = _config:GetController('btn_Controller').selectedIndex
local round = _config:GetController('round').selectedIndex+1 --== 0 and 1 or 2
local Cost = _config:GetController('Cost').selectedIndex
local tun = _config:GetController('tun').selectedIndex
local fengding = _config:GetController('fengding').selectedIndex
--local choupai = _config:GetController('choupai').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('renshu').selectedIndex == 0 and 2 or 3
local qixihu = _config:GetController('qixihu').selectedIndex --起息胡
local weipai = _config:GetController('weipai').selectedIndex --偎牌
local xidouble30 = _config:GetController('xidouble30').selectedIndex --30息胡翻倍
local zimo = _config:GetController('zimo').selectedIndex --自摸加3
local daxiaozi = _config:GetController('daxiaozi').selectedIndex --大小胡
local hongheihu = _config:GetController('hongheihu').selectedIndex --红黑胡
local yidianhu = _config:GetController('yidianhu').selectedIndex --一点红
local qupai=0
if renshu==2 then
qupai=_config:GetController('qupai').selectedIndex
end
-- local qupai = _config:GetController('qupai').selectedIndex == 1 and true or false
local _data = {}
--wanfa_C=2
_data['opt'] = round -- 1 2 8局 16 局
_data['mode'] = wanfa_C + 1 -- 1 全名堂 2 红黑点 3 多红多番
_data['AA'] = Cost
_data['maxPlayers'] = renshu
if wanfa_C == 0 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
_data['qupai'] = qupai
_data['qixihu'] = qixihu
_data['weipai'] = weipai
_data['xidouble30'] = xidouble30
_data['zimo'] = zimo
_data['daxiaozi'] = daxiaozi
_data['hongheihu'] = hongheihu
_data['yidianhu'] = yidianhu
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 选
elseif wanfa_C == 2 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 选
end
-- if renshu == 2 then
-- _data['qupai'] = false
-- 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
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)
local _config = self._config
-- data.mode=3
_config:GetController('btn_Controller').selectedIndex = data.mode - 1
_config:GetController('round').selectedIndex = data.opt - 1 --== 1 and 0 or 1
_config:GetController('Cost').selectedIndex = data.AA
_config:GetController('renshu').selectedIndex = data.maxPlayers == 2 and 0 or 1
if data.mode == 1 then
_config:GetController('haihu').selectedIndex = 0
_config:GetController('tinghu').selectedIndex = 0
_config:GetController('tianhu').selectedIndex = data.tianhu
_config:GetController('dihu').selectedIndex = 0
_config:GetController('huangfan').selectedIndex = 0
_config:GetController('tun').selectedIndex = data.tun
_config:GetController('fengding').selectedIndex = data.fengding
_config:GetController('qupai').selectedIndex = data.qupai
_config:GetController('qixihu').selectedIndex = data.qixihu
_config:GetController('weipai').selectedIndex = data.weipai
_config:GetController('xidouble30').selectedIndex = data.xidouble30
_config:GetController('zimo').selectedIndex = data.zimo
_config:GetController('daxiaozi').selectedIndex = data.daxiaozi
_config:GetController('hongheihu').selectedIndex = data.hongheihu
_config:GetController('yidianhu').selectedIndex = data.yidianhu
elseif data.mode == 2 then
_config:GetController('tun').selectedIndex = data.tun
_config:GetController('fengding').selectedIndex = data.fengding
_config:GetController('duizifu').selectedIndex = data.duizifu
elseif data.mode == 3 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
end
if data.maxPlayers == 2 then
--_config:GetController('qupai').selectedIndex = data.qupai == true and 1 or 0
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/1000
self.xipaiValue=data.xi_pai_score/1000
self.anchouValueText.text=data.an_chou_score/1000
self.anchouValue=data.an_chou_score/1000
end
end
function M:OnChangeOption(ctype)
IGameInfo.OnChangeOption(self, ctype)
local people = self._config:GetController('renshu')
people.onChanged:Set(
function()
self._maxPlayer = people.selectedIndex == 0 and 2 or 3
self:ShowVariablePrice(ctype)
end
)
end
return M