242 lines
8.2 KiB
Lua
242 lines
8.2 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/mushi/ui/Info_Poker_MuShi")
|
||
|
|
return self
|
||
|
|
end
|
||
|
|
|
||
|
|
function M:FillData(view, index)
|
||
|
|
|
||
|
|
self._maxPlayer = 3 -- 默认玩家人数
|
||
|
|
self._roundChoice = 3 -- 回合选项数
|
||
|
|
self._config = UIPackage.CreateObjectFromURL("ui://Info_Poker_MuShi/Cgm_create_room")
|
||
|
|
|
||
|
|
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_MuShi/Com_help"
|
||
|
|
function M:GetHelpUrl()
|
||
|
|
return _help_url
|
||
|
|
end
|
||
|
|
|
||
|
|
local _icon_url = "ui://Info_Poker_MuShi/icon"
|
||
|
|
function M:GetIconUrl()
|
||
|
|
return _icon_url
|
||
|
|
end
|
||
|
|
|
||
|
|
local _icon_url1 = "ui://Info_Poker_MuShi/icon1"
|
||
|
|
function M:GetIconUrl1()
|
||
|
|
return _icon_url1
|
||
|
|
end
|
||
|
|
|
||
|
|
local _play_list = {"木虱鱼"}
|
||
|
|
function M:GetPlayList()
|
||
|
|
return _play_list
|
||
|
|
end
|
||
|
|
|
||
|
|
function M:LoadConfigData(data)
|
||
|
|
--printlog("eeeeeeeewwwwwwwwwww111111111111111")
|
||
|
|
--printlog(debug.traceback())
|
||
|
|
--pt(data)
|
||
|
|
local _config = self._config
|
||
|
|
_config:GetController("round").selectedIndex = data.opt - 1
|
||
|
|
_config:GetController("rule").selectedIndex = data.rule == 2 and 0 or 1
|
||
|
|
_config:GetController("play_list").selectedIndex = data.leaf - 1
|
||
|
|
_config:GetController("willBeOut").selectedIndex = data.willBeOut - 1
|
||
|
|
_config:GetController("heart10").selectedIndex = data.heartten - 1
|
||
|
|
_config:GetController("bombSpring").selectedIndex = data.minboom - 1
|
||
|
|
_config:GetController("player_num").selectedIndex = data.maxPlayers == 5 and 0 or 1
|
||
|
|
_config:GetController("Cost").selectedIndex = data.AA == 0 and 0 or 1
|
||
|
|
_config:GetController("showlength").selectedIndex = data.showlength
|
||
|
|
_config:GetController("fourBeltThree").selectedIndex = data.fourBeltThree
|
||
|
|
_config:GetController("demolition").selectedIndex = data.demolition
|
||
|
|
_config:GetController("fangzuobi").selectedIndex = data.fangzuobi
|
||
|
|
|
||
|
|
_config:GetController("selectDiqu").selectedIndex = data.area
|
||
|
|
_config:GetController("wanfa").selectedIndex = data.playType
|
||
|
|
|
||
|
|
local beiMul = _config:GetChild("n158")
|
||
|
|
if (data.mushiMul == 1) then
|
||
|
|
_config:GetController("beilv").selectedIndex = 0
|
||
|
|
elseif (data.mushiMul == 2) then
|
||
|
|
_config:GetController("beilv").selectedIndex = 1
|
||
|
|
elseif (data.mushiMul == 5) then
|
||
|
|
_config:GetController("beilv").selectedIndex = 2
|
||
|
|
else
|
||
|
|
_config:GetController("beilv").selectedIndex = 3
|
||
|
|
beiMul.text = data.mushiMul
|
||
|
|
end
|
||
|
|
--_config:GetController("beilv").selectedIndex= data.mushiMul
|
||
|
|
_config:GetController("laizi").selectedIndex= data.laizi
|
||
|
|
_config:GetController("fanbei").selectedIndex= data.tiangong
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
local sandaidan = data.sandaidan
|
||
|
|
if sandaidan ~= nil and sandaidan == 1 then
|
||
|
|
_config:GetChild("sandaidan").selected = true
|
||
|
|
|
||
|
|
_config:GetChild("planelack").selected = false
|
||
|
|
_config:GetChild("Threelack").selected = false
|
||
|
|
|
||
|
|
else
|
||
|
|
_config:GetChild("sandaidan").selected = false
|
||
|
|
|
||
|
|
_config:GetChild("planelack").selected = data.planelack == 1 and true or false
|
||
|
|
_config:GetChild("Threelack").selected = data.threelack == 1 and true or false
|
||
|
|
end
|
||
|
|
|
||
|
|
local fs = data.fs
|
||
|
|
if fs ~= nil and fs == 1 then
|
||
|
|
_config:GetChild("fan_sprint").selected = true
|
||
|
|
else
|
||
|
|
_config:GetChild("fan_sprint").selected = false
|
||
|
|
end
|
||
|
|
|
||
|
|
local ba = data.ba
|
||
|
|
if ba ~= nil and ba == 1 then
|
||
|
|
_config:GetChild("boom_add").selected = true
|
||
|
|
else
|
||
|
|
_config:GetChild("boom_add").selected = false
|
||
|
|
end
|
||
|
|
|
||
|
|
_config:GetChild("ThreeA").selected = data.threeA == 1 and true or false
|
||
|
|
|
||
|
|
if data.piao ~= nil then
|
||
|
|
_config:GetController("piao").selectedIndex = data.piao
|
||
|
|
end
|
||
|
|
|
||
|
|
if data.daniao ~= nil then
|
||
|
|
_config:GetController("daniao").selectedIndex = data.daniao
|
||
|
|
end
|
||
|
|
|
||
|
|
end
|
||
|
|
|
||
|
|
function M:SelectedConfigData()
|
||
|
|
local _config = self._config
|
||
|
|
local round = _config:GetController("round").selectedIndex
|
||
|
|
local player_num = _config:GetController("player_num").selectedIndex
|
||
|
|
local selectDiqu = _config:GetController("selectDiqu").selectedIndex
|
||
|
|
local wanfa = _config:GetController("wanfa").selectedIndex
|
||
|
|
local beilvIndex = _config:GetController("beilv").selectedIndex
|
||
|
|
local beilv = 1
|
||
|
|
local beiMul = _config:GetChild("n158")
|
||
|
|
if (beilvIndex == 0) then
|
||
|
|
beilv = 1
|
||
|
|
elseif (beilvIndex == 1) then
|
||
|
|
beilv = 2
|
||
|
|
elseif (beilvIndex == 2) then
|
||
|
|
beilv = 5
|
||
|
|
elseif (beilvIndex == 3) then
|
||
|
|
beilv = tonumber(beiMul.text)
|
||
|
|
end
|
||
|
|
|
||
|
|
local laizi = _config:GetController("laizi").selectedIndex
|
||
|
|
local fanbei = _config:GetController("fanbei").selectedIndex
|
||
|
|
|
||
|
|
-- local rule = _config:GetController("rule").selectedIndex
|
||
|
|
-- local leaf = _config:GetController("play_list").selectedIndex
|
||
|
|
-- local willBeOut = _config:GetController("willBeOut").selectedIndex
|
||
|
|
-- local bombSpring = _config:GetController("bombSpring").selectedIndex
|
||
|
|
-- local heart10 = _config:GetController("heart10").selectedIndex
|
||
|
|
|
||
|
|
-- local AA = _config:GetController("Cost").selectedIndex
|
||
|
|
-- local showlength = _config:GetController("showlength").selectedIndex
|
||
|
|
-- local fourBeltThree = _config:GetController("fourBeltThree").selectedIndex
|
||
|
|
-- local demolition = _config:GetController("demolition").selectedIndex
|
||
|
|
-- local fangzuobi = _config:GetController("fangzuobi").selectedIndex
|
||
|
|
-- local planelack = _config:GetChild("planelack").selected and 1 or 0
|
||
|
|
-- local threelack = _config:GetChild("Threelack").selected and 1 or 0
|
||
|
|
-- local ThreeA = _config:GetChild("ThreeA").selected and 1 or 0
|
||
|
|
-- local piao = _config:GetController("piao").selectedIndex
|
||
|
|
-- local daniao = _config:GetController("daniao").selectedIndex
|
||
|
|
-- local sandaidan = _config:GetController("sandaidan").selectedIndex
|
||
|
|
-- local ba = _config:GetChild("boom_add").selected and 1 or 0
|
||
|
|
-- local fs = _config:GetChild("fan_sprint").selected and 1 or 0
|
||
|
|
|
||
|
|
local _data = {}
|
||
|
|
_data["account_id"] = DataManager.SelfUser.Id
|
||
|
|
_data["opt"] = round + 1
|
||
|
|
_data["maxPlayers"] = player_num ==0 and 5 or 9
|
||
|
|
_data["area"] = selectDiqu
|
||
|
|
_data["playType"] = wanfa
|
||
|
|
_data["mushiMul"] = beilv
|
||
|
|
_data["laizi"] = laizi
|
||
|
|
_data["tiangong"] = fanbei
|
||
|
|
|
||
|
|
_data["rule"] = 1--rule == 0 and 2 or 1
|
||
|
|
_data["leaf"] = 1--leaf + 1
|
||
|
|
_data["AA"] = 1--AA
|
||
|
|
_data["willBeOut"] = 1--willBeOut + 1
|
||
|
|
_data["showlength"] = 1--showlength
|
||
|
|
_data["heartten"] = 2--willBeOut == 0 and heart10 + 1 or 2
|
||
|
|
_data["minboom"] = 1--(willBeOut == 0 and leaf == 1 and player_num == 1) and bombSpring + 1 or 2
|
||
|
|
--_data["maxPlayers"] = 0--player_num + 2
|
||
|
|
_data["fourBeltThree"] = 1--fourBeltThree
|
||
|
|
_data["demolition"] = 1--demolition
|
||
|
|
_data["fangzuobi"] = 1--fangzuobi
|
||
|
|
_data["threeA"] = 1--ThreeA
|
||
|
|
_data["piao"] = 1--piao
|
||
|
|
_data["daniao"] = 1--daniao
|
||
|
|
_data["sandaidan"] = 1--sandaidan
|
||
|
|
_data["ba"] = 1--ba
|
||
|
|
_data["fs"] = 1--fs
|
||
|
|
|
||
|
|
_data["planelack"] = 0
|
||
|
|
_data["threelack"] = 0
|
||
|
|
|
||
|
|
-- if willBeOut == 1 then
|
||
|
|
-- -- body
|
||
|
|
-- _data["planelack"] = 0
|
||
|
|
-- _data["threelack"] = 0
|
||
|
|
-- else
|
||
|
|
|
||
|
|
-- if sandaidan == 1 then
|
||
|
|
-- _data["planelack"] = 0
|
||
|
|
-- _data["threelack"] = 0
|
||
|
|
-- else
|
||
|
|
-- _data["planelack"] = planelack
|
||
|
|
-- _data["threelack"] = threelack
|
||
|
|
-- end
|
||
|
|
-- end
|
||
|
|
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
|