83 lines
2.3 KiB
Lua
83 lines
2.3 KiB
Lua
|
---@class WB_BuffSelectItem_C:UUserWidget
|
||
|
---@field CanvasPanel_IsUpLevel UCanvasPanel
|
||
|
---@field Image_3 UImage
|
||
|
---@field Image_BuffIcon UImage
|
||
|
---@field NewButton_BuffSelect UNewButton
|
||
|
---@field TextBlock_Name UTextBlock
|
||
|
--Edit Below--
|
||
|
local WB_BuffSelectItem = { bInitDoOnce = false; };
|
||
|
|
||
|
--[==[ Construct
|
||
|
function WB_BuffSelectItem:Construct()
|
||
|
|
||
|
end
|
||
|
-- Construct ]==]
|
||
|
|
||
|
-- function WB_BuffSelectItem:Tick(MyGeometry, InDeltaTime)
|
||
|
|
||
|
-- end
|
||
|
|
||
|
-- function WB_BuffSelectItem:Destruct()
|
||
|
|
||
|
-- end
|
||
|
|
||
|
|
||
|
function WB_BuffSelectItem:LuaInit()
|
||
|
if self.bInitDoOnce then
|
||
|
return;
|
||
|
end
|
||
|
self.bInitDoOnce = true;
|
||
|
WidgetLibrary.BindButtonClicked(self.NewButton_BuffSelect, self.ClickSelect, self)
|
||
|
end
|
||
|
|
||
|
function WB_BuffSelectItem:UpdateIncreaseType(InIncreaseType)
|
||
|
self:LuaInit()
|
||
|
UGCLogSystem.Log("[WB_BuffSelectItem_UpdateIncreaseType]")
|
||
|
local LocalPawn = UGCGameSystem.GameState:GetAlivePawn(UGCSystemLibrary.GetLocalPlayerKey())
|
||
|
if LocalPawn then
|
||
|
-- 判断是否为升级
|
||
|
if LocalPawn:GetOwnedIncreaseLevel(InIncreaseType) > 0 then
|
||
|
self.CanvasPanel_IsUpLevel:SetVisibility(ESlateVisibility.HitTestInvisible)
|
||
|
else
|
||
|
self.CanvasPanel_IsUpLevel:SetVisibility(ESlateVisibility.Collapsed)
|
||
|
end
|
||
|
-- 设置名字
|
||
|
self.TextBlock_Name:SetText(tostring(GodOfWarConfig.IncreaseName[InIncreaseType]))
|
||
|
-- 设置图案
|
||
|
UGCSystemLibrary.AsyncLoadAsset(GodOfWarConfig.IncreaseIcon[InIncreaseType],
|
||
|
function(InTex)
|
||
|
if UE.IsValid(InTex) then
|
||
|
self.Image_BuffIcon:SetBrushFromTexture(InTex, false)
|
||
|
end
|
||
|
end,
|
||
|
nil,
|
||
|
true
|
||
|
)
|
||
|
end
|
||
|
end
|
||
|
|
||
|
function WB_BuffSelectItem:ClickSelect()
|
||
|
UGCLogSystem.Log("[WB_BuffSelectItem_ClickSelect]")
|
||
|
if self.SelectCallBackFunc then
|
||
|
if self.SelectCallBackObj then
|
||
|
self.SelectCallBackFunc(self.SelectCallBackObj, self:GetIndex())
|
||
|
else
|
||
|
self.SelectCallBackFunc(self:GetIndex())
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
|
||
|
function WB_BuffSelectItem:BindClickSelect(Func, Obj)
|
||
|
self.SelectCallBackFunc = Func
|
||
|
self.SelectCallBackObj = Obj
|
||
|
end
|
||
|
|
||
|
function WB_BuffSelectItem:SetIndex(InIndex)
|
||
|
self.Index = InIndex
|
||
|
end
|
||
|
|
||
|
function WB_BuffSelectItem:GetIndex()
|
||
|
return self.Index
|
||
|
end
|
||
|
|
||
|
return WB_BuffSelectItem;
|