yunque9/lua_probject/extend_project/extend/poker/twodoudizhu/EXGameInfo.lua

211 lines
7.5 KiB
Lua
Raw Normal View History

2025-05-24 14:29:14 +08:00
---
--- 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/twodoudizhu/ui/Info_Poker_TwoDouDiZhu")
return self
end
function M:FillData(view, index)
self._maxPlayer = 3 -- 默认玩家人数
self._roundChoice = 3 -- 回合选项数
self._config = UIPackage.CreateObjectFromURL("ui://Info_Poker_TwoDouDiZhu/Creat_TwoDouDiZhu")
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_TwoDouDiZhu/Com_help"
function M:GetHelpUrl()
return _help_url
end
local _icon_url = "ui://Info_Poker_TwoDouDiZhu/icon"
function M:GetIconUrl()
return _icon_url
end
local _icon_url1 = "ui://Info_Poker_TwoDouDiZhu/icon1"
function M:GetIconUrl1()
return _icon_url1
end
local _play_list = {"二人斗地主"}
function M:GetPlayList()
return _play_list
end
function M:LoadConfigData(data)
printlog("LoadConfigData====================================")
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 == 2 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
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
_config:GetController("threetwo").selectedIndex = data.threeBeltTwo
_config:GetController("three").selectedIndex = data.threezhang
_config:GetController("bei").selectedIndex = data.baseMul
_config:GetController("rangxian").selectedIndex = data.rangXian
_config:GetController("fengding").selectedIndex = data.scoreTop
end
function M:SelectedConfigData()
printlog("SelectedConfigData=======================================")
local _config = self._config
local round = _config:GetController("round").selectedIndex
local rule = _config:GetController("rule").selectedIndex == 0 and 2 or 1
local leaf = 0--_config:GetController("play_list").selectedIndex
local willBeOut = 0--_config:GetController("willBeOut").selectedIndex
local bombSpring = 0--_config:GetController("bombSpring").selectedIndex
local heart10 = 0--_config:GetController("heart10").selectedIndex
local player_num = 0--_config:GetController("player_num").selectedIndex
local AA = 0--_config:GetController("Cost").selectedIndex
local showlength = 0--_config:GetController("showlength").selectedIndex
local fourBeltThree = _config:GetController("fourBeltThree").selectedIndex
local demolition = 0--_config:GetController("demolition").selectedIndex
local fangzuobi = 0--_config:GetController("fangzuobi").selectedIndex
local planelack =0-- _config:GetChild("planelack").selected and 1 or 0
local threelack = 0--_config:GetChild("Threelack").selected and 1 or 0
local ThreeA =0 --_config:GetChild("ThreeA").selected and 1 or 0
local piao =0-- _config:GetController("piao").selectedIndex
local daniao = 0--_config:GetController("daniao").selectedIndex
local sandaidan = 0--_config:GetController("sandaidan").selectedIndex
local ba = 0--_config:GetChild("boom_add").selected and 1 or 0
local fs =0-- _config:GetChild("fan_sprint").selected and 1 or 0
local threeBeltTwo = _config:GetController("threetwo").selectedIndex
local threezhang = _config:GetController("three").selectedIndex
local baseMul = _config:GetController("bei").selectedIndex
local rangXian = _config:GetController("rangxian").selectedIndex
local scoreTop = _config:GetController("fengding").selectedIndex
printlog("fourBeltThree===================",fourBeltThree)
local _data = {}
_data["account_id"] = DataManager.SelfUser.Id
_data["opt"] = round + 1
_data["rule"] = rule == 0 and 2 or 1
_data["leaf"] = leaf + 1
_data["AA"] = AA
_data["willBeOut"] = willBeOut + 1
_data["showlength"] = showlength
_data["heartten"] = willBeOut == 0 and heart10 + 1 or 2
_data["minboom"] = (willBeOut == 0 and leaf == 1 and player_num == 1) and bombSpring + 1 or 2
_data["maxPlayers"] = player_num + 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["threeBeltTwo"] = threeBeltTwo
_data["threezhang"] = threezhang
_data["baseMul"] = baseMul
_data["rangXian"] = rangXian
_data["scoreTop"] = scoreTop
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