changhong/lua_probject/extend_project/extend/poker/shengsidu/EXGameInfo.lua

244 lines
6.3 KiB
Lua

---
--- Created by 谌建军.
--- DateTime: 2017/12/18 15:19
---
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/poker/shengsidu/ui/Info_Poker_ShengSiDu")
return self
end
function M:FillData(view, index)
self._maxPlayer = 3 -- 默认玩家人数
self._roundChoice = 3 -- 回合选项数
self._config = UIPackage.CreateObjectFromURL("ui://Info_Poker_ShengSiDu/Creat_RunFast")
self._config:GetChild("people_2").onClick:Set(function()
self._config:GetController("rule").selectedIndex = 0
end)
local piao = self._config:GetController("piao")
local daniao = self._config:GetController("daniao")
piao.onChanged:Add(function()
if piao.selectedIndex ~= 0 then
daniao.selectedIndex = 0
end
end)
daniao.onChanged:Add(function()
if daniao.selectedIndex ~= 0 then
piao.selectedIndex = 0
end
end)
end
local _help_url = "ui://Info_Poker_ShengSiDu/Com_help"
function M:GetHelpUrl()
return _help_url
end
local _icon_url = "ui://Info_Poker_ShengSiDu/icon"
function M:GetIconUrl()
return _icon_url
end
local _icon_url1 = "ui://Info_Poker_ShengSiDu/icon1"
function M:GetIconUrl1()
return _icon_url1
end
local _play_list = {"生死赌"}
function M:GetPlayList()
return _play_list
end
function M:LoadConfigData(data)
local _config = self._config
_config:GetController("round").selectedIndex = data.opt - 1
_config:GetController("rule").selectedIndex = data.rule -1
_config:GetController("player_num").selectedIndex = data.maxPlayers-2
_config:GetChild("fangzuobi").selected = data.fangzuobi
_config:GetChild("fangpian3bidai").selected = false
if data.must_first_card==1 then
_config:GetChild("fangpian3bidai").selected = true
end
_config:GetChild("will_be_card").selected = false
if data.willBeOut==1 then
_config:GetChild("will_be_card").selected = true
end
_config:GetChild("baodanbiding").selected = false
if data.baodanbili==1 then
_config:GetChild("baodanbiding").selected = true
end
_config:GetChild("showlength").selected = false
if data.showlength==1 then
_config:GetChild("showlength").selected = true
end
_config:GetChild("2bulian3").selected = false
if data.two_budai_three==1 then
_config:GetChild("2bulian3").selected = true
end
_config:GetChild("3d2bufenduihesan").selected = false
if data.sandai2_notdui==1 then
_config:GetChild("3d2bufenduihesan").selected = true
end
_config:GetChild("Akaitou").selected = false
if data.a_ke_dai_tou==1 then
_config:GetChild("Akaitou").selected = true
end
_config:GetChild("3zkeshaodaiwan").selected = false
if data.threeoutlack==1 then
_config:GetChild("3zkeshaodaiwan").selected = true
end
_config:GetChild("3zkeshaojiewan").selected = false
if data.threelack==1 then
_config:GetChild("3zkeshaojiewan").selected = true
end
_config:GetChild("4zshaodaikechuwan").selected = false
if data.fouroutlack==1 then
_config:GetChild("4zshaodaikechuwan").selected = true
end
--_config:GetChild("baodanbiding").selected = data.baodanbili
--_config:GetChild("showlength").selected = data.showlength
--_config:GetChild("2bulian3").selected = data.two_budai_three
--_config:GetChild("3d2bufenduihesan").selected = data.sandai2_notdui
--_config:GetChild("Akaitou").selected = data.a_ke_dai_tou
--_config:GetChild("3zkeshaodaiwan").selected = data.threeoutlack
--_config:GetChild("3zkeshaojiewan").selected = data.threelack
--_config:GetChild("4zshaodaikechuwan").selected = data.fouroutlack
_config:GetController("piao").selectedIndex = data.zha_dan_score
_config:GetController("jifen").selectedIndex = data.ji_fen_type
end
function M:SelectedConfigData()
local _config = self._config
local round = _config:GetController("round").selectedIndex
local rule = _config:GetController("rule").selectedIndex
local player_num = _config:GetController("player_num").selectedIndex
local fangzuobi=false
if player_num>0 then
fangzuobi = _config:GetChild("fangzuobi").selected
end
local must_first_card=0
if rule==0 then
if _config:GetChild("fangpian3bidai").selected then
must_first_card=1
end
else
--must_first_card=2
end
local willBeOut=0
if _config:GetChild("will_be_card").selected then
willBeOut=1
end
local baodanbili=0
if _config:GetChild("baodanbiding").selected then
baodanbili=1
end
local showlength=0
if _config:GetChild("showlength").selected then
showlength=1
end
local two_budai_three=0
if _config:GetChild("2bulian3").selected then
two_budai_three=1
end
local sandai2_notdui=0
if _config:GetChild("3d2bufenduihesan").selected then
sandai2_notdui=1
end
local a_ke_dai_tou=0
if _config:GetChild("Akaitou").selected then
a_ke_dai_tou=1
end
local threeoutlack=0
if _config:GetChild("3zkeshaodaiwan").selected then
threeoutlack=1
end
local threelack=0
if _config:GetChild("3zkeshaojiewan").selected then
threelack=1
end
local fouroutlack=0
if _config:GetChild("4zshaodaikechuwan").selected then
fouroutlack=1
end
local zha_dan_score = _config:GetController("piao").selectedIndex
local ji_fen_type = _config:GetController("jifen").selectedIndex
local _data = {}
_data["account_id"] = DataManager.SelfUser.Id
_data["opt"] = round + 1
_data["rule"] = rule +1
_data["must_first_card"] = must_first_card
_data["willBeOut"] = willBeOut
_data["maxPlayers"] = player_num + 2
_data["fangzuobi"] = fangzuobi
_data["baodanbili"] = baodanbili
_data["showlength"] = showlength
_data["two_budai_three"] = two_budai_three
_data["sandai2_notdui"] = sandai2_notdui
_data["a_ke_dai_tou"] = a_ke_dai_tou
_data["threeoutlack"] = threeoutlack
_data["threelack"] = threelack
_data["fouroutlack"] = fouroutlack
_data["zha_dan_score"] = zha_dan_score
_data["ji_fen_type"] = ji_fen_type
return _data
end
function M:OnChangeOption(ctype, pay_obj)
IGameInfo.OnChangeOption(self, ctype, pay_obj)
local people = self._config:GetController("player_num")
people.onChanged:Set(function()
self._maxPlayer = people.selectedIndex + 2
self:ShowVariablePrice(ctype, pay_obj)
end)
end
return M