From d6af38c644a1005a91525c8531e1f2a23a6e2cf2 Mon Sep 17 00:00:00 2001 From: Morgan - 6 Freedom Date: Sat, 27 Jan 2024 10:19:32 +0100 Subject: [PATCH] database classes --- Assets/Scripts/DatabaseClasses.meta | 8 +++++ Assets/Scripts/DatabaseClasses/Player.cs | 31 +++++++++++++++++++ Assets/Scripts/DatabaseClasses/Player.cs.meta | 11 +++++++ Assets/Scripts/DatabaseClasses/Prompt.cs | 9 ++++++ Assets/Scripts/DatabaseClasses/Prompt.cs.meta | 11 +++++++ Assets/Scripts/DatabaseClasses/Proposition.cs | 10 ++++++ .../DatabaseClasses/Proposition.cs.meta | 11 +++++++ Assets/Scripts/DatabaseClasses/Question.cs | 11 +++++++ .../Scripts/DatabaseClasses/Question.cs.meta | 11 +++++++ Assets/Scripts/DatabaseClasses/Room.cs | 10 ++++++ Assets/Scripts/DatabaseClasses/Room.cs.meta | 11 +++++++ Assets/Scripts/RoomManager.cs | 19 ++++++++++++ Assets/Scripts/RoomManager.cs.meta | 11 +++++++ 13 files changed, 164 insertions(+) create mode 100644 Assets/Scripts/DatabaseClasses.meta create mode 100644 Assets/Scripts/DatabaseClasses/Player.cs create mode 100644 Assets/Scripts/DatabaseClasses/Player.cs.meta create mode 100644 Assets/Scripts/DatabaseClasses/Prompt.cs create mode 100644 Assets/Scripts/DatabaseClasses/Prompt.cs.meta create mode 100644 Assets/Scripts/DatabaseClasses/Proposition.cs create mode 100644 Assets/Scripts/DatabaseClasses/Proposition.cs.meta create mode 100644 Assets/Scripts/DatabaseClasses/Question.cs create mode 100644 Assets/Scripts/DatabaseClasses/Question.cs.meta create mode 100644 Assets/Scripts/DatabaseClasses/Room.cs create mode 100644 Assets/Scripts/DatabaseClasses/Room.cs.meta create mode 100644 Assets/Scripts/RoomManager.cs create mode 100644 Assets/Scripts/RoomManager.cs.meta diff --git a/Assets/Scripts/DatabaseClasses.meta b/Assets/Scripts/DatabaseClasses.meta new file mode 100644 index 0000000..c54c99c --- /dev/null +++ b/Assets/Scripts/DatabaseClasses.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4d72bb021c4624be8926ddb7e8e95ec3 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/DatabaseClasses/Player.cs b/Assets/Scripts/DatabaseClasses/Player.cs new file mode 100644 index 0000000..3d67c75 --- /dev/null +++ b/Assets/Scripts/DatabaseClasses/Player.cs @@ -0,0 +1,31 @@ +using System.Collections; +using System.Collections.Generic; +using System.Text.RegularExpressions; + +public class Player +{ + public string name; + public string id; + + /// + /// Will sanitize the text and set it for the player + /// + public void SetName(string _name) + { + name = SanitizeString(_name); + } + + private string SanitizeString(string input) + { + // Utilisez une expression régulière pour supprimer tout ce qui n'est pas une lettre ou un chiffre + string sanitized = Regex.Replace(input, @"[^a-zA-Z0-9]", ""); + + // Limitez la longueur à 16 caractères maximum + if (sanitized.Length > 16) + { + sanitized = sanitized.Substring(0, 16); + } + + return sanitized; + } +} diff --git a/Assets/Scripts/DatabaseClasses/Player.cs.meta b/Assets/Scripts/DatabaseClasses/Player.cs.meta new file mode 100644 index 0000000..1b79c2f --- /dev/null +++ b/Assets/Scripts/DatabaseClasses/Player.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 35e3951b470804ec7a58bb36aa6ca57b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/DatabaseClasses/Prompt.cs b/Assets/Scripts/DatabaseClasses/Prompt.cs new file mode 100644 index 0000000..dd483fd --- /dev/null +++ b/Assets/Scripts/DatabaseClasses/Prompt.cs @@ -0,0 +1,9 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class Prompt +{ + public string id; + public string text; +} diff --git a/Assets/Scripts/DatabaseClasses/Prompt.cs.meta b/Assets/Scripts/DatabaseClasses/Prompt.cs.meta new file mode 100644 index 0000000..9c8925f --- /dev/null +++ b/Assets/Scripts/DatabaseClasses/Prompt.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3a411cfa7a83945fe91266ec0690a09d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/DatabaseClasses/Proposition.cs b/Assets/Scripts/DatabaseClasses/Proposition.cs new file mode 100644 index 0000000..5e09d06 --- /dev/null +++ b/Assets/Scripts/DatabaseClasses/Proposition.cs @@ -0,0 +1,10 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class Proposition +{ + public string photoUrl; + public Player owner; + public string[] voters; +} diff --git a/Assets/Scripts/DatabaseClasses/Proposition.cs.meta b/Assets/Scripts/DatabaseClasses/Proposition.cs.meta new file mode 100644 index 0000000..57a1cab --- /dev/null +++ b/Assets/Scripts/DatabaseClasses/Proposition.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b40d0d645f6d44cd3a7d806d2e4c32bd +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/DatabaseClasses/Question.cs b/Assets/Scripts/DatabaseClasses/Question.cs new file mode 100644 index 0000000..8036ea8 --- /dev/null +++ b/Assets/Scripts/DatabaseClasses/Question.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class Question +{ + public string promptId; + public Proposition propositions; + public int creationDate; +} diff --git a/Assets/Scripts/DatabaseClasses/Question.cs.meta b/Assets/Scripts/DatabaseClasses/Question.cs.meta new file mode 100644 index 0000000..2ab18e2 --- /dev/null +++ b/Assets/Scripts/DatabaseClasses/Question.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3a69ca9367b9f4b36abb81a861a996a4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/DatabaseClasses/Room.cs b/Assets/Scripts/DatabaseClasses/Room.cs new file mode 100644 index 0000000..83f964d --- /dev/null +++ b/Assets/Scripts/DatabaseClasses/Room.cs @@ -0,0 +1,10 @@ +using System.Collections.Generic; + +public class Room +{ + public string code; + public List questions; + public List players; + public int currentQuestion; + public int creationDate; +} diff --git a/Assets/Scripts/DatabaseClasses/Room.cs.meta b/Assets/Scripts/DatabaseClasses/Room.cs.meta new file mode 100644 index 0000000..d5acdef --- /dev/null +++ b/Assets/Scripts/DatabaseClasses/Room.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d279c923334964e1b95d498ebfe08299 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/RoomManager.cs b/Assets/Scripts/RoomManager.cs new file mode 100644 index 0000000..715ad5a --- /dev/null +++ b/Assets/Scripts/RoomManager.cs @@ -0,0 +1,19 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class RoomManager : MonoBehaviour +{ + + // Start is called before the first frame update + void Start() + { + + } + + // Update is called once per frame + void Update() + { + + } +} diff --git a/Assets/Scripts/RoomManager.cs.meta b/Assets/Scripts/RoomManager.cs.meta new file mode 100644 index 0000000..a8c9054 --- /dev/null +++ b/Assets/Scripts/RoomManager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: de098f8fd5f884a1aa55db7874246b92 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: