392 lines
14 KiB
Lua
392 lines
14 KiB
Lua
---
|
||
--- Created by 谌建军.
|
||
--- DateTime: 2017/12/18 15:19
|
||
---
|
||
local EXGameInfo = {}
|
||
|
||
local M = EXGameInfo
|
||
|
||
local roundTable = { 10, 15, 20 }
|
||
function EXGameInfo.new(blur_view)
|
||
setmetatable(M, { __index = IGameInfo })
|
||
local self = setmetatable({}, { __index = M })
|
||
self.class = "EXGameInfo"
|
||
UIPackage.AddPackage("extend/poker/duoduo/ui/Info_Poker_DuoDuo")
|
||
return self
|
||
end
|
||
|
||
function M:FillData(view, index)
|
||
self._maxPlayer = 2 -- 默认玩家人数
|
||
self._roundChoice = 5 -- 回合选项数
|
||
|
||
-- if oldGameVersion == 1 then
|
||
self._config = UIPackage.CreateObjectFromURL("ui://Info_Poker_DuoDuo/Label_Detail_Play")
|
||
|
||
local com_editSetting = self._config:GetChild("com_editSetting")
|
||
|
||
com_editSetting:GetController("cGps").selectedIndex = 2
|
||
|
||
local ctr_round = self._config:GetController("round")
|
||
if ctr_round.selectedIndex == 0 then
|
||
com_editSetting:GetController("oneRound").selectedIndex = 1
|
||
else
|
||
com_editSetting:GetController("oneRound").selectedIndex = 0
|
||
end
|
||
self._config:GetController("round").onChanged:Set(function()
|
||
if ctr_round.selectedIndex == 0 then
|
||
com_editSetting:GetController("oneRound").selectedIndex = 1
|
||
else
|
||
com_editSetting:GetController("oneRound").selectedIndex = 0
|
||
end
|
||
end)
|
||
-- else
|
||
-- self._config = UIPackage.CreateObjectFromURL("ui://Info_Poker_DuoDuo/Creat_EXyueyang")
|
||
-- end
|
||
|
||
|
||
-- 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_DuoDuo/Com_help"
|
||
function M:GetHelpUrl()
|
||
return _help_url
|
||
end
|
||
|
||
local _icon_url = "ui://Info_Poker_DuoDuo/icon"
|
||
function M:GetIconUrl()
|
||
return "ui://Lobby/paodekuai2", "ui://Lobby/paodekuai1"
|
||
end
|
||
|
||
local _icon_url1 = "ui://Info_Poker_DuoDuo/icon1"
|
||
function M:GetIconUrl1()
|
||
return _icon_url1
|
||
end
|
||
|
||
local _play_list = { "15张玩法", "16张玩法" }
|
||
function M:GetPlayList()
|
||
return _play_list
|
||
end
|
||
|
||
function M:LoadConfigData(data)
|
||
local _config = self._config
|
||
pt(data)
|
||
_config:GetController("round").selectedIndex = data.opt - 1
|
||
_config:GetController("handcard").selectedIndex = 2 - data.leaf
|
||
_config:GetController("peopleNum").selectedIndex = 3 - data.maxPlayers
|
||
_config:GetController("showCardNum").selectedIndex = 1 - data.showlength
|
||
_config:GetController("wanfa1_1").selectedIndex = data.planeNoBelt
|
||
_config:GetController("wanfa1_2").selectedIndex = data.planelack
|
||
_config:GetController("wanfa1_3").selectedIndex = data.fourDaiThree and 1 or 0
|
||
_config:GetController("wanfa1_4").selectedIndex = data.heartten - 1
|
||
_config:GetController("wanfa1_5").selectedIndex = 2 - data.rule
|
||
_config:GetController("wanfa2_1").selectedIndex = data.specilAdd
|
||
|
||
-- 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
|
||
|
||
-- if _config:GetChild("fourBeltThree") then
|
||
-- _config:GetChild("fourBeltThree").selected = data.fourDaiTwo
|
||
-- end
|
||
|
||
-- if _config:GetChild("fourBeltTwo") then
|
||
-- _config:GetChild("fourBeltTwo").selected = data.fourDaiThree
|
||
-- 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:SelectedConfigData()
|
||
local _config = self._config
|
||
local round = _config:GetController("round").selectedIndex
|
||
local handcard = _config:GetController("handcard").selectedIndex
|
||
local peopleNum = _config:GetController("peopleNum").selectedIndex
|
||
local showCardNum = _config:GetController("showCardNum").selectedIndex
|
||
local wanfa1_1 = _config:GetController("wanfa1_1").selectedIndex
|
||
local wanfa1_2 = _config:GetController("wanfa1_2").selectedIndex
|
||
local wanfa1_3 = _config:GetController("wanfa1_3").selectedIndex
|
||
local wanfa1_4 = _config:GetController("wanfa1_4").selectedIndex
|
||
local wanfa1_5 = _config:GetController("wanfa1_5").selectedIndex
|
||
local wanfa2_1 = _config:GetController("wanfa2_1").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 player_num = _config:GetController("player_num").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 fourDaiTwo = false
|
||
if _config:GetChild("fourBeltThree") then
|
||
fourDaiTwo = _config:GetChild("fourBeltThree").selected
|
||
end
|
||
|
||
local fourDaiThree = false
|
||
if _config:GetChild("fourBeltTwo") then
|
||
fourDaiThree = _config:GetChild("fourBeltTwo").selected
|
||
end
|
||
|
||
local xi_pai = false
|
||
if _config:GetChild("xipai") then
|
||
xi_pai = _config:GetChild("xipai").selected
|
||
end
|
||
|
||
----
|
||
local _data = {}
|
||
_data["account_id"] = DataManager.SelfUser.Id
|
||
-- _data["AA"] = AA
|
||
-- _data["willBeOut"] = willBeOut + 1
|
||
-- _data["minboom"] = (willBeOut == 0 and leaf == 1 and player_num == 1) and bombSpring + 1 or 2
|
||
-- _data["fourBeltThree"] = fourBeltThree
|
||
-- _data["demolition"] = demolition
|
||
-- _data["fangzuobi"] = fangzuobi
|
||
-- _data["threeA"] = ThreeA
|
||
-- _data["piao"] = piao
|
||
-- _data["daniao"] = daniao
|
||
-- _data["sandaidan"] = sandaidan
|
||
-- _data["ba"] = ba
|
||
-- _data["fs"] = fs
|
||
|
||
_data["fourDaiTwo"] = fourDaiTwo
|
||
|
||
-----------------------lingmeng----------------------------
|
||
|
||
_data["AA"] = 0
|
||
_data["willBeOut"] = 1
|
||
_data["minboom"] = 2
|
||
_data["fourBeltThree"] = 0
|
||
_data["demolition"] = 0
|
||
_data["fangzuobi"] = 0
|
||
_data["threeA"] = 0
|
||
_data["piao"] = 0
|
||
_data["daniao"] = 0
|
||
_data["sandaidan"] = 0
|
||
_data["ba"] = 0
|
||
_data["fs"] = 0
|
||
|
||
|
||
_data["leaf"] = handcard == 0 and 2 or handcard --手牌 1是15张,2是16张
|
||
_data["opt"] = round + 1 --局数 1是10局 2是15局 3是20局 ("未知")
|
||
_data["maxPlayers"] = peopleNum == 1 and 4 or 3 --人数 2是2人 3是三人
|
||
_data["rule"] = wanfa1_5 == 0 and 2 or 1 --黑桃3必出 2是选择了该玩法 1是没有该玩法
|
||
_data["showlength"] = (showCardNum + 1) % 2 --显示手牌数量 0是不显示 1是显示
|
||
_data["planeNoBelt"] = wanfa1_1 --飞机不带
|
||
_data["threeNoBelt"] = wanfa1_1 --三张不带
|
||
_data["planelack"] = wanfa1_2 --飞机可少带接完
|
||
_data["threelack"] = wanfa1_2 --三张可少带接完
|
||
_data["fourDaiThree"] = false --四带三 false没有该玩法 true有该玩法
|
||
if wanfa1_3 == 1 then
|
||
_data["fourDaiThree"] = true
|
||
end
|
||
_data["heartten"] = wanfa1_4 + 1 --红桃扎鸟 1没有该玩法 2有该玩法 似乎说的是红桃10分数翻倍,具体要问江西那边
|
||
_data["specilAdd"] = wanfa2_1 --特殊加分规则:只出一张加扣10分,出2-3张加扣5分 0没有该玩法 1有该玩法
|
||
|
||
|
||
|
||
|
||
-----------------------------------------------------------
|
||
|
||
|
||
-- 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
|
||
|
||
_data['xi_pai'] = xi_pai
|
||
|
||
local xi_pai_score = 1
|
||
local an_chou_score = 1
|
||
|
||
-- 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:OnChangeOption(ctype, pay_obj)
|
||
IGameInfo.OnChangeOption(self, ctype, pay_obj)
|
||
local peopleNum = self._config:GetController("peopleNum")
|
||
peopleNum.onChanged:Set(function()
|
||
self._maxPlayer = peopleNum.selectedIndex == 1 and 2 or 3
|
||
self:ShowVariablePrice(ctype, pay_obj)
|
||
end)
|
||
end
|
||
|
||
function M:LoadConfigToDetail(data, hpdata)
|
||
local configData = data
|
||
if type(data) == 'string' then
|
||
configData = json.decode(data)
|
||
end
|
||
|
||
local hpData = configData.hpData or hpdata
|
||
if type(hpData) == 'string' then
|
||
if hpData == "null" then
|
||
hpData = nil
|
||
else
|
||
hpData = json.decode(hpData)
|
||
end
|
||
end
|
||
local returnString = ""
|
||
|
||
if hpData then
|
||
returnString = string.format("%s倍,", hpData.times / 1000)
|
||
end
|
||
|
||
returnString = string.format("%s人数%s人", returnString, configData.maxPlayers)
|
||
|
||
if hpData then
|
||
returnString = string.format("%s %s局", returnString, hpData.maxRound)
|
||
end
|
||
if configData.leaf then
|
||
returnString = string.format("%s,%s", returnString, configData.leaf == 1 and "15张手牌" or "16张手牌")
|
||
end
|
||
if configData.showlength then
|
||
returnString = string.format("%s,%s", returnString, configData.showlength == 0 and "不显示牌数" or "显示牌数")
|
||
end
|
||
if configData.planeNoBelt and configData.threeNoBelt then
|
||
if configData.planeNoBelt == 0 and configData.threeNoBelt == 0 then
|
||
returnString = string.format("%s,%s", returnString, "三张、飞机必带")
|
||
elseif configData.planeNoBelt == 0 then
|
||
returnString = string.format("%s,%s", returnString, "三张必带、飞机可不带")
|
||
elseif configData.threeNoBelt == 0 then
|
||
returnString = string.format("%s,%s", returnString, "三张可不带、飞机必带")
|
||
else
|
||
returnString = string.format("%s,%s", returnString, "三张、飞机可不带")
|
||
end
|
||
else
|
||
if configData.planeNoBelt then
|
||
returnString = string.format("%s%s", returnString, configData.planeNoBelt == 0 and "" or ",飞机可不带")
|
||
end
|
||
if configData.threeNoBelt then
|
||
returnString = string.format("%s%s", returnString, configData.threeNoBelt == 0 and "" or ",三张可不带")
|
||
end
|
||
end
|
||
|
||
if configData.planelack and configData.threelack then
|
||
if configData.planelack == 0 and configData.threelack == 0 then
|
||
returnString = string.format("%s,%s", returnString, "三张、飞机不可少带接完")
|
||
elseif configData.planelack == 0 then
|
||
returnString = string.format("%s,%s", returnString, "三张不可少带接完、飞机可少带接完")
|
||
elseif configData.threelack == 0 then
|
||
returnString = string.format("%s,%s", returnString, "三张可少带接完、飞机不可少带接完")
|
||
else
|
||
returnString = string.format("%s,%s", returnString, "三张、飞机可少带接完")
|
||
end
|
||
else
|
||
if configData.planelack then
|
||
returnString = string.format("%s%s", returnString, configData.planelack == 0 and "" or ",飞机可少带")
|
||
end
|
||
if configData.threelack then
|
||
returnString = string.format("%s%s", returnString, configData.threelack == 0 and "" or ",三张可少带")
|
||
end
|
||
end
|
||
if configData.fourDaiThree then
|
||
returnString = string.format("%s%s", returnString, configData.fourDaiThree and ",四带三" or "")
|
||
end
|
||
if configData.heartten then
|
||
returnString = string.format("%s%s", returnString, configData.heartten == 1 and "" or ",红桃10扎鸟")
|
||
end
|
||
if configData.rule then
|
||
returnString = string.format("%s%s", returnString,
|
||
configData.rule == 1 and ",首局黑桃三必出" or "")
|
||
end
|
||
if configData.specilAdd then
|
||
returnString = string.format("%s%s", returnString, configData.specilAdd == 0 and "" or ",只出一张加扣10分,出2-3张加扣5分")
|
||
end
|
||
|
||
returnString = returnString .. IGameInfo.LoadConfigToDetail(self, configData, hpData)
|
||
|
||
return returnString
|
||
end
|
||
|
||
return M
|