This commit is contained in:
Killian Marty 2023-12-11 15:03:47 +01:00
parent 3b939ae37e
commit 539ccd2213
5 changed files with 98 additions and 3 deletions

View file

@ -10,4 +10,74 @@ html, body{
#canvas{
max-height: 100vh;
max-width: 100vw;
}
#phoneDiv{
position: relative;
}
#phone{
width: 200px;
}
#phoneScreen{
background-color: 524b4a;
position: absolute;
left: 7%;
top: 12%;
right: 7%;
bottom: 13%;
}
#chatHeader{
height: 10%;
width: 100%;
border-bottom: 1px solid black;
text-align: center;
color: white;
line-height: 7%;
padding: 0px;
overflow: hidden;
}
#chatHeader > p{
line-height: 10%;
}
#chatMessages{
height: 80%;
width: 100%;
}
#chatInputDiv{
height: 10%;
width: 100%;
text-align: center;
}
#chatInput{
width: 90%;
box-sizing: border-box;
appearance: none;
background-color: transparent;
border-radius: 10px;
border: 1px solid black;
color: white;
padding-left: 10px;
height: 85%;
margin-bottom: 15%;
outline: none;
}
.message{
color: white;
font-family: sans-serif;
}
.messageTitle{
font-size: 75%;
margin: 0px;
}
.messageContent{
margin: 0px;
font-size: 60%;
}

View file

@ -3,6 +3,7 @@
<head>
<script type="text/javascript" src="./js/sound.js"></script>
<script type="text/javascript" src="./js/cookies.js"></script>
<script type="text/javascript" src="./js/phone.js"></script>
<script type="text/javascript" src="./js/class.js"></script>
<script type="text/javascript" src="./js/render.js"></script>
<script type="text/javascript" src="./js/input.js"></script>
@ -16,6 +17,23 @@
</head>
<body>
<canvas width="800" height="800" id="canvas"></canvas>
<div id="phoneDiv">
<img id="phone" src="assets/phone.png" alt="Phone">
<div id="phoneScreen">
<div id="chatHeader">
<p>Concorde</p>
</div>
<div id="chatMessages">
<div class="message">
<h2 class="messageTitle">Killian</h2>
<p class="messageContent">yo les gars</p>
</div>
</div>
<div id="chatInputDiv">
<input type="text" placeholder="Ecrivez un message ici" id="chatInput" onkeydown="phone.keyPress(this)">
</div>
</div>
</div>
</body>
</html>

View file

@ -220,7 +220,7 @@ class Car
Update()
{
if(this.tick==0 && new Date().getSeconds()%20==this.spawn) {
if(this.tick==0 && (new Date()).getSeconds()%20==this.spawn) {
this.tick=1;
}

View file

@ -6,6 +6,7 @@ let bulletSound = new Sound("./assets/sounds/shoot.mp3");
let driftSound = new Sound("./assets/sounds/drift.mp3");
let net = new Network("wss://ws.gta6.insat.fr:8080?name=" + getCookie("pseudo"));
let inp = new Input("canvas");
let phone = new Phone();
let bullets = [];
let circles = [];
let squares = [];
@ -16,12 +17,11 @@ let PNJS = [new PNJ(500, 100),
let cars = [new Car(renderer, 0, 0),
new Car(renderer, 0, 7),
new Car(renderer, 1, 7),
new Car(renderer, 1, 3),
new Car(renderer, 1, 13),
new Car(renderer, 1, 14),
new Car(renderer, 0, 15)];
function updatePlayer(data)
{
if(data.id==player.id)

View file

@ -39,6 +39,9 @@ class Network{
addKill(data.data.id,data.data.killerId);
break;
case "message":
phone.addMessage(data.data);
default:
console.log("received unknown data:",data);
break;
@ -70,4 +73,8 @@ class Network{
{
this.socket.send(JSON.stringify({type:"newBullet",data:{x: x,y: y,dx: dx,dy: dy,id:parentId}}));
}
sendMessage(title, content){
this.socket.send(JSON.stringify({type: "sendMessage", data: {title: title, content: content}}));
}
}