92 lines
3.0 KiB
Lua
92 lines
3.0 KiB
Lua
|
---@class WB_PlayerSelectedMiniGame_C:UUserWidget
|
||
|
---@field PlayerReady UWidgetAnimation
|
||
|
---@field Image_IsReady UImage
|
||
|
---@field Image_PlayerHead UImage
|
||
|
---@field TextBlock_StarCount UTextBlock
|
||
|
--Edit Below--
|
||
|
local WB_PlayerSelectedMiniGame = {
|
||
|
bInitDoOnce = false;
|
||
|
PlayerKey = -1;
|
||
|
IsReady = false;
|
||
|
};
|
||
|
|
||
|
|
||
|
--function WB_PlayerSelectedMiniGame:Construct()
|
||
|
--
|
||
|
--end
|
||
|
|
||
|
function WB_PlayerSelectedMiniGame:BindEvent()
|
||
|
if self.DoOnceBindEvent == nil then
|
||
|
self.DoOnceBindEvent = true
|
||
|
UGCEventSystem.AddListener(EventEnum.UpdatePlayerSelectMiniMapType, self.SetPlayerSelected, self)
|
||
|
end
|
||
|
end
|
||
|
|
||
|
-- function WB_PlayerSelectedMiniGame:Tick(MyGeometry, InDeltaTime)
|
||
|
|
||
|
-- end
|
||
|
|
||
|
-- function WB_PlayerSelectedMiniGame:Destruct()
|
||
|
|
||
|
-- end
|
||
|
|
||
|
--function WB_PlayerSelectedMiniGame:InitPlayerReady(InPlayerKey)
|
||
|
-- if InPlayerKey then
|
||
|
-- self:SetVisibility(ESlateVisibility.SelfHitTestInvisible)
|
||
|
-- self:BindEvent()
|
||
|
-- self.IsReady = false
|
||
|
-- self.Image_IsReady:SetVisibility(ESlateVisibility.Collapsed)
|
||
|
-- if InPlayerKey == nil or InPlayerKey < 0 then
|
||
|
-- self:SetVisibility(ESlateVisibility.Collapsed)
|
||
|
-- elseif InPlayerKey ~= self.PlayerKey then
|
||
|
-- self:SetVisibility(ESlateVisibility.SelfHitTestInvisible)
|
||
|
-- UGCSystemLibrary.DownloadImageToUImage(self.Image_PlayerHead, UGCGameSystem.GameState:GetHeadIconByPlayerKey(InPlayerKey));
|
||
|
-- end
|
||
|
-- self.PlayerKey = InPlayerKey
|
||
|
-- else
|
||
|
-- self:SetVisibility(ESlateVisibility.Collapsed)
|
||
|
-- end
|
||
|
--end
|
||
|
|
||
|
|
||
|
function WB_PlayerSelectedMiniGame: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
|
||
|
self:SetPlayerSelected(UGCGameSystem.GameState:GetPlayerSelectMiniGameTypes())
|
||
|
end
|
||
|
|
||
|
function WB_PlayerSelectedMiniGame:ResetIsReady()
|
||
|
self.IsReady = false
|
||
|
self.Image_IsReady:SetVisibility(ESlateVisibility.Collapsed)
|
||
|
end
|
||
|
|
||
|
|
||
|
function WB_PlayerSelectedMiniGame:GetPlayerKey()
|
||
|
return self.PlayerKey
|
||
|
end
|
||
|
|
||
|
function WB_PlayerSelectedMiniGame:SetPlayerSelected(PlayerSelectMiniGameTypes)
|
||
|
-- UGCLogSystem.LogTree("[WB_PlayerSelectedMiniGame_SetPlayerReady]PlayerSelectMiniGameTypes:", PlayerSelectMiniGameTypes)
|
||
|
if not self.IsReady and PlayerSelectMiniGameTypes[self.PlayerKey] then
|
||
|
self.IsReady = true
|
||
|
self:PlayAnimation(self.PlayerReady, 0, 1, EUMGSequencePlayMode.Forward, 1)
|
||
|
SoundSystem.PlaySound(SoundSystem.ESound.IsReady)
|
||
|
UGCLogSystem.Log("[WB_PlayerSelectedMiniGame_SetPlayerSelected]")
|
||
|
end
|
||
|
end
|
||
|
|
||
|
function WB_PlayerSelectedMiniGame:UpdateStarCount(InStarCount)
|
||
|
self.TextBlock_StarCount:SetText(tostring(InStarCount))
|
||
|
end
|
||
|
|
||
|
return WB_PlayerSelectedMiniGame;
|