73 lines
2.0 KiB
Lua
73 lines
2.0 KiB
Lua
|
---@class WB_PlayerReady_C:UUserWidget
|
||
|
---@field PlayerReady UWidgetAnimation
|
||
|
---@field Image_IsReady UImage
|
||
|
---@field Image_PlayerHead UImage
|
||
|
---@field WidgetSwitcher_StarCount UWidgetSwitcher
|
||
|
--Edit Below--
|
||
|
local WB_PlayerReady = {
|
||
|
bInitDoOnce = false;
|
||
|
PlayerKey = -1;
|
||
|
IsReady = false;
|
||
|
};
|
||
|
|
||
|
|
||
|
--function WB_PlayerReady:Construct()
|
||
|
--
|
||
|
--end
|
||
|
|
||
|
function WB_PlayerReady:BindEvent()
|
||
|
if self.DoOnceBindEvent == nil then
|
||
|
self.DoOnceBindEvent = true
|
||
|
UGCEventSystem.AddListener(EventEnum.UpdatePlayerIsReady, self.SetPlayerReady, self)
|
||
|
end
|
||
|
end
|
||
|
|
||
|
-- function WB_PlayerReady:Tick(MyGeometry, InDeltaTime)
|
||
|
|
||
|
-- end
|
||
|
|
||
|
-- function WB_PlayerReady:Destruct()
|
||
|
|
||
|
-- end
|
||
|
|
||
|
function WB_PlayerReady:InitPlayerReady(InPlayerKey)
|
||
|
if InPlayerKey and InPlayerKey > 0 then
|
||
|
self:SetVisibility(ESlateVisibility.SelfHitTestInvisible)
|
||
|
self:BindEvent()
|
||
|
self:ResetIsReady()
|
||
|
if InPlayerKey ~= self.PlayerKey then
|
||
|
UGCSystemLibrary.DownloadImageToUImage(self.Image_PlayerHead, UGCGameSystem.GameState:GetHeadIconByPlayerKey(InPlayerKey));
|
||
|
end
|
||
|
|
||
|
else
|
||
|
self:SetVisibility(ESlateVisibility.Collapsed)
|
||
|
end
|
||
|
self.PlayerKey = InPlayerKey
|
||
|
end
|
||
|
|
||
|
function WB_PlayerReady:ResetIsReady()
|
||
|
self.IsReady = false
|
||
|
self.Image_IsReady:SetVisibility(ESlateVisibility.Collapsed)
|
||
|
end
|
||
|
|
||
|
function WB_PlayerReady:GetPlayerKey()
|
||
|
return self.PlayerKey
|
||
|
end
|
||
|
|
||
|
|
||
|
|
||
|
function WB_PlayerReady:SetPlayerReady(InPlayerIsReady)
|
||
|
UGCLogSystem.Log("[WB_PlayerReady_SetPlayerReady]")
|
||
|
if not self.IsReady and table.hasValue(InPlayerIsReady, self.PlayerKey) then
|
||
|
self.IsReady = true
|
||
|
self:PlayAnimation(self.PlayerReady, 0, 1, EUMGSequencePlayMode.Forward, 1)
|
||
|
self.Image_IsReady:SetVisibility(ESlateVisibility.SelfHitTestInvisible)
|
||
|
SoundSystem.PlaySound(SoundSystem.ESound.IsReady)
|
||
|
end
|
||
|
end
|
||
|
|
||
|
function WB_PlayerReady:UpdateStarCount(InStarCount)
|
||
|
self.WidgetSwitcher_StarCount:SetActiveWidgetIndex(InStarCount)
|
||
|
end
|
||
|
|
||
|
return WB_PlayerReady;
|