diff --git a/.drone.yml b/.drone.yml index 4e374d2..5033420 100644 --- a/.drone.yml +++ b/.drone.yml @@ -15,7 +15,7 @@ steps: IMAGENAME: mysql:latest CONTAINERNAME: mysql COMMAND: create - OVERWRITE: true + #OVERWRITE: true PRIVATE: true CODEFIRST_CLIENTDRONE_ENV_MYSQL_ROOT_PASSWORD: from_secret: MYSQL_ROOT_PASSWORD diff --git a/bob_party/Dockerfile b/bob_party/Dockerfile index 04e680c..e72937a 100644 --- a/bob_party/Dockerfile +++ b/bob_party/Dockerfile @@ -7,7 +7,8 @@ FROM node:latest # where available (npm@5+) COPY bob_party/package*.json ./ -RUN yarn +RUN yarn install --frozen-lockfile + # If you are building your code for production # RUN npm ci --only=production @@ -15,5 +16,5 @@ RUN yarn COPY bob_party/server.js . EXPOSE 3000 -CMD [ "node", "server.js" ] -CMD [ "cat", "server.js" ] \ No newline at end of file + +CMD [ "node", "server.js" ] \ No newline at end of file diff --git a/bob_party/server.js b/bob_party/server.js index de4c167..5093689 100644 --- a/bob_party/server.js +++ b/bob_party/server.js @@ -1,9 +1,11 @@ const express = require('express'); -const app = express(); const http = require('http'); -const server = http.createServer(app); const { Server } = require("socket.io"); + + +const app = express(); +const server = http.createServer(app); const io = new Server(server); io.on('connection', (socket) => { diff --git a/bob_party/socketConfig.js b/bob_party/socketConfig.js index 81b208b..54c91fd 100644 --- a/bob_party/socketConfig.js +++ b/bob_party/socketConfig.js @@ -1,4 +1,4 @@ const { io } = require("socket.io-client"); -export const socket = io("http://codefirst.iut.uca.fr/containers/BOB_PARTEAM-server-bobParty:3000"); \ No newline at end of file +export const socket = io("https://codefirst.iut.uca.fr/containers/BOB_PARTEAM-server-bobParty/server:3000"); \ No newline at end of file diff --git a/bob_party/src/components/LobbyComponent.tsx b/bob_party/src/components/LobbyComponent.tsx index edf6e38..5b490ec 100644 --- a/bob_party/src/components/LobbyComponent.tsx +++ b/bob_party/src/components/LobbyComponent.tsx @@ -1,5 +1,5 @@ import { FC, useState} from "react" -import { Button, FlatList, Pressable } from "react-native" +import { Alert, Button, FlatList, Pressable } from "react-native" import React from "react" import { Game } from "../core/game" @@ -51,7 +51,19 @@ FC<{nav: any}> = async function launchMatch(){ - + const tmpMatch=MANAGER_MATCH.getCurrentMatch(); + if (tmpMatch!==undefined && tmpMatch!==null){ + if (tmpMatch.getGame().getNbPlayerMin()>tmpMatch.getTabUsers().length){ + Alert.alert("Wait until there is enough players!"); + return; + } + else if(tmpMatch.getGame().getNbPlayerMin() = /> {socket.emit("launchMatch", MANAGER_MATCH.getCurrentMatch()); nav.navigate(MANAGER_MATCH.getCurrentMatch()?.getGame().getName().replace(/\s/g, ''))}} + onPress={() => {launchMatch()}} > Lancer la partie diff --git a/bob_party/src/screens/SignUp.tsx b/bob_party/src/screens/SignUp.tsx index 4a8beda..e1a7296 100644 --- a/bob_party/src/screens/SignUp.tsx +++ b/bob_party/src/screens/SignUp.tsx @@ -194,13 +194,11 @@ function SignUp(props: { navigation: any; }) { function initSocket(){ socket.emit("signIn", MANAGER_USER.getCurrentUser()?.id); - MANAGER_CONVERSATION.getTabConv()?.forEach( conv =>{ - socket.emit("inConv", conv); - }); socket.on("messageReceived", async () =>{ await handleConversationLoad(); }); socket.on("addedToConv", async (conv) =>{ + console.log("HEY"); socket.emit("inConv", conv); await handleConversationLoad(); });