Merge branch 'peristanceBDD' of https://codefirst.iut.uca.fr/git/BOB_PARTEAM/BOB_PARTY into peristanceBDD
continuous-integration/drone/push Build is passing Details

peristanceBDD
Alban GUILHOT 2 years ago
commit 75a4a525bc

@ -15,7 +15,7 @@ steps:
IMAGENAME: mysql:latest IMAGENAME: mysql:latest
CONTAINERNAME: mysql CONTAINERNAME: mysql
COMMAND: create COMMAND: create
OVERWRITE: true #OVERWRITE: true
PRIVATE: true PRIVATE: true
CODEFIRST_CLIENTDRONE_ENV_MYSQL_ROOT_PASSWORD: CODEFIRST_CLIENTDRONE_ENV_MYSQL_ROOT_PASSWORD:
from_secret: MYSQL_ROOT_PASSWORD from_secret: MYSQL_ROOT_PASSWORD

@ -7,7 +7,8 @@ FROM node:latest
# where available (npm@5+) # where available (npm@5+)
COPY bob_party/package*.json ./ COPY bob_party/package*.json ./
RUN yarn RUN yarn install --frozen-lockfile
# If you are building your code for production # If you are building your code for production
# RUN npm ci --only=production # RUN npm ci --only=production
@ -15,5 +16,5 @@ RUN yarn
COPY bob_party/server.js . COPY bob_party/server.js .
EXPOSE 3000 EXPOSE 3000
CMD [ "node", "server.js" ] CMD [ "node", "server.js" ]
CMD [ "cat", "server.js" ]

@ -1,9 +1,11 @@
const express = require('express'); const express = require('express');
const app = express();
const http = require('http'); const http = require('http');
const server = http.createServer(app);
const { Server } = require("socket.io"); const { Server } = require("socket.io");
const app = express();
const server = http.createServer(app);
const io = new Server(server); const io = new Server(server);
io.on('connection', (socket) => { io.on('connection', (socket) => {

@ -1,4 +1,4 @@
const { io } = require("socket.io-client"); const { io } = require("socket.io-client");
export const socket = io("http://codefirst.iut.uca.fr/containers/BOB_PARTEAM-server-bobParty:3000"); export const socket = io("https://codefirst.iut.uca.fr/containers/BOB_PARTEAM-server-bobParty/server:3000");

@ -1,5 +1,5 @@
import { FC, useState} from "react" 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 React from "react"
import { Game } from "../core/game" import { Game } from "../core/game"
@ -51,7 +51,19 @@ FC<{nav: any}> =
async function launchMatch(){ 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()<tmpMatch.getTabUsers().length){
Alert.alert("There is too much players!");
return;
}
}
socket.emit("launchMatch", MANAGER_MATCH.getCurrentMatch());
nav.navigate(MANAGER_MATCH.getCurrentMatch()?.getGame().getName().replace(/\s/g, ''));
} }
@ -110,7 +122,7 @@ FC<{nav: any}> =
/> />
<Pressable <Pressable
style={style.pressable} style={style.pressable}
onPress={() => {socket.emit("launchMatch", MANAGER_MATCH.getCurrentMatch()); nav.navigate(MANAGER_MATCH.getCurrentMatch()?.getGame().getName().replace(/\s/g, ''))}} onPress={() => {launchMatch()}}
> >
<Text style={style.text}>Lancer la partie</Text> <Text style={style.text}>Lancer la partie</Text>
</Pressable> </Pressable>

@ -194,13 +194,11 @@ function SignUp(props: { navigation: any; }) {
function initSocket(){ function initSocket(){
socket.emit("signIn", MANAGER_USER.getCurrentUser()?.id); socket.emit("signIn", MANAGER_USER.getCurrentUser()?.id);
MANAGER_CONVERSATION.getTabConv()?.forEach( conv =>{
socket.emit("inConv", conv);
});
socket.on("messageReceived", async () =>{ socket.on("messageReceived", async () =>{
await handleConversationLoad(); await handleConversationLoad();
}); });
socket.on("addedToConv", async (conv) =>{ socket.on("addedToConv", async (conv) =>{
console.log("HEY");
socket.emit("inConv", conv); socket.emit("inConv", conv);
await handleConversationLoad(); await handleConversationLoad();
}); });

Loading…
Cancel
Save