87 lines
3.6 KiB
Lua
87 lines
3.6 KiB
Lua
---@class WB_SelectChallenge_C:UUserWidget
|
|
---@field CanvasPanel_Main UCanvasPanel
|
|
---@field HorizontalBox_NotSelectedChallengerCount UHorizontalBox
|
|
---@field NewButton_Challenge UNewButton
|
|
---@field NewButton_Reselect UNewButton
|
|
---@field NewButton_Siege UNewButton
|
|
---@field TextBlock_ChallengeName UTextBlock
|
|
---@field TextBlock_ChallengeSelectCount UTextBlock
|
|
---@field TextBlock_SelectName UTextBlock
|
|
---@field TextBlock_SiegeName UTextBlock
|
|
---@field TextBlock_SiegeSelectCount UTextBlock
|
|
---@field TextBlock_WaitTime UTextBlock
|
|
---@field WidgetSwitcher_0 UWidgetSwitcher
|
|
---@field WidgetSwitcher_1 UWidgetSwitcher
|
|
---@field WidgetSwitcher_IsSelected UWidgetSwitcher
|
|
--Edit Below--
|
|
local WB_SelectChallenge = { bInitDoOnce = false }
|
|
|
|
|
|
function WB_SelectChallenge:Construct()
|
|
self.TextBlock_WaitTime:BindingProperty("Text", self.TextBlock_WaitTime_Text, self)
|
|
|
|
self.TextBlock_ChallengeName:SetText(ProjectConfig.ChallengeName)
|
|
self.TextBlock_SiegeName:SetText(ProjectConfig.SiegeName)
|
|
|
|
WidgetLibrary.BindButtonClicked(self.NewButton_Challenge, self.SelectChallenge, self)
|
|
WidgetLibrary.BindButtonClicked(self.NewButton_Siege, self.SelectSiege, self)
|
|
WidgetLibrary.BindButtonClicked(self.NewButton_Reselect, self.ShowSelf, self)
|
|
|
|
UGCEventSystem.AddListener(EventEnum.UpdatePlayerSelectedChallenge, self.UpdatePlayerSelectedChallenge, self)
|
|
UGCEventSystem.AddListener(ArchiveDataConfig.GetParamNotifyEvent(ArchiveDataConfig.EArchiveType.NotSelectedChallengerCount), self.UpdateNotSelectedChallengerCount, self)
|
|
|
|
self:ShowSelf()
|
|
self:UpdateNotSelectedChallengerCount()
|
|
end
|
|
|
|
function WB_SelectChallenge:UpdatePlayerSelectedChallenge()
|
|
local ChallengeCount, SiegeCount = UGCGameSystem.GameState:GetSelectedChallengeCount()
|
|
self.TextBlock_ChallengeSelectCount:SetText(ChallengeCount .. "/1")
|
|
self.TextBlock_SiegeSelectCount:SetText(SiegeCount .. "/4")
|
|
end
|
|
|
|
function WB_SelectChallenge:SelectChallenge()
|
|
UGCSendRPCSystem.ActorRPCNotify(nil, UGCGameSystem.GameState, "PlayerSelectChallenge", UGCSystemLibrary.GetLocalPlayerKey(), true)
|
|
self.TextBlock_SelectName:SetText(ProjectConfig.ChallengeName)
|
|
self:CloseSelf()
|
|
end
|
|
|
|
function WB_SelectChallenge:SelectSiege()
|
|
UGCSendRPCSystem.ActorRPCNotify(nil, UGCGameSystem.GameState, "PlayerSelectChallenge", UGCSystemLibrary.GetLocalPlayerKey(), false)
|
|
self.TextBlock_SelectName:SetText(ProjectConfig.SiegeName)
|
|
self:CloseSelf()
|
|
end
|
|
|
|
function WB_SelectChallenge:CloseSelf()
|
|
self.WidgetSwitcher_IsSelected:SetActiveWidgetIndex(1)
|
|
end
|
|
|
|
function WB_SelectChallenge:ShowSelf()
|
|
self.WidgetSwitcher_IsSelected:SetActiveWidgetIndex(0)
|
|
end
|
|
|
|
function WB_SelectChallenge:TextBlock_WaitTime_Text(ReturnValue)
|
|
return tostring(UGCGameSystem.GameState:GetGameTime()) .. "s"
|
|
end
|
|
|
|
function WB_SelectChallenge:UpdateNotSelectedChallengerCount()
|
|
local NotSelectedChallengerCount = ArchiveDataConfig.GetPlayerArchiveDataFromType(UGCSystemLibrary.GetLocalPlayerKey(), ArchiveDataConfig.EArchiveType.NotSelectedChallengerCount)
|
|
NotSelectedChallengerCount = NotSelectedChallengerCount and NotSelectedChallengerCount or 0
|
|
for i = 1, self.HorizontalBox_NotSelectedChallengerCount:GetChildrenCount() do
|
|
local Item = self.HorizontalBox_NotSelectedChallengerCount:GetChildAt(i - 1)
|
|
if i <= NotSelectedChallengerCount then
|
|
Item:SetVisibility(ESlateVisibility.SelfHitTestInvisible)
|
|
else
|
|
Item:SetVisibility(ESlateVisibility.Collapsed)
|
|
end
|
|
end
|
|
end
|
|
-- function WB_SelectChallenge:Tick(MyGeometry, InDeltaTime)
|
|
|
|
-- end
|
|
|
|
-- function WB_SelectChallenge:Destruct()
|
|
|
|
-- end
|
|
|
|
return WB_SelectChallenge |