189 lines
6.5 KiB
Lua
189 lines
6.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/fanpaofa/ui/Extend_Poker_FanPaoFa')
|
||
UIPackage.AddPackage('extend/zipai/fanpaofa/ui/Info_Poker_FanPaoFa')
|
||
return self
|
||
end
|
||
|
||
function M:FillData()
|
||
self._maxPlayer = 3 -- 默认玩家人数
|
||
self._roundChoice = 3 -- 回合选项数
|
||
self._config = UIPackage.CreateObjectFromURL('ui://Info_Poker_FanPaoFa/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 / 100
|
||
self.xipaiValue = value / 100
|
||
end, 3, nil)
|
||
gniv:Show()
|
||
end
|
||
)
|
||
end
|
||
end
|
||
|
||
local _help_url = 'ui://Info_Poker_FanPaoFa/Com_help'
|
||
function M:GetHelpUrl()
|
||
return _help_url
|
||
end
|
||
|
||
local _icon_url = "ui://Info_Poker_FanPaoFa/icon"
|
||
function M:GetIconUrl()
|
||
return _icon_url
|
||
end
|
||
|
||
local _icon_url1 = "ui://Info_Poker_FanPaoFa/icon1"
|
||
function M:GetIconUrl1()
|
||
return _icon_url1
|
||
end
|
||
|
||
function M:SelectedConfigData()
|
||
local _config = self._config
|
||
local round = _config:GetController('round').selectedIndex + 1 --局数
|
||
local Cost = _config:GetController('Cost').selectedIndex
|
||
local renshu = _config:GetController('renshu').selectedIndex + 2 --人数
|
||
local shoupai = _config:GetController('shoupai').selectedIndex --手牌
|
||
local choupai = _config:GetController('choupai').selectedIndex --抽牌
|
||
local hunum = _config:GetController('hunum').selectedIndex --多少起胡 0:6,1:10,2:15
|
||
|
||
local daniao = _config:GetController('daniao').selectedIndex --多少起胡 0:6,1:10,2:15
|
||
|
||
local fengding = _config:GetController('fengding').selectedIndex + 1 --多少起胡 0:6,1:10,2:15
|
||
--名堂--
|
||
local tiandihu = _config:GetChild('btn_tiandihu').selected
|
||
local honghu = _config:GetChild('btn_honghu').selected
|
||
local shisanhong = _config:GetChild('btn_shisanhong').selected
|
||
local wuhu = _config:GetChild('btn_wuhu').selected
|
||
local yidianhong = _config:GetChild('btn_yidianhong').selected
|
||
local yikuaibian = _config:GetChild('btn_yikuaibian').selected
|
||
local haidihu = _config:GetChild('btn_haidihu').selected
|
||
local kahu = _config:GetChild('btn_kahu').selected
|
||
local mingwei = _config:GetChild('btn_mingwei').selected
|
||
|
||
|
||
|
||
if shoupai == 1 then
|
||
hunum = 0
|
||
end
|
||
if shoupai == 0 and hunum == 0 then
|
||
_config:GetController('hunum').selectedIndex = 1
|
||
end
|
||
|
||
local _data = {}
|
||
|
||
_data['opt'] = round -- 1 2 8局 16 局
|
||
_data['AA'] = Cost
|
||
_data['maxPlayers'] = renshu
|
||
_data['mode'] = round --模式:
|
||
_data['shoupai'] = shoupai --手牌
|
||
_data["choupai"] = choupai --抽牌
|
||
_data['hunum'] = hunum --胡息计算
|
||
_data['daniao'] = daniao --打鸟
|
||
_data['tiandihu'] = tiandihu --天地胡
|
||
_data['honghu'] = honghu --红胡
|
||
_data['shisanhong'] = shisanhong --十三红
|
||
_data['wuhu'] = wuhu --乌胡
|
||
_data['yidianhong'] = yidianhong --一点红
|
||
_data['yikuaibian'] = yikuaibian --一块扁
|
||
_data['haidiliao'] = haidihu --海底胡
|
||
_data['kahu'] = kahu --卡胡
|
||
_data['mingwei'] = mingwei --明偎
|
||
_data['fengding'] = fengding
|
||
|
||
|
||
|
||
local xi_pai = false
|
||
if oldGameVersion == 2 then
|
||
if _config:GetChild("xipai") then
|
||
--xi_pai = _config:GetChild("xipai").selected
|
||
xi_pai = true
|
||
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 * 100
|
||
|
||
return _data
|
||
end
|
||
|
||
function M:LoadConfigData(data)
|
||
local _config = self._config
|
||
-- data.mode=3
|
||
_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
|
||
|
||
_config:GetController('shoupai').selectedIndex = data.shoupai --手牌
|
||
_config:GetController('choupai').selectedIndex = data.choupai --抽牌
|
||
_config:GetController('hunum').selectedIndex = data.hunum --起胡息
|
||
_config:GetController('daniao').selectedIndex = data.daniao --打鸟 0不打,1:10,2:20,3:50
|
||
_config:GetController('fengding').selectedIndex = data.fengding - 1
|
||
|
||
_config:GetChild('btn_tiandihu').selected = data.tiandihu --天地胡
|
||
_config:GetChild('btn_honghu').selected = data.honghu --红胡
|
||
_config:GetChild('btn_shisanhong').selected = data.shisanhong --十三红
|
||
_config:GetChild('btn_wuhu').selected = data.wuhu --乌胡
|
||
_config:GetChild('btn_yidianhong').selected = data.yidianhong --一点红
|
||
_config:GetChild('btn_yikuaibian').selected = data.yikuaibian --一块扁
|
||
_config:GetChild('btn_haidihu').selected = data.haidihu --海底胡
|
||
_config:GetChild('btn_kahu').selected = data.kahu --卡胡
|
||
_config:GetChild('btn_mingwei').selected = data.mingwei --明偎
|
||
|
||
|
||
if oldGameVersion == 2 then
|
||
self.xipaiValueText.text = data.xi_pai_score / 100
|
||
self.xipaiValue = data.xi_pai_score / 100
|
||
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
|