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

Commit 75bdc37

Browse files
committed
bug fixes and improvements
1 parent 390aee6 commit 75bdc37

File tree

7 files changed

+60
-25
lines changed

7 files changed

+60
-25
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ App for our assetto corsa Formula 1 championship.
44

55
Can be tweaked for other championships using the "teams.ini" file.
66

7-
During the race it saves a file that can be read when replaying the race to be able to load the whole UI again.
7+
During the race a file is saved, that will be read by the app during a race replay to be able to load the whole UI again. However currently **it only saves different files for each combination of track and car**.
88

99
## STILL A WORK IN PROGRESS!!
1010

apps/python/F12020Leaderboard/DriverComparisonWidget.py

+43-12
Original file line numberDiff line numberDiff line change
@@ -18,66 +18,91 @@ def __init__(self, appName):
1818

1919
self.backgroundTexture = ac.addLabel(self.window, "")
2020
ac.setPosition(self.backgroundTexture, 0,0)
21-
ac.setSize(self.backgroundTexture, 700, 50)
21+
ac.setSize(self.backgroundTexture, 800, 50)
2222
ac.setBackgroundTexture(self.backgroundTexture, FC.DRIVER_WIDGET_BACKGROUND_ALTERNATE);
2323

2424
self.extendedBackgroundTexture = ac.addLabel(self.window, "")
2525
ac.setPosition(self.extendedBackgroundTexture, 0, 50)
26-
ac.setSize(self.extendedBackgroundTexture, 700, 100)
26+
ac.setSize(self.extendedBackgroundTexture, 800, 92)
2727
ac.setBackgroundTexture(self.extendedBackgroundTexture, FC.LEADERBOARD_BACKGROUND);
2828

2929
self.rolexLabel = ac.addLabel(self.window, "")
3030
ac.setPosition(self.rolexLabel, 0, -72)
3131
ac.setSize(self.rolexLabel, 123, 70)
3232
ac.setBackgroundTexture(self.rolexLabel, FC.ROLEX_LOGO);
3333

34+
self.speedometerIconLabel = ac.addLabel(self.window, "")
35+
ac.setPosition(self.speedometerIconLabel, 378, 3)
36+
ac.setSize(self.speedometerIconLabel, 44, 44)
37+
ac.setBackgroundTexture(self.speedometerIconLabel, FC.SPEEDOMETER_ICON);
38+
39+
# ==========================================
40+
3441
self.positionLabel1 = ac.addLabel(self.window, "")
3542
ac.setPosition(self.positionLabel1, 3,3)
3643
ac.setSize(self.positionLabel1, 44, 44)
3744

3845
self.positionLabel2 = ac.addLabel(self.window, "")
39-
ac.setPosition(self.positionLabel2, 383,3)
46+
ac.setPosition(self.positionLabel2, 433,3)
4047
ac.setSize(self.positionLabel2, 44, 44)
4148

49+
# ==========================================
50+
4251
self.teamLabel1 = ac.addLabel(self.window, "")
43-
ac.setPosition(self.teamLabel1, 57, 10)
52+
ac.setPosition(self.teamLabel1, 56, 10)
4453
ac.setSize(self.teamLabel1, 6, 27)
4554

4655
self.teamLabel2 = ac.addLabel(self.window, "")
47-
ac.setPosition(self.teamLabel2, 437, 10)
56+
ac.setPosition(self.teamLabel2, 486, 10)
4857
ac.setSize(self.teamLabel2, 6, 27)
4958

59+
# ==========================================
60+
5061
self.nameLabel1 = ac.addLabel(self.window, "")
51-
ac.setPosition(self.nameLabel1, 77, 15)
62+
ac.setPosition(self.nameLabel1, 74, 15)
5263
ac.setFontSize(self.nameLabel1, 25)
5364
ac.setCustomFont(self.nameLabel1, FC.FONT_NAME, 0, 1)
5465
ac.setFontColor(self.nameLabel1, 0.86, 0.86, 0.86, 1)
5566
ac.setFontAlignment(self.nameLabel1, "left")
5667

5768
self.nameLabel2 = ac.addLabel(self.window, "")
58-
ac.setPosition(self.nameLabel2, 457, 15)
69+
ac.setPosition(self.nameLabel2, 504, 15)
5970
ac.setFontSize(self.nameLabel2, 25)
6071
ac.setCustomFont(self.nameLabel2, FC.FONT_NAME, 0, 1)
6172
ac.setFontColor(self.nameLabel2, 0.86, 0.86, 0.86, 1)
6273
ac.setFontAlignment(self.nameLabel2, "left")
6374

75+
# ==========================================
76+
6477
self.carLabel1 = ac.addLabel(self.window, "")
65-
ac.setPosition(self.carLabel1, 80, 55)
78+
ac.setPosition(self.carLabel1, 88, 55)
6679
ac.setSize(self.carLabel1, 195, 85)
6780

6881
self.carLabel2 = ac.addLabel(self.window, "")
69-
ac.setPosition(self.carLabel2, 430, 55)
82+
ac.setPosition(self.carLabel2, 507, 55)
7083
ac.setSize(self.carLabel2, 195, 85)
7184

85+
# ==========================================
86+
87+
self.gapsIconLabelL = ac.addLabel(self.window, "")
88+
ac.setPosition(self.gapsIconLabelL, 310, 110)
89+
ac.setSize(self.gapsIconLabelL, 40, 6)
90+
ac.setBackgroundTexture(self.gapsIconLabelL, FC.GAPS);
91+
92+
self.gapsIconLabelR = ac.addLabel(self.window, "")
93+
ac.setPosition(self.gapsIconLabelR, 454, 110)
94+
ac.setSize(self.gapsIconLabelR, 40, 6)
95+
ac.setBackgroundTexture(self.gapsIconLabelR, FC.GAPS);
96+
7297
self.gapLabel = ac.addLabel(self.window, "")
73-
ac.setPosition(self.gapLabel, 350, 70)
74-
ac.setFontSize(self.gapLabel, 30)
98+
ac.setPosition(self.gapLabel, 400, 68)
99+
ac.setFontSize(self.gapLabel, 40)
75100
ac.setCustomFont(self.gapLabel, FC.FONT_NAME, 0, 1)
76101
ac.setFontColor(self.gapLabel, 0.94, 0.87, 0.17, 1)
77102
ac.setFontAlignment(self.gapLabel, "center")
78103

79104
self.secondsLabel = ac.addLabel(self.window, "SECONDS")
80-
ac.setPosition(self.secondsLabel, 350, 105)
105+
ac.setPosition(self.secondsLabel, 400, 107)
81106
ac.setFontSize(self.secondsLabel, 16)
82107
ac.setCustomFont(self.secondsLabel, FC.FONT_NAME, 0, 1)
83108
ac.setFontColor(self.secondsLabel, 0.86, 0.86, 0.86, 1)
@@ -89,6 +114,7 @@ def hide(self):
89114
ac.setVisible(self.backgroundTexture, 0)
90115
ac.setVisible(self.extendedBackgroundTexture, 0)
91116
ac.setVisible(self.rolexLabel, 0)
117+
ac.setVisible(self.speedometerIconLabel, 0)
92118
ac.setVisible(self.positionLabel1, 0)
93119
ac.setVisible(self.positionLabel2, 0)
94120
ac.setVisible(self.teamLabel1, 0)
@@ -97,6 +123,8 @@ def hide(self):
97123
ac.setVisible(self.nameLabel2, 0)
98124
ac.setVisible(self.carLabel1, 0)
99125
ac.setVisible(self.carLabel2, 0)
126+
ac.setVisible(self.gapsIconLabelL, 0)
127+
ac.setVisible(self.gapsIconLabelR, 0)
100128
ac.setVisible(self.gapLabel, 0)
101129
ac.setVisible(self.secondsLabel, 0)
102130

@@ -106,6 +134,7 @@ def show(self, id1, pos1, id2, pos2, time_gap):
106134
ac.setText(self.gapLabel, time_to_string(time_gap))
107135

108136
ac.setVisible(self.rolexLabel, 1)
137+
ac.setVisible(self.speedometerIconLabel, 1)
109138
ac.setVisible(self.backgroundTexture, 1)
110139
ac.setVisible(self.extendedBackgroundTexture, 1)
111140
ac.setVisible(self.positionLabel1, 1)
@@ -114,6 +143,8 @@ def show(self, id1, pos1, id2, pos2, time_gap):
114143
ac.setVisible(self.nameLabel2, 1)
115144
ac.setVisible(self.carLabel1, 1)
116145
ac.setVisible(self.carLabel2, 1)
146+
ac.setVisible(self.gapsIconLabelL, 1)
147+
ac.setVisible(self.gapsIconLabelR, 1)
117148
ac.setVisible(self.gapLabel, 1)
118149
ac.setVisible(self.secondsLabel, 1)
119150

apps/python/F12020Leaderboard/DriverWidget.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ def show(self, id, pos, starting_position, tyres, pit_stops):
211211
if u == "3": subscript = "rd"
212212
else: subscript = "th"
213213
ac.setText(self.startedLabel, str(starting_position) + subscript)
214-
ac.setBackgroundTexture(self.tyreLabel, FC.TYRE_BASE_NAME + tyres + ".png");
214+
ac.setBackgroundTexture(self.tyreLabel, FC.TYRE_DIR + tyres + ".png");
215215
ac.setBackgroundTexture(self.backgroundTexture, FC.DRIVER_WIDGET_BACKGROUND_ALTERNATE)
216216
ac.setVisible(self.extendedBackgroundTexture, 1)
217217
ac.setVisible(self.startedLabel, 1)

apps/python/F12020Leaderboard/F12020Leaderboard.py

+12-10
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,6 @@ def acUpdate(deltaT):
269269
ac.setBackgroundOpacity(driverComparisonWidget.window, 0)
270270
ac.setBackgroundOpacity(fastest_lap_banner.window, 0)
271271

272-
ac.console("LAP >> " + str(ac.getCarState(0, acsys.CS.LapInvalidated)))
273-
274272
# ============================
275273
# SERVER LAP
276274
for i in range(totalDrivers):
@@ -386,13 +384,14 @@ def acUpdate(deltaT):
386384
for i in range(totalDrivers):
387385
# MARK IN/OUT DRIVERS
388386
connected = ac.isConnected(i)
389-
if connected == 0 and not dPosition[i].out: # mark unconnected drivers
387+
if connected == 0: # mark unconnected drivers
390388
leaderboard[i].mark_out()
391389
dPosition[i].out = True
392-
elif connected == 1 and dPosition[i].out:
390+
dPosition[i].best_lap += 1 # checky hack to put unconnected drivers at the bottom of the leaderboard
391+
else:
393392
leaderboard[i].mark_in()
394393
dPosition[i].out = False
395-
if connected == 1:
394+
396395
leaderboard[i].update_name(dPosition[i].id)
397396
if dPosition[i].best_lap == MAX_LAP_TIME:
398397
leaderboard[i].update_time("NO TIME")
@@ -401,7 +400,7 @@ def acUpdate(deltaT):
401400
else:
402401
timeDiff = dPosition[i].best_lap - dPosition[0].best_lap
403402
if timeDiff > 60000:
404-
leaderboard[driver.position].update_time("+1 MIN")
403+
leaderboard[i].update_time("+1 MIN")
405404
else:
406405
leaderboard[i].update_time("+" + time_to_string(timeDiff))
407406

@@ -435,14 +434,17 @@ def acUpdate(deltaT):
435434
ac.setBackgroundOpacity(driverComparisonWidget.window, 0)
436435
ac.setBackgroundOpacity(fastest_lap_banner.window, 0)
437436

438-
ac.console("LAP >> " + str(ac.getCarState(0, acsys.CS.LapInvalidated)))
439-
440437
if quali_started:
441-
ac.setText(lapCountTimerLabel, time_to_string(info.graphics.sessionTimeLeft)[:-4])
438+
if info.graphics.sessionTimeLeft < 0:
439+
ac.setText(lapCountTimerLabel, "0:00")
440+
else:
441+
timeText = time_to_string(info.graphics.sessionTimeLeft)[:-4]
442+
ac.setText(lapCountTimerLabel, "0:00"[:-len(timeText)] + timeText)
442443
if info.graphics.sessionTimeLeft < qualify_session_time / 5:
443444
ac.setFontColor(lapCountTimerLabel, 1,0,0,1)
444445

445446
driverWidget.hide()
447+
driverComparisonWidget.hide()
446448

447449

448450
# ================================================================
@@ -476,7 +478,7 @@ def acUpdate(deltaT):
476478
leaderboard[pos].mark_out()
477479
else:
478480
leaderboard[pos].mark_in()
479-
leaderboard[pos].update_name(i)
481+
leaderboard[pos].update_name(i)
480482

481483
# OVERTAKE
482484
if pos != drivers[i].position: # there was an overtake

apps/python/F12020Leaderboard/constants.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,10 @@ class FC:
4545

4646
# MISCELANEOUS
4747
ROLEX_LOGO = "apps/python/%s/ui/rolex.png" % APP_NAME
48+
SPEEDOMETER_ICON = "apps/python/%s/ui/icon.png" % APP_NAME
49+
GAPS = "apps/python/%s/ui/gaps.png" % APP_NAME
4850

49-
TYRE_BASE_NAME = "apps/python/%s/ui/tyres/" % APP_NAME
51+
TYRE_DIR = "apps/python/%s/ui/tyres/" % APP_NAME
5052

5153
# REPLAY DIRECTORY
5254
REPLAY_DIR = "apps/python/%s/replays/" % APP_NAME
14.9 KB
Loading
16.9 KB
Loading

0 commit comments

Comments
 (0)