Browse Source

Add in the download button

new_auth
Quildra 2 years ago
parent
commit
de02fecf4e
  1. 3
      packages/bridge-server/src/races/races.service.ts
  2. 5
      packages/bridge-server/src/upload/upload.service.ts
  3. 4
      packages/bridge-ui/src/app/components/race-details/race-details.component.html
  4. 2
      packages/bridge-ui/src/app/models/race.model.ts
  5. 16
      packages/bridge-ui/src/app/pages/getting-started/getting-started.component.html
  6. 3
      packages/bridge-ui/src/app/services/server-endpoint.service.ts

3
packages/bridge-server/src/races/races.service.ts

@ -5,6 +5,7 @@ import { Race } from './race.model';
import { RaceResult } from 'src/race-results/race-result.model'; import { RaceResult } from 'src/race-results/race-result.model';
import { Season } from 'src/seasons/season.model'; import { Season } from 'src/seasons/season.model';
//https://github.com/GreepTheSheep/node-trackmania.io
import * as TMIO from 'trackmania.io'; import * as TMIO from 'trackmania.io';
import { from } from 'rxjs'; import { from } from 'rxjs';
import { Racer } from 'src/racers/racer.model'; import { Racer } from 'src/racers/racer.model';
@ -61,7 +62,7 @@ export class RacesService {
const transactionHost = { transaction: t }; const transactionHost = { transaction: t };
await this.raceModel.create({ await this.raceModel.create({
mapName: mapDetails.name, mapName: mapDetails.name,
mapURL: "", mapURL: mapDetails.fileUrl,
mapUID: mapUID, mapUID: mapUID,
mapImgUrl: mapDetails.thumbnailUrl, mapImgUrl: mapDetails.thumbnailUrl,
authorTime: mapDetails.authorScore, authorTime: mapDetails.authorScore,

5
packages/bridge-server/src/upload/upload.service.ts

@ -49,6 +49,11 @@ export class UploadService {
return; return;
} }
if(Date.now() < race.startDate.getTime()) {
console.log("Too Soon!")
return;
}
let result = await this.raceResultsService.create(race.id, currentRacer.id, replay.bestTime, file.path); let result = await this.raceResultsService.create(race.id, currentRacer.id, replay.bestTime, file.path);
console.log(result); console.log(result);

4
packages/bridge-ui/src/app/components/race-details/race-details.component.html

@ -3,6 +3,10 @@
<div class="details-container"> <div class="details-container">
<div class="map-title"> <div class="map-title">
<h1>{{race.mapName}}</h1> <h1>{{race.mapName}}</h1>
<a mat-fab extended href="{{race.mapURL}}" class="button is-fullwidth is-danger" title="{{race.mapName}}.Map.Gbx" color="primary">
<mat-icon>download</mat-icon>
Download map
</a>
</div> </div>
<div class="map-times"> <div class="map-times">
<p>Author Time: {{formatMilliseconds(race.authorTime)}}</p> <p>Author Time: {{formatMilliseconds(race.authorTime)}}</p>

2
packages/bridge-ui/src/app/models/race.model.ts

@ -1,7 +1,7 @@
export class Race{ export class Race{
id: string = ""; id: string = "";
mapName: string = ""; mapName: string = "";
mapUrl: string = ""; mapURL: string = "";
mapUID: string = ""; mapUID: string = "";
mapImgUrl: string = ""; mapImgUrl: string = "";
authorTime: number = 0; authorTime: number = 0;

16
packages/bridge-ui/src/app/pages/getting-started/getting-started.component.html

@ -8,6 +8,15 @@
<br/> <br/>
<h1>Racing</h1>
<p>If the race you need to run is from a campign, you can tell if it is its name will be a season and a number, the easiest way to race it is by using the capmaing selector on the main menu.</p>
<p>Otherwise follow the link on the race to download the map from Trackmania.exchange. Place the map into your Documents/Trackmania/Maps/My Maps folder.</p>
<p>While in the game Select Play from the main menu then Local -> Play a Track -> My Local Tracks</p>
<br/>
<!--
<h1>Plugins</h1> <h1>Plugins</h1>
<p>You are going to need to install some plugins for the game to help facilitate the tournaments.</p> <p>You are going to need to install some plugins for the game to help facilitate the tournaments.</p>
@ -17,7 +26,14 @@
<p>These replay will be used to record your best times during the tournament.</p> <p>These replay will be used to record your best times during the tournament.</p>
<br/> <br/>
-->
<h1>Replays</h1> <h1>Replays</h1>
<p>To report a result you are going to need to upload your replays. At the end of a race, after you cross the finish line, you must press the Save Replay button.</p>
<p>The replays are stored in your Documents folder in Documents/Trackmania/Replays/My Replays</p>
<p>To upload a replay you need to press the large "Upload Replay" button in and attach the replay you want. It will auto detect the race its for and extract your time.</p>
<p>You can upload as many attempts as you like and it will only use you fastest one.</p>
</div> </div>
</div> </div>

3
packages/bridge-ui/src/app/services/server-endpoint.service.ts

@ -10,7 +10,8 @@ export class ServerEndpointService {
constructor() constructor()
{ {
this.currentHost = "172.16.40.146"; //this.currentHost = "172.16.40.146";
this.currentHost = "localhost";
this.currentPort = "3000"; this.currentPort = "3000";
} }

Loading…
Cancel
Save