--- --- 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/sanqianfen/ui/Info_Poker_SanQianFen") return self end function M:FillData(view, index) self._maxPlayer = 3 -- 默认玩家人数 self._roundChoice = 5 -- 回合选项数 if oldGameVersion == 1 then self._config = UIPackage.CreateObjectFromURL("ui://Info_Poker_SanQianFen/Creat_SanQianFen") else self._config = UIPackage.CreateObjectFromURL("ui://Info_Poker_SanQianFen/Creat_SanQianFen") end -- if oldGameVersion==2 then -- self._config:GetController("xipai").selectedIndex=0 -- self.xipaiValueText=self._config:GetChild('xipaifen') -- 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, 0, nil) -- gniv:Show() -- end -- ) -- 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_SanQianFen/Com_help" function M:GetHelpUrl() return _help_url end local _icon_url = "ui://Info_Poker_SanQianFen/icon" function M:GetIconUrl() return _icon_url end local _icon_url1 = "ui://Info_Poker_SanQianFen/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 _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 _config:GetController("jiang").selectedIndex = data.score_510k _config:GetController("pai").selectedIndex = data.score_510k_type 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 -- self.xipaiValue=data.xi_pai_score -- end end function M:SelectedConfigData() local _config = self._config local round = _config:GetController("round").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 k_score = _config:GetController("jiang").selectedIndex local score_type = _config:GetController("pai").selectedIndex ---- 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["fourDaiTwo"] = fourDaiTwo _data["fourDaiThree"] = fourDaiThree _data["score_510k"] = k_score _data["score_510k_type"] = score_type 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 = 0 if oldGameVersion == 2 then xi_pai_score = self.xipaiValue end _data['xi_pai_score'] = xi_pai_score 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