---@class WB_ParkourSettlement_C:UUserWidget ---@field ShowAnim UWidgetAnimation ---@field Button_AutoReturnToLobby UButton ---@field Button_share UButton ---@field TextBlock_AutoReturnToLobby UTextBlock ---@field TextBlock_IsNewRecord UTextBlock ---@field TextBlock_Level UTextBlock ---@field TextBlock_Time UTextBlock --Edit Below-- ---@type WB_TeamSettlement_C local WB_ParkourSettlement = { bInitDoOnce = false; LeftTeamType = 1; RightTeamType = 2; }; function WB_ParkourSettlement:Construct() --UGCEventSystem.AddListener(EventEnum.UpdatePlayerScoreData, self.UpdateRank, self); WidgetLibrary.BindButtonClicked(self.Button_AutoReturnToLobby, self.Button_AutoReturnToLobby_OnClicked, self) WidgetLibrary.BindButtonClicked(self.Button_share, self.ShareSettlement, self) end function WB_ParkourSettlement:OnShowPanel(IsNewRecord, IsDestination) self:AutoReturnToLobby() self:UpdateRank() UGCEventSystem.AddListener(EventEnum.UpdatePlayerScoreData, self.UpdateRank, self) if IsNewRecord then self.TextBlock_IsNewRecord:SetVisibility(ESlateVisibility.SelfHitTestInvisible) else self.TextBlock_IsNewRecord:SetVisibility(ESlateVisibility.Collapsed) end if IsDestination then local SceneCameraPath = UGCGameSystem.GetUGCResourcesFullPath('Asset/Blueprint/SceneActor/BP_SceneCamera.BP_SceneCamera_C') local SceneCamera = UGCSystemLibrary.GetUniqueInstanceFromPath(SceneCameraPath) if UE.IsValid(SceneCamera) then UGCSystemLibrary.GetLocalPlayerController():SetViewTargetWithBlend(SceneCamera, 1.,EViewTargetBlendFunction.VTBlend_Linear, 0., false); end end local MainControlUI = UGCWidgetManagerSystem.GetMainControlUI() if MainControlUI then MainControlUI:SetVisibility(ESlateVisibility.Collapsed) end end function WB_ParkourSettlement:UpdateRank() local Level = PlayerScoreSystem.GetPlayerScoreDataFromType(UGCSystemLibrary.GetLocalPlayerKey(), PlayerScoreSystem.Config.EScoreType.Level) local Remainder = PlayerScoreSystem.GetPlayerScoreDataFromType(UGCSystemLibrary.GetLocalPlayerKey(), PlayerScoreSystem.Config.EScoreType.Remainder) self.TextBlock_Level:SetText(Level .. "关") self.TextBlock_Time:SetText(UGCSystemLibrary.formatTime(Remainder)) end function WB_ParkourSettlement:AutoReturnToLobby() self.DelayReturnToLobbyTime = GlobalConfigs.GameSetting.DelayReturnToLobbyTime self.SettlementTime = KismetSystemLibrary.GetGameTimeInSeconds(self) self.DelayReturnToLobbyTimerHandle = UGCEventSystem.SetTimerLoop( self, function () local NowTime = KismetSystemLibrary.GetGameTimeInSeconds(self) local ShowTime = math.floor(self.DelayReturnToLobbyTime - (NowTime - self.SettlementTime)) ShowTime = ShowTime >= 0 and ShowTime or 0 self.TextBlock_AutoReturnToLobby:SetText(string.format("返回大厅(%ds)", ShowTime)) if ShowTime <= 0 then self:Button_AutoReturnToLobby_OnClicked() end end, 0.5 ) end function WB_ParkourSettlement:Button_AutoReturnToLobby_OnClicked() -- if UGCGameSystem.GameState.GameStateType ~= CustomEnum.EGameState.End then return end if self == nil or self.DoOnceReturnToLobby then return end if self.DelayReturnToLobbyTimerHandle then UGCEventSystem.StopTimer(self.DelayReturnToLobbyTimerHandle) self.DelayReturnToLobbyTimerHandle = nil end self.DoOnceReturnToLobby = true UGCGameSystem.ReturnToLobby() --UGCMultiMode.ReqesetMatch(PlacementModeConfig.PlaceModeID) UGCLogSystem.Log("[WB_TeamSettlement_Button_AutoReturnToLobby_OnClicked]") end --- 分享战绩 function WB_ParkourSettlement:ShareSettlement() UGCWidgetManagerSystem.Share(); end return WB_ParkourSettlement;