diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts
index 370f337..357ef21 100644
--- a/src/app/app-routing.module.ts
+++ b/src/app/app-routing.module.ts
@@ -8,6 +8,7 @@ import {BanlistPageComponent} from "./pages/banlist-page/banlist-page.component"
import {MessagesPageComponent} from "./pages/messages-page/messages-page.component";
import {VipPageComponent} from "./pages/vip-page/vip-page.component";
import {DowngamePageComponent} from "./pages/downgame-page/downgame-page.component";
+import {StatisticPageComponent} from "./pages/statistic-page/statistic-page.component";
const routes: Routes = [
{ path: "", component: MainPageComponent},
@@ -17,7 +18,8 @@ const routes: Routes = [
{ path: "banlist", component: BanlistPageComponent },
{ path: "messages", component: MessagesPageComponent },
{ path: "vip", component: VipPageComponent },
- { path: "putisRun", component: DowngamePageComponent}
+ { path: "putisRun", component: DowngamePageComponent },
+ { path: "statistic", component: StatisticPageComponent }
];
@NgModule({
diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index f735d05..775ca5c 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -67,6 +67,7 @@ import {VipPromocodeDialog} from "./pages/vip-page/VipPromocodeDialog";
import {MatCheckboxModule} from "@angular/material/checkbox";
import {PromocodeService} from "./services/promocode.service";
import { DowngamePageComponent } from './pages/downgame-page/downgame-page.component';
+import { StatisticPageComponent } from './pages/statistic-page/statistic-page.component';
registerLocaleData(localeRu, "ru")
@@ -103,7 +104,8 @@ registerLocaleData(localeRu, "ru")
VipBuyDialog,
VipFreeDialog,
VipPromocodeDialog,
- DowngamePageComponent
+ DowngamePageComponent,
+ StatisticPageComponent
],
imports: [
BrowserModule,
diff --git a/src/app/entities/graph/StatsOfPeakOfDay.ts b/src/app/entities/graph/StatsOfPeakOfDay.ts
new file mode 100644
index 0000000..7705633
--- /dev/null
+++ b/src/app/entities/graph/StatsOfPeakOfDay.ts
@@ -0,0 +1,13 @@
+export class StatsOfPeakOfDay {
+ date!: string;
+ max!:number;
+ avg!:number;
+
+ static fromData(res:any):StatsOfPeakOfDay[] {
+ return res.map((ss: any) => {
+ const s = new StatsOfPeakOfDay();
+ Object.assign(s, ss);
+ return s;
+ })
+ }
+}
diff --git a/src/app/entities/graph/StatsOfPeakOfPerFiveMinutes.ts b/src/app/entities/graph/StatsOfPeakOfPerFiveMinutes.ts
new file mode 100644
index 0000000..bf352ae
--- /dev/null
+++ b/src/app/entities/graph/StatsOfPeakOfPerFiveMinutes.ts
@@ -0,0 +1,12 @@
+export class StatsOfPeakOfPerFiveMinutes {
+ timestamp!:Date;
+ max!:number;
+
+ static fromData(res:any):StatsOfPeakOfPerFiveMinutes[] {
+ return res.map((ss: any) => {
+ const s = new StatsOfPeakOfPerFiveMinutes();
+ Object.assign(s, ss);
+ return s;
+ })
+ }
+}
diff --git a/src/app/pages/downgame-page/downgame-page.component.scss b/src/app/pages/downgame-page/downgame-page.component.scss
index 301a173..e3cdf03 100644
--- a/src/app/pages/downgame-page/downgame-page.component.scss
+++ b/src/app/pages/downgame-page/downgame-page.component.scss
@@ -1,4 +1,4 @@
-@keyframes cactusMov {
+@keyframes shitMov {
0%{
left: 580px;
}
@@ -36,21 +36,21 @@
#putis {
width: 50px;
height: 50px;
- background-image: url(../../../assets/images/downGame/dino.png);
+ background-image: url(../../../assets/images/downGame/putis.webp);
background-size: 50px 50px;
position: relative;
top: 150px;
}
-#cactus {
- width: 20px;
+#shit {
+ width: 40px;
height: 40px;
- background-image: url(../../../assets/images/downGame/cactus.png);
- background-size: 20px 40px;
+ background-image: url(../../../assets/images/downGame/shit.webp);
+ background-size: 40px 40px;
position: relative;
top: 110px;
left: 580px;
- animation: cactusMov 1s infinite linear;
+ animation: shitMov 1s infinite linear;
}
.jump {
diff --git a/src/app/pages/downgame-page/downgame-page.component.ts b/src/app/pages/downgame-page/downgame-page.component.ts
index ecafb64..35882eb 100644
--- a/src/app/pages/downgame-page/downgame-page.component.ts
+++ b/src/app/pages/downgame-page/downgame-page.component.ts
@@ -1,53 +1,78 @@
-import {Component, ElementRef, OnInit, ViewChild} from '@angular/core';
+import {Component, ElementRef, Input, OnInit, ViewChild} from '@angular/core';
import {ActionService} from "../../services/action.service";
+import {ActivatedRoute} from "@angular/router";
@Component({
selector: 'app-downgame-page',
styleUrls: ['./downgame-page.component.scss'],
template: `
+
+
Факты13 умерли, поиграй пока в симулятор путиса
+
+
+
{{funnyText}}
+
Уронил кала: {{counter}}
+
`
})
export class DowngamePageComponent implements OnInit {
- constructor(private actionService: ActionService) { }
+ constructor(private actionService: ActionService,
+ private route: ActivatedRoute) { }
@ViewChild('putis', {static: false})
putis!: ElementRef;
- @ViewChild('cactus', {static: false})
- cactus!: ElementRef;
+ @ViewChild('shit', {static: false})
+ shit!: ElementRef;
isAlive!: NodeJS.Timeout;
isJump: boolean = false;
+ dead: boolean = true;
+
+ counter: number = 0;
+ funnyText: string = "";
ngOnInit(): void {
this.createGame();
+ if (this.route.snapshot.queryParamMap.get("dead") == null) {
+ this.dead = false;
+ }
}
createGame() {
this.isAlive = setInterval (() => {
- //console.log(this.putis, window.getComputedStyle(this.putis.nativeElement).top)
-
- let putisTop = this.putis ? parseInt(window.getComputedStyle(this.putis.nativeElement).top) : 0;
- let cactusLeft = this.cactus ? parseInt(window.getComputedStyle(this.cactus.nativeElement).left) : 0;
-
- if (cactusLeft < 50 && cactusLeft > 0 && putisTop >= 140) {
- alert("GAME OVER!")
+ if (this.isTouch(this.putis, this.shit)) {
+ this.counter = 0;
+ this.funnyText = "Лох";
}
+
}, 10)
}
jump() {
if (!this.isJump) {
this.isJump = true;
+ this.funnyText = "Молодец";
setTimeout(() => {
this.isJump = false;
+ this.counter++;
}, 300);
}
}
+
+ isTouch(obj1_ref: any, obj2_ref: any): boolean {
+ const obj1: CSSStyleDeclaration = window.getComputedStyle(obj1_ref.nativeElement);
+ const obj2: CSSStyleDeclaration = window.getComputedStyle(obj2_ref.nativeElement);
+
+ const touch: boolean = parseInt(obj1.right) >= parseInt(obj2.left) && Math.abs(parseInt(obj1.bottom)) >= parseInt(obj2.top);
+
+ return touch;
+ }
+
}
diff --git a/src/app/pages/main-page/main-page.component.ts b/src/app/pages/main-page/main-page.component.ts
index cd3336b..71262ad 100644
--- a/src/app/pages/main-page/main-page.component.ts
+++ b/src/app/pages/main-page/main-page.component.ts
@@ -21,7 +21,7 @@ export class MainPageComponent implements OnInit {
{ico: 'rowing', name: 'Статистика', url: 'statistic'},
{ico: 'message', name: 'Сообщения', url: 'messages'},
{ico: 'list_alt', name: 'Киллфид', url: 'killfeed'},
- {ico: 'live_help', name: 'О нас', url: 'abot'}
+ {ico: 'live_help', name: 'О нас', url: 'about'}
]
search: string = "";
@@ -38,7 +38,8 @@ export class MainPageComponent implements OnInit {
ngOnInit(): void {
this.serverService.getStats("statistic").subscribe(
- (res) => this.statistic = res.export()
+ (res) => this.statistic = res.export(),
+ (err) => this.router.navigate(["/putisRun"], {queryParams: {dead: true}})
)
}
diff --git a/src/app/pages/statistic-page/statistic-page.component.html b/src/app/pages/statistic-page/statistic-page.component.html
new file mode 100644
index 0000000..8bca3fa
--- /dev/null
+++ b/src/app/pages/statistic-page/statistic-page.component.html
@@ -0,0 +1,15 @@
+
+
+
diff --git a/src/app/pages/statistic-page/statistic-page.component.scss b/src/app/pages/statistic-page/statistic-page.component.scss
new file mode 100644
index 0000000..552e12c
--- /dev/null
+++ b/src/app/pages/statistic-page/statistic-page.component.scss
@@ -0,0 +1,3 @@
+h2 {
+ color: #000000;
+}
diff --git a/src/app/pages/statistic-page/statistic-page.component.ts b/src/app/pages/statistic-page/statistic-page.component.ts
new file mode 100644
index 0000000..a28f3b1
--- /dev/null
+++ b/src/app/pages/statistic-page/statistic-page.component.ts
@@ -0,0 +1,38 @@
+import { Component, OnInit } from '@angular/core';
+import {GraphService} from "../../services/graph.service";
+
+export interface Period {
+ name: string
+ value: string
+}
+
+@Component({
+ selector: 'app-statistic-page',
+ templateUrl: './statistic-page.component.html',
+ styleUrls: ['./statistic-page.component.scss']
+})
+export class StatisticPageComponent implements OnInit {
+
+ init: boolean = true;
+ loading: boolean = false;
+
+ periods:Period[] = [
+ {name: 'По дням', value: 'days'},
+ {name: 'По минутам', value: 'minutes'}
+ ];
+ selectedPeriod:Period = this.periods[0];
+
+ days:number[] = [1,7,14,21,30,60,90,180];
+ selectedDays:number = 30;
+
+ constructor(private graphService: GraphService) { }
+
+ ngOnInit(): void {
+ }
+
+ getGraph() {
+ this.init = false;
+ this.loading = true;
+ }
+
+}
diff --git a/src/app/services/graph.service.ts b/src/app/services/graph.service.ts
new file mode 100644
index 0000000..0fe566c
--- /dev/null
+++ b/src/app/services/graph.service.ts
@@ -0,0 +1,21 @@
+import { Injectable } from '@angular/core';
+import {HttpClient} from "@angular/common/http";
+import {map, Observable} from "rxjs";
+import {StatsOfPeakOfDay} from "../entities/graph/StatsOfPeakOfDay";
+import {StatsOfPeakOfPerFiveMinutes} from "../entities/graph/StatsOfPeakOfPerFiveMinutes";
+
+@Injectable({
+ providedIn: 'root'
+})
+export class GraphService {
+
+ constructor(private http: HttpClient) { }
+
+ public getOnlineStatsOfDays(limit: number, server_id: string):Observable {
+ return this.http.get(`api/stats/graph/peak/of/days`, {params: {limit, server_id}}).pipe((map((res) => StatsOfPeakOfDay.fromData(res))))
+ }
+
+ public getOnlineStatsOfMinutes(minutes: number, limit: number, server_id: string):Observable {
+ return this.http.get(`api/stats/graph/peak/of/minutes`, {params: {limit, server_id, minutes}}).pipe((map((res) => StatsOfPeakOfPerFiveMinutes.fromData(res))))
+ }
+}
diff --git a/src/assets/images/downGame/putis.webp b/src/assets/images/downGame/putis.webp
new file mode 100644
index 0000000..d925162
Binary files /dev/null and b/src/assets/images/downGame/putis.webp differ
diff --git a/src/assets/images/downGame/shit.webp b/src/assets/images/downGame/shit.webp
new file mode 100644
index 0000000..9d2b874
Binary files /dev/null and b/src/assets/images/downGame/shit.webp differ