From 7e2751393c89feb411b765ecea68b9b780037be4 Mon Sep 17 00:00:00 2001 From: Sofia Date: Fri, 24 Jul 2026 00:14:54 +0300 Subject: [PATCH] Add ping icon --- godot/RawAssets/Ping.xcf | Bin 0 -> 3178 bytes godot/assets/Ping_high.png | Bin 0 -> 260 bytes godot/assets/Ping_high.png.import | 40 ++++++++++++++++++++++++++++ godot/assets/Ping_low.png | Bin 0 -> 239 bytes godot/assets/Ping_low.png.import | 40 ++++++++++++++++++++++++++++ godot/assets/Ping_medium.png | Bin 0 -> 251 bytes godot/assets/Ping_medium.png.import | 40 ++++++++++++++++++++++++++++ godot/scenes/ui/player_listing.tscn | 26 +++++++++++++++--- rust/src/ui/player_listing.rs | 27 ++++++++++++++++++- 9 files changed, 168 insertions(+), 5 deletions(-) create mode 100644 godot/RawAssets/Ping.xcf create mode 100644 godot/assets/Ping_high.png create mode 100644 godot/assets/Ping_high.png.import create mode 100644 godot/assets/Ping_low.png create mode 100644 godot/assets/Ping_low.png.import create mode 100644 godot/assets/Ping_medium.png create mode 100644 godot/assets/Ping_medium.png.import diff --git a/godot/RawAssets/Ping.xcf b/godot/RawAssets/Ping.xcf new file mode 100644 index 0000000000000000000000000000000000000000..db6fff6db7b8b918145f02e37236b40cedf29883 GIT binary patch literal 3178 zcmeHJZEqVz5WbX>CMo4D0U^PM32NgJnCVDO8bCHEI&k@@;*$cV2OCx?2aE zPy7Nt@+}cKCtJxeRg(cc6N4le7+15Hg-IAZa1468Y_wLAE5U@ zYioFIgEkJpB0}2%-2{CM`mn?#_kpI}`V0LXAEpf_4nq+sj5V5k{~#4y377pM)sQ_t zd~!@P@8+U1iGw(0yLo4%{(v((f0}nOJ$S`* zljRRhkF$h3GV)o|#%MA(DhI|Wl8VX58H$WFV$aKjV!3<`7jRyfeE#Y&wtSq%j&Mh* zIEW)p`p-s@;mJT4N#q-1oW!Xz0-jY7S!?XdNQpGyP-0PxRS~iz6M60VlZ22=`*+g=}>&j}TjhE8xCfbmxs+?Su*&PxDGrbR}DhLi?)ZdRdv$ads|cxtcqS zt~INdRBCH&MAOj#mN!Hen_(Y@t+6{W4t%K;3VG8<`@cwUj<4sTEYt^UFP9$q`P541CF ZefrS?dK>&3pzHQGOFLxizknZVe*;^AYO4SM literal 0 HcmV?d00001 diff --git a/godot/assets/Ping_high.png b/godot/assets/Ping_high.png new file mode 100644 index 0000000000000000000000000000000000000000..abaf4e6e2d28af33355496c9a05293c1e829b6b9 GIT binary patch literal 260 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdz#^NA%C&rs6b?Si}mUKs7M+SzC z{oH>NSwSk3J%W507^>757#dm_7=8hT8eT9klo~KFyh>nTu$sZZAYL$MSD+10f-TA0 z-G#xNL7zdtsOfPoP=vFdPhB2sE$*mv@jJt>fH@uay+eC*t!1^|?p$2W%)qdPIqhn7 pArnxi4Ex2m4G&p>EQSv}4N+@~cx--I+_(zjd%F6$taD0e0su==M)Lpw literal 0 HcmV?d00001 diff --git a/godot/assets/Ping_high.png.import b/godot/assets/Ping_high.png.import new file mode 100644 index 0000000..3803863 --- /dev/null +++ b/godot/assets/Ping_high.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://c0n5ugd867e2k" +path="res://.godot/imported/Ping_high.png-78b5667ceb93c91e9ec1243749341ac5.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/Ping_high.png" +dest_files=["res://.godot/imported/Ping_high.png-78b5667ceb93c91e9ec1243749341ac5.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/godot/assets/Ping_low.png b/godot/assets/Ping_low.png new file mode 100644 index 0000000000000000000000000000000000000000..f142d72d2e6bbaf1144e7468f66e67ce3298a85c GIT binary patch literal 239 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdz#^NA%C&rs6b?Si}mUKs7M+SzC z{oH>NSwSk3J%W507^>757#dm_7=8hT8eT9klo~KFyh>nTu$sZZAYL$MSD+10f-TA0 z-G#xNL7zdtsOfPoP=vFzV8F0tyZd42(MU XLM#$fSF~>hYG?3t^>bP0l+XkKr^r3v literal 0 HcmV?d00001 diff --git a/godot/assets/Ping_low.png.import b/godot/assets/Ping_low.png.import new file mode 100644 index 0000000..490d896 --- /dev/null +++ b/godot/assets/Ping_low.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bhrbrc725q0yd" +path="res://.godot/imported/Ping_low.png-607d26045b7085e3f2b980d8e4623f1d.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/Ping_low.png" +dest_files=["res://.godot/imported/Ping_low.png-607d26045b7085e3f2b980d8e4623f1d.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/godot/assets/Ping_medium.png b/godot/assets/Ping_medium.png new file mode 100644 index 0000000000000000000000000000000000000000..f1973226254c060c7ff830248ae2113f847ff7d1 GIT binary patch literal 251 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdz#^NA%C&rs6b?Si}mUKs7M+SzC z{oH>NSwSk3J%W507^>757#dm_7=8hT8eT9klo~KFyh>nTu$sZZAYL$MSD+10f-TA0 z-G#xNL7zdtsOfPoP=vFz`>`4tbov6U3+nXu&Hrr!%zy|U8TY@6@>, #[export] ping_label: Option>, + #[export] + ping_low: Option>, + #[export] + ping_low_color: Color, + #[export] + ping_medium: Option>, + #[export] + ping_medium_color: Color, + #[export] + ping_high: Option>, + #[export] + ping_high_color: Color, + #[export] + ping_icon: Option>, pub player_id: Option, @@ -55,6 +69,17 @@ impl PlayerListing { if let Some(ping_label) = &mut self.ping_label { ping_label.set_text(&player.data.ping.to_string()); } + if let Some(ping_icon) = &mut self.ping_icon { + let (icon, color) = match player.data.ping { + ..100 => (self.ping_low.clone(), self.ping_low_color), + 100..200 => (self.ping_medium.clone(), self.ping_medium_color), + 200.. => (self.ping_high.clone(), self.ping_high_color), + }; + if let Some(icon) = icon { + ping_icon.set_texture(&icon); + } + ping_icon.set_modulate(color); + } } else { if let Some(name_label) = &mut self.name_label { name_label.set_text("Name");