Skip to content

Commit

Permalink
optimize player class icons
Browse files Browse the repository at this point in the history
  • Loading branch information
icewind1991 committed Dec 6, 2024
1 parent 22ad43a commit 78d8d4e
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 13 deletions.
2 changes: 1 addition & 1 deletion images/class_icons/demoman.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion images/class_icons/engineer.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion images/class_icons/heavy.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion images/class_icons/medic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion images/class_icons/pyro.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion images/class_icons/scout.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion images/class_icons/sniper.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion images/class_icons/soldier.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion images/class_icons/spy.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 5 additions & 4 deletions script/viewer/Analyse/Render/Player.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const healthMap = {
};

const imageMap = {
0: require("inline://images/class_icons/empty.svg"),
0: '',
1: require("inline://images/class_icons/scout.svg"),
2: require("inline://images/class_icons/sniper.svg"),
3: require("inline://images/class_icons/soldier.svg"),
Expand Down Expand Up @@ -55,17 +55,18 @@ export function Player(props: PlayerProp) {
<polygon points="-6,14 0, 16 6,14 0,24" fill="white"
opacity={imageOpacity()}
transform={rotate()}/>
<circle r={16} stroke-width={1} stroke="white" fill={teamColor()}
<circle r={16} stroke-width={1.5} stroke="white" fill={teamColor()}
opacity={alpha()}/>
{getClassImage(props.player, imageOpacity())}
</g>
}

function getClassImage(player: PlayerState, imageOpacity: number) {
if (!imageMap[player.playerClass]) {
const image = imageMap[player.playerClass];
if (!image) {
return [];
}
return <image href={imageMap[player.playerClass]}
return <image href={image}
class={"player-icon " + player.team}
opacity={imageOpacity}
height={32}
Expand Down

0 comments on commit 78d8d4e

Please sign in to comment.