From 4d8a6ef97e5e38fc946f4a7b9993fc8ededd740e Mon Sep 17 00:00:00 2001 From: GenZmeY Date: Mon, 12 Sep 2022 05:34:44 +0300 Subject: [PATCH] add status icons --- YAS/Classes/GUIStyleBase.uc | 5 +- YAS/Classes/YAS_ScoreBoard.uc | 89 ++++++++++++++++++++--------------- 2 files changed, 54 insertions(+), 40 deletions(-) diff --git a/YAS/Classes/GUIStyleBase.uc b/YAS/Classes/GUIStyleBase.uc index 82e3b7c..193b2be 100644 --- a/YAS/Classes/GUIStyleBase.uc +++ b/YAS/Classes/GUIStyleBase.uc @@ -1404,12 +1404,11 @@ final function DrawArrowBox(int Direction, float X, float Y, float Width, float DrawTileStretched(DirectionMat, X,Y, Width, Height); } -function DrawTexture(Texture2D Tex, float X, float Y, float W, float H, Color TexColor) +function DrawTexture(Texture2D Tex, float X, float Y, float W, float H, optional float UL, optional float VL) { Canvas.SetPos(X, Y); - Canvas.SetDrawColorStruct(TexColor); - Canvas.DrawTile(Tex, W, H, 0, 0, Tex.SizeX, Tex.SizeY); + Canvas.DrawTile(Tex, W, H, 0, 0, UL == 0.f ? float(Tex.SizeX) : UL, VL == 0.f ? float(Tex.SizeY) : VL); } final function DrawTileStretched(Texture Tex, float X, float Y, float XS, float YS) diff --git a/YAS/Classes/YAS_ScoreBoard.uc b/YAS/Classes/YAS_ScoreBoard.uc index 5612c2f..65c49d4 100644 --- a/YAS/Classes/YAS_ScoreBoard.uc +++ b/YAS/Classes/YAS_ScoreBoard.uc @@ -5,7 +5,7 @@ const HeaderWidthRatio = 0.30f; const PlayerListWidthRatio = 0.6f; const PlayerEntryHeightMod = 1.05f; -const CompactModePlayers = 12; +const CompactModePlayers = 5; const ListItemsCompact = 16; const ListItemsDefault = 12; @@ -13,17 +13,19 @@ const ListItemsDefault = 12; const FontScalarModCompact = 1.0f; const FontScalarModDefault = 1.25f; -/* -const IconRanked = Texture2D'YAS.IconRanked'; -const IconCustom = Texture2D'UI_Menus.ServerBrowserMenu_SWF_I26'; -const IconUnranked = Texture2D'UI_Menus.ServerBrowserMenu_SWF_I28'; -const IconPassword = Texture2D'UI_Menus.ServerBrowserMenu_SWF_I20'; -const IconDosh = Texture2D'UI_HUD.InGameHUD_SWF_I13A'; -const IconPlayer = Texture2D'UI_HUD.InGameHUD_ZED_SWF_I1F5'; -const IconClock = Texture2D'UI_HUD.InGameHUD_SWF_I17D'; -const IconSkull = Texture2D'UI_Shared.AssetLib_I32'; -const IconHealth = Texture2D'UI_VoiceComms_TEX.UI_VoiceCommand_Icon_Heal'; -*/ +//const IconRanked = Texture2D'YAS.IconRanked'; +const IconCustom = Texture2D'UI_Menus.ServerBrowserMenu_SWF_I26'; +const IconUnranked = Texture2D'UI_Menus.ServerBrowserMenu_SWF_I28'; +const IconPassword = Texture2D'UI_Menus.ServerBrowserMenu_SWF_I20'; +const IconDosh = Texture2D'UI_HUD.InGameHUD_SWF_I13A'; +const IconPlayer = Texture2D'UI_HUD.InGameHUD_ZED_SWF_I1F5'; +const IconClock = Texture2D'UI_HUD.InGameHUD_SWF_I17D'; +const IconSkull = Texture2D'UI_Shared.AssetLib_I32'; +const IconSkullAndBones = Texture2D'UI_ZEDRadar_TEX.MapIcon_FailedSpawn'; +const IconHealth = Texture2D'UI_VoiceComms_TEX.UI_VoiceCommand_Icon_Heal'; +const IconHealthAlt = Texture2D'UI_Objective_Tex.UI_Obj_Healing_Loc'; +const IconHorzine = Texture2D'UI_PerkIcons_TEX.UI_Horzine_H_Logo'; +const IconGlobe = Texture2D'DailyObjective_UI.KF2_Dailies_Icon_Map'; var public E_LogLevel LogLevel; @@ -401,7 +403,7 @@ function DrawMenu() DrawTextShadowHLeftVCenter(S, BoxX + EdgeSize, YPos, BoxH, FontScalar); S = Owner.CurrentStyle.GetTimeString(KFGRI.ElapsedTime); - DrawTextShadowHVCenter(S, XPos + Width * 0.7, YPos, Width * 0.3, BoxH, FontScalar); // TODO: ? + DrawTextShadowHVCenter(S, XPos + Width * 0.7, YPos, Width * 0.3, BoxH, FontScalar); YPos += BoxH; @@ -474,9 +476,15 @@ function DrawMenu() ColorTMP = Settings.Style.ListHeaderTextColor; ColorTMP.A = 150; - Canvas.SetDrawColorStruct(ColorTmp); - - DrawHealthIcon(XPos + HealthXPos, YPos, HealthWBox, BoxH); + Canvas.SetDrawColorStruct(ColorTMP); + Owner.CurrentStyle.DrawTexture( + IconHealthAlt, + XPos + HealthXPos + BoxH * 0.5f, + YPos + BorderSize, + BoxH - BorderSize * 2, + BoxH - BorderSize * 2, + 256, + 256); PlayersList.XPosition = ((Canvas.ClipX - Width) * 0.5) / InputPos[2]; PlayersList.YPosition = (YPos + YL + BorderSize * 4) / InputPos[3]; @@ -532,26 +540,6 @@ function DrawMenu() } } -function DrawHealthIcon(float X, float Y, float W, float H) -{ - local float XPos, YPos, Size, Part; - - Size = H * 0.65; - Part = Size / 3; - - XPos = X + (W * 0.5 - Part * 0.5); - YPos = Y + (H * 0.5 - Size * 0.5); - Owner.CurrentStyle.DrawRectBox(XPos, YPos, Part, Part, 4, 100); - - XPos = X + (W * 0.5 - Size * 0.5); - YPos = Y + (H * 0.5 - Part * 0.5); - Owner.CurrentStyle.DrawRectBox(XPos, YPos, Size, Part, 4, 100); - - XPos = X + (W * 0.5 - Part * 0.5); - YPos = Y + (H * 0.5 + Part * 0.5); - Owner.CurrentStyle.DrawRectBox(XPos, YPos, Part, Part, 4, 100); -} - function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float Width, bool bFocus) { local string S, StrValue; @@ -559,6 +547,7 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float local float XPos, BoxWidth, RealPlayerWBox; local KFPlayerReplicationInfo KFPRI; local byte Level, PrestigeLevel; + local Color ColorTMP; local bool bIsZED; local int Ping; local Rank Rank; @@ -607,13 +596,39 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float // Health box C.SetDrawColorStruct(HealthBoxColor); - Owner.CurrentStyle.DrawRectBox(XPos, + Owner.CurrentStyle.DrawRectBox( + XPos, YOffset, HealthWBox, Height, EdgeSize, ShapeHealth); + if (!KFGRI.bMatchHasBegun) + { + ColorTMP = Settings.Style.ListHeaderTextColor; + ColorTMP.A = 200; + Canvas.SetDrawColorStruct(ColorTMP); + Owner.CurrentStyle.DrawTexture( + IconHorzine, + XPos + (HealthWBox - Height) * 0.5f + BorderSize * 2, + YOffset + BorderSize * 2, + Height - BorderSize * 4, + Height - BorderSize * 4); + } + else if (KFPRI.PlayerHealth <= 0 || KFPRI.PlayerHealthPercent <= 0) + { + ColorTMP = Settings.Style.ListHeaderTextColor; + ColorTMP.A = 200; + Canvas.SetDrawColorStruct(ColorTMP); + Owner.CurrentStyle.DrawTexture( + IconSkullAndBones, + XPos + BorderSize * 2, + YOffset + BorderSize * 2, + HealthWBox - BorderSize * 4, + Height - BorderSize * 4); + } + C.SetDrawColorStruct(Settings.Style.StateTextColorHealthHigh); if (KFPRI.PlayerHealth > 0)