hengyang_client/lua_probject/extend_project/extend/poker2/suoha/ExPlayerSelfPokerInfoView.lua

96 lines
2.3 KiB
Lua
Raw Normal View History

2025-05-07 10:29:37 +08:00
---
--- Created by 谌建军.
--- DateTime: 2017/12/13 17:04
---
2025-05-15 16:49:18 +08:00
local TipType = {
guo = 0,
qi = 1,
xia = 4
}
2025-05-14 10:59:30 +08:00
local EXPlayerPokerInfoView = import('.EXPlayerPokerInfoView')
local EXCardType = import('.EXCardType')
local EXCardCheck = import(".CardCheck")
2025-05-07 10:29:37 +08:00
2025-05-14 10:59:30 +08:00
local EXPlayerSelfPokerInfoView = {
2025-05-07 10:29:37 +08:00
_view = nil,
_mainView = nil,
_mask_liangpai = nil
}
2025-05-14 10:59:30 +08:00
local M = EXPlayerSelfPokerInfoView
2025-05-07 10:29:37 +08:00
function M.new(view, mainView)
2025-05-14 10:59:30 +08:00
setmetatable(M, { __index = EXPlayerPokerInfoView })
2025-05-07 10:29:37 +08:00
local self = setmetatable({}, { __index = M })
self._view = view
self._mainView = mainView
self.gameCtr = ControllerManager.GetController(GameController)
self:init()
return self
end
function M:init()
2025-05-15 16:49:18 +08:00
local view = self._view
2025-05-14 10:59:30 +08:00
EXPlayerPokerInfoView.init(self)
2025-05-15 16:49:18 +08:00
self._view_tipsList = view:GetChild('list_tips')
2025-05-15 17:01:19 +08:00
self._view_tipsList.onClickItem:Set(function(context)
self:OnClickTips(context)
end)
2025-05-15 16:49:18 +08:00
self._ctr_out = view:GetController('out')
2025-05-07 10:29:37 +08:00
end
2025-05-15 16:49:18 +08:00
function M:ShowTips(type)
self._ctr_out.selectedIndex = 1
if type == 1 then
self._view_tipsList:RemoveChildren()
local obj = self._view_tipsList:AddItemFromPool()
self.SetTipData(obj, TipType.qi)
2025-05-15 18:30:29 +08:00
obj = self._view_tipsList:AddItemFromPool()
obj.title = "1分"
self.SetTipData(obj, TipType.xia, 1)
obj = self._view_tipsList:AddItemFromPool()
obj.title = "2分"
self.SetTipData(obj, TipType.xia, 2)
obj = self._view_tipsList:AddItemFromPool()
obj.title = "5分"
self.SetTipData(obj, TipType.xia, 5)
2025-05-15 16:49:18 +08:00
end
end
2025-05-07 10:29:37 +08:00
2025-05-15 17:01:19 +08:00
function M:OnClickTips(context)
2025-05-15 18:30:29 +08:00
local button = context.data.data
local type = button.type
2025-05-15 18:46:02 +08:00
local _data = {}
2025-05-15 17:01:19 +08:00
if type == TipType.guo then
elseif type == TipType.qi then
2025-05-15 18:46:02 +08:00
_data["id"] = 1016
self:ClickTip(_data)
2025-05-15 17:01:19 +08:00
elseif type == TipType.xia then
2025-05-15 18:30:29 +08:00
local score = button.data
2025-05-15 18:46:02 +08:00
_data["id"] = 1012
_data["betScore"] = tonumber(score)
self:ClickTip(_data)
2025-05-15 17:01:19 +08:00
end
end
2025-05-15 18:46:02 +08:00
function M:ClickTip(_data)
self._gameCtr:SendTip(_data)
2025-05-15 17:01:19 +08:00
end
2025-05-15 18:30:29 +08:00
function M.SetTipData(obj, type, ...)
2025-05-15 16:49:18 +08:00
obj.data = {}
obj.data.type = type
2025-05-15 18:30:29 +08:00
obj.data.data = ...
2025-05-15 16:49:18 +08:00
obj:GetController('type').selectedIndex = type
2025-05-07 10:29:37 +08:00
end
function M:Clear()
2025-05-14 10:59:30 +08:00
EXPlayerPokerInfoView.Clear(self)
2025-05-07 10:29:37 +08:00
end
return M