Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…Evolution into feat/hud-ui
  • Loading branch information
RobbeBryssinck committed Apr 16, 2022
2 parents c80ec80 + a684e3f commit a51a909
Show file tree
Hide file tree
Showing 14 changed files with 42 additions and 40 deletions.
2 changes: 1 addition & 1 deletion Code/client/Services/Generic/OverlayService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ void OverlayService::Reset() const noexcept
void OverlayService::Initialize() noexcept
{
m_pOverlay->ExecuteAsync("init");
SetVersion(BUILD_BRANCH "@" BUILD_COMMIT);
SetVersion(BUILD_COMMIT);
}

void OverlayService::SetActive(bool aActive) noexcept
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<app-popup class="app-error" *ngIf="error">
<p>{{error}}</p>
<p innerHTML={{error}}>{{error}}</p>
<app-popup-buttons>
<button (click)="removeError()" data-style-ornament="simple">Ok</button>
</app-popup-buttons>
Expand Down
5 changes: 0 additions & 5 deletions Code/skyrim_ui/src/app/components/root/root.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@

</app-notification-popup>

<div class="app-root-preview">
Skyrim Together
<div class="app-root-preview-stage">{{ watermark }}</div>
<div class="app-root-preview-build">{{ version }}</div>
</div>
<app-notifications [@notifications]="!active"></app-notifications>
<div [@controls]="active" class="app-root-controls">
<app-window *ngIf="isnightly || connected || currentUser" border="strip" class="app-root-menu">
Expand Down
20 changes: 0 additions & 20 deletions Code/skyrim_ui/src/app/components/root/root.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -46,26 +46,6 @@ app-root {
}
}

.app-root-preview {
position: absolute;
right: $-size-gap;
top: $-size-gap;
opacity: 0.5;
font-size: 1.4rem;
text-align: right;
color: mod($-color-background, 1);
}

.app-root-preview-stage {
font-weight: bold;
font-size: 2.25em;
text-transform: uppercase
}

.app-root-preview-build {
font-size: 0.6em;
}

.app-root-controls {
@include gapped-vertical($-size-gap);

Expand Down
4 changes: 0 additions & 4 deletions Code/skyrim_ui/src/app/components/root/root.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,6 @@ export class RootComponent implements OnInit, OnDestroy {
return environment.nightlyBuild;
}

public get watermark(): string {
return environment.watermarkText;
}

public reconnect(): void {
this.client.reconnect();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<th>Server Name<app-order [isIncreasingOrder]="isIncreasingNameOrder" (sorted)="sortName($event)"></app-order></th>
<th>Players<app-order [isIncreasingOrder]="isIncreasingPlayerOrder" (sorted)="sortPlayers($event)"></app-order></th>
<th>Country<app-order [isIncreasingOrder]="isIncreasingCountryOrder" (sorted)="sortCountry($event)"></app-order></th>
<th>Version</th>
<th>Version ({{ getClientVersion() }})</th>
<th>Favorite<app-order [isIncreasingOrder]="isIncreasingFavoriteOrder" (sorted)="sortFavorite($event)"></app-order></th> <!-- Pls not automatic fav on top, make it sortable like other titles, thanks! -->
<th></th>
</tr>
Expand All @@ -30,7 +30,7 @@
<td>{{ server.name }}</td>
<td>{{ server.player_count }}</td>
<td>{{ server.country }}</td>
<td>{{ server.version }}</td>
<td [ngClass]="isCompatibleToClient(server) ? 'server-compatible' : 'server-incompatible'">{{ server.version }}</td>
<td (click)="toggleServerFavorite(server)" class="app-server-list-notfavorite"><fa-icon [icon]="getFavoriteIcon(server)"></fa-icon></td>
<td><button (click)="connect(server)" class="joinbutton">Join</button></td>
</tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,17 @@ app-server-list {
}

.offline {
// PokPok you need to change that !
background-color: #FF9494
}

.server-compatible {
color: green;
}

.server-incompatible {
color: red;
}

#noserv {
margin-top: 3%;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,15 @@ export class ServerListComponent implements OnInit, OnDestroy {
return server.isFavorite ? fasStar : farStar;
}

public getClientVersion() {
return this.clientService.versionSet.getValue();
}

public isCompatibleToClient(server: Server) {
const clientVersion = this.getClientVersion();
return server.version === clientVersion;
}

private close() {
if (this.errorService.error$.value) {
this.errorService.removeError();
Expand Down
17 changes: 15 additions & 2 deletions Code/skyrim_ui/src/app/services/client.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { Debug } from '../models/debug';
import { UserService } from './user.service';
import { Player } from '../models/player';
import { take } from 'rxjs/operators';
import { ErrorService } from './error.service';

/** Message. */
export interface Message {
Expand Down Expand Up @@ -44,7 +45,7 @@ export class ClientService implements OnDestroy {
public nameChange = new BehaviorSubject(environment.game ? '' : 'test');

/** Client version setting. */
public versionSet = new BehaviorSubject(environment.game ? '' : 'browser-preview');
public versionSet = new BehaviorSubject(environment.game ? '' : 'v1.23.0-12-g58e3');

/** Debug state change. */
public debugStateChange = new Subject<boolean>();
Expand Down Expand Up @@ -72,6 +73,9 @@ export class ClientService implements OnDestroy {

public protocolMismatchChange = new BehaviorSubject(false);

/** Receive error from core */
public triggerError = new BehaviorSubject('');

private _host: string;

private _port: number;
Expand All @@ -85,7 +89,7 @@ export class ClientService implements OnDestroy {
*
* @param zone Angular Zone.
*/
public constructor(private zone: NgZone, private userService: UserService) {
public constructor(private zone: NgZone, private userService: UserService, private errorService: ErrorService) {
if (environment.game) {
skyrimtogether.on('init', this.onInit.bind(this));
skyrimtogether.on('activate', this.onActivate.bind(this));
Expand All @@ -110,6 +114,7 @@ export class ClientService implements OnDestroy {
skyrimtogether.on('setplayer3Dloaded', this.onSetPlayer3DLoaded.bind(this));
skyrimtogether.on('serverid', this.onServerId.bind(this));
skyrimtogether.on('protocolmismatch', this.onProtocolMismatch.bind(this));
skyrimtogether.on('triggererror', this.onTriggerError.bind(this));
}
}

Expand Down Expand Up @@ -141,6 +146,7 @@ export class ClientService implements OnDestroy {
skyrimtogether.off('setplayer3Dloaded');
skyrimtogether.off('serverid');
skyrimtogether.off('protocolmismatch');
skyrimtogether.off('triggererror');
}
}

Expand Down Expand Up @@ -433,4 +439,11 @@ export class ClientService implements OnDestroy {
this.protocolMismatchChange.next(true);
})
}

private onTriggerError(error: string) {
this.zone.run(() => {
this.triggerError.next(error);
this.errorService.error(error);
})
}
}
1 change: 0 additions & 1 deletion Code/skyrim_ui/src/environments/environment.browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ export const environment = {
urlProtocol: "http",
url: "localhost:4200",
intervalPingWebSocket: 5, // seconds
watermarkText: "Browser",
chatMessageLengthLimit: 256,
nbReconnectionAttempts: 5
};
1 change: 0 additions & 1 deletion Code/skyrim_ui/src/environments/environment.nightly.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ export const environment = {
urlProtocol: "https",
url: "skyrim-reborn-list.skyrim-together.com",
intervalPingWebSocket: 5, // seconds
watermarkText: "nightly",
chatMessageLengthLimit: 256,
nbReconnectionAttempts: 5
};
1 change: 0 additions & 1 deletion Code/skyrim_ui/src/environments/environment.prod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ export const environment = {
urlProtocol: "https",
url: "skyrim-reborn-list.skyrim-together.com",
intervalPingWebSocket: 5, // seconds
watermarkText: "Beta",
chatMessageLengthLimit: 127,
nbReconnectionAttempts: 5
};
1 change: 0 additions & 1 deletion Code/skyrim_ui/src/environments/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export const environment = {
urlProtocol: "https",
url: "skyrim-reborn-list.skyrim-together.com",
intervalPingWebSocket: 5, // seconds
watermarkText: "Dev",
chatMessageLengthLimit: 127,
nbReconnectionAttempts: 5
};
6 changes: 6 additions & 0 deletions Code/skyrim_ui/src/typings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ declare namespace SkyrimTogetherTypes {
type SetServerIdCallback = (serverId: number) => void;

type ProtocolMismatch = () => void;

type TriggerError = () => void;
}

/** Global Skyrim: Together object. */
Expand Down Expand Up @@ -143,6 +145,8 @@ interface SkyrimTogether {

on(event: 'protocolmismatch', callback: SkyrimTogetherTypes.ProtocolMismatch): void;

on(event: 'triggererror', callback: SkyrimTogetherTypes.TriggerError): void;

/** Remove listener from when the application is first initialized. */
off(event: 'init', callback?: SkyrimTogetherTypes.InitCallback): void;

Expand Down Expand Up @@ -205,6 +209,8 @@ interface SkyrimTogether {

off(event: 'protocolmismatch', callback?: SkyrimTogetherTypes.ProtocolMismatch): void;

off(event: 'triggererror', callback?: SkyrimTogetherTypes.TriggerError): void;

/**
* Connect to server at given address and port.
*
Expand Down

0 comments on commit a51a909

Please sign in to comment.