Compare commits

..

10 Commits

10 changed files with 27 additions and 12 deletions

View File

@ -7,6 +7,5 @@
</div> </div>
<skirda-text>description</skirda-text> <skirda-text>description</skirda-text>
</div> </div>
<skirda-icon *ngIf="!collapsed" name="play" size="24" (click)="run(game)" color="var(--sk-primary-accent)"></skirda-icon>
</div> </div>
</a> </a>

View File

@ -1,12 +1,12 @@
<menu> <menu>
<div class="menu-search-panel"> <!-- <div class="menu-search-panel">
<skirda-input *ngIf="!collapsed" [formControl]="search" size="l" placeholder="Quick search"> <skirda-input *ngIf="!collapsed" [formControl]="search" size="l" placeholder="Quick search">
<skirda-icon name="search" size="18" role="left"></skirda-icon> <skirda-icon name="search" size="18" role="left"></skirda-icon>
</skirda-input> </skirda-input>
<button (click)="toggle()"> <button (click)="toggle()">
<skirda-icon name="menu-panel" color="var(--sk-primary-accent)"></skirda-icon> <skirda-icon name="menu-panel" color="var(--sk-primary-accent)"></skirda-icon>
</button> </button>
</div> </div> -->
<div class="menu-content" skirdaIsScrolling> <div class="menu-content" skirdaIsScrolling>
<!-- <div class="menu-sections"> <!-- <div class="menu-sections">
<skirda-section [routerLink]="['servers']" routerLinkActive="active"> <skirda-section [routerLink]="['servers']" routerLinkActive="active">

View File

@ -1,5 +1,5 @@
<skirda-section-label *ngIf="!collapsed"> <skirda-section-label *ngIf="!collapsed">
Pinned games <div class="count">{{games.length}}</div> Games <div class="count">{{games.length}}</div>
</skirda-section-label> </skirda-section-label>
<skirda-icon name="library" size="20" *ngIf="collapsed"></skirda-icon> <skirda-icon name="library" size="20" *ngIf="collapsed"></skirda-icon>
<div class="games"> <div class="games">

View File

@ -34,7 +34,7 @@ export class MenuGamesComponent implements OnInit {
} }
else{ else{
GoGetGames().then((value) => { GoGetGames().then((value) => {
console.log(value); // console.log(value);
this.games = value; this.games = value;
}); });
} }

View File

@ -4,9 +4,9 @@
<skirda-heading size="6">{{profile.username}}</skirda-heading> <skirda-heading size="6">{{profile.username}}</skirda-heading>
<skirda-text>online</skirda-text> <skirda-text>online</skirda-text>
</div> </div>
<a [routerLink]="['settings']" *ngIf="!collapsed"> <!-- <a [routerLink]="['settings']" *ngIf="!collapsed">
<skirda-icon name="settings" color="var(--sk-primary-accent)"></skirda-icon> <skirda-icon name="settings" color="var(--sk-primary-accent)"></skirda-icon>
</a> </a> -->
</a> </a>
<div class="theme-toggle" *ngIf="!collapsed" (click)="toggleTheme()" [ngClass]="{'active': theme === 'light'}"> <div class="theme-toggle" *ngIf="!collapsed" (click)="toggleTheme()" [ngClass]="{'active': theme === 'light'}">
<skirda-icon name="sun" color="var(--sk-primary-accent)"></skirda-icon> <skirda-icon name="sun" color="var(--sk-primary-accent)"></skirda-icon>

View File

@ -10,6 +10,7 @@ import { GoGetSessions } from 'src/app/services/go';
export class MenuSessionsComponent implements OnInit { export class MenuSessionsComponent implements OnInit {
fakeSessions: Session[] = [ fakeSessions: Session[] = [
{ {
skirdaSessionId: 'a',
gameId: 'minecraft-001', gameId: 'minecraft-001',
icon: '/assets/games/minecraft/icon.png', icon: '/assets/games/minecraft/icon.png',
title: 'Minecraft', title: 'Minecraft',
@ -18,6 +19,7 @@ export class MenuSessionsComponent implements OnInit {
expires: new Date('2022-10-30'), expires: new Date('2022-10-30'),
}, },
{ {
skirdaSessionId: 'b',
gameId: 'minecraft-002', gameId: 'minecraft-002',
icon: '/assets/games/garrysmod/icon.png', icon: '/assets/games/garrysmod/icon.png',
title: 'Minecraft 2', title: 'Minecraft 2',
@ -25,6 +27,7 @@ export class MenuSessionsComponent implements OnInit {
expires: new Date('2022-10-27T20:00:00'), expires: new Date('2022-10-27T20:00:00'),
}, },
{ {
skirdaSessionId: 'c',
gameId: 'minecraft-003', gameId: 'minecraft-003',
icon: '/assets/games/minecraft/icon.png', icon: '/assets/games/minecraft/icon.png',
title: 'Minecraft 3', title: 'Minecraft 3',

View File

@ -47,7 +47,7 @@
<!-- 6. Вызываем в нужном месте (в html компонента) открытие попап окна и передаем в метод из ts шаблон <!-- 6. Вызываем в нужном месте (в html компонента) открытие попап окна и передаем в метод из ts шаблон
(название переменной popupContent должно совпадать с аттрибутом (название переменной popupContent должно совпадать с аттрибутом
у описанного шаблона из пункта 2 (<ng-template #popupContent>)) --> у описанного шаблона из пункта 2 (<ng-template #popupContent>)) -->
<skirda-button size="large" appearance="primary" (click)="openPopup(popupContent)"> <skirda-button size="large" appearance="primary" (click)="run(game)">
<skirda-icon name="play" size="32"></skirda-icon> <skirda-icon name="play" size="32"></skirda-icon>
<skirda-heading size="1">Play</skirda-heading> <skirda-heading size="1">Play</skirda-heading>
</skirda-button> </skirda-button>

View File

@ -5,6 +5,7 @@ import { PopupService } from 'projects/ui/src/lib/popup/popup.service'
import { Subscription } from 'rxjs' import { Subscription } from 'rxjs'
import { Game } from 'src/app/interfaces/game.interface' import { Game } from 'src/app/interfaces/game.interface'
import { UiService } from 'src/app/services/ui.service' import { UiService } from 'src/app/services/ui.service'
import { LauncherService } from 'src/app/services/launcher.service';
@Component({ @Component({
selector: 'app-game-page', selector: 'app-game-page',
@ -19,7 +20,7 @@ export class GamePageComponent implements OnInit, OnDestroy {
uiService = inject(UiService) uiService = inject(UiService)
subs: Map<string, Subscription> = new Map(); subs: Map<string, Subscription> = new Map();
game: Game = { game: Game = {
gameId: 'minecraft', gameId: '20929f6b-983e-4dd1-8d59-5e680fd0a10d',
title: 'Minecraft', title: 'Minecraft',
image: '/assets/games/minecraft/icon.png', image: '/assets/games/minecraft/icon.png',
description: 'Minecraft description', description: 'Minecraft description',
@ -43,10 +44,17 @@ export class GamePageComponent implements OnInit, OnDestroy {
constructor( constructor(
private router: Router, private router: Router,
private launcher: LauncherService,
// 4. Импортировать сервис для попап окон // 4. Импортировать сервис для попап окон
private popup: PopupService private popup: PopupService
) {} ) {}
run(game: Game) {
//console.log('Game to run ' + game.title)
this.launcher.RunGame(game)
}
ngOnInit(): void { ngOnInit(): void {
this.observeNavigation() this.observeNavigation()
} }

View File

@ -1,8 +1,9 @@
export interface Session { export interface Session {
skirdaSessionId: string;
gameId: string; gameId: string;
icon: string; icon: string;
title: string; title: string;
status?: string; status?: string;
version: string; version: string;
expires: Date; expires: Date;
} }

View File

@ -1,6 +1,7 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Game } from '../interfaces/game.interface'; import { Game } from '../interfaces/game.interface';
import { GoRunGame } from './go'; import { Session } from '../interfaces/session.interface';
import { GoRunGame, GoRunSession } from './go';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
}) })
@ -20,4 +21,7 @@ export class LauncherService {
// console.log(game.title) // console.log(game.title)
// console.log(game.gameId) // console.log(game.gameId)
} }
public RunSession(session: Session){
GoRunSession(session.skirdaSessionId)
}
} }