164 lines
4.5 KiB
Lua
164 lines
4.5 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/yueyangwaihuzi/ui/Info_Poker_YueYangWHZ')
|
||
|
|
return self
|
||
|
|
end
|
||
|
|
|
||
|
|
function M:FillData()
|
||
|
|
self._maxPlayer = 3 -- 默认玩家人数
|
||
|
|
self._roundChoice = 2 -- 回合选项数
|
||
|
|
self._config = UIPackage.CreateObjectFromURL('ui://Info_Poker_YueYangWHZ/Cgm_create_room')
|
||
|
|
|
||
|
|
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/1000
|
||
|
|
self.xipaiValue=value/1000
|
||
|
|
|
||
|
|
end, 3, nil)
|
||
|
|
gniv:Show()
|
||
|
|
|
||
|
|
|
||
|
|
end
|
||
|
|
)
|
||
|
|
|
||
|
|
end
|
||
|
|
|
||
|
|
end
|
||
|
|
local _help_url = 'ui://Info_Poker_YueYangWHZ/Com_help'
|
||
|
|
function M:GetHelpUrl()
|
||
|
|
return _help_url
|
||
|
|
end
|
||
|
|
|
||
|
|
local _icon_url = "ui://Info_Poker_YueYangWHZ/icon"
|
||
|
|
function M:GetIconUrl()
|
||
|
|
return _icon_url
|
||
|
|
end
|
||
|
|
|
||
|
|
local _icon_url1 = "ui://Info_Poker_YueYangWHZ/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 == 0 and 1 or 2
|
||
|
|
local renshu = _config:GetController('play_list').selectedIndex +2
|
||
|
|
|
||
|
|
local kawai=_config:GetController('kawai').selectedIndex
|
||
|
|
local piao=_config:GetController('piao').selectedIndex
|
||
|
|
local first_rand_zhuang=_config:GetChild('suijizhuang').selected and true or false
|
||
|
|
local zhuang_di_hu=_config:GetController('zdihu').selectedIndex
|
||
|
|
local hao_config=_config:GetController('hao').selectedIndex
|
||
|
|
local hao_jiabei=_config:GetController('jiabei').selectedIndex
|
||
|
|
local ming_tang=_config:GetController('mingtang').selectedIndex
|
||
|
|
local qupai=0
|
||
|
|
if renshu==2 then
|
||
|
|
qupai=_config:GetController('qupai').selectedIndex
|
||
|
|
end
|
||
|
|
|
||
|
|
local _data = {}
|
||
|
|
_data['opt'] = round -- 1 2 8局 16 局
|
||
|
|
_data['maxPlayers'] = renshu
|
||
|
|
_data['kawai'] = kawai
|
||
|
|
_data['piao'] = piao
|
||
|
|
_data['zhuang_di_hu'] = zhuang_di_hu
|
||
|
|
_data['hao_config'] = hao_config
|
||
|
|
_data['hao_jiabei'] = hao_jiabei
|
||
|
|
_data['ming_tang'] = ming_tang
|
||
|
|
_data['first_rand_zhuang'] = first_rand_zhuang
|
||
|
|
_data['qupai'] = qupai
|
||
|
|
|
||
|
|
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('kawai').selectedIndex=data.kawai
|
||
|
|
_config:GetController('piao').selectedIndex=data.piao
|
||
|
|
_config:GetChild('suijizhuang').selected =data.first_rand_zhuang
|
||
|
|
_config:GetController('zdihu').selectedIndex=data.zhuang_di_hu
|
||
|
|
_config:GetController('hao').selectedIndex=data.hao_config
|
||
|
|
_config:GetController('jiabei').selectedIndex=data.hao_jiabei
|
||
|
|
_config:GetController('mingtang').selectedIndex=data.ming_tang
|
||
|
|
_config:GetController('qupai').selectedIndex=data.qupai
|
||
|
|
|
||
|
|
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
|