41 lines
1.3 KiB
Lua
Raw Normal View History

2025-01-04 23:00:19 +08:00
---@class WB_SaveMap_C:UUserWidget
---@field AnimShow UWidgetAnimation
---@field Button_PlaceMode UButton
---@field Button_Save UButton
---@field EditableText_MapName UWidget_NewEditableText_C
--Edit Below--
local WB_SaveMap = { bInitDoOnce = false; };
function WB_SaveMap:Construct()
WidgetLibrary.BindButtonClicked(self.Button_PlaceMode, self.NotifyToPlaceMode, self)
WidgetLibrary.BindButtonClicked(self.Button_Save, self.NotifySaveMap, self)
self.EditableText_MapName.OnTextCommitted:Add(self.TextCommit, self)
end
function WB_SaveMap:NotifyToPlaceMode()
UGCSendRPCSystem.RPCEvent(nil, EventEnum.BackToPlaceMode)
end
function WB_SaveMap:NotifySaveMap()
local Text = self.EditableText_MapName:GetText()
UGCSendRPCSystem.RPCEvent(nil, EventEnum.SaveRunMap, Text)
end
function WB_SaveMap:TextCommit(InText)
-- UGCLogSystem.Log("[WB_SaveMap_TextCommit] InText:%s", InText)
local TargetText = UGCSystemLibrary.remove_punctuation(InText)
UGCLogSystem.Log("[WB_SaveMap_TextCommit] TargetText:%s", TargetText)
self.EditableText_MapName:SetText(UGCSystemLibrary.utf8sub(TargetText, 1, PlacementModeConfig.PlacingAttr.PlaceMapNameLengthLimit))
end
-- function WB_SaveMap:Tick(MyGeometry, InDeltaTime)
-- end
-- function WB_SaveMap:Destruct()
-- end
return WB_SaveMap;