2025-04-01 10:48:36 +08:00
|
|
|
|
-- 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()
|
2025-09-19 16:34:16 +08:00
|
|
|
|
return 0
|
2025-04-01 10:48:36 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function M:SelectedConfigData()
|
2025-09-19 16:34:16 +08:00
|
|
|
|
return {}
|
2025-04-01 10:48:36 +08:00
|
|
|
|
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)
|
2025-11-10 21:01:13 +08:00
|
|
|
|
-- local round = self._config:GetController("round")
|
|
|
|
|
|
-- round.onChanged:Set(function()
|
|
|
|
|
|
-- self:ShowVariablePrice(ctype)
|
|
|
|
|
|
-- end)
|
2025-04-01 10:48:36 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function M:ShowVariablePrice(ctype)
|
|
|
|
|
|
-- 显示回合数后面的价格,tex_price1、tex_price2
|
2025-09-19 16:34:16 +08:00
|
|
|
|
|
2025-04-01 10:48:36 +08:00
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
-- 显示房主支付、aa支付的价格,tex_aa/tex_owner
|
|
|
|
|
|
-- local tex_aa = self._config:GetChild("tex_aa")
|
|
|
|
|
|
-- local tex_owner = self._config:GetChild("tex_owner")
|
|
|
|
|
|
-- local opt = self._config:GetController("round").selectedIndex
|
|
|
|
|
|
-- local price = self._game_data[string.format("pay%s_%s", opt + 1, self._maxPlayer)]
|
|
|
|
|
|
-- tex_aa.text = math.ceil(price / self._maxPlayer)
|
|
|
|
|
|
-- tex_owner.text = price
|
|
|
|
|
|
end
|
|
|
|
|
|
|
2025-09-12 15:36:45 +08:00
|
|
|
|
function M:SetDefault()
|
|
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
2025-09-19 16:34:16 +08:00
|
|
|
|
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
|
2025-08-05 20:29:11 +08:00
|
|
|
|
|
|
|
|
|
|
return returnString
|
|
|
|
|
|
end
|
|
|
|
|
|
|
2025-12-18 20:23:31 +08:00
|
|
|
|
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
|
|
|
|
|
|
|
2025-09-19 16:34:16 +08:00
|
|
|
|
return M
|