Compare commits

...

172 Commits

Author SHA1 Message Date
Thomas CHAZOT 0c84338ade Mise à jour de '.drone.yml'
1 year ago
Thomas CHAZOT 5ba18d8f85 Mise à jour de '.drone.yml'
1 year ago
Thomas CHAZOT 9e74eac3f3 Mise à jour de '.drone.yml'
continuous-integration/drone/push Build is passing Details
2 years ago
Alban GUILHOT 1aeb9442e5 Merge branch 'master' into peristanceBDD
continuous-integration/drone/push Build is passing Details
2 years ago
Alban GUILHOT 63d2990789 Resolution Warnings
continuous-integration/drone/push Build is passing Details
2 years ago
Alban GUILHOT 22dbb5a076 Remplacement monnaie réelle par bobcoins
continuous-integration/drone/push Build was killed Details
2 years ago
Alban GUILHOT 4684f45b59 clean
continuous-integration/drone/push Build was killed Details
2 years ago
Alban GUILHOT 980f729c77 Ajout indicateur validité mot de passe
2 years ago
Alban GUILHOT 20fc3279da Nouvelle image Cookie Clicker
2 years ago
Alban GUILHOT 7e4683d1eb Changement Image cookie Clicker
2 years ago
Alban GUILHOT 079a840a82 Style
continuous-integration/drone/push Build was killed Details
2 years ago
Thomas Chazot d956c21cf8 Correction bug blackjack
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas Chazot a655460a75 modif initBdd
continuous-integration/drone/push Build is passing Details
2 years ago
Alban GUILHOT baf5748804 Merge branch 'peristanceBDD' of https://codefirst.iut.uca.fr/git/BOB_PARTEAM/BOB_PARTY into peristanceBDD
continuous-integration/drone/push Build is passing Details
2 years ago
Alban GUILHOT f51d19659f Correction vue
2 years ago
Alban GUILHOT bc2ef3e15c Correction gestion borderradius android
2 years ago
Alban GUILHOT 15c2aba65b Changement vue
2 years ago
Thomas Chazot b8138127dc correction du draw pour tictactoe online
continuous-integration/drone/push Build is passing Details
2 years ago
Alban GUILHOT 2d14f83813 Correction chargement jeux a la déconneciton
continuous-integration/drone/push Build is passing Details
2 years ago
Alban GUILHOT 46922ef737 Clean console.log
continuous-integration/drone/push Build is passing Details
2 years ago
Alban GUILHOT 53c42d12de Merge branch 'peristanceBDD' of https://codefirst.iut.uca.fr/git/BOB_PARTEAM/BOB_PARTY into peristanceBDD
continuous-integration/drone/push Build is passing Details
2 years ago
Alban GUILHOT 3aeae1d554 Correctif navigation déconnection
2 years ago
Alban GUILHOT 59a2c64621 Correctif navigation deconnection
2 years ago
Thomas Chazot f5314fb6af Bug fix
continuous-integration/drone/push Build is passing Details
2 years ago
Alban GUILHOT 3b2bf5f6b9 Merge branch 'peristanceBDD' of https://codefirst.iut.uca.fr/git/BOB_PARTEAM/BOB_PARTY into peristanceBDD
continuous-integration/drone/push Build is passing Details
2 years ago
Alban GUILHOT 5cb33fe713 ADD: bouton quitter partie BlackJack
2 years ago
Thomas CHAZOT 16c11b9a08 Mise à jour de 'bob_party/server.js'
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas Chazot 412fe8f1c3 encore
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas CHAZOT 63bdd6bf52 Mise à jour de 'bob_party/server.js'
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas CHAZOT 1f7ff582a6 Mise à jour de 'bob_party/server.js'
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas CHAZOT 43db045f79 Mise à jour de 'bob_party/server.js'
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas CHAZOT aec97ce182 Mise à jour de 'bob_party/server.js'
continuous-integration/drone/push Build was killed Details
2 years ago
Thomas CHAZOT 2900f460be Mise à jour de 'bob_party/server.js'
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas CHAZOT 6327eff2e8 Mise à jour de 'bob_party/server.js'
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas CHAZOT 18da268189 Mise à jour de 'bob_party/Dockerfile'
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas CHAZOT bf1b8c1922 Mise à jour de 'bob_party/Dockerfile'
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas CHAZOT 95f1acf53d Mise à jour de 'bob_party/Dockerfile'
continuous-integration/drone/push Build is failing Details
2 years ago
Thomas CHAZOT 1df6cfebb1 Mise à jour de 'bob_party/Dockerfile'
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas CHAZOT dedbe48f33 Mise à jour de 'bob_party/Dockerfile'
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas CHAZOT e35dc7c59b Mise à jour de 'bob_party/server.js'
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas CHAZOT 727e833c55 Mise à jour de 'bob_party/server.js'
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas CHAZOT 1fff3fa33f Mise à jour de 'bob_party/Dockerfile'
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas Chazot 669b420c18 encore des tests
continuous-integration/drone/push Build is failing Details
2 years ago
Thomas CHAZOT e9545b8995 Mise à jour de 'bob_party/server.js'
continuous-integration/drone/push Build is failing Details
2 years ago
Thomas CHAZOT d53a51c5fb Mise à jour de 'bob_party/Dockerfile'
continuous-integration/drone/push Build is failing Details
2 years ago
Thomas CHAZOT 3bd4e7bd54 Mise à jour de 'bob_party/Dockerfile'
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas CHAZOT 284438dcb6 Mise à jour de 'bob_party/server.js'
continuous-integration/drone/push Build was killed Details
2 years ago
Thomas CHAZOT e6e2c3759f Mise à jour de 'bob_party/server.js'
continuous-integration/drone/push Build was killed Details
2 years ago
Thomas CHAZOT d11d49acb7 Mise à jour de 'bob_party/server.js'
continuous-integration/drone/push Build was killed Details
2 years ago
Thomas Chazot cd4582da07 revert
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas Chazot 4c91c7d236 test
continuous-integration/drone/push Build was killed Details
2 years ago
Thomas Chazot 44de84190b Test pour la connection au serveur
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas Chazot c211f6a277 revert
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas Chazot 6b2fe92a50 Tentative pour le serveur sur docker
continuous-integration/drone/push Build is passing Details
2 years ago
Alban GUILHOT 75a4a525bc Merge branch 'peristanceBDD' of https://codefirst.iut.uca.fr/git/BOB_PARTEAM/BOB_PARTY into peristanceBDD
continuous-integration/drone/push Build is passing Details
2 years ago
Alban GUILHOT 1d3c3857bf ADD: gestion dynamique de la distance de la
2 years ago
Thomas CHAZOT 8dc39fc83a Mise à jour de 'bob_party/server.js'
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas CHAZOT 3d68745f3d Mise à jour de 'bob_party/server.js'
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas CHAZOT 4bae987de3 Mise à jour de 'bob_party/server.js'
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas CHAZOT ccb77b5c23 Mise à jour de 'bob_party/server.js'
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas CHAZOT 633dcb7a3b Mise à jour de 'bob_party/server.js'
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas CHAZOT 8c263f2e06 Mise à jour de 'bob_party/server.js'
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas CHAZOT 0e64a6f75f Mise à jour de 'bob_party/server.js'
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas CHAZOT d2273a1f46 Mise à jour de 'bob_party/server.js'
continuous-integration/drone/push Build was killed Details
2 years ago
Thomas CHAZOT e086b8f410 Mise à jour de '.drone.yml'
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas CHAZOT 7ec07bffb3 Mise à jour de 'bob_party/server.js'
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas CHAZOT 8695c9b8c6 Mise à jour de 'bob_party/server.js'
continuous-integration/drone/push Build was killed Details
2 years ago
Thomas Chazot 6fe0efbce2 Vérification nombre de joueurs pour match
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas CHAZOT 0235e7d8d9 Mise à jour de 'bob_party/server.js'
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas CHAZOT 8ed4c1a0da Mise à jour de 'bob_party/Dockerfile'
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas CHAZOT bb74a2a597 Mise à jour de 'bob_party/Dockerfile'
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas CHAZOT 39ab3c1ac6 Mise à jour de '.drone.yml'
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas CHAZOT 4fe08a5385 Mise à jour de 'bob_party/Dockerfile'
continuous-integration/drone/push Build was killed Details
2 years ago
Thomas CHAZOT 849be820e2 Mise à jour de 'bob_party/Dockerfile'
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas CHAZOT 72fdfe3f43 Mise à jour de '.drone.yml'
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas CHAZOT df7a22f4f2 Mise à jour de '.drone.yml'
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas CHAZOT 20354f42e9 Mise à jour de 'bob_party/Dockerfile'
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas CHAZOT e541d4fd5d Mise à jour de 'bob_party/Dockerfile'
continuous-integration/drone/push Build is passing Details
2 years ago
Alban GUILHOT 7c2b14f1c5 Merge branch 'peristanceBDD' of https://codefirst.iut.uca.fr/git/BOB_PARTEAM/BOB_PARTY into peristanceBDD
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas CHAZOT 6156b5fec7 Mise à jour de 'bob_party/Dockerfile'
continuous-integration/drone/push Build was killed Details
2 years ago
Alban GUILHOT 06e4f61fcb Adaptation datepicker pour android
2 years ago
Thomas CHAZOT edd1e50a11 Mise à jour de 'bob_party/Dockerfile'
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas CHAZOT f33313b1ee Mise à jour de 'bob_party/Dockerfile'
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas CHAZOT db27e27351 Mise à jour de 'bob_party/Dockerfile'
continuous-integration/drone/push Build is failing Details
2 years ago
Thomas CHAZOT a1ba063570 Mise à jour de 'bob_party/Dockerfile'
continuous-integration/drone/push Build is failing Details
2 years ago
Thomas CHAZOT 40f20f68f1 Mise à jour de 'bob_party/Dockerfile'
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas CHAZOT 3f2f62ca3e Mise à jour de 'bob_party/Dockerfile'
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas CHAZOT a4de36f886 Mise à jour de 'bob_party/Dockerfile'
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas CHAZOT 990d866ec4 Mise à jour de '.drone.yml'
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas CHAZOT 33b0f68a99 Mise à jour de 'bob_party/Dockerfile'
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas CHAZOT 2d8fa25a12 Mise à jour de '.drone.yml'
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas CHAZOT fa4ce968a3 Mise à jour de '.drone.yml'
continuous-integration/drone/push Build is failing Details
2 years ago
Thomas CHAZOT 39b05d799c Mise à jour de 'api-rest/index.php'
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas CHAZOT 4624b3cc05 Mise à jour de 'api-rest/index.php'
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas CHAZOT 2faa9ecffb Mise à jour de 'api-rest/index.php'
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas CHAZOT 0b98e57ec7 Mise à jour de 'bob_party/Dockerfile'
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas CHAZOT a33e92fbec Mise à jour de 'bob_party/Dockerfile'
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas CHAZOT e3bb8a808d Mise à jour de '.drone.yml'
continuous-integration/drone/push Build is failing Details
2 years ago
Thomas CHAZOT d3c83d08ac Ajouter 'bob_party/Dockerfile'
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas Chazot 21b231d548 Correction d'une faute de frappe
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas Chazot f704fa7ea4 Augmentation de la taille des mdp pour hashage
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas Chazot 5641e271bb Correction erreur
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas Chazot b5ecdb455b quitter match marche + tentative hashage
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas Chazot 1acc475741 signUp initialisé comme signIn
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas Chazot f7970d35b2 Add: Réseau:
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas Chazot 0f1439c8d2 correction d'erreurs
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas Chazot 55f297ca1c test
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas Chazot 15cf3a1101 test 2
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas Chazot a682a76776 test
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas Chazot d8cd6b9a5a celui des conversations
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas Chazot fad7dae4e0 Changement des triggers par modifs dans gateway
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas Chazot c74b54465a Les triggers ne marchent pas...
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas Chazot 64b6ac2c31 De même
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas Chazot e95a26746c Correction bug bdd docker
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas CHAZOT e18aec54b2 Mise à jour de 'api-rest/initBdd.php'
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas CHAZOT ce313aba90 Mise à jour de 'api-rest/gateways/userGateway.php'
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas CHAZOT 9efd55bb81 Mise à jour de 'api-rest/gateways/userGateway.php'
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas CHAZOT d26179eed2 Mise à jour de 'api-rest/gateways/userGateway.php'
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas Chazot 50958eadc8 ajout pour test api
continuous-integration/drone/push Build is passing Details
2 years ago
Alban GUILHOT 9f62ea0158 Typo ManagerUser
2 years ago
Thomas CHAZOT d6c3695038 Mise à jour de 'api-rest/index.php'
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas CHAZOT e527cef87a Mise à jour de 'api-rest/index.php'
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas CHAZOT ab49004cc4 Mise à jour de '.drone.yml'
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas CHAZOT 10b2428aea Mise à jour de '.drone.yml'
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas Chazot b8624936d7 changement du fichier sql
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas CHAZOT 3e66d8118f Mise à jour de 'api-rest/index.php'
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas CHAZOT 01c2a0ef6f Mise à jour de '.drone.yml'
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas Chazot 1958934bf7 changement des url des requêtes sur l'api
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas Chazot c1212ed509 Remove: useless file and useless echo
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas Chazot ab9da76344 Merge branch 'testDockerToto' into peristanceBDD
continuous-integration/drone/push Build is passing Details
2 years ago
Alban GUILHOT 4cf38e28c9 Fin lobby multi
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas Chazot 0dd98f20f6 ADD: SaverMatchApi + persistance pour match
continuous-integration/drone/push Build is passing Details
2 years ago
Alban GUILHOT 48dbae30d9 Clean console.log
continuous-integration/drone/push Build is passing Details
2 years ago
Alban GUILHOT 4f97e83faa Merge branch 'peristanceBDD' of https://codefirst.iut.uca.fr/git/BOB_PARTEAM/BOB_PARTY into peristanceBDD
continuous-integration/drone/push Build is passing Details
2 years ago
Alban GUILHOT 2ea5eb1513 Creation du component user preview et debut du Lobby multi
2 years ago
Alban GUILHOT a00d7e0ba4 Packages
2 years ago
Alban GUILHOT 3f2f3af626 yarn
2 years ago
Thomas Chazot 5b2b142646 Ajout: load match
continuous-integration/drone/push Build is passing Details
2 years ago
Alban GUILHOT 1c30bdffb5 Changement nom component BBB
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas Chazot 3ab38b1d30 Add: Sort des conversations
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas Chazot d885b09ed8 Ajout de la suppression des conversations
continuous-integration/drone/push Build is passing Details
2 years ago
Alban GUILHOT 070b2624fc ajout du bouton addConv en absolute
continuous-integration/drone/push Build is passing Details
2 years ago
Alban GUILHOT 8f6bd2cded Ajout icon LeaveConv
2 years ago
Alban GUILHOT 8cf6e36928 Modifications on the GameList component
2 years ago
Alban GUILHOT 4895af2547 Creation of GameList component
2 years ago
Alban GUILHOT eb17c128e6 Creation of the gameList component
2 years ago
Alban GUILHOT 82a7fd6413 Correction syntaxe
2 years ago
Thomas Chazot 4851e6111d Fin de la partie ajoue conversation avec le réseau
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas Chazot d016ed0589 Add: AddConversation
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas Chazot e2fb286b00 Correction du problème lors du load des jeux
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas Chazot 5a43d53b3c Oups
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas Chazot 2f8071bfbe push pour alban
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas Chazot d3f50e8227 Bug fixed
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas Chazot d677886aa4 Fin conversation
continuous-integration/drone/push Build is passing Details
2 years ago
Alban GUILHOT 172aeab0b5 Prévention bugs
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas Chazot 2267eaa529 UPDATE: Correction de bugs
continuous-integration/drone/push Build is passing Details
2 years ago
Thomas Chazot 0057d8ecca Add: Black jack + online tic tac toe
continuous-integration/drone/push Build is passing Details
2 years ago
Mathilde JEAN 1c115e0bf1 correction diagramme de cas d'utilisation
2 years ago
Alban GUILHOT e5c3f93809 ADD: Ajout du logo
3 years ago
Thomas CHAZOT 5c78f34c38 Ajout des diagrammes de séquence de la boutique
3 years ago
Mathilde JEAN f3d66fac00 Supprimer 'Documentation/Diagrammes_de_seq/jouerSeul.mdj'
3 years ago
Mathilde Jean 4c6213a06b diagrammes de séquence s'inscrire et se connecter
3 years ago
Mathilde Jean 7f194f393c diagramme de séquence jouer à un jeu
3 years ago
Mathilde Jean cc0a7eb587 diagrammes de séquence changerSonAvatar, créerUnGroupe, modifierSesRéglages et tchatterAvecUnAmi
3 years ago
Mathilde Jean 7bcb261927 diagrammes de séquence
3 years ago
Alban GUILHOT b6313131cd Suppression de la ToDoList dans la branche master
3 years ago
Alban GUILHOT 0c216e844e Ajout du fichier des To-Do Lists
3 years ago
Alban GUILHOT b78d3191f2 Clean banch master
3 years ago
Alban GUILHOT d3ff225f38 Ajout des personas finis dans la branche master
3 years ago
Alban GUILHOT 83e07e61a6 Clean branche master
3 years ago
Alban GUILHOT 805d3a432d Ajout des storyboards et du Diagramme Cas d'Utilisation dans la branche master
3 years ago
Alban GUILHOT 6251d9ba01 Ajout de l'ancien README
3 years ago

@ -2,20 +2,19 @@
kind: pipeline kind: pipeline
name: Dockers_Builder name: Dockers_Builder
# Creation of the DB docker # Creation of the DB docker
steps: steps:
# database container deployment # database container deployment
- name: deploy-container-mysql - name: deploy-container-mysql
image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dockerproxy-clientdrone:latest image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dockerproxy-clientdrone:latest
environment: build:
settings:
dockerfile: ./Dockerfile
context: . context: .
dockerfile: ./Dockerfile
environment:
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
@ -36,7 +35,7 @@ steps:
dockerfile: ./api-rest/Dockerfile dockerfile: ./api-rest/Dockerfile
context: . context: .
registry: hub.codefirst.iut.uca.fr registry: hub.codefirst.iut.uca.fr
repo: hub.codefirst.iut.uca.fr/bob_parteam/bob_party repo: hub.codefirst.iut.uca.fr/bob_parteam/bob_party/api
username: username:
from_secret: SECRET_REGISTRY_USERNAME from_secret: SECRET_REGISTRY_USERNAME
password: password:
@ -48,7 +47,7 @@ steps:
- name: deploy-api-containers - name: deploy-api-containers
image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dockerproxy-clientdrone:latest image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dockerproxy-clientdrone:latest
environment: environment:
IMAGENAME: hub.codefirst.iut.uca.fr/bob_parteam/bob_party:latest IMAGENAME: hub.codefirst.iut.uca.fr/bob_parteam/bob_party/api:latest
CONTAINERNAME: api-bobParty CONTAINERNAME: api-bobParty
COMMAND: create COMMAND: create
OVERWRITE: true OVERWRITE: true
@ -66,6 +65,33 @@ steps:
ADMINS: thomaschazot2,mathildejean3,lilianbreton,luciebedouret,albanguilhot,cedricbouhours ADMINS: thomaschazot2,mathildejean3,lilianbreton,luciebedouret,albanguilhot,cedricbouhours
depends_on: [ deploy-container-mysql, container-api ] depends_on: [ deploy-container-mysql, container-api ]
# docker image build
- name: container-server
image: plugins/docker
settings:
dockerfile: ./bob_party/Dockerfile
context: .
registry: hub.codefirst.iut.uca.fr
repo: hub.codefirst.iut.uca.fr/bob_parteam/bob_party/server
username:
from_secret: SECRET_REGISTRY_USERNAME
password:
from_secret: SECRET_REGISTRY_PASSWORD
#container deployment
- name: deploy-server-containers
image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dockerproxy-clientdrone:latest
environment:
IMAGENAME: hub.codefirst.iut.uca.fr/bob_parteam/bob_party/server:latest
CONTAINERNAME: server-bobParty
COMMAND: create
OVERWRITE: true
#PRIVATE: true
ADMINS: thomaschazot2,mathildejean3,lilianbreton,luciebedouret,albanguilhot,cedricbouhours
depends_on: [ container-server ]

@ -155,8 +155,12 @@ public function deleteUserFromConversation(int $idConv, int $idUser){
public function deleteConversation(int $id):void{ public function deleteConversation(int $id):void{
$deleteConv = "DELETE FROM T_H_CONVERSATION_COV $deleteConv = "DELETE FROM T_H_CONVERSATION_COV
WHERE PK_ID=:idConv"; WHERE PK_ID=:idConv";
$deleteMessages="DELETE FROM T_H_MESSAGE_MSG WHERE PK_ID = (SELECT FK_MESSAGE
FROM T_J_CONTAIN_MESSAGE_CMG
WHERE FK_CONVERSATION=:id)";
$argIdConv = array('idConv'=>array($id,PDO::PARAM_INT)); $argIdConv = array('idConv'=>array($id,PDO::PARAM_INT));
$this->connection->execQuery($deleteConv,$argIdConv); $this->connection->execQuery($deleteConv,$argIdConv);
$this->connection->execQuery($deleteMessages,$argIdConv);
} }
} }

@ -20,14 +20,28 @@ class GameGateway{
public function getGames():?array{ public function getGames():?array{
$tabGames=null; $tabGames=null;
$gamesQuery="SELECT * FROM T_E_GAME_GAM"; $gamesQuery="SELECT * FROM T_E_GAME_GAM";
$mapQuery="SELECT * FROM T_J_GAME_MAP_GMP WHERE FK_GAME=:id ORDER BY GMP_KEY";
$this->connection->execQuery($gamesQuery,[]); $this->connection->execQuery($gamesQuery,[]);
$res = $this->connection->getRes(); $res = $this->connection->getRes();
$i=0;
foreach($res as $row){ foreach($res as $row){
$tabKey=[];
$tabValue=[];
$arg=array(':id'=>array($row['PK_ID'], PDO::PARAM_INT));
$this->connection->execQuery($mapQuery,$arg);
$resMap = $this->connection->getRes();
foreach($resMap as $rowMap){
$tabKey[]=$rowMap['GMP_KEY'];
$tabValue[]=$rowMap['GMP_VALUE'];
}
$tabGames[]= new Game($row['PK_ID'], $tabGames[]= new Game($row['PK_ID'],
$row['GAM_NAME'], $row['GAM_NAME'],
$row['GAM_IMAGE'], $row['GAM_IMAGE'],
$row['GAM_TYPE'],
$row['GAM_NB_PLAYER_MIN'], $row['GAM_NB_PLAYER_MIN'],
$row['GAM_NB_PLAYER_MAX']); $row['GAM_NB_PLAYER_MAX'],
$tabKey,
$tabValue);
} }
return $tabGames; return $tabGames;
} }
@ -37,15 +51,28 @@ class GameGateway{
public function getGameById(string $id):?Game{ public function getGameById(string $id):?Game{
$game=null; $game=null;
$gameInfoQuery="SELECT * FROM T_E_GAME_GAM WHERE PK_ID=:id"; $gameInfoQuery="SELECT * FROM T_E_GAME_GAM WHERE PK_ID=:id";
$mapQuery="SELECT * FROM T_J_GAME_MAP_GMP WHERE FK_GAME=:id ORDER BY GMP_KEY";
$arg=array('id'=>array($id,PDO::PARAM_STR)); $arg=array('id'=>array($id,PDO::PARAM_STR));
$this->connection->execQuery($gameInfoQuery,$arg); $this->connection->execQuery($gameInfoQuery,$arg);
$res=$this->connection->getRes(); $res=$this->connection->getRes();
foreach($res as $row){ foreach($res as $row){
$tabKey=[];
$tabValue=[];
$arg=array(':id'=>array($row['PK_ID'], PDO::PARAM_INT));
$this->connection->execQuery($mapQuery,$arg);
$resMap = $this->connection->getRes();
foreach($resMap as $rowMap){
$tabKey[]=$rowMap['GMP_KEY'];
$tabValue[]=$rowMap['GMP_VALUE'];
}
$game= new Game($row['PK_ID'], $game= new Game($row['PK_ID'],
$row['GAM_NAME'], $row['GAM_NAME'],
$row['GAM_IMAGE'], $row['GAM_IMAGE'],
$row['GAM_TYPE'],
$row['GAM_NB_PLAYER_MIN'], $row['GAM_NB_PLAYER_MIN'],
$row['GAM_NB_PLAYER_MAX']); $row['GAM_NB_PLAYER_MAX'],
$tabKey,
$tabValue);
} }
return $game; return $game;
} }

@ -41,7 +41,7 @@ class MatchGateway{
} }
/// Brief : Adding a NEW match in database /// Brief : Adding a NEW match in database
public function postMatch(int $idGame, int $idCreator){ public function postMatch(int $idGame, int $idCreator): ?Matchs{
$insertMatchQuery="INSERT INTO T_E_MATCH_MTC VALUES(NULL,0,:idGame)"; $insertMatchQuery="INSERT INTO T_E_MATCH_MTC VALUES(NULL,0,:idGame)";
$insertPlayQuery = "INSERT INTO T_J_PLAY_MATCH_PLM VALUES(:idCreator,:id);"; $insertPlayQuery = "INSERT INTO T_J_PLAY_MATCH_PLM VALUES(:idCreator,:id);";
$argInsertMatch=array('idGame'=>array($idGame, PDO::PARAM_INT)); $argInsertMatch=array('idGame'=>array($idGame, PDO::PARAM_INT));
@ -57,7 +57,7 @@ class MatchGateway{
$argInsertPlay= array('idCreator'=>array($idCreator,PDO::PARAM_INT), $argInsertPlay= array('idCreator'=>array($idCreator,PDO::PARAM_INT),
'id'=>array($id,PDO::PARAM_INT)); 'id'=>array($id,PDO::PARAM_INT));
$this->connection->execQuery($insertPlayQuery,$argInsertPlay); $this->connection->execQuery($insertPlayQuery,$argInsertPlay);
return; return new Matchs($id, 0, $idGame, [$idCreator]);
} }
/// Brief : Modifying an EXISTING match in database /// Brief : Modifying an EXISTING match in database

@ -59,7 +59,7 @@ class UserGateway{
$tabSkin=null; $tabSkin=null;
$skinsOfUserQuery="SELECT s.* $skinsOfUserQuery="SELECT s.*
FROM T_H_SKIN_SKI s, T_J_OWN_SKIN_OWN o FROM T_H_SKIN_SKI s, T_J_OWN_SKIN_OWN o
WHERE o.FK_USER=:id AND S.PK_ID=o.FK_SKIN"; WHERE o.FK_USER=:id AND s.PK_ID=o.FK_SKIN";
$argIdUser=array('id'=>array($id,PDO::PARAM_INT)); $argIdUser=array('id'=>array($id,PDO::PARAM_INT));
$this->connection->execQuery($skinsOfUserQuery,$argIdUser); $this->connection->execQuery($skinsOfUserQuery,$argIdUser);
$resSkin=$this->connection->getRes(); $resSkin=$this->connection->getRes();
@ -110,12 +110,15 @@ class UserGateway{
public function getUserForConnection(string $username,string $password):?User{ public function getUserForConnection(string $username,string $password):?User{
$userQuery = "SELECT * $userQuery = "SELECT *
FROM T_S_USER_USR FROM T_S_USER_USR
WHERE USR_USERNAME=:username WHERE USR_USERNAME=:username";
AND USR_PASSWORD=:password"; $argUsernamePassword=(array('username'=>array($username,PDO::PARAM_STR)));
$argUsernamePassword=(array('username'=>array($username,PDO::PARAM_STR),
'password'=>array($password,PDO::PARAM_STR)));
$this->connection->execQuery($userQuery,$argUsernamePassword); $this->connection->execQuery($userQuery,$argUsernamePassword);
$res=$this->connection->getRes(); $res=$this->connection->getRes();
foreach($res as $row){
if(!password_verify($password,$row["USR_PASSWORD"])){
return null;
}
}
$usr=$this->convertResToUser($res); $usr=$this->convertResToUser($res);
if ($usr != null){ if ($usr != null){
$usr->tabSkin=$this->getSkinList($usr->id); $usr->tabSkin=$this->getSkinList($usr->id);
@ -127,19 +130,27 @@ class UserGateway{
/// Parameters : * $u (User): user we want to insert in database /// Parameters : * $u (User): user we want to insert in database
/// Returning TRUE if the user has been added succesfully, FALSE otherwise /// Returning TRUE if the user has been added succesfully, FALSE otherwise
public function postUser(string $username, string $password, string $nationality, string $sex, string $dateOfBirth) { public function postUser(string $username, string $password, string $nationality, string $sex, string $dateOfBirth) {
$password=password_hash($password,PASSWORD_DEFAULT);
$insertUserQuery = "INSERT INTO T_S_USER_USR VALUES (NULL, :username, :password, :nationality, :sex, :dateOfBirth, 0, 0, 0, 1)"; $insertUserQuery = "INSERT INTO T_S_USER_USR VALUES (NULL, :username, :password, :nationality, :sex, :dateOfBirth, 0, 0, 0, 1)";
$getLastIdQuery = "SELECT max(PK_ID) id FROM T_S_USER_USR";
$argUser=array('username' => array($username, PDO::PARAM_STR), $argUser=array('username' => array($username, PDO::PARAM_STR),
'password' => array($password, PDO::PARAM_STR), 'password' => array($password, PDO::PARAM_STR),
'nationality' => array($nationality, PDO::PARAM_STR), 'nationality' => array($nationality, PDO::PARAM_STR),
'sex' => array($sex, PDO::PARAM_STR), 'sex' => array($sex, PDO::PARAM_STR),
'dateOfBirth' => array($dateOfBirth, PDO::PARAM_STR)); 'dateOfBirth' => array($dateOfBirth, PDO::PARAM_STR));
$this->connection->execQuery($insertUserQuery, $argUser); $this->connection->execQuery($insertUserQuery, $argUser);
$this->connection->execQuery($getLastIdQuery, array());
$res=$this->connection->getRes();
foreach($res as $row){
$this->putSkinList($row['id'], 1);
}
} }
/// Brief : Modifying an EXISTING user in database /// Brief : Modifying an EXISTING user in database
/// Parameters : * $u (User): user we want to update in database /// Parameters : * $u (User): user we want to update in database
/// Returning TRUE if the modifications has been done succesfully, FALSE otherwise /// Returning TRUE if the modifications has been done succesfully, FALSE otherwise
public function putUser(int $id,string $username, string $password, string $sex, string $nationality, int $currentBobCoins,int $totalBobCoins,int $nbGamesPlayed, int $currentSkin){ public function putUser(int $id,string $username, string $password, string $sex, string $nationality, int $currentBobCoins,int $totalBobCoins,int $nbGamesPlayed, int $currentSkin){
$password=password_hash($password,PASSWORD_DEFAULT);
$updateUserQuery="UPDATE T_S_USER_USR $updateUserQuery="UPDATE T_S_USER_USR
SET USR_USERNAME = :username, SET USR_USERNAME = :username,
USR_PASSWORD=:password, USR_PASSWORD=:password,

@ -12,7 +12,7 @@
exit; exit;
*/ */
//require_once("initBdd.php"); require_once("initBdd.php");
@ -47,7 +47,7 @@
} catch (PDOException $e) { } catch (PDOException $e) {
echo "ERROR connection"; echo "ERROR connection";
echo $e->getMessage(); echo $e->getMessage();
echo $dsn; //echo $dsn;
//header("HTTP/1.0 ".$e->getMessage()); //header("HTTP/1.0 ".$e->getMessage());
http_response_code(600); // Quel code pour les erreurs PDO? http_response_code(600); // Quel code pour les erreurs PDO?
} }
@ -76,12 +76,16 @@
$url = explode('/', $url); $url = explode('/', $url);
$i=0; $i=0;
while ($url[$i]!=="index.php"){ while ($url[$i]!=="index.php" && count($url)>0){
unset($url[$i]); unset($url[$i]);
$i++; $i++;
} }
echo json_encode($url); if (empty($url)){
exit;
}
//echo json_encode($url);
$method_name = !empty($url[2]) ? (string)$url[2] : null; $method_name = !empty($url[2]) ? (string)$url[2] : null;
if($method_name == null){ if($method_name == null){
@ -199,6 +203,7 @@
$idCreator = !empty($url[4]) ? (int) $url[4] : null; $idCreator = !empty($url[4]) ? (int) $url[4] : null;
if ($idGame != null || $idCreator != null){ if ($idGame != null || $idCreator != null){
$match =$matchgw->postMatch($idGame,$idCreator); $match =$matchgw->postMatch($idGame,$idCreator);
echo json_encode($match, JSON_PRETTY_PRINT);
http_response_code(200); http_response_code(200);
} else{ } else{
//header("HTTP/1.0 400 idGame or idCreator not given"); //header("HTTP/1.0 400 idGame or idCreator not given");
@ -234,9 +239,9 @@
$password = !empty($url[5]) ? (string) $url[5] : null; $password = !empty($url[5]) ? (string) $url[5] : null;
$sexe = !empty($url[6]) ? (string) $url[6] : null; $sexe = !empty($url[6]) ? (string) $url[6] : null;
$nationality = !empty($url[7]) ? (string) $url[7] : null; $nationality = !empty($url[7]) ? (string) $url[7] : null;
$nbCurrentCoins = !empty($url[8]) ? (int) $url[8] : null; $nbCurrentCoins = (int) $url[8];
$totalnbCoins = !empty($url[9]) ? (int) $url[9] : null; $totalnbCoins = (int) $url[9];
$nbGames = !empty($url[10]) ? (int) $url[10] : null; $nbGames = (int) $url[10];
$currentSkin = !empty($url[11]) ? (int) $url[11] : null; $currentSkin = !empty($url[11]) ? (int) $url[11] : null;
$usergw->putUser($id,$username,$password,$sexe, $nationality, $nbCurrentCoins,$totalnbCoins,$nbGames,$currentSkin); $usergw->putUser($id,$username,$password,$sexe, $nationality, $nbCurrentCoins,$totalnbCoins,$nbGames,$currentSkin);
http_response_code(200); http_response_code(200);

@ -27,9 +27,6 @@ $conn->query("CREATE TABLE `T_H_CONVERSATION_COV` (
`COV_NAME` varchar(20) DEFAULT NULL `COV_NAME` varchar(20) DEFAULT NULL
) ;"); ) ;");
$conn->query("CREATE TRIGGER `before_delete_conversation` BEFORE DELETE ON `T_H_CONVERSATION_COV` FOR EACH ROW DELETE FROM T_H_MESSAGE_MSG WHERE PK_ID = (SELECT FK_MESSAGE
FROM T_J_CONTAIN_MESSAGE_CMG
WHERE FK_CONVERSATION=OLD.PK_ID);");
$conn->query("CREATE TABLE `T_H_MESSAGE_MSG` ( $conn->query("CREATE TABLE `T_H_MESSAGE_MSG` (
`PK_ID` int(11) NOT NULL, `PK_ID` int(11) NOT NULL,
@ -73,7 +70,7 @@ $conn->query("CREATE TABLE `T_J_PLAY_MATCH_PLM` (
$conn->query("CREATE TABLE `T_S_USER_USR` ( $conn->query("CREATE TABLE `T_S_USER_USR` (
`PK_ID` int(11) NOT NULL, `PK_ID` int(11) NOT NULL,
`USR_USERNAME` varchar(50) NOT NULL, `USR_USERNAME` varchar(50) NOT NULL,
`USR_PASSWORD` varchar(50) NOT NULL, `USR_PASSWORD` varchar(200) NOT NULL,
`USR_NATIONALITY` varchar(20) NOT NULL, `USR_NATIONALITY` varchar(20) NOT NULL,
`USR_SEX` varchar(30) NOT NULL, `USR_SEX` varchar(30) NOT NULL,
`USR_DATE_OF_BIRTH` date DEFAULT NULL, `USR_DATE_OF_BIRTH` date DEFAULT NULL,
@ -84,9 +81,6 @@ $conn->query("CREATE TABLE `T_S_USER_USR` (
);"); );");
$conn->query("CREATE TRIGGER `after_insert_user` AFTER INSERT ON `T_S_USER_USR` FOR EACH ROW INSERT INTO T_J_OWN_SKIN_OWN VALUES(NEW.PK_ID,1);");
$conn->query("ALTER TABLE `T_E_GAME_GAM` $conn->query("ALTER TABLE `T_E_GAME_GAM`
ADD PRIMARY KEY (`PK_ID`), ADD PRIMARY KEY (`PK_ID`),
ADD UNIQUE KEY `GAM_NAME` (`GAM_NAME`);"); ADD UNIQUE KEY `GAM_NAME` (`GAM_NAME`);");
@ -180,11 +174,11 @@ ADD CONSTRAINT `t_s_user_usr_ibfk_1` FOREIGN KEY (`FK_CURRENT_SKIN`) REFERENCES
$conn->query("INSERT INTO `T_J_GAME_MAP_GMP` (`FK_GAME`, `GMP_KEY`, `GMP_VALUE`) VALUES $conn->query("INSERT INTO `T_J_GAME_MAP_GMP` (`FK_GAME`, `GMP_KEY`, `GMP_VALUE`) VALUES
(1, 0, 0), (1, 0, 0),
(1, 100, 25), (1, 1000, 25),
(1, 1000, 30), (1, 10000, 30),
(1, 10000, 40), (1, 100000, 40),
(1, 100000, 50), (1, 1000000, 50),
(1, 1000000, 75), (1, 10000000, 75),
(2, 0, 5), (2, 0, 5),
(3, 0, 0), (3, 0, 0),
(3, 1, 25), (3, 1, 25),
@ -197,13 +191,11 @@ $conn->query("INSERT INTO `T_H_SKIN_SKI` (`PK_ID`, `SKI_NAME`, `SKI_IMAGE`, `SKI
(4, 'Bob BW', 'https://codefirst.iut.uca.fr/git/BOB_PARTEAM/BOB_PARTY/raw/branch/typescript/bob_party/assets/BobsSkins/BobBW.png', '100');"); (4, 'Bob BW', 'https://codefirst.iut.uca.fr/git/BOB_PARTEAM/BOB_PARTY/raw/branch/typescript/bob_party/assets/BobsSkins/BobBW.png', '100');");
$conn->query("INSERT INTO `T_E_GAME_GAM` (`PK_ID`, `GAM_NAME`, `GAM_IMAGE`, `GAM_NB_PLAYER_MIN`, `GAM_NB_PLAYER_MAX`, `GAM_TYPE`) VALUES $conn->query("INSERT INTO `T_E_GAME_GAM` (`PK_ID`, `GAM_NAME`, `GAM_IMAGE`, `GAM_NB_PLAYER_MIN`, `GAM_NB_PLAYER_MAX`, `GAM_TYPE`) VALUES
(1, 'Cookie Clicker', 'https://codefirst.iut.uca.fr/git/BOB_PARTEAM/BOB_PARTY/raw/branch/typescript/bob_party/assets/ImagesJeux/Pong.png', 1, 1, 'GameSolo'), (1, 'Cookie Clicker', 'https://codefirst.iut.uca.fr/git/BOB_PARTEAM/BOB_PARTY/raw/branch/typescript/bob_party/assets/ImagesJeux/CookieClicker.png', 1, 1, 'GameSolo'),
(2, 'TicTacToe', 'https://is3-ssl.mzstatic.com/image/thumb/Purple123/v4/f2/06/ef/f206ef53-7206-ffae-af6b-52460ba5636f/source/256x256bb.jpg', 1, 1, 'GameSolo'), (2, 'TicTacToe', 'https://is3-ssl.mzstatic.com/image/thumb/Purple123/v4/f2/06/ef/f206ef53-7206-ffae-af6b-52460ba5636f/source/256x256bb.jpg', 1, 1, 'GameSolo'),
(3, 'TicTacToe Online', 'https://is3-ssl.mzstatic.com/image/thumb/Purple123/v4/f2/06/ef/f206ef53-7206-ffae-af6b-52460ba5636f/source/256x256bb.jpg', 2, 2, 'GameMulti'), (3, 'TicTacToe Online', 'https://is3-ssl.mzstatic.com/image/thumb/Purple123/v4/f2/06/ef/f206ef53-7206-ffae-af6b-52460ba5636f/source/256x256bb.jpg', 2, 2, 'GameMulti'),
(4, 'BlackJack', 'https://codefirst.iut.uca.fr/git/BOB_PARTEAM/BOB_PARTY/raw/branch/peristanceBDD/bob_party/assets/ImagesJeux/blackjack.jpg', 1, 1, 'GameCasino');"); (4, 'BlackJack', 'https://codefirst.iut.uca.fr/git/BOB_PARTEAM/BOB_PARTY/raw/branch/peristanceBDD/bob_party/assets/ImagesJeux/blackjack.jpg', 1, 1, 'GameCasino');");
$conn->query("INSERT INTO `T_S_USER_USR` (`PK_ID`, `USR_USERNAME`, `USR_PASSWORD`, `USR_NATIONALITY`, `USR_SEX`, `USR_DATE_OF_BIRTH`, `USR_CURRENT_NB_COINS`, `USR_TOTAL_NB_COINS`, `USR_NB_GAMES_PLAYED`, `FK_CURRENT_SKIN`) VALUES
(1, 'to', 't', 'Anglais(e)', 'M', '2003-07-01', 105, 230, 12, 2);");

@ -4,12 +4,21 @@ class Game{
public int $id; public int $id;
public string $name; public string $name;
public string $image; public string $image;
public string $type;
public int $nbPlayerMin;
public int $nbPlayerMax;
public array $keys;
public array $values;
public function __construct(int $_id, string $_name, string $_image, string $_type, $_nbPlayerMin, $_nbPlayerMax, array $_keys, array $_values){
public function __construct(int $_id, string $_name, string $_image){
$this->id=$_id; $this->id=$_id;
$this->name=$_name; $this->name=$_name;
$this->image=$_image; $this->image=$_image;
$this->type=$_type;
$this->nbPlayerMin=$_nbPlayerMin;
$this->nbPlayerMax=$_nbPlayerMax;
$this->keys=$_keys;
$this->values=$_values;
} }
} }

@ -1,5 +0,0 @@
<php?
echo "coucou";
?>

@ -3,7 +3,7 @@
-- https://www.phpmyadmin.net/ -- https://www.phpmyadmin.net/
-- --
-- Hôte : localhost:8889 -- Hôte : localhost:8889
-- Généré le : jeu. 05 jan. 2023 à 07:29 -- Généré le : mar. 10 jan. 2023 à 09:00
-- Version du serveur : 5.7.34 -- Version du serveur : 5.7.34
-- Version de PHP : 7.4.21 -- Version de PHP : 7.4.21
@ -41,7 +41,7 @@ CREATE TABLE `T_E_GAME_GAM` (
-- --
INSERT INTO `T_E_GAME_GAM` (`PK_ID`, `GAM_NAME`, `GAM_IMAGE`, `GAM_NB_PLAYER_MIN`, `GAM_NB_PLAYER_MAX`, `GAM_TYPE`) VALUES INSERT INTO `T_E_GAME_GAM` (`PK_ID`, `GAM_NAME`, `GAM_IMAGE`, `GAM_NB_PLAYER_MIN`, `GAM_NB_PLAYER_MAX`, `GAM_TYPE`) VALUES
(1, 'Cookie Clicker', 'https://codefirst.iut.uca.fr/git/BOB_PARTEAM/BOB_PARTY/raw/branch/typescript/bob_party/assets/ImagesJeux/Pong.png', 1, 1, 'GameSolo'), (1, 'Cookie Clicker', 'https://codefirst.iut.uca.fr/git/BOB_PARTEAM/BOB_PARTY/raw/branch/typescript/bob_party/assets/ImagesJeux/CookieClicker.png', 1, 1, 'GameSolo'),
(2, 'TicTacToe', 'https://is3-ssl.mzstatic.com/image/thumb/Purple123/v4/f2/06/ef/f206ef53-7206-ffae-af6b-52460ba5636f/source/256x256bb.jpg', 1, 1, 'GameSolo'), (2, 'TicTacToe', 'https://is3-ssl.mzstatic.com/image/thumb/Purple123/v4/f2/06/ef/f206ef53-7206-ffae-af6b-52460ba5636f/source/256x256bb.jpg', 1, 1, 'GameSolo'),
(3, 'TicTacToe Online', 'https://is3-ssl.mzstatic.com/image/thumb/Purple123/v4/f2/06/ef/f206ef53-7206-ffae-af6b-52460ba5636f/source/256x256bb.jpg', 2, 2, 'GameMulti'), (3, 'TicTacToe Online', 'https://is3-ssl.mzstatic.com/image/thumb/Purple123/v4/f2/06/ef/f206ef53-7206-ffae-af6b-52460ba5636f/source/256x256bb.jpg', 2, 2, 'GameMulti'),
(4, 'BlackJack', 'https://codefirst.iut.uca.fr/git/BOB_PARTEAM/BOB_PARTY/raw/branch/peristanceBDD/bob_party/assets/ImagesJeux/blackjack.jpg', 1, 1, 'GameCasino'); (4, 'BlackJack', 'https://codefirst.iut.uca.fr/git/BOB_PARTEAM/BOB_PARTY/raw/branch/peristanceBDD/bob_party/assets/ImagesJeux/blackjack.jpg', 1, 1, 'GameCasino');
@ -58,6 +58,15 @@ CREATE TABLE `T_E_MATCH_MTC` (
`FK_GAME` int(11) DEFAULT NULL `FK_GAME` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Déchargement des données de la table `T_E_MATCH_MTC`
--
INSERT INTO `T_E_MATCH_MTC` (`PK_ID`, `MTC_IN_GAME`, `FK_GAME`) VALUES
(12, 0, 3),
(13, 0, 4),
(16, 0, 3);
-- -------------------------------------------------------- -- --------------------------------------------------------
-- --
@ -66,7 +75,7 @@ CREATE TABLE `T_E_MATCH_MTC` (
CREATE TABLE `T_H_CONVERSATION_COV` ( CREATE TABLE `T_H_CONVERSATION_COV` (
`PK_ID` int(11) NOT NULL, `PK_ID` int(11) NOT NULL,
`COV_NAME` varchar(20) DEFAULT NULL `COV_NAME` varchar(30) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --
@ -79,7 +88,14 @@ INSERT INTO `T_H_CONVERSATION_COV` (`PK_ID`, `COV_NAME`) VALUES
(34, 'bony'), (34, 'bony'),
(35, 'la conversation'), (35, 'la conversation'),
(36, 'fratitude'), (36, 'fratitude'),
(37, 'coucouuuuuuuuu'); (37, 'coucouuuuuuuuu'),
(38, 'coucou les copains'),
(39, 'ccc'),
(40, 'wesh ca marche'),
(41, 'salut'),
(48, 'saluuuuut'),
(49, 'to'),
(50, 'wesh');
-- --
-- Déclencheurs `T_H_CONVERSATION_COV` -- Déclencheurs `T_H_CONVERSATION_COV`
@ -130,7 +146,12 @@ INSERT INTO `T_H_MESSAGE_MSG` (`PK_ID`, `MSG_MESSAGE`, `FK_SENDER`, `MSG_DATEENV
(74, 'Salut les bags', 1, '2023-01-04 22:44:16'), (74, 'Salut les bags', 1, '2023-01-04 22:44:16'),
(75, 'to created a conversation', 1, '2023-01-05 08:15:50'), (75, 'to created a conversation', 1, '2023-01-05 08:15:50'),
(76, 'Wesh les fratés', 2, '2023-01-05 08:16:18'), (76, 'Wesh les fratés', 2, '2023-01-05 08:16:18'),
(77, 'to created a conversation', 1, '2023-01-05 08:25:54'); (77, 'to created a conversation', 1, '2023-01-05 08:25:54'),
(78, 'to created a conversation', 1, '2023-01-05 08:38:21'),
(79, 'to created a conversation', 1, '2023-01-05 09:40:42'),
(86, 'to created a conversation', 1, '2023-01-05 16:53:48'),
(87, 'to created a conversation', 1, '2023-01-05 17:12:14'),
(88, 'to created a conversation', 1, '2023-01-05 17:13:07');
-- -------------------------------------------------------- -- --------------------------------------------------------
@ -182,6 +203,7 @@ INSERT INTO `T_J_CONTAIN_MESSAGE_CMG` (`FK_CONVERSATION`, `FK_MESSAGE`) VALUES
(32, 63), (32, 63),
(32, 64), (32, 64),
(32, 65), (32, 65),
(40, 65),
(32, 66), (32, 66),
(32, 68), (32, 68),
(32, 69), (32, 69),
@ -192,7 +214,12 @@ INSERT INTO `T_J_CONTAIN_MESSAGE_CMG` (`FK_CONVERSATION`, `FK_MESSAGE`) VALUES
(35, 74), (35, 74),
(36, 75), (36, 75),
(36, 76), (36, 76),
(37, 77); (37, 77),
(39, 78),
(41, 79),
(48, 86),
(49, 87),
(50, 88);
-- -------------------------------------------------------- -- --------------------------------------------------------
@ -213,21 +240,25 @@ INSERT INTO `T_J_DISCUSS_DIS` (`FK_USER`, `FK_CONVERSATION`) VALUES
(1, 32), (1, 32),
(2, 32), (2, 32),
(3, 32), (3, 32),
(1, 33),
(2, 33), (2, 33),
(3, 33), (3, 33),
(1, 34), (1, 34),
(2, 34), (2, 34),
(3, 34), (3, 34),
(1, 35),
(2, 35), (2, 35),
(3, 35), (3, 35),
(1, 36),
(2, 36), (2, 36),
(7, 36), (7, 36),
(1, 37),
(2, 37), (2, 37),
(6, 37); (6, 37),
(2, 41),
(3, 41),
(2, 48),
(3, 48),
(1, 49),
(2, 49),
(1, 50),
(2, 50);
-- -------------------------------------------------------- -- --------------------------------------------------------
@ -298,6 +329,16 @@ CREATE TABLE `T_J_PLAY_MATCH_PLM` (
`FK_MATCH` int(11) NOT NULL `FK_MATCH` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Déchargement des données de la table `T_J_PLAY_MATCH_PLM`
--
INSERT INTO `T_J_PLAY_MATCH_PLM` (`FK_USER`, `FK_MATCH`) VALUES
(1, 12),
(7, 12),
(1, 13),
(1, 16);
-- -------------------------------------------------------- -- --------------------------------------------------------
-- --
@ -322,7 +363,7 @@ CREATE TABLE `T_S_USER_USR` (
-- --
INSERT INTO `T_S_USER_USR` (`PK_ID`, `USR_USERNAME`, `USR_PASSWORD`, `USR_NATIONALITY`, `USR_SEX`, `USR_DATE_OF_BIRTH`, `USR_CURRENT_NB_COINS`, `USR_TOTAL_NB_COINS`, `USR_NB_GAMES_PLAYED`, `FK_CURRENT_SKIN`) VALUES INSERT INTO `T_S_USER_USR` (`PK_ID`, `USR_USERNAME`, `USR_PASSWORD`, `USR_NATIONALITY`, `USR_SEX`, `USR_DATE_OF_BIRTH`, `USR_CURRENT_NB_COINS`, `USR_TOTAL_NB_COINS`, `USR_NB_GAMES_PLAYED`, `FK_CURRENT_SKIN`) VALUES
(1, 'to', 't', 'Anglais(e)', 'M', '2003-07-01', 105, 230, 12, 2), (1, 'to', 't', 'Anglais(e)', 'M', '2003-07-01', 135, 260, 12, 2),
(2, 'leilla20', 't', 'Anglais(e)', 'M', '2003-11-22', 100, 225, 12, 2), (2, 'leilla20', 't', 'Anglais(e)', 'M', '2003-11-22', 100, 225, 12, 2),
(3, 'test', 't', 'Français(e)', 'H', '1999-12-27', 0, 0, 0, 1), (3, 'test', 't', 'Français(e)', 'H', '1999-12-27', 0, 0, 0, 1),
(6, 'LEBg', 'belleBite63*', 'Espagnol(e)', 'Autre', '2001-12-27', 0, 0, 0, 1), (6, 'LEBg', 'belleBite63*', 'Espagnol(e)', 'Autre', '2001-12-27', 0, 0, 0, 1),
@ -429,25 +470,25 @@ ALTER TABLE `T_S_USER_USR`
-- AUTO_INCREMENT pour la table `T_E_GAME_GAM` -- AUTO_INCREMENT pour la table `T_E_GAME_GAM`
-- --
ALTER TABLE `T_E_GAME_GAM` ALTER TABLE `T_E_GAME_GAM`
MODIFY `PK_ID` int(11) NOT NULL AUTO_INCREMENT; MODIFY `PK_ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
-- --
-- AUTO_INCREMENT pour la table `T_E_MATCH_MTC` -- AUTO_INCREMENT pour la table `T_E_MATCH_MTC`
-- --
ALTER TABLE `T_E_MATCH_MTC` ALTER TABLE `T_E_MATCH_MTC`
MODIFY `PK_ID` int(11) NOT NULL AUTO_INCREMENT; MODIFY `PK_ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17;
-- --
-- AUTO_INCREMENT pour la table `T_H_CONVERSATION_COV` -- AUTO_INCREMENT pour la table `T_H_CONVERSATION_COV`
-- --
ALTER TABLE `T_H_CONVERSATION_COV` ALTER TABLE `T_H_CONVERSATION_COV`
MODIFY `PK_ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=38; MODIFY `PK_ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=51;
-- --
-- AUTO_INCREMENT pour la table `T_H_MESSAGE_MSG` -- AUTO_INCREMENT pour la table `T_H_MESSAGE_MSG`
-- --
ALTER TABLE `T_H_MESSAGE_MSG` ALTER TABLE `T_H_MESSAGE_MSG`
MODIFY `PK_ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=78; MODIFY `PK_ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=89;
-- --
-- AUTO_INCREMENT pour la table `T_H_SKIN_SKI` -- AUTO_INCREMENT pour la table `T_H_SKIN_SKI`

@ -3,7 +3,11 @@ import store from './src/redux/store'
import { Provider } from 'react-redux' import { Provider } from 'react-redux'
import React, { useCallback } from 'react'; import React, { useCallback } from 'react';
import { useFonts } from 'expo-font'; import { useFonts } from 'expo-font';
import TicTacToeOnline from './src/Games/Tic-Tac-Toe/tic_tac_toe_online';
import BlackJack from './src/Games/BlackJack/blackJack';
// RN >= 0.63
import { LogBox } from 'react-native';
export default function App() { export default function App() {
@ -17,8 +21,10 @@ export default function App() {
return null; return null;
} }
LogBox.ignoreLogs(['Warning:...', 'Require', 'Constants']);
return ( return (
<Provider store={store} > <Provider store={store} >
<MainTabNavigator /> <MainTabNavigator />
</Provider> </Provider>

@ -0,0 +1,20 @@
FROM node:latest
# Create app directory
# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY bob_party/package*.json ./
RUN yarn
# If you are building your code for production
# RUN npm ci --only=production
# Bundle app source
COPY bob_party/server.js .
EXPOSE 3000
CMD [ "node", "server.js" ]

@ -24,7 +24,8 @@
"adaptiveIcon": { "adaptiveIcon": {
"foregroundImage": "./assets/adaptive-icon.png", "foregroundImage": "./assets/adaptive-icon.png",
"backgroundColor": "#FFFFFF" "backgroundColor": "#FFFFFF"
} },
"softwareKeyboardLayoutMode": "pan"
}, },
"web": { "web": {
"favicon": "./assets/favicon.png" "favicon": "./assets/favicon.png"

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 320 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 448 KiB

@ -11,8 +11,9 @@
}, },
"dependencies": { "dependencies": {
"@babel/runtime": "^7.20.6", "@babel/runtime": "^7.20.6",
"@react-native-community/datetimepicker": "6.2.0", "@dietime/react-native-date-picker": "^1.2.0",
"@react-native-picker/picker": "2.4.2", "@react-native-community/datetimepicker": "^6.7.1",
"@react-native-picker/picker": "^2.4.8",
"@react-navigation/bottom-tabs": "^6.4.0", "@react-navigation/bottom-tabs": "^6.4.0",
"@react-navigation/native": "^6.0.13", "@react-navigation/native": "^6.0.13",
"@react-navigation/stack": "^6.3.2", "@react-navigation/stack": "^6.3.2",
@ -26,8 +27,10 @@
"babel-test": "^0.2.4", "babel-test": "^0.2.4",
"cors": "^2.8.5", "cors": "^2.8.5",
"expo": "^46.0.17", "expo": "^46.0.17",
"expo-linear-gradient": "^12.0.1",
"expo-status-bar": "~1.4.0", "expo-status-bar": "~1.4.0",
"express": "^4.18.2", "express": "^4.18.2",
"is-docker": "^3.0.0",
"jest": "^29.3.1", "jest": "^29.3.1",
"jquery": "^3.6.1", "jquery": "^3.6.1",
"node": "^18.10.0", "node": "^18.10.0",
@ -41,7 +44,9 @@
"react-native-gesture-handler": "~2.5.0", "react-native-gesture-handler": "~2.5.0",
"react-native-picker-select": "^8.0.4", "react-native-picker-select": "^8.0.4",
"react-native-safe-area-context": "4.3.1", "react-native-safe-area-context": "4.3.1",
"react-native-status-bar-height": "^2.6.0",
"react-native-web": "~0.18.7", "react-native-web": "~0.18.7",
"react-native-woodpicker": "^0.3.17",
"react-redux": "^8.0.4", "react-redux": "^8.0.4",
"socket.io": "^4.5.4", "socket.io": "^4.5.4",
"socket.io-client": "^4.5.4", "socket.io-client": "^4.5.4",

@ -7,21 +7,49 @@ const { Server } = require("socket.io");
const io = new Server(server); const io = new Server(server);
io.on('connection', (socket) => { io.on('connection', (socket) => {
console.log(socket.id) console.log(socket.id);
socket.on('signIn', (id) => {
socket.join("U"+id);
});
socket.on('inConv', (conv) => { socket.on('inConv', (conv) => {
socket.join("C" + conv.id); socket.join("C" + conv.id);
console.log("C"+conv.id); });
socket.on('quitConv', (conv) => {
socket.off("C" + conv.id);
}); });
socket.on("messageSent", (conv) =>{ socket.on("messageSent", (conv) =>{
console.log("C"+conv.id);
socket.to("C"+conv.id).emit("messageReceived"); socket.to("C"+conv.id).emit("messageReceived");
console.log("Message envoyé"); console.log("Message envoyé");
}); });
socket.on("createConversation", (tabId, conv) =>{
tabId.forEach(id => {
socket.to("U"+id).emit("addedToConv", conv);
});
});
socket.on('joinMatch', (match) => {
socket.join("M" + match.code);
socket.to("M"+ match.code).emit("matchUsersChanged");
}); });
server.listen(3000, () => { socket.on('launchMatch', (match) => {
console.log('listening on *:3000'); socket.to("M"+ match.code).emit("matchLaunched");
}); });
socket.on('quitMatch', (match) => {
socket.to("M"+ match.code).emit("matchUsersChanged")
});
socket.on("playTicTacToe", (match, rowIndex, columnIndex, turn) =>{
socket.to("M"+match.code).emit("oppPlayTicTacToe", rowIndex, columnIndex, turn);
});
});
server.listen(3000);

@ -1,4 +1,4 @@
const { io } = require("socket.io-client"); const { io } = require("socket.io-client");
export const socket = io("http://192.168.1.54:3000"); export const socket = io("http://172.20.10.2:3000");

@ -0,0 +1,242 @@
import React,{Component, useState} from 'react';
import {
View,
StyleSheet,
ImageBackground,
UIManager,
StatusBar,
NativeModules,
AppState,
Platform
} from 'react-native';
import cardsDeck from './source/data/cards';
import {shuffle} from './source/helpers';
import {Overlay,ChipSelector, UserControls,FloatingText} from './source/components';
import boardBg from './source/assets/board.png';
import { MANAGER_USER } from '../../../appManagers';
import { UserCoinsModifier } from '../../core/User/userCoinsModifier';
import { useNavigation } from '@react-navigation/native';
import { useUserStore } from '../../context/userContext';
export default function BlackJack(props){
const [totalBet, setTotalBet] = useState(0);
const [amount, setAmount] = useState(MANAGER_USER.getCurrentUser()?.getCurrentCoins());
const [playerHand, setPlayerHand] = useState([]);
const [dealerHand, setDealerHand] = useState([]);
const [gameover, setGameover] = useState(false);
const [cardCount, setCardCount] = useState(0);
const [gameMessage, setGameMessage] = useState("");
const [gameStarted, setGameStarted] = useState(false);
const [startGame, setStartGame] = useState(false);
const navigation = useNavigation();
const setUser = useUserStore((state) => state.setUser);
return(
<>
<ImageBackground
source={boardBg}
style={styles.container}>
<StatusBar backgroundColor={"green"} translucent={true} />
<View style={styles.bottom}>
<UserControls
playerHand={playerHand}
dealerHand={dealerHand}
goBack={() => navigation.goBack()}
hit={() => hit()}
doubleGame={() => doubleGame()}
endgame={() => endgame()}
gameover={gameover}
totalBet={totalBet}
/>
<View style={styles.center}>
<FloatingText
text={`Total Bet ${totalBet} BobCoins`}
/>
</View>
<ChipSelector
onSelect={(chipValue) => {
if(!gameover && startGame){
if(chipValue <= amount && !gameStarted){
setTotalBet(totalBet+chipValue);
setAmount(amount-chipValue);
}
}
else{
if (amount > 0 && amount>=chipValue){
newGame();
setTotalBet(totalBet+chipValue);
setAmount(amount-chipValue);
}
}
}}
/>
<View style={styles.center}>
<FloatingText
text={`Available ${amount} BobCoins`}
/>
</View>
{gameover && gameMessage != "" && <Overlay text={gameMessage} onClose={() => { newGame() }} />}
</View>
</ImageBackground>
</>
)
async function modifAmount(money){
const modif = new UserCoinsModifier();
const tmp=MANAGER_USER.getCurrentUser();
setAmount(money);
if (tmp!=null){
await modif.changeCurrentCoins(tmp, money);
setUser(MANAGER_USER.getCurrentUser());
}
}
function newGame(){
let cardCount = 0;
shuffle(cardsDeck);
let playerHand = [],
dealerHand = [];
for(let i = 0; i < 2; i++){
playerHand.push(cardsDeck[cardCount]);
cardCount++;
dealerHand.push(cardsDeck[cardCount]);
cardCount++;
}
setPlayerHand(playerHand);
setDealerHand(dealerHand);
setGameover(false);
setCardCount(cardCount);
setGameMessage("");
setStartGame(true);
}
function hit(){
const hand=playerHand;
hand.push(cardsDeck[cardCount]);
let userPoints = checkTotalPlayerPoints(hand);
setGameStarted(true);
setPlayerHand(hand);
setCardCount(cardCount+1)
if(userPoints > 21){
endgame();
return;
}
}
function doubleGame(){
hit();
endgame();
}
async function endgame(){
let _cardCount = cardCount;
let dealerPoints = checkTotalPlayerPoints(dealerHand),
playerPoints = checkTotalPlayerPoints(playerHand);
//alert(dealerPoints)
while(dealerPoints < 17){
dealerHand.push(cardsDeck[_cardCount]);
_cardCount++;
dealerPoints = checkTotalPlayerPoints(dealerHand);
}
let betValue = totalBet * 1.5;
setGameStarted(false);
//who won
if(playerPoints == 21 && playerHand.length == 2){
let newAmount = totalBet * 1.5;
await modifAmount(newAmount);
setTotalBet(0);
setGameover(true);
setGameMessage("Player BlackJack!");
}
if(
(playerPoints < 22 && dealerPoints < playerPoints) ||
(dealerPoints > 21 && playerPoints < 22)
){
await modifAmount(amount+betValue);
setTotalBet(0);
setGameover(true);
setGameMessage("You Win "+ betValue+" BobCoins");
}
else if(playerPoints > 21 && dealerPoints <= 21){
await modifAmount(amount);
setCardCount(_cardCount);
setTotalBet(0);
setGameover(true);
setGameMessage("Bust!");
}else if(playerPoints == dealerPoints){
await modifAmount(amount+totalBet);
setTotalBet(0);
setGameover(true);
setGameMessage("Push!");
}else{
await modifAmount(amount);
setTotalBet(0);
setGameover(true);
setGameMessage("Dealer Wins, You Lost");
}
}
function checkTotalPlayerPoints(playerHand){
let aceAdjuts = false,
points = 0;
playerHand.map((card,_index) => {
if(card.name == 'A' && !aceAdjuts) {
aceAdjuts = true;
points = points + 10;
}
points = points + card.value;
});
if(aceAdjuts && points > 21){
points = points - 10;
}
return points;
}
}
const styles = StyleSheet.create({
container : {
flex : 1
},
center : {
alignItems : "center"
},
bottom : {
position : "absolute",
left : 0,
right : 0,
bottom : 0,
zIndex : 2
}
});

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

@ -0,0 +1,52 @@
import React from 'react';
import {
StyleSheet,
View,
TouchableOpacity,
Text
} from 'react-native';
const ActionButton = props => {
return(
<TouchableOpacity
onPress={() => {
if(props.onPress) props.onPress()
}}
>
<View style={[
props.direction == 'right' ? styles.rightDirection :
props.direction == 'left' ? styles.leftDirection : {},
styles.wrap,
props.style
]}>
<Text style={styles.text}>{props.text.replace(" ",'\n')}</Text>
</View>
</TouchableOpacity>
)
}
const styles = StyleSheet.create({
wrap : {
padding : 6,
backgroundColor : "rgba(255,255,255,0.7)",
borderColor : "rgba(255,255,255,0.9)",
borderWidth : 2,
marginBottom : 12
},
rightDirection : {
borderTopRightRadius : 6,
borderBottomRightRadius : 6
},
leftDirection : {
borderTopLeftRadius : 6,
borderBottomLeftRadius : 6
},
text : {
color : "white",
fontWeight : "bold",
fontSize : 14,
textAlign : "center"
}
});
export default ActionButton;

@ -0,0 +1,65 @@
import React,{Component} from 'react';
import {
View,
Text,
Image,
StyleSheet,
Dimensions
} from 'react-native';
import backCard from '../assets/cards/back.png';
const {width} = Dimensions.get("window");
const CARD_WIDTH = (width / 3) - 50;
const CARD_HEIGHT = (width / 3) + 5;
const CARD_SEPARATION = 50;
class CardDeck extends Component{
render(){
const {cards, isDealer, gameover} = this.props
return(
<View style={styles.container}>
<View
style={[
{marginLeft : -(cards.length * CARD_SEPARATION) / 1.8}
,styles.row]}>
{cards && cards.length > 0 && cards.map((card,i) => {
return (
<View
key={i}
style={[
i > 0 ? {
position : "absolute",
left : (i * CARD_SEPARATION),
} : {},
{
//elevation : 2,
borderWidth : 1,
borderColor : "black",
borderRadius : 6
}]}
><Image
source={ (isDealer && i == 0 && !gameover) ? backCard : cards[i].image}
style={{
width : CARD_WIDTH,
height : CARD_HEIGHT,
//position : "absolute",
//left : cards.length == 2 ? -(i * CARD_SEPARATION) : (i * -20)
}}
resizeMode={"stretch"}
/></View>)
})}
</View>
</View>
)
}
}
const styles = StyleSheet.create({
container : {
justifyContent : "center"
},
row : {
}
});
export default CardDeck;

@ -0,0 +1,79 @@
import React,{Component} from 'react';
import {
View,
ScrollView,
StyleSheet,
Image,
Text,
TouchableOpacity,
Dimensions
} from 'react-native';
import chips from '../data/chips';
const {width} = Dimensions.get('window');
const PADDING_WRAP = 8;
const MARGIN_SIDE = 20;
const CHIPS_SHOWN = 7;
const CHIP_WIDTH = (width / CHIPS_SHOWN) - ((MARGIN_SIDE / 2) * 2);
class ChipSelector extends Component{
render(){
const {onSelect} = this.props;
return(
<View style={styles.chipsWrapper}>
<ScrollView
horizontal={true}
contentContainerStyle={styles.scrollableContent}
showsHorizontalScrollIndicator={false}
>
{chips && chips.length > 0 && chips.map((chip,_index) => (
<TouchableOpacity
key={_index}
onPress={() => onSelect(chip.value)}
>
<View style={
_index < (chips.length-1) ? styles.chipWrap : {}
}>
<Image
source={chip.image}
resizeMode={'cover'}
style={styles.chip}
/>
</View>
</TouchableOpacity>
))}
</ScrollView>
</View>
)
}
}
const styles = StyleSheet.create({
chipsWrapper : {
backgroundColor : "#8A5D3C",
borderColor : "#AF7B56",
borderTopWidth : 2,
borderBottomWidth : 2,
/*elevation : 5,
position : "absolute",
bottom : 0,
left : 0,
right : 0,
zIndex : 3*/
},
scrollableContent:{
padding : PADDING_WRAP
},
chipWrap: {
marginRight : MARGIN_SIDE
},
chip : {
width : CHIP_WIDTH,
height: CHIP_WIDTH
}
})
export default ChipSelector;

@ -0,0 +1,32 @@
import React from 'react';
import {
View,
Text,
StyleSheet
} from 'react-native';
const FloatingText = props => {
return(
<View style={styles.indicator}>
<Text style={styles.indicatorTxt}>{props.text}</Text>
</View>
)
}
const styles = StyleSheet.create({
indicator : {
backgroundColor : "rgba(0,0,0,0.6)",
borderColor : "rgba(0,0,0,0.9)",
padding : 8,
alignItems : "center",
marginTop : 8,
marginBottom : 8,
borderRadius : 4
},
indicatorTxt : {
color : "white",
fontSize : 12
}
});
export default FloatingText;

@ -0,0 +1,62 @@
import React from 'react';
import {
View,
Text,
StyleSheet,
TouchableOpacity,
Dimensions
} from 'react-native';
const {width,height} = Dimensions.get("window");
const Overlay = props =>{
return(
<View style={styles.overlay}>
<Text style={styles.text}>{props.text}</Text>
<TouchableOpacity onPress={() => props.onClose()}>
<View style={styles.btn}>
<Text style={styles.continueBtn}>CONTINUE</Text>
</View>
</TouchableOpacity>
</View>
)
}
const styles = StyleSheet.create({
overlay : {
backgroundColor : "rgba(0,0,0,0.8)",
position : "absolute",
top : (height / 2) - 60,
left : 0,
right : 0,
zIndex : 5,
alignItems : "center",
justifyContent : "center",
padding : 12
},
text : {
color : "#fff",
fontSize : 40,
textAlign : "center"
},
center : {
alignItems : "center",
justifyContent : "center"
},
btn : {
marginTop : 10,
borderWidth : 1,
borderColor : "#fff",
padding : 8
},
continueBtn : {
color : "#fff",
fontSize : 14,
textAlign : "center"
}
});
export default Overlay;

@ -0,0 +1,132 @@
import React,{Component} from 'react';
import {
View,
Text,
TouchableOpacity,
StyleSheet,
Dimensions
} from 'react-native';
import {calculatePoints} from '../helpers';
import {ActionButton, FloatingText, CardDeck} from '../components';
const {width} = Dimensions.get('window');
const CIRCLE_BET_SIZE = (width / 4) - 20;
class UserControls extends Component{
constructor(){
super();
this.state = {
playerPoints : 0
}
}
UNSAFE_componentWillReceiveProps(nextProps){
if(nextProps.playerHand){
this.setState({
playerPoints : calculatePoints(nextProps.playerHand),
dealerPoints : calculatePoints(nextProps.dealerHand)
});
}
}
render(){
const {playerHand, dealerHand, goBack, hit, endgame, doubleGame, gameover, totalBet, moreMoney} = this.props;
const {playerPoints, dealerPoints} = this.state;
return(
<View style={styles.centerView}>
{/*<View>
<ActionButton
direction={'right'}
text={"DOUBLE WIN"}
/>
</View>*/}
<View style={styles.center}>
{gameover && <FloatingText text={dealerPoints} />}
<CardDeck
cards={dealerHand}
isDealer={true}
gameover={gameover}
/>
</View>
<View style={styles.center}>
<FloatingText text={playerPoints} />
<CardDeck
cards={playerHand}
/>
</View>
{totalBet == false && (<View style={styles.absoluteBtnRight}>
<ActionButton
direction={'left'}
text={"QUITER PARTIE"}
onPress={() => goBack()}
/>
</View>)}
{!!totalBet && (<View style={[styles.absoluteBtnRight,{top:60}]}>
<ActionButton
direction={'left'}
text={"HIT"}
onPress={() => hit()}
/>
</View>)}
{!!totalBet && (<View style={[styles.absoluteBtnRight,{top:105}]}>
<ActionButton
direction={'left'}
text={"DOUBLE"}
onPress={() => doubleGame()}
/>
</View>)}
{!!totalBet && (<View style={[styles.absoluteBtnRight,{top:150}]}>
<ActionButton
direction={'left'}
text={"DEAL"}
onPress={() => endgame()}
/>
</View>)}
</View>
)
}
}
const styles = StyleSheet.create({
centerView : {
//flexDirection : "row",
alignItems : "center",
justifyContent : "space-around",
paddingTop : 10,
paddingBottom : 10
},
/*betCircle : {
width : CIRCLE_BET_SIZE,
height : CIRCLE_BET_SIZE,
borderRadius : (CIRCLE_BET_SIZE / 2),
borderColor : 'white',
borderWidth : 1,
padding : 2
},*/
betText : {
color : "white",
textAlign : "center"
},
center : {
alignItems : "center",
justifyContent : "center"
},
absoluteBtnRight : {
position : "absolute",
right : 0,
zIndex : 2
}
});
export default UserControls;

@ -0,0 +1,15 @@
import ChipSelector from './ChipSelector';
import UserControls from './UserControls';
import ActionButton from './ActionButton';
import FloatingText from './FloatingText';
import CardDeck from './CardDeck';
import Overlay from './Overlay';
export {
ChipSelector,
UserControls,
ActionButton,
FloatingText,
CardDeck,
Overlay
}

@ -0,0 +1,314 @@
export default [
{
name : 'A',
deck : 'spades',
value : 1,
image : require('../assets/cards/spades/A.png')
},
{
name : 'J',
deck : 'spades',
value : 10,
image : require('../assets/cards/spades/J.png')
},
{
name : 'Q',
deck : 'spades',
value : 10,
image : require('../assets/cards/spades/Q.png')
},
{
name : 'K',
deck : 'spades',
value : 10,
image : require('../assets/cards/spades/K.png')
},
{
name : '2',
deck : 'spades',
value : 2,
image : require('../assets/cards/spades/2.png')
},
{
name : '3',
deck : 'spades',
value : 3,
image : require('../assets/cards/spades/3.png')
},
{
name : '4',
deck : 'spades',
value : 4,
image : require('../assets/cards/spades/4.png')
},
{
name : '5',
deck : 'spades',
value : 5,
image : require('../assets/cards/spades/5.png')
},
{
name : '6',
deck : 'spades',
value : 6,
image : require('../assets/cards/spades/6.png')
},
{
name : '7',
deck : 'spades',
value : 7,
image : require('../assets/cards/spades/7.png')
},
{
name : '8',
deck : 'spades',
value : 8,
image : require('../assets/cards/spades/8.png')
},
{
name : '9',
deck : 'spades',
value : 9,
image : require('../assets/cards/spades/9.png')
},
{
name : '10',
deck : 'spades',
value : 10,
image : require('../assets/cards/spades/10.png')
},
{
name : 'A',
deck : 'hearts',
value : 1,
image : require('../assets/cards/hearts/A.png')
},
{
name : 'J',
deck : 'hearts',
value : 10,
image : require('../assets/cards/hearts/J.png')
},
{
name : 'Q',
deck : 'hearts',
value : 10,
image : require('../assets/cards/hearts/Q.png')
},
{
name : 'K',
deck : 'hearts',
value : 10,
image : require('../assets/cards/hearts/K.png')
},
{
name : '2',
deck : 'hearts',
value : 2,
image : require('../assets/cards/hearts/2.png')
},
{
name : '3',
deck : 'hearts',
value : 3,
image : require('../assets/cards/hearts/3.png')
},
{
name : '4',
deck : 'hearts',
value : 4,
image : require('../assets/cards/hearts/4.png')
},
{
name : '5',
deck : 'hearts',
value : 5,
image : require('../assets/cards/hearts/5.png')
},
{
name : '6',
deck : 'hearts',
value : 6,
image : require('../assets/cards/hearts/6.png')
},
{
name : '7',
deck : 'hearts',
value : 7,
image : require('../assets/cards/hearts/7.png')
},
{
name : '8',
deck : 'hearts',
value : 8,
image : require('../assets/cards/hearts/8.png')
},
{
name : '9',
deck : 'hearts',
value : 9,
image : require('../assets/cards/hearts/9.png')
},
{
name : '10',
deck : 'hearts',
value : 10,
image : require('../assets/cards/hearts/10.png')
},
{
name : 'A',
deck : 'clubs',
value : 1,
image : require('../assets/cards/clubs/A.png')
},
{
name : 'J',
deck : 'clubs',
value : 10,
image : require('../assets/cards/clubs/J.png')
},
{
name : 'Q',
deck : 'clubs',
value : 10,
image : require('../assets/cards/clubs/Q.png')
},
{
name : 'K',
deck : 'clubs',
value : 10,
image : require('../assets/cards/clubs/K.png')
},
{
name : '2',
deck : 'clubs',
value : 2,
image : require('../assets/cards/clubs/2.png')
},
{
name : '3',
deck : 'clubs',
value : 3,
image : require('../assets/cards/clubs/3.png')
},
{
name : '4',
deck : 'clubs',
value : 4,
image : require('../assets/cards/clubs/4.png')
},
{
name : '5',
deck : 'clubs',
value : 5,
image : require('../assets/cards/clubs/5.png')
},
{
name : '6',
deck : 'clubs',
value : 6,
image : require('../assets/cards/clubs/6.png')
},
{
name : '7',
deck : 'clubs',
value : 7,
image : require('../assets/cards/clubs/7.png')
},
{
name : '8',
deck : 'clubs',
value : 8,
image : require('../assets/cards/clubs/8.png')
},
{
name : '9',
deck : 'clubs',
value : 9,
image : require('../assets/cards/clubs/9.png')
},
{
name : '10',
deck : 'clubs',
value : 10,
image : require('../assets/cards/clubs/10.png')
},
{
name : 'A',
deck : 'diamonds',
value : 1,
image : require('../assets/cards/diamonds/A.png')
},
{
name : 'J',
deck : 'diamonds',
value : 10,
image : require('../assets/cards/diamonds/J.png')
},
{
name : 'Q',
deck : 'diamonds',
value : 10,
image : require('../assets/cards/diamonds/Q.png')
},
{
name : 'K',
deck : 'diamonds',
value : 10,
image : require('../assets/cards/diamonds/K.png')
},
{
name : '2',
deck : 'diamonds',
value : 2,
image : require('../assets/cards/diamonds/2.png')
},
{
name : '3',
deck : 'diamonds',
value : 3,
image : require('../assets/cards/diamonds/3.png')
},
{
name : '4',
deck : 'diamonds',
value : 4,
image : require('../assets/cards/diamonds/4.png')
},
{
name : '5',
deck : 'diamonds',
value : 5,
image : require('../assets/cards/diamonds/5.png')
},
{
name : '6',
deck : 'diamonds',
value : 6,
image : require('../assets/cards/diamonds/6.png')
},
{
name : '7',
deck : 'diamonds',
value : 7,
image : require('../assets/cards/diamonds/7.png')
},
{
name : '8',
deck : 'diamonds',
value : 8,
image : require('../assets/cards/diamonds/8.png')
},
{
name : '9',
deck : 'diamonds',
value : 9,
image : require('../assets/cards/diamonds/9.png')
},
{
name : '10',
deck : 'diamonds',
value : 10,
image : require('../assets/cards/diamonds/10.png')
}
];

@ -0,0 +1,42 @@
export default [
{
image : require("../assets/chips/1.png"),
value : 1
},
{
image : require("../assets/chips/5.png"),
value : 5
},
{
image : require("../assets/chips/25.png"),
value : 25
},
{
image : require("../assets/chips/100.png"),
value : 100
},
{
image : require("../assets/chips/500.png"),
value : 500
},
{
image : require("../assets/chips/1k.png"),
value : 1000
},
{
image : require("../assets/chips/2k.png"),
value : 2000
},
{
image : require("../assets/chips/5k.png"),
value : 5000
},
{
image : require("../assets/chips/10k.png"),
value : 10000
},
{
image : require("../assets/chips/25k.png"),
value : 25000
}
]

@ -0,0 +1,32 @@
export function shuffle(a){
for (let i = a.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[a[i], a[j]] = [a[j], a[i]];
}
return a;
}
export function calculatePoints(playerHand){
/*let points = 0;
arr.map((card,_index) => {
//if(card.name == 'A' && card.name == 'J')
points = points + card.value
});
return points;*/
let aceAdjuts = false,
points = 0;
playerHand.map((card,_index) => {
if(card.name == 'A' && !aceAdjuts) {
aceAdjuts = true;
points = points + 10;
}
points = points + card.value;
});
if(aceAdjuts && points > 21){
points = points - 10;
}
return points;
}

@ -22,7 +22,7 @@ let points = 0;
function CookieClicker(props: { navigation: any }) { function CookieClicker(props: { navigation: any }) {
const { navigation } = props const { navigation } = props
const GAMING_TIME = 120; const GAMING_TIME = 50;
const setUser = useUserStore((state) => state.setUser); const setUser = useUserStore((state) => state.setUser);
@ -91,6 +91,7 @@ function CookieClicker(props: { navigation: any }) {
if (tmp !== null) { if (tmp !== null) {
if (MANAGER_MATCH.getCurrentMatch()?.getTabUsers().includes(tmp)) { if (MANAGER_MATCH.getCurrentMatch()?.getTabUsers().includes(tmp)) {
MANAGER_MATCH.getCurrentMatch()?.updatePostMatch(tmp, points); MANAGER_MATCH.getCurrentMatch()?.updatePostMatch(tmp, points);
MANAGER_USER.setCurrentUser(tmp);
setUser(tmp); setUser(tmp);
} }
} }

@ -8,7 +8,7 @@ export default StyleSheet.create({
flex:1, flex:1,
backgroundColor:"#45444E", backgroundColor:"#45444E",
alignItems:"center", alignItems:"center",
justifyContent:"center" justifyContent:"center",
}, },
grid:{ grid:{
width:375, width:375,

@ -3,11 +3,18 @@ import React, {useState} from "react";
import styles from './TicTacToeStyle.js'; import styles from './TicTacToeStyle.js';
import { useMatchStore } from "../../context/matchContext"; import { useMatchStore } from "../../context/matchContext";
import { current } from "@reduxjs/toolkit"; import { current } from "@reduxjs/toolkit";
import { ScreenIndicator } from "../../components/ScreenIndicator.tsx"; import { ScreenIndicator } from "../../components/ScreenIndicator";
import { TopBar } from "../../components/TopBar.tsx"; import { TopBar } from "../../components/TopBar";
import { MANAGER_MATCH, MANAGER_USER } from "../../../appManagers";
import { useUserStore } from "../../context/userContext";
export default function tic_tac_toe(props: { navigation: any}){ export default function TicTacToe(props: { navigation: any}){
const setUser = useUserStore((state) => state.setUser);
const resetMatch = useMatchStore((state) => state.resetMatch);
const [map,setMap]=useState([ const [map,setMap]=useState([
['','',''], ['','',''],
['','',''], ['','',''],
@ -46,12 +53,12 @@ export default function tic_tac_toe(props: { navigation: any}){
const isRowOWinning = map[i] .every((cell)=>cell==="o"); const isRowOWinning = map[i] .every((cell)=>cell==="o");
if(isRowXWinning==true){ if(isRowXWinning==true){
Alert.alert("X won !"); Alert.alert("X won !");
navigation.goBack(); endGame();
return true; return true;
} }
else if(isRowOWinning==true){ else if(isRowOWinning==true){
Alert.alert("O won !"); Alert.alert("O won !");
navigation.goBack(); endGame();
return true; return true;
} }
} }
@ -70,12 +77,12 @@ export default function tic_tac_toe(props: { navigation: any}){
} }
if (isColumnXWinning == true){ if (isColumnXWinning == true){
Alert.alert("X won !"); Alert.alert("X won !");
navigation.goBack(); endGame();
return true; return true;
} }
if(isColumnOWinning==true){ if(isColumnOWinning==true){
Alert.alert("O won !"); Alert.alert("O won !");
navigation.goBack(); endGame();
return true; return true;
} }
@ -101,12 +108,12 @@ export default function tic_tac_toe(props: { navigation: any}){
} }
if(isDiag1OWinning==true || isDiag2OWinning==true){ if(isDiag1OWinning==true || isDiag2OWinning==true){
Alert.alert("O won !"); Alert.alert("O won !");
navigation.goBack(); endGame();
return true; return true;
} }
if(isDiag1XWinning==true || isDiag2XWinning==true){ if(isDiag1XWinning==true || isDiag2XWinning==true){
Alert.alert("X won !"); Alert.alert("X won !");
navigation.goBack(); endGame();
return true; return true;
} }
}; };
@ -117,11 +124,25 @@ export default function tic_tac_toe(props: { navigation: any}){
const isRow2Full = map[2] .every((cell)=>cell!==""); const isRow2Full = map[2] .every((cell)=>cell!=="");
if(isRow0Full==true && isRow1Full==true && isRow2Full==true){ if(isRow0Full==true && isRow1Full==true && isRow2Full==true){
Alert.alert("Draw !"); Alert.alert("Draw !");
navigation.goBack(); endGame();
return false; return false;
} }
}; };
function endGame() {
const tmp = MANAGER_USER.getCurrentUser();
if (tmp !== null) {
if (MANAGER_MATCH.getCurrentMatch()?.getTabUsers().includes(tmp)) {
MANAGER_MATCH.getCurrentMatch()?.updatePostMatch(tmp, 0);
MANAGER_USER.setCurrentUser(tmp);
setUser(tmp);
}
}
resetMatch();
navigation.goBack();
}
return( return(
<View style={styles.container}> <View style={styles.container}>
<TopBar nav={navigation} state={"game"}/> <TopBar nav={navigation} state={"game"}/>

@ -0,0 +1,245 @@
import {Alert, Button, ImageBackground, Pressable, StyleSheet, Text, View } from "react-native";
import React, {useState} from "react";
import styles from './TicTacToeStyle.js';
import { useMatchStore } from "../../context/matchContext";
import { current } from "@reduxjs/toolkit";
import { ScreenIndicator } from "../../components/ScreenIndicator";
import { TopBar } from "../../components/TopBar";
import { socket } from "../../../socketConfig";
import { MANAGER_MATCH, MANAGER_USER } from "../../../appManagers";
import { useUserStore } from "../../context/userContext";
export default function TicTacToeOnline(props: { navigation: any }){
const [initTic, setInitTic]=useState(0);
const setUser = useUserStore((state) => state.setUser);
setUpTicTacToeOnline();
const [map,setMap]=useState([
['','',''],
['','',''],
['','',''],
]);
const [turnUser, setTurnUser]=useState("x");
const {navigation}=props;
const [currentTurn,setCurrentTurn] = useState("x");
const onPressCell = async (rowIndex:number,columnIndex:number) => {
if (turnUser!==currentTurn){
Alert.alert("ce n'est pas à votre tour de jouer");
return;
}
if(map[rowIndex][columnIndex]==""){
setMap((existingMap) =>{
const updateMap = [...existingMap]
updateMap[rowIndex][columnIndex]=currentTurn;
return updateMap;
});
socket.emit("playTicTacToe", MANAGER_MATCH.getCurrentMatch(), rowIndex, columnIndex, currentTurn);
setCurrentTurn(currentTurn === "x"? "o" : "x");
const retour= await checkWinning();
if(retour!=true){
checkComplete();
}
}else{
Alert.alert("Case déjà prise");
}
};
function setUpTicTacToeOnline() {
if (initTic===0){
setInitTic(1);
socket.on("oppPlayTicTacToe", async (rowIndex, columnIndex, turn) =>{
setMap((existingMap) =>{
const updateMap = [...existingMap]
updateMap[rowIndex][columnIndex]=turn;
return updateMap;
});
const retour= await checkWinning();
if(retour!=true){
checkComplete();
}
if (turn==="x"){
setCurrentTurn("o");
setTurnUser("o");
}
else{
setCurrentTurn("x");
setTurnUser("x");
}
});
}
}
async function endGame(win: number){
socket.off("oppPlayTicTacToe");
navigation.goBack();
const tmp=MANAGER_USER.getCurrentUser();
if (tmp!==null){
await MANAGER_MATCH.getCurrentMatch()?.updatePostMatch(tmp, win);
MANAGER_USER.setCurrentUser(tmp);
setUser(tmp);
}
}
const checkWinning = async () =>{
const tmp=MANAGER_USER.getCurrentUser()
// Checks rows
for (let i=0; i<3; i++){
const isRowXWinning = map[i].every((cell)=> cell==="x");
const isRowOWinning = map[i] .every((cell)=>cell==="o");
if(isRowXWinning==true){
Alert.alert("X won !");
if (turnUser==="x"){
await endGame(2);
}
else{
await endGame(0);
}
return true;
}
else if(isRowOWinning==true){
Alert.alert("O won !");
if (turnUser==="x"){
await endGame(0);
}
else{
await endGame(2);
}
return true;
}
}
// Checks columns
for (let col=0;col<3;col++){
let isColumnXWinning=true;
let isColumnOWinning=true;
for(let row=0;row<3;row++){
if(map[row][col] !== "x"){
isColumnXWinning=false;
}
if(map[row][col] !== "o"){
isColumnOWinning=false;
}
}
if (isColumnXWinning == true){
Alert.alert("X won !");
if (turnUser==="x"){
await endGame(2);
}
else{
await endGame(0);
}
return true;
}
if(isColumnOWinning==true){
Alert.alert("O won !");
if (turnUser==="x"){
await endGame(0);
}
else{
await endGame(2);
}
return true;
}
}
// Checks diag
let isDiag1XWinning=true;
let isDiag1OWinning=true;
let isDiag2XWinning=true;
let isDiag2OWinning=true;
for (let i=0;i<3;i++){
if(map[i][i]!=="x"){
isDiag1XWinning=false;
}
if(map[i][i]!=="o"){
isDiag1OWinning=false;
}
if(map[i][2-i]!=="x"){
isDiag2XWinning=false;
}
if(map[i][2-i]!=="o"){
isDiag2OWinning=false;
}
}
if(isDiag1OWinning==true || isDiag2OWinning==true){
Alert.alert("O won !");
if (turnUser==="x"){
await endGame(0);
}
else{
await endGame(2);
}
return true;
}
if(isDiag1XWinning==true || isDiag2XWinning==true){
Alert.alert("X won !");
if (turnUser==="x"){
await endGame(2);
}
else{
await endGame(0);
}
return true;
}
};
const checkComplete = async () =>{
const isRow0Full = map[0].every((cell)=> cell!=="");
const isRow1Full = map[1] .every((cell)=>cell!=="");
const isRow2Full = map[2] .every((cell)=>cell!=="");
if(isRow0Full==true && isRow1Full==true && isRow2Full==true){
Alert.alert("Draw !");
await endGame(1);
return false;
}
};
return(
<View style={styles.container}>
<ScreenIndicator title='TIC TAC TOE'/>
<Text style={styles.text}>Current turn: {currentTurn}</Text>
<ImageBackground style={styles.grid} source={{uri:"https://upload.wikimedia.org/wikipedia/commons/6/64/Tic-tac-toe.png"}} >
<View style={styles.map}>
{map.map((row, rowIndex)=>(
<View key={`row-${rowIndex}`} style={styles.row}>
{row.map((cell, columnIndex)=> (
<Pressable
onPress={() => onPressCell(rowIndex,columnIndex)}
style={styles.cell}
key={`row-${rowIndex}-col-${columnIndex}`}
>
{cell === "o" && <View style={styles.circle}/>}
{cell === "x" &&(
<View style={styles.cross}>
<View style={styles.crossLine}/>
<View style={[styles.crossLine, styles.crossLineReversed]}/>
</View>
)}
</Pressable>
))}
</View>
))}
</View>
</ImageBackground>
</View>
);
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save