55 lines
1.9 KiB
Lua
55 lines
1.9 KiB
Lua
|
---@class WB_SelectMapItem_C:UUserWidget
|
||
|
---@field Button_Select UButton
|
||
|
---@field Image_0 UImage
|
||
|
---@field Image_1 UImage
|
||
|
---@field Image_3 UImage
|
||
|
---@field Image_Frame UImage
|
||
|
---@field Image_IsSelect UImage
|
||
|
---@field Image_Map UImage
|
||
|
---@field Overlay_EnableMap UOverlay
|
||
|
---@field TextBlock_MapName UTextBlock
|
||
|
---@field TextBlock_SelectNum UTextBlock
|
||
|
---@field WidgetSwitcher_ShowSelect UWidgetSwitcher
|
||
|
--Edit Below--
|
||
|
---@type WB_SelectMapItem_C
|
||
|
local WB_SelectMapItem = {
|
||
|
bInitDoOnce = false;
|
||
|
SelectMapType = -1;
|
||
|
};
|
||
|
|
||
|
---@param SelectMapType int32 Enum.SelectMap
|
||
|
function WB_SelectMapItem:InitSelectItem(SelectMapType, ParentObj, ParentObjSelectCallBack)
|
||
|
self.Overlay_EnableMap:SetVisibility(ESlateVisibility.Collapsed)
|
||
|
self.SelectMapType = SelectMapType
|
||
|
self.ParentObj = ParentObj
|
||
|
self.CallBackFunc = ParentObjSelectCallBack
|
||
|
self.TextBlock_MapName:SetText(LevelTable.LevelInfo[self.SelectMapType].ShowName)
|
||
|
if SelectMapType == LevelTable.ELevelType.Random then
|
||
|
self.WidgetSwitcher_ShowSelect:SetActiveWidgetIndex(1)
|
||
|
else
|
||
|
self.WidgetSwitcher_ShowSelect:SetActiveWidgetIndex(0);
|
||
|
UE.AsyncLoadObject(LevelTable.LevelInfo[self.SelectMapType].IconSelect, function(TargetObject)
|
||
|
self.Image_Map:SetBrushFromTexture(TargetObject);
|
||
|
end);
|
||
|
end
|
||
|
UITool.BindButtonClicked(self.Button_Select, self.ClickSelect, self);
|
||
|
end
|
||
|
|
||
|
function WB_SelectMapItem:GetSelectMapType()
|
||
|
return self.SelectMapType
|
||
|
end
|
||
|
|
||
|
function WB_SelectMapItem:ClickSelect()
|
||
|
self.CallBackFunc(self.ParentObj, self.SelectMapType);
|
||
|
SoundSystem.PlaySound(SoundSystem.ESound.Btn);
|
||
|
end
|
||
|
|
||
|
function WB_SelectMapItem:SetSelectCount(InCount)
|
||
|
self.TextBlock_SelectNum:SetText(tostring(InCount));
|
||
|
end
|
||
|
|
||
|
function WB_SelectMapItem:SetSelect(bSelect)
|
||
|
self.Image_IsSelect:SetVisibility((bSelect and ESlateVisibility.SelfHitTestInvisible or ESlateVisibility.Collapsed))
|
||
|
end
|
||
|
|
||
|
return WB_SelectMapItem;
|