v1 #4

Sapludināts
rebillar sapludināja 50 revīzijas no dev uz master 2023-12-29 21:34:13 +01:00
7 mainīti faili ar 19 papildinājumiem un 2 dzēšanām
Rāda tikai revīzijas 18686fea69 izmaiņas - Rādīt visas revīzijas

Bināro failu nav iespējams attēlot.

Bināro failu nav iespējams attēlot.

Bināro failu nav iespējams attēlot.

Pirms

Platums:  |  Augstums:  |  Izmērs: 20 KiB

Bināro failu nav iespējams attēlot.

Pirms

Platums:  |  Augstums:  |  Izmērs: 49 KiB

Parādīt failu

@ -28,6 +28,12 @@ html, body{
user-select: none; user-select: none;
} }
#phoneContainer.notification{
position: absolute;
right: 20px;
top: calc(100% - 40px);
}
#phoneDiv{ #phoneDiv{
position: relative; position: relative;
} }

Parādīt failu

@ -4,6 +4,7 @@ let renderer = new Render("canvas");
let LB = new LeaderBoard("canvas"); let LB = new LeaderBoard("canvas");
let bulletSound = new Sound("./assets/sounds/shoot.mp3"); let bulletSound = new Sound("./assets/sounds/shoot.mp3");
let driftSound = new Sound("./assets/sounds/drift.mp3"); let driftSound = new Sound("./assets/sounds/drift.mp3");
let notificationSound = new Sound("./assets/sounds/notification.mp3");
let net = new Network("wss://ws.gta6.insat.fr:8080?name=" + getCookie("pseudo")); let net = new Network("wss://ws.gta6.insat.fr:8080?name=" + getCookie("pseudo"));
let inp = new Input("canvas"); let inp = new Input("canvas");
let phone = new Phone(); let phone = new Phone();

Parādīt failu

@ -1,6 +1,6 @@
class Phone{ class Phone{
constructor(){ constructor(){
this.position = 0; this.position = 0; //0: hidden 1: visible 2: notification
this.messages = []; this.messages = [];
this.name = document.getElementById("TitlePage"); this.name = document.getElementById("TitlePage");
@ -99,10 +99,20 @@ class Phone{
this.contentmsg.appendChild(msg); this.contentmsg.appendChild(msg);
this.contentmsg.scrollTop = this.contentmsg.scrollHeight; this.contentmsg.scrollTop = this.contentmsg.scrollHeight;
//notification
if(message.playerId!=player.id){
notificationSound.play();
if(this.position == 0){
this.position = 2;
document.getElementById("phoneContainer").className = "notification";
}
}
} }
sendMessage(title, content){ sendMessage(title, content){
let message = { let message = {
playerId: player.id,
title: player.name, title: player.name,
content: content content: content
} }
@ -122,7 +132,7 @@ class Phone{
changePosition(){ changePosition(){
if(!document.getElementById("phoneContainer").contains(document.activeElement)){ if(!document.getElementById("phoneContainer").contains(document.activeElement)){
if(this.position == 0){ if(this.position == 0 || this.position == 2){
document.getElementById("phoneContainer").className = "visible"; document.getElementById("phoneContainer").className = "visible";
this.position = 1; this.position = 1;
}else{ }else{