Skip to content
This repository has been archived by the owner on Jul 24, 2022. It is now read-only.

Commit

Permalink
Create constants.py
Browse files Browse the repository at this point in the history
Line 12-14 amended to add up to 32 driver positions
Updated folder and UI driver position png's can be found here https://drive.google.com/file/d/15z_pHP5gTxUo6rsUdwcvlR4LwkZj-0Yb/view?usp=sharing
  • Loading branch information
Cozy61 authored Oct 12, 2021
1 parent 3d40e47 commit 5ab1a79
Showing 1 changed file with 87 additions and 0 deletions.
87 changes: 87 additions & 0 deletions constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
import ac

APP_NAME = "F12020Leaderboard"

class FC:
APP_NAME = APP_NAME
FONT_NAME = "Formula"

# IMAGES

# POSITION NUMBERS
LEADERBOARD_POSITION_LABEL = ["apps/python/%s/ui/positions/%d.png" % (APP_NAME, n) for n in range(33)]
LEADERBOARD_POSITION_RED_LABEL = ["apps/python/%s/ui/positions/%d_red.png" % (APP_NAME, n) for n in range(33)]
LEADERBOARD_POSITION_GREEN_LABEL = ["apps/python/%s/ui/positions/%d_green.png" % (APP_NAME, n) for n in range(33)]

# LEADERBOARD BACKGROUNDS
LEADERBOARD_BACKGROUND = "apps/python/%s/ui/background.png" % APP_NAME
LEADERBOARD_BASE_RACE = "apps/python/%s/ui/race_base.png" % APP_NAME
LEADERBOARD_BASE_QUALI = "apps/python/%s/ui/quali_base.png" % APP_NAME
LEADERBOARD_BASE_PRACTICE = "apps/python/%s/ui/practice_base.png" % APP_NAME
LEADERBOARD_FINAL_LAP = "apps/python/%s/ui/final_lap.png" % APP_NAME
LEADERBOARD_INFO_BACKGROUNG = "apps/python/%s/ui/background_info.png" % APP_NAME
LEADERBOARD_PLAYER_HIGHLIGHT = "apps/python/%s/ui/highlight.png" % APP_NAME

# FASTEST LAP
LEADERBOARD_FASTEST_LAP = "apps/python/%s/ui/fastest_lap.png" % APP_NAME
FASTEST_LAP_BANNER = "apps/python/%s/ui/fastest_lap_banner.png" % APP_NAME

# DRIVER WIDGET BACKGROUND
DRIVER_WIDGET_BACKGROUND = "apps/python/%s/ui/driver_widget_background.png" % APP_NAME
DRIVER_WIDGET_BACKGROUND_ALTERNATE = "apps/python/%s/ui/driver_widget_background_alternate.png" % APP_NAME
DRIVER_WIDGET_EXTENDED_BACKGROUND = "apps/python/%s/ui/driver_widget_extended_background.png" % APP_NAME

# FLAGS
YELLOW_FLAG = "apps/python/%s/ui/yellow_flag.png" % APP_NAME
BLUE_FLAG = "apps/python/%s/ui/blue_flag.png" % APP_NAME
YELLOW_FLAG_SECTOR1 = "apps/python/%s/ui/yellow_flag_s1.png" % APP_NAME
YELLOW_FLAG_SECTOR2 = "apps/python/%s/ui/yellow_flag_s2.png" % APP_NAME
YELLOW_FLAG_SECTOR3 = "apps/python/%s/ui/yellow_flag_s3.png" % APP_NAME
# GREEN_FLAG = "apps/python/%s/ui/green_flag.png" % APP_NAME
CHECKERED_FLAG = "apps/python/%s/ui/race_flag.png" % APP_NAME

# POSITION CHANGED INDICATOR
POSITION_GAINED = "apps/python/%s/ui/position_gained.png" % APP_NAME
POSITION_LOST = "apps/python/%s/ui/position_lost.png" % APP_NAME
POSITION_MAINTAINED = "apps/python/%s/ui/position_maintained.png" % APP_NAME

# MISCELANEOUS
ROLEX_LOGO = "apps/python/%s/ui/rolex.png" % APP_NAME
SPEEDOMETER_ICON = "apps/python/%s/ui/icon.png" % APP_NAME
GAPS = "apps/python/%s/ui/gaps.png" % APP_NAME

TYRE_DIR = "apps/python/%s/ui/tyres/" % APP_NAME

# REPLAY DIRECTORY
REPLAY_DIR = "apps/python/%s/replays/" % APP_NAME

# CONSTANTS
OVERTAKE_POSITION_LABEL_TIMER = 3 # seconds
FASTEST_LAP_DISPLAY_TIME = 8
FASTEST_LAP_STARTING_LAP = 2
TRACK_SECTION_LENGTH = 110

TEAM_COLORS = None
TEAM_NAME = None
DRIVER_NUMBER = None
NUMBER_TAGS = None
CARS = None

try:
if not FC.TEAM_COLORS:
FC.TEAM_COLORS = {}
FC.TEAM_NAME = {}
FC.DRIVER_NUMBER = {}
FC.NUMBER_TAGS = {}
FC.CARS = {}
with open("apps/python/%s/teams.ini" % APP_NAME) as fp:
for line in fp:
line = line.split(":")
name = line[-1][:-1]
FC.TEAM_NAME[name] = line[0]
FC.TEAM_COLORS[name] = "apps/python/%s/ui/teams/%s.png" % (APP_NAME, line[1])
FC.CARS[name] = "apps/python/%s/ui/cars/%s.png" % (APP_NAME, line[1])
FC.DRIVER_NUMBER[name] = line[2]
FC.NUMBER_TAGS[name] = "apps/python/%s/ui/numbers/%s.png" % (APP_NAME, line[2])
except FileNotFoundError:
ac.log("File teams.ini not found.")

0 comments on commit 5ab1a79

Please sign in to comment.