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

100 lines
2.4 KiB
Lua
Raw Normal View History

2025-11-14 23:38:35 +08:00
---
--- Created by 谌建军.
--- DateTime: 2017/12/13 17:04
---
local TipID = {
xia = 1012,
gen = 1013,
jia = 1014,
suo = 1015,
qi = 1016,
guo = 1017
}
local EXPlayerPokerInfoView = import('.EXPlayerPokerInfoView')
local EXCardType = import('.EXCardType')
local EXCardCheck = import(".CardCheck")
local EXPlayerSelfPokerInfoView = {
_view = nil,
_mainView = nil,
_mask_liangpai = nil
}
local M = EXPlayerSelfPokerInfoView
function M.new(view, mainView)
setmetatable(M, { __index = EXPlayerPokerInfoView })
local self = setmetatable({}, { __index = M })
self._view = view
self._mainView = mainView
self.gameCtr = ControllerManager.GetController(GameController)
self:init()
return self
end
function M:init()
local view = self._view
EXPlayerPokerInfoView.init(self)
self._view_tipsList = view:GetChild('list_tips')
self._view_tipsList.onClickItem:Set(function(context)
self:OnClickTips(context)
end)
self._ctr_out = view:GetController('out')
end
function M:ShowTips(tipsList)
self._ctr_out.selectedIndex = 1
self._view_tipsList:RemoveChildren()
print("lingmengShowTips", #tipsList)
for i = 1, #tipsList do
if tipsList[i] == 1012 or tipsList[i] == 1014 then
local xiaScore = { 1, 2, 5 }
for j = 1, 3 do
local obj = self._view_tipsList:AddItemFromPool()
self.SetTipData(obj, tipsList[i], xiaScore[j])
obj.title = string.format("%d分", xiaScore[j])
end
else
local obj = self._view_tipsList:AddItemFromPool()
self.SetTipData(obj, tipsList[i])
end
end
end
function M:OnClickTips(context)
self._ctr_out.selectedIndex = 0
local button = context.data.data
local id = button.id
local _data = {}
if id == TipID.xia or id == TipID.jia then
local score = button.data
_data["id"] = id
_data["betScore"] = tonumber(score)
self:ClickTip(_data)
else
_data["id"] = id
self:ClickTip(_data)
end
end
function M:ClickTip(_data)
self._gameCtr:SendTip(_data)
end
function M.SetTipData(obj, id, ...)
obj.data = {}
obj.data.id = id
obj.data.data = ...
obj:GetController('type').selectedIndex = id - 1012
end
function M:Clear()
EXPlayerPokerInfoView.Clear(self)
end
return M