202 lines
5.2 KiB
Lua
202 lines
5.2 KiB
Lua
-- Edit by ChenGY
|
||
--@type IGameInfo
|
||
|
||
--扩展UI:
|
||
--需要两个控制器,agent控制支付类型显示,Cost控制目前选中的支付类型
|
||
--回合数对应的显示价格组件统一命名为:tex_price1、tex_price2、...
|
||
--房主支付、AA支付显示价格的组件需要统一名称:tex_owner、tex_aa
|
||
|
||
IGameInfo = {
|
||
-- 回合选项数量,必填
|
||
_roundChoice = 2,
|
||
-- 玩家数量,在子类中赋值,如果玩家数量可选,需要重载 OnChangeOption 方法, 详见长沙麻将
|
||
_maxPlayer = 2,
|
||
_game_data = nil,
|
||
}
|
||
|
||
local M = IGameInfo
|
||
|
||
function M:SelectedCardNum()
|
||
return 0
|
||
end
|
||
|
||
function M:SelectedConfigData()
|
||
local data = {}
|
||
local com_editSetting = self._config:GetChild("com_editSetting")
|
||
|
||
self.cGps = com_editSetting:GetController("cGps")
|
||
self.cTuoguan = com_editSetting:GetController("cTuoguan")
|
||
-- GPS设置
|
||
local dis = 0
|
||
if self.cGps.selectedIndex == 0 then
|
||
dis = 100
|
||
elseif self.cGps.selectedIndex == 1 then
|
||
dis = 500
|
||
elseif self.cGps.selectedIndex == 2 then
|
||
dis = 0
|
||
end
|
||
data.GPSDetection = dis
|
||
|
||
-- 托管
|
||
local time = 0
|
||
if self.cTuoguan.selectedIndex == 1 then
|
||
time = 30
|
||
elseif self.cTuoguan.selectedIndex == 2 then
|
||
time = 60
|
||
elseif self.cTuoguan.selectedIndex == 3 then
|
||
time = 120
|
||
end
|
||
data.tuoguan_active_time = time
|
||
|
||
--其余默认值
|
||
data.isNonnegative = 1
|
||
data.hp_no_limit = 0
|
||
data.tuoguan = true
|
||
data.tuoguan_active_timeIndex = self.cTuoguan.selectedIndex
|
||
data.tuoguan_result_type = 1
|
||
|
||
return data
|
||
end
|
||
|
||
function M:FillData()
|
||
|
||
end
|
||
|
||
function M:ShowRoomPrice(ctype)
|
||
local list = DataManager.SelfUser.games
|
||
if not self._game_data then
|
||
for i = 1, #list do
|
||
if list[i].game_id == self.game_data.game_id then
|
||
self._game_data = list[i]
|
||
end
|
||
end
|
||
end
|
||
self:ShowVariablePrice(ctype)
|
||
end
|
||
|
||
function M:OnChangeOption(ctype)
|
||
self:ShowRoomPrice(ctype)
|
||
-- local round = self._config:GetController("round")
|
||
-- round.onChanged:Set(function()
|
||
-- self:ShowVariablePrice(ctype)
|
||
-- end)
|
||
end
|
||
|
||
function M:ShowVariablePrice(ctype)
|
||
-- 显示回合数后面的价格,tex_price1、tex_price2
|
||
|
||
for i = 1, self._roundChoice do
|
||
local price = "0"
|
||
price = self._game_data[string.format("pay%s_%s", i, self._maxPlayer)]
|
||
local tex_price = self._config:GetChild("tex_price" .. i)
|
||
if tex_price then
|
||
tex_price.text = price
|
||
end
|
||
end
|
||
end
|
||
|
||
function M:SetDefault()
|
||
|
||
end
|
||
|
||
function M:LoadConfigToDetail(configData, hpData)
|
||
local returnString = ""
|
||
if configData.GPSDetection then
|
||
returnString = string.format("%s%s", returnString,
|
||
configData.GPSDetection == 0 and ",距离不限制" or string.format(",距离限制%s米", configData.GPSDetection))
|
||
end
|
||
if configData.tuoguan_active_time then
|
||
returnString = string.format("%s%s", returnString,
|
||
configData.tuoguan_active_time == 0 and ",不自动托管" or string.format(",%s秒托管", configData.tuoguan_active_time))
|
||
end
|
||
if hpData then
|
||
if hpData.JieShan then
|
||
returnString = string.format("%s%s", returnString,
|
||
hpData.JieShan == 1 and ",托管结束后不解散" or
|
||
string.format(",托管%s结束后强制解散", hpData.JieShan == 2 and "当局" or string.format("%s局", hpData.JieShan - 1)))
|
||
end
|
||
if hpData.BanChat then
|
||
returnString = string.format("%s%s", returnString, hpData.BanChat == 1 and ",不允许快捷聊天" or "")
|
||
end
|
||
if hpData.BanMissile then
|
||
returnString = string.format("%s%s", returnString, hpData.BanMissile == 1 and ",关闭互动表情" or "")
|
||
end
|
||
end
|
||
|
||
return returnString
|
||
end
|
||
|
||
function M:LoadConfigOneInfo(data, hpdata, name)
|
||
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 = nil
|
||
|
||
if configData[name] then
|
||
returnString = configData[name]
|
||
end
|
||
|
||
if hpData[name] then
|
||
returnString = hpData[name]
|
||
end
|
||
|
||
return returnString
|
||
end
|
||
|
||
function M:GetHpData()
|
||
local hpData = {}
|
||
-- 通用设置
|
||
local com_editSetting = self._config:GetChild("com_editSetting")
|
||
|
||
local cJiesan = com_editSetting:GetController("cJiesan")
|
||
local cGongneng = com_editSetting:GetController("cGongneng")
|
||
local cChat = com_editSetting:GetController("cChat")
|
||
local cMisslie = com_editSetting:GetController("cMisslie")
|
||
|
||
-- 解散
|
||
hpData.JieShan = cJiesan.selectedIndex + 1
|
||
-- 功能
|
||
hpData.GongNeng = cGongneng.selectedIndex + 1
|
||
-- 开启聊天
|
||
hpData.BanChat = cChat.selectedIndex
|
||
-- 开启表情互动
|
||
hpData.BanMissile = cMisslie.selectedIndex
|
||
|
||
--一下是大联盟数据,全部采取默认值
|
||
hpData.type = 1
|
||
hpData.rewards_val = 100
|
||
hpData.anchou_rewards_val = 100
|
||
hpData.xipai_rewards_val = 100
|
||
hpData.rewards_type = 1
|
||
hpData.xipai_rewardType = 3
|
||
hpData.anchou_rewardType = 3
|
||
hpData.rewardValueType = 1
|
||
hpData.anchou_rewardValueType = 1
|
||
hpData.xipai_rewardValueType = 1
|
||
hpData.limitPlay = 1000
|
||
hpData.limitloot = 0
|
||
hpData.limitInRoom = 0
|
||
hpData.limitPump = 0
|
||
hpData.basePump = 0
|
||
hpData.robot_room = 0
|
||
hpData.tex_times_room = 1000
|
||
hpData.times = 1000
|
||
hpData.rewards_list = {}
|
||
hpData.rewards_list.cb_proportion = 0
|
||
hpData.rewards_list.UpperLimit = 0
|
||
hpData.rewards_list.UpperLimitReward = 0
|
||
return hpData
|
||
end
|
||
|
||
return M
|