---@class WB_ReplaceSavedMap_C:UUserWidget ---@field Button_Cancellation UNewButton ---@field Button_Replace UNewButton ---@field UniformGridPanel_SavedMapPanel UUniformGridPanel --Edit Below-- local WB_ReplaceSavedMap = { bInitDoOnce = false; ItemsCol = 2; AllSavedMapItems = {}; }; function WB_ReplaceSavedMap:Construct() local LocalPC = UGCSystemLibrary.GetLocalPlayerController() local ItemClass = UE.LoadClass(UGCGameSystem.GetUGCResourcesFullPath('Asset/UI/StatusUI/ReplaceSavedMap/WB_ReplaceSavedMapItem.WB_ReplaceSavedMapItem_C')) for i = 0, PlacementModeConfig.PlacingAttr.MaxPlaceValue - 1 do local Item = UserWidget.NewWidgetObjectBP(LocalPC, ItemClass) self.UniformGridPanel_SavedMapPanel:AddChild(Item) local Slot = WidgetLayoutLibrary.SlotAsUniformGridSlot(Item) Slot:SetColumn(i % self.ItemsCol) Slot:SetRow(i // self.ItemsCol) Slot:SetVerticalAlignment(EVerticalAlignment.VAlign_Center) Slot:SetHorizontalAlignment(EHorizontalAlignment.HAlign_Center) Item:Init(self.ClickSavedMapItem, self, i + 1, "Nil") self.AllSavedMapItems[i] = Item end WidgetLibrary.BindButtonClicked(self.Button_Cancellation, self.ClickCancellation, self) WidgetLibrary.BindButtonClicked(self.Button_Replace, self.ClickReplace, self) UGCEventSystem.AddListener(ArchiveDataConfig.GetParamNotifyEvent(ArchiveDataConfig.EArchiveType.SavedMap), self.UpdateSavedMap, self) self:UpdateSavedMap() end function WB_ReplaceSavedMap:OnShowPanel() self:ClickSavedMapItem(1) end function WB_ReplaceSavedMap:UpdateSavedMap() local SimplePlayerSavedMapList = ArchiveDataConfig.GetPlayerArchiveDataFromType(UGCSystemLibrary.GetLocalPlayerKey(), ArchiveDataConfig.EArchiveType.SavedMap) if SimplePlayerSavedMapList == nil then SimplePlayerSavedMapList = {} end for i, v in pairs(self.AllSavedMapItems) do local MapInfo = SimplePlayerSavedMapList[v:GetIndex()] if MapInfo == nil then v:SetVisibility(ESlateVisibility.Collapsed) else v:SetVisibility(ESlateVisibility.SelfHitTestInvisible) v:ResetName(MapInfo.MapName) end end end function WB_ReplaceSavedMap:ClickSavedMapItem(InIndex) self.SelectIndex = InIndex for i, v in pairs(self.AllSavedMapItems) do v:SetIsSelected(v:GetIndex() == InIndex) end end function WB_ReplaceSavedMap:ClickReplace() UGCSendRPCSystem.ActorRPCNotify(nil, UGCGameSystem.GameState, "ReplaceMap", UGCSystemLibrary.GetLocalPlayerKey(), self.SelectIndex) WidgetManager:ClosePanel(WidgetConfig.EUIType.ReplaceSavedMap) end function WB_ReplaceSavedMap:ClickCancellation() WidgetManager:ClosePanel(WidgetConfig.EUIType.ReplaceSavedMap) end -- function WB_ReplaceSavedMap:Tick(MyGeometry, InDeltaTime) -- end -- function WB_ReplaceSavedMap:Destruct() -- end return WB_ReplaceSavedMap;