-
Notifications
You must be signed in to change notification settings - Fork 1k
Add player name display option #4643
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
starnotes-xj
wants to merge
10
commits into
danielkrupinski:master
Choose a base branch
from
starnotes-xj:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
5a53364
新增玩家名称显示选项及相关配置
starnotes-xj 09ebfde
Potential fix for pull request finding
starnotes-xj 932e88f
Resolve player name offset independently
starnotes-xj 0dc0c82
Restore player name lookup
starnotes-xj 6fe3e8b
在头部上方展示玩家名称,并采用独立的世界空间投影方式
starnotes-xj ea89132
Merge branch 'master' into master
starnotes-xj ae1e14a
Add player name display feature and pattern scan fixes
starnotes-xj e201c7b
Address review feedback for in-world player name
starnotes-xj f9d7cae
Add pattern scan crash diagnostics and Chinese/English i18n
starnotes-xj d625727
Always write pattern scan log file, even when all patterns match
starnotes-xj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
Source/Features/Visuals/PlayerInfoInWorld/PlayerNamePanel.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| #pragma once | ||
|
|
||
| #include <utility> | ||
|
|
||
| #include <CS2/Panorama/CUIPanel.h> | ||
| #include <Features/Visuals/PlayerInfoInWorld/PlayerInfoInWorldConfigVariables.h> | ||
| #include <GameClient/Panorama/PanoramaLabel.h> | ||
| #include <GameClient/Panorama/PanoramaUiPanel.h> | ||
|
|
||
| #include "PlayerNamePanelParams.h" | ||
|
|
||
| template <typename HookContext> | ||
| class PlayerNamePanelContext { | ||
| public: | ||
| PlayerNamePanelContext(HookContext& hookContext, cs2::CUIPanel* panel, auto&) noexcept | ||
| : _hookContext{hookContext} | ||
| , _panel{panel} | ||
| { | ||
| } | ||
|
|
||
| [[nodiscard]] decltype(auto) config() const noexcept | ||
| { | ||
| return _hookContext.config(); | ||
| } | ||
|
|
||
| [[nodiscard]] decltype(auto) panel() const noexcept | ||
| { | ||
| return _hookContext.template make<PanoramaUiPanel>(_panel); | ||
| } | ||
|
|
||
| private: | ||
| HookContext& _hookContext; | ||
| cs2::CUIPanel* _panel; | ||
| }; | ||
|
|
||
| template <typename HookContext, typename Context = PlayerNamePanelContext<HookContext>> | ||
| class PlayerNamePanel { | ||
| public: | ||
| template <typename... Args> | ||
| explicit PlayerNamePanel(Args&&... args) noexcept | ||
| : context{std::forward<Args>(args)...} | ||
| { | ||
| } | ||
|
|
||
| void update(auto&& playerPawn) const noexcept | ||
| { | ||
| if (!context.config().template getVariable<player_info_vars::PlayerNameEnabled>()) { | ||
| context.panel().setVisible(false); | ||
| return; | ||
| } | ||
|
|
||
| const auto playerName = playerPawn.playerController().getName(); | ||
| if (!playerName || !*playerName) { | ||
| context.panel().setVisible(false); | ||
| return; | ||
| } | ||
|
|
||
| context.panel().setVisible(true); | ||
| context.panel().clientPanel().template as<PanoramaLabel>().setText(playerName); | ||
| } | ||
|
|
||
| private: | ||
| Context context; | ||
| }; |
31 changes: 31 additions & 0 deletions
31
Source/Features/Visuals/PlayerInfoInWorld/PlayerNamePanelParams.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| #pragma once | ||
|
|
||
| #include <CS2/Constants/ColorConstants.h> | ||
| #include <CS2/Panorama/CUILength.h> | ||
| #include <CS2/Panorama/StyleEnums.h> | ||
| #include <GameClient/Panorama/PanelAlignmentParams.h> | ||
| #include <GameClient/Panorama/PanelFontParams.h> | ||
| #include <GameClient/Panorama/PanelMarginParams.h> | ||
| #include <GameClient/Panorama/PanelShadowParams.h> | ||
|
|
||
| namespace player_name_panel_params | ||
| { | ||
| static constexpr auto kFont = PanelFontParams{ | ||
| .fontFamily = "Stratum2, 'Arial Unicode MS'", | ||
| .fontSize = 20, | ||
| .fontWeight = cs2::k_EFontWeightBold | ||
| }; | ||
| static constexpr auto kAlignment = PanelAlignmentParams{ | ||
| .horizontalAlignment = cs2::k_EHorizontalAlignmentCenter, | ||
| .verticalAlignment = cs2::k_EVerticalAlignmentTop | ||
| }; | ||
| static constexpr auto kMargin = PanelMarginParams{.marginBottom = cs2::CUILength::pixels(1)}; | ||
| static constexpr auto kColor = cs2::kColorWhite; | ||
| static constexpr auto kShadowParams = PanelShadowParams{ | ||
| .horizontalOffset{cs2::CUILength::pixels(0)}, | ||
| .verticalOffset{cs2::CUILength::pixels(0)}, | ||
| .blurRadius{cs2::CUILength::pixels(3)}, | ||
| .strength = 3, | ||
| .color{cs2::kColorBlack} | ||
| }; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| {"Combat":{"NoScopeInaccuracyVis":{"Enabled":true}},"Hud":{"BombTimer":{"Enabled":true},"BombDefuseAlert":{"Enabled":true},"PreserveKillfeed":{"Enabled":true},"PostRoundTimer":{"Enabled":true},"BombPlantAlert":{"Enabled":true}},"Visuals":{"ModelGlow":{"Enabled":true,"Players":{"Enabled":true,"OnlyEnemies":true,"ColorMode":0},"Weapons":true,"DroppedBomb":false,"TickingBomb":false,"DefuseKits":true,"GrenadeProjectiles":true,"Hues":{"PlayerBlue":203,"PlayerGreen":133,"PlayerYellow":48,"PlayerOrange":13,"PlayerPurple":269,"TeamT":30,"TeamCT":220,"LowHealth":311,"HighHealth":256,"Enemy":353,"Ally":74,"Molotov":37,"Flashbang":205,"HEGrenade":333,"SmokeGrenade":116,"DroppedBomb":69,"TickingBomb":303,"DefuseKit":227}},"OutlineGlow":{"Enabled":true,"Players":{"Enabled":true,"OnlyEnemies":false,"ColorMode":2},"Weapons":true,"DroppedBomb":true,"TickingBomb":false,"DefuseKits":true,"Hostages":true,"GrenadeProjectiles":true,"Hues":{"PlayerBlue":200,"PlayerGreen":134,"PlayerYellow":57,"PlayerOrange":12,"PlayerPurple":256,"TeamT":37,"TeamCT":227,"LowHealth":287,"HighHealth":171,"Enemy":304,"Ally":103,"Molotov":60,"Flashbang":250,"HEGrenade":300,"SmokeGrenade":140,"DroppedBomb":302,"TickingBomb":26,"DefuseKit":160,"Hostage":334}},"PlayerInfoInWorld":{"Enabled":true,"OnlyEnemies":true,"PlayerPositionArrow":{"Enabled":true,"ColorMode":0},"Health":{"Enabled":true,"ColorMode":0},"ActiveWeaponIcon":true,"BombCarrierIcon":true,"BombPlantIcon":true,"ActiveWeaponAmmo":false,"BombDefuseIcon":true,"HostagePickupIcon":true,"HostageRescueIcon":true,"BlindedIcon":true},"ViewmodelMod":{"Enabled":true,"ModifyFov":true,"Fov":90}},"Sound":{"Visualizations":{"Footsteps":{"Enabled":true},"BombPlant":{"Enabled":true},"BombBeep":{"Enabled":true},"BombDefuse":{"Enabled":true},"WeaponScope":{"Enabled":true},"WeaponReload":{"Enabled":true}}}} | ||
| {"Combat":{"NoScopeInaccuracyVis":{"Enabled":true}},"Hud":{"BombTimer":{"Enabled":true},"BombDefuseAlert":{"Enabled":true},"PreserveKillfeed":{"Enabled":true},"PostRoundTimer":{"Enabled":true},"BombPlantAlert":{"Enabled":true}},"Visuals":{"ModelGlow":{"Enabled":true,"Players":{"Enabled":true,"OnlyEnemies":true,"ColorMode":0},"Weapons":true,"DroppedBomb":false,"TickingBomb":false,"DefuseKits":true,"GrenadeProjectiles":true,"Hues":{"PlayerBlue":203,"PlayerGreen":133,"PlayerYellow":48,"PlayerOrange":13,"PlayerPurple":269,"TeamT":30,"TeamCT":220,"LowHealth":311,"HighHealth":256,"Enemy":353,"Ally":74,"Molotov":37,"Flashbang":205,"HEGrenade":333,"SmokeGrenade":116,"DroppedBomb":69,"TickingBomb":303,"DefuseKit":227}},"OutlineGlow":{"Enabled":true,"Players":{"Enabled":true,"OnlyEnemies":false,"ColorMode":2},"Weapons":true,"DroppedBomb":true,"TickingBomb":false,"DefuseKits":true,"Hostages":true,"GrenadeProjectiles":true,"Hues":{"PlayerBlue":200,"PlayerGreen":134,"PlayerYellow":57,"PlayerOrange":12,"PlayerPurple":256,"TeamT":37,"TeamCT":227,"LowHealth":287,"HighHealth":171,"Enemy":304,"Ally":103,"Molotov":60,"Flashbang":250,"HEGrenade":300,"SmokeGrenade":140,"DroppedBomb":302,"TickingBomb":26,"DefuseKit":160,"Hostage":334}},"PlayerInfoInWorld":{"Enabled":true,"OnlyEnemies":true,"PlayerPositionArrow":{"Enabled":true,"ColorMode":0},"PlayerName":true,"Health":{"Enabled":true,"ColorMode":0},"ActiveWeaponIcon":true,"BombCarrierIcon":true,"BombPlantIcon":true,"ActiveWeaponAmmo":false,"BombDefuseIcon":true,"HostagePickupIcon":true,"HostageRescueIcon":true,"BlindedIcon":true},"ViewmodelMod":{"Enabled":true,"ModifyFov":true,"Fov":90}},"Sound":{"Visualizations":{"Footsteps":{"Enabled":true},"BombPlant":{"Enabled":true},"BombBeep":{"Enabled":true},"BombDefuse":{"Enabled":true},"WeaponScope":{"Enabled":true},"WeaponReload":{"Enabled":true}}}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.