REFACTOR assets

This commit is contained in:
2025-05-01 13:14:46 +02:00
parent 5abf81c6cb
commit 98e44a6cf8
27 changed files with 55 additions and 42 deletions

View File

Before

Width:  |  Height:  |  Size: 7.2 KiB

After

Width:  |  Height:  |  Size: 7.2 KiB

View File

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 9.4 KiB

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

@@ -1,6 +1,6 @@
{ {
"material": "maps/cs_office.png", "material": "assets/maps/overview/cs_office.png",
"pos_x": -1838, "pos_x": -1838,
"pos_y": 1858, "pos_y": 1858,
"scale": 4.1, "scale": 4.1,

View File

@@ -0,0 +1,8 @@
{
"material": "assets/maps/overview/de_ancient.png",
"pos_x": -2953,
"pos_y": 2164,
"scale": 5
}

View File

@@ -1,5 +1,5 @@
{ {
"material": "maps/de_anubis.png", "material": "assets/maps/overview/de_anubis.png",
"pos_x": -2796.000000, "pos_x": -2796.000000,
"pos_y": 3328.000000, "pos_y": 3328.000000,
"scale": 5.220000 "scale": 5.220000

View File

@@ -1,6 +1,6 @@
{ {
"material": "maps/de_dust2.png" , "material": "assets/maps/overview/de_dust2.png" ,
"pos_x": -2476 , "pos_x": -2476 ,
"pos_y": 3239, "pos_y": 3239,
"scale": 4.4 , "scale": 4.4 ,

View File

@@ -1,6 +1,6 @@
{ {
"material": "maps/de_inferno.png", "material": "assets/maps/overview/de_inferno.png",
"pos_x": -2087 , "pos_x": -2087 ,
"pos_y" : 3870, "pos_y" : 3870,
"scale": 4.9, "scale": 4.9,

View File

@@ -1,5 +1,5 @@
{ {
"material": "maps/de_mirage.png", "material": "assets/maps/overview/de_mirage.png",
"pos_x": -3230, "pos_x": -3230,
"pos_y": 1713, "pos_y": 1713,
"scale": 5.00, "scale": 5.00,

View File

@@ -0,0 +1,8 @@
{
"material": "assets/maps/overview/de_overpass.png",
"pos_x": -4831,
"pos_y": 1781,
"scale": 5.2
}

View File

Before

Width:  |  Height:  |  Size: 195 KiB

After

Width:  |  Height:  |  Size: 195 KiB

View File

Before

Width:  |  Height:  |  Size: 88 KiB

After

Width:  |  Height:  |  Size: 88 KiB

View File

Before

Width:  |  Height:  |  Size: 126 KiB

After

Width:  |  Height:  |  Size: 126 KiB

View File

Before

Width:  |  Height:  |  Size: 172 KiB

After

Width:  |  Height:  |  Size: 172 KiB

View File

Before

Width:  |  Height:  |  Size: 129 KiB

After

Width:  |  Height:  |  Size: 129 KiB

View File

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 37 KiB

View File

Before

Width:  |  Height:  |  Size: 200 KiB

After

Width:  |  Height:  |  Size: 200 KiB

View File

@@ -1,8 +0,0 @@
{
"material": "maps/de_ancient.png",
"pos_x": -2953,
"pos_y": 2164,
"scale": 5
}

View File

@@ -1,8 +0,0 @@
{
"material": "maps/de_overpass.png",
"pos_x": -4831,
"pos_y": 1781,
"scale": 5.2
}

View File

@@ -17,18 +17,7 @@ class Match:
self.game_info = game_info.sort_values(by=["tick", "player_steamid"]) # pd dataframe sorted by tick self.game_info = game_info.sort_values(by=["tick", "player_steamid"]) # pd dataframe sorted by tick
self.tick_rate = tick_rate self.tick_rate = tick_rate
def _update_player_positions(self) -> None: def _update_player(self, player: Player) -> None:
# inefficient, might need to change
# empty tick
if self.current_tick.empty:
return
# # check if current tick has NaN values
# if self.current_tick.isnull().values.any():
# return
for player in self.get_players():
player.x = self.current_tick[self.current_tick["player_steamid"] == player.steam_id]["X"].values[0] player.x = self.current_tick[self.current_tick["player_steamid"] == player.steam_id]["X"].values[0]
player.y = self.current_tick[self.current_tick["player_steamid"] == player.steam_id]["Y"].values[0] player.y = self.current_tick[self.current_tick["player_steamid"] == player.steam_id]["Y"].values[0]
player.z = self.current_tick[self.current_tick["player_steamid"] == player.steam_id]["Z"].values[0] player.z = self.current_tick[self.current_tick["player_steamid"] == player.steam_id]["Z"].values[0]
@@ -42,6 +31,25 @@ class Match:
player.kills = int(self.current_tick[self.current_tick["player_steamid"] == player.steam_id]["kills_total"].values[0]) player.kills = int(self.current_tick[self.current_tick["player_steamid"] == player.steam_id]["kills_total"].values[0])
player.deaths = int(self.current_tick[self.current_tick["player_steamid"] == player.steam_id]["deaths_total"].values[0]) player.deaths = int(self.current_tick[self.current_tick["player_steamid"] == player.steam_id]["deaths_total"].values[0])
player.assists = int(self.current_tick[self.current_tick["player_steamid"] == player.steam_id]["assists_total"].values[0]) player.assists = int(self.current_tick[self.current_tick["player_steamid"] == player.steam_id]["assists_total"].values[0])
player.inventory = self.current_tick[self.current_tick["player_steamid"] == player.steam_id]["inventory"].values[0]
if "C4 Explosive" in player.inventory:
player.has_bomb = True
else:
player.has_bomb = False
if "Defuse Kit" in player.inventory:
player.has_defuser = True
else:
player.has_defuser = False
def _update_players(self) -> None:
# empty tick
if self.current_tick.empty:
return
for player in self.get_players():
self._update_player(player)
def _update_round(self) -> None: def _update_round(self) -> None:
if self.current_tick.empty: if self.current_tick.empty:
@@ -69,14 +77,14 @@ class Match:
def next_tick(self) -> None: def next_tick(self) -> None:
self.tick += 1 self.tick += 1
self.current_tick = self.game_info[self.game_info["tick"] == self.tick] self.current_tick = self.game_info[self.game_info["tick"] == self.tick]
self._update_player_positions() self._update_players()
self._update_team_ids() self._update_team_ids()
self._update_round() self._update_round()
def set_tick(self, tick: int) -> None: def set_tick(self, tick: int) -> None:
self.tick = tick self.tick = tick
self.current_tick = self.game_info[self.game_info["tick"] == self.tick] self.current_tick = self.game_info[self.game_info["tick"] == self.tick]
self._update_player_positions() self._update_players()
self._update_round() self._update_round()
def get_players(self) -> list[Player]: def get_players(self) -> list[Player]:

View File

@@ -13,6 +13,11 @@ class Player:
self.dead = False self.dead = False
self.is_shooting = False self.is_shooting = False
self.current_weapon = None self.current_weapon = None
self.has_bomb = False
self.is_planting = False
self.has_defuser = False
self.is_defusing = False
self.inventory = []
self.kills = 0 self.kills = 0
self.deaths = 0 self.deaths = 0

View File

@@ -10,10 +10,10 @@ class GUIRenderer:
# Buttons # Buttons
self.settings_button = Button(self.screen.get_width()-40, 10, 30, 30, None) self.settings_button = Button(self.screen.get_width()-40, 10, 30, 30, None)
self.settings_button.set_image("assets/setting.png") self.settings_button.set_image("assets/images/setting.png")
self.back_button = Button(self.screen.get_width()-80, 10, 30, 30, None) self.back_button = Button(self.screen.get_width()-80, 10, 30, 30, None)
self.back_button.set_image("assets/arrow.png") self.back_button.set_image("assets/images/arrow.png")
self.colour = (255, 255, 255) self.colour = (255, 255, 255)

View File

@@ -21,7 +21,7 @@ class SettingsMenuRenderer:
self.back_button.set_colour(self.styling["button_colour"]) self.back_button.set_colour(self.styling["button_colour"])
self.back_button.set_font(self.styling["font"]) self.back_button.set_font(self.styling["font"])
self.back_button.set_pressed_colour(self.styling["pressed_button_colour"]) self.back_button.set_pressed_colour(self.styling["pressed_button_colour"])
self.back_button.set_image("assets/arrow.png") self.back_button.set_image("assets/images/arrow.png")
# Switches # Switches
self.show_yaw_button = Switch(self.widget_start_x, 100, 100, self.show_yaw_text.get_rect().height, self.options["show_yaw"]) self.show_yaw_button = Switch(self.widget_start_x, 100, 100, self.show_yaw_text.get_rect().height, self.options["show_yaw"])

View File

@@ -15,8 +15,8 @@ class Game(GameState):
def __init__(self, switch_state_callback, context): def __init__(self, switch_state_callback, context):
super().__init__(switch_state_callback, context) super().__init__(switch_state_callback, context)
match_data_path = f"maps/{self.match.map_name}.json" match_data_path = f"assets/maps/config/{self.match.map_name}.json"
match_image_path = f"maps/{self.match.map_name}.png" match_image_path = f"assets/maps/overview/{self.match.map_name}.png"
# Screen Areas # Screen Areas
self.info_box = pygame.Surface((350, self.screen.get_height()), pygame.SRCALPHA) self.info_box = pygame.Surface((350, self.screen.get_height()), pygame.SRCALPHA)

View File

@@ -17,7 +17,7 @@ class StartMenu(GameState):
self.default_button_width = self.screen.get_width() * 0.8 self.default_button_width = self.screen.get_width() * 0.8
# logo # logo
self.logo = pygame.image.load("assets/logo.png").convert_alpha() self.logo = pygame.image.load("assets/images/logo.png").convert_alpha()
self.logo_scale = 0.7 self.logo_scale = 0.7
self.logo = pygame.transform.smoothscale(self.logo, (self.logo.get_rect().size[0] * self.logo_scale, self.logo.get_rect().size[1] * self.logo_scale)) self.logo = pygame.transform.smoothscale(self.logo, (self.logo.get_rect().size[0] * self.logo_scale, self.logo.get_rect().size[1] * self.logo_scale))
@@ -84,7 +84,7 @@ class StartMenu(GameState):
demo_parser = demoparser2.DemoParser(demo_file) demo_parser = demoparser2.DemoParser(demo_file)
game_info = demo_parser.parse_ticks(["X", "Y", "Z", "pitch", "yaw", "is_alive", "team", "player_steamid", game_info = demo_parser.parse_ticks(["X", "Y", "Z", "pitch", "yaw", "is_alive", "team", "player_steamid",
"team_rounds_total", "team_num", "total_rounds_played", "shots_fired", "team_rounds_total", "team_num", "total_rounds_played", "shots_fired",
"kills_total", "deaths_total", "assists_total", "kills_total", "deaths_total", "assists_total", "inventory",
"health", "armor_value", "active_weapon_name"]) "health", "armor_value", "active_weapon_name"])
header_info = demo_parser.parse_header() header_info = demo_parser.parse_header()
map_name = header_info['map_name'] map_name = header_info['map_name']