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()
|
|
|
|
|
|
return 0
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function M:SelectedConfigData()
|
|
|
|
|
|
return {}
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
-- 显示房主支付、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-08-05 20:29:11 +08:00
|
|
|
|
function M:LoadConfigToDetail(data)
|
|
|
|
|
|
|
|
|
|
|
|
local returnString = ''
|
|
|
|
|
|
|
|
|
|
|
|
local configData = json.decode(data)
|
|
|
|
|
|
|
|
|
|
|
|
pt(configData)
|
|
|
|
|
|
|
|
|
|
|
|
return returnString
|
|
|
|
|
|
end
|
|
|
|
|
|
|
2025-04-01 10:48:36 +08:00
|
|
|
|
return M
|