78 lines
2.3 KiB
Lua
Raw Permalink Normal View History

2025-01-04 23:00:19 +08:00
---@class W_RandomSelectMapItem_C:UUserWidget
---@field CanvasPanel_SpecialModeMain UCanvasPanel
---@field Image_Map UImage
---@field Overlay_Defaut UOverlay
---@field Overlay_IsSelect UOverlay
---@field Overlay_IsVote UOverlay
---@field TextBlock_MapName UTextBlock
---@field TextBlock_SpecialModeName UTextBlock
---@field WidgetSwitcher_Enable UWidgetSwitcher
---@field WidgetSwitcher_ShowSelect UWidgetSwitcher
---@field WidgetSwitcher_VoteState UWidgetSwitcher
--Edit Below--
---@type W_RandomSelectMapItem_C
local W_RandomSelectMapItem = {
bInitDoOnce = false;
SelectMapType = -1;
bVote = false;
bIsSelect = false;
};
function W_RandomSelectMapItem:Construct()
end
-- function W_RandomSelectMapItem:Tick(MyGeometry, InDeltaTime)
-- end
-- function W_RandomSelectMapItem:Destruct()
-- end
---@param SelectMapType MapConfig.MapType
function W_RandomSelectMapItem:InitSelectItem(SelectMapType)
if MapConfig.MapEnable[SelectMapType] then
self.WidgetSwitcher_Enable:SetActiveWidgetIndex(0)
else
self.WidgetSwitcher_Enable:SetActiveWidgetIndex(1)
end
self.SelectMapType = SelectMapType
self.TextBlock_MapName:SetText(MapConfig.MapInfo[self.SelectMapType].ShowName)
local SpecialModeType = MapConfig.MapInfo[self.SelectMapType].SpecialModeType
if SpecialModeType == nil or SpecialModeType == MapConfig.ESpecialModeType.Default then
self.CanvasPanel_SpecialModeMain:SetVisibility(ESlateVisibility.Collapsed)
elseif MapConfig.SpecialModeName[SpecialModeType] then
self.TextBlock_SpecialModeName:SetText(MapConfig.SpecialModeName[SpecialModeType])
end
if SelectMapType == MapConfig.MapType.Random then
self.WidgetSwitcher_ShowSelect:SetActiveWidgetIndex(1)
else
self.WidgetSwitcher_ShowSelect:SetActiveWidgetIndex(0)
self.Image_Map:SetBrushFromTexture(UGCSystemLibrary.LoadAsset(MapConfig.MapInfo[self.SelectMapType].IconSelect, true))
end
end
function W_RandomSelectMapItem:SetSelect(InbSelect)
self.bIsSelect = InbSelect
if self.bIsSelect then
self.WidgetSwitcher_VoteState:SetActiveWidgetIndex(1)
else
self.WidgetSwitcher_VoteState:SetActiveWidgetIndex(0)
end
end
function W_RandomSelectMapItem:GetIsSelect()
return self.bIsSelect
end
return W_RandomSelectMapItem;