57 lines
1.4 KiB
Lua
57 lines
1.4 KiB
Lua
|
---@class WBP_TitleButton_C:UUserWidget
|
||
|
---@field Button_Title UButton
|
||
|
---@field TextBlock_Title UTextBlock
|
||
|
---@field WidgetSwitcher_Click UWidgetSwitcher
|
||
|
---@field TitleText FText
|
||
|
---@field ItemType TEnumAsByte<EItemType>
|
||
|
--Edit Below--
|
||
|
local WBP_TitleButton = {
|
||
|
bInitDoOnce = false;
|
||
|
};
|
||
|
|
||
|
function WBP_TitleButton:Construct()
|
||
|
self.Button_Title.OnClicked:Add(WBP_TitleButton.OnClickTitle, self)
|
||
|
end
|
||
|
|
||
|
-- function WBP_TitleButton:Tick(MyGeometry, InDeltaTime)
|
||
|
|
||
|
-- end
|
||
|
|
||
|
function WBP_TitleButton:Destruct()
|
||
|
self.Button_Title.OnClicked:Remove(WBP_TitleButton.OnClickTitle, self)
|
||
|
end
|
||
|
|
||
|
function WBP_TitleButton:OnClickTitle()
|
||
|
-- 在此处判断一下
|
||
|
local BackpackPanel = UIManager:GetPanel(EUIType.Backpack)
|
||
|
if BackpackPanel == nil then
|
||
|
return
|
||
|
end
|
||
|
local It = BackpackPanel.WBP_GenerateInfo:GetCurrentType()
|
||
|
local bCanAdd = false;
|
||
|
if It == -1 then
|
||
|
bCanAdd = true
|
||
|
else
|
||
|
if self.ItemType == It then
|
||
|
bCanAdd = true
|
||
|
else
|
||
|
UIManager:ShowGeneralNotice("当前合成的物品类型不符合,请选择相同类型的物品进行合成", true)
|
||
|
end
|
||
|
end
|
||
|
|
||
|
if bCanAdd then
|
||
|
EventSystem:SendEvent(EventType.ClickTitle, self.ItemType)
|
||
|
end
|
||
|
|
||
|
NewPlayerGuideManager:RemoveGuide(21)
|
||
|
end
|
||
|
|
||
|
function WBP_TitleButton:SetClick(InClick)
|
||
|
if InClick then
|
||
|
self.WidgetSwitcher_Click:SetActiveWidgetIndex(1)
|
||
|
else
|
||
|
self.WidgetSwitcher_Click:SetActiveWidgetIndex(0)
|
||
|
end
|
||
|
end
|
||
|
|
||
|
return WBP_TitleButton;
|