merge conflict

This commit is contained in:
Marine 2024-01-27 17:59:12 +01:00
commit 530cca0be2
6 changed files with 168 additions and 28 deletions

View File

@ -13,15 +13,6 @@ MonoBehaviour:
m_Name: PromptList
m_EditorClassIdentifier:
prompts:
- <id>k__BackingField: acb689ed-a57a-4463-bb6e-098b4896e930
<fr>k__BackingField: mooi
<en>k__BackingField: moi
- <id>k__BackingField: 9cc1b2c7-3af0-475c-8d25-6f5913b19843
<fr>k__BackingField: lui
<en>k__BackingField: lui
- <id>k__BackingField: 48017744-4552-487a-817a-abd5d03bbbc0
<fr>k__BackingField: elle
<en>k__BackingField: elle
- <id>k__BackingField: cef08696-352b-4003-85ff-2864996e9949
<fr>k__BackingField: Jacque chirac
<en>k__BackingField: Jacque chirac
@ -105,3 +96,72 @@ MonoBehaviour:
- <id>k__BackingField: 598d0c4f-da47-4182-946c-c4704f9c8f0b
<fr>k__BackingField: La meilleure boisson
<en>k__BackingField: The best drink
- <id>k__BackingField: 0e2b168f-eed0-42b3-9e38-3f6f8f2c211b
<fr>k__BackingField: Le film de votre vie
<en>k__BackingField: The movie of your life
- <id>k__BackingField: a30a6454-8bea-4229-845a-0ccef95bf25e
<fr>k__BackingField: Un jambon
<en>k__BackingField: Ham
- <id>k__BackingField: 5c684958-ae10-4976-bbc0-70d254c6435f
<fr>k__BackingField: Une main verte
<en>k__BackingField: A green thumb
- <id>k__BackingField: 8a952db4-c57b-45b8-a0ec-557674718e2a
<fr>k__BackingField: "Le jeu vid\xE9o le plus fou"
<en>k__BackingField: The craziest video game
- <id>k__BackingField: 7940c8df-2a56-4496-9efe-7989db697de9
<fr>k__BackingField: Une autre personne que vous
<en>k__BackingField: Someone other than you
- <id>k__BackingField: 81d001fc-8994-481a-9947-db9308511525
<fr>k__BackingField: Une personne importante de votre ville
<en>k__BackingField: An important person in your city
- <id>k__BackingField: 147c2764-a387-4d5a-949b-1c503f12dc6f
<fr>k__BackingField: Un paparazzi
<en>k__BackingField: A paparazzi
- <id>k__BackingField: 50631f22-4f9a-4b1a-92e7-b1b54f60e343
<fr>k__BackingField: Un Nounours
<en>k__BackingField: A Teddy
- <id>k__BackingField: 7ca824e6-68ea-43aa-ab2d-7b7222d60f8d
<fr>k__BackingField: La couleur bleu
<en>k__BackingField: The color blue
- <id>k__BackingField: a42bdbb3-ebbe-471c-ae3f-b4e394d48fce
<fr>k__BackingField: "Un ch\xE2teau de papier WC"
<en>k__BackingField: A toilet paper castle
- <id>k__BackingField: fcd81532-591a-4f20-8afd-8baa9a626ef7
<fr>k__BackingField: Un roi
<en>k__BackingField: A king
- <id>k__BackingField: a9f5ddb7-21d8-4d44-aa05-d747bb780cab
<fr>k__BackingField: Le nouveau Miyazaki
<en>k__BackingField: The new Miyazaki
- <id>k__BackingField: cc3900c7-e3a5-497c-a0a6-36c747c531eb
<fr>k__BackingField: Un objet artistique
<en>k__BackingField: An artistic object
- <id>k__BackingField: df0008cc-7e9d-49bd-84aa-902feaeb2122
<fr>k__BackingField: "Une relique du pass\xE9"
<en>k__BackingField: A relic of the past
- <id>k__BackingField: be0aa5e4-5c23-4e7e-b076-0e65edb1db86
<fr>k__BackingField: "\xC9voque le sport"
<en>k__BackingField: Talk about sport
- <id>k__BackingField: 42bdb0ce-d4cb-45a6-b622-7a6a01873332
<fr>k__BackingField: MDR
<en>k__BackingField: LOL
- <id>k__BackingField: ee634bbd-983b-4963-a71f-1a3f3532b5db
<fr>k__BackingField: Un personnage Disney
<en>k__BackingField: A Disney character
- <id>k__BackingField: e4bbb02b-40f2-4670-8e9c-0d7e844f5fd4
<fr>k__BackingField: "Le d\xE9but de la fin"
<en>k__BackingField: The beginning of the end
- <id>k__BackingField: 66c374cf-d23b-4398-9835-9acca24016f9
<fr>k__BackingField: Le concept de l'amour
<en>k__BackingField: The concept of love
- <id>k__BackingField: 4ff9fb67-bce3-4e7e-be07-87fb27f3f6f2
<fr>k__BackingField: "Une contrefa\xE7on"
<en>k__BackingField: A counterfeit
- <id>k__BackingField: 31a7f875-97ac-416c-956f-f0984cdc2701
<fr>k__BackingField: Mario
<en>k__BackingField: Mario
- <id>k__BackingField: 9d00221b-7a14-47fe-b4dc-404984fee729
<fr>k__BackingField: Naviguer sur internet
<en>k__BackingField: Surf the Internet
- <id>k__BackingField: 70f8b286-b245-45b9-a850-ac2e14bf9cef
<fr>k__BackingField: Votre plus belle grimace
<en>k__BackingField: Your best grimace

View File

@ -8,11 +8,12 @@ public class CameraManager : MonoBehaviour
public WebCamDevice wDevice;
public Button freezeButton;
public Button resumeButton;
private Texture2D photo;
// Start is called before the first frame update
void Start()
{
wDevice = WebCamTexture.devices.First(x => x.isFrontFacing == false);
wDevice = WebCamTexture.devices.FirstOrDefault(x => x.isFrontFacing == false);
wTexture = new WebCamTexture(wDevice.name);
WebcamResume();
}
@ -20,16 +21,14 @@ void Start()
// Update is called once per frame
void Update()
{
Texture2D cropped = CropTexture(wTexture);
Texture2D rotated = RotateTexture(cropped, !wDevice.isFrontFacing);
gameObject.GetComponent<RawImage>().texture = rotated;
gameObject.GetComponent<RawImage>().material.mainTexture = rotated;
gameObject.GetComponent<RawImage>().texture = photo ? photo : GetPhoto();
Resources.UnloadUnusedAssets();
}
public void WebcamResume()
{
wTexture.Play();
photo = null;
freezeButton.gameObject.SetActive(true);
resumeButton.gameObject.SetActive(false);
}
@ -50,6 +49,7 @@ public void WebcamChange()
public void WebcamStop()
{
photo = GetPhoto();
wTexture.Stop();
freezeButton.gameObject.SetActive(false);
resumeButton.gameObject.SetActive(true);
@ -76,7 +76,6 @@ Texture2D RotateTexture(Texture2D originalTexture, bool clockwise)
Texture2D rotatedTexture = new(h, w);
rotatedTexture.SetPixels32(rotated);
rotatedTexture.Apply();
return rotatedTexture;
}
@ -100,8 +99,16 @@ Texture2D CropTexture(WebCamTexture originalTexture)
Texture2D croppedTexture = new(size, size);
croppedTexture.SetPixels(originalTexture.GetPixels(x, y, size, size));
croppedTexture.Apply();
return croppedTexture;
}
Texture2D GetPhoto()
{
Texture2D cropped = CropTexture(wTexture);
Texture2D rotated = RotateTexture(cropped, !wDevice.isFrontFacing);
rotated.Apply();
return rotated;
}
}

View File

@ -8,6 +8,12 @@ public class Player
public string name;
public string id;
public Player(string _name)
{
id = System.Guid.NewGuid().ToString();
name = _name;
}
/// <summary>
/// Will sanitize the text and set it for the player
/// </summary>

View File

@ -56,6 +56,7 @@ public class GameManager : MonoBehaviour
private DatabaseReference realtimeDB;
private Room myRoom;
private DatabaseReference myOnlineRoom;
private void Awake()
{
@ -88,8 +89,49 @@ private void Initialize()
/// </summary>
public void PlayerValidateNameAndServerRoom(string _name, string _code)
{
if (string.IsNullOrEmpty(_name))
{
Debug.LogError("Player name is empty", this);
//TODO : MARINE : use the error label to explain to the user that they have forget to put a name
return;
}
if (string.IsNullOrEmpty(_code))
{
Debug.LogError("Room code is empty", this);
//TODO : MARINE : use the error label to explain to the user that they have forget to put a room code
return;
}
//check if the room exists, if not display an error message
realtimeDB.Child("rooms").Child(_code).GetValueAsync().ContinueWithOnMainThread(task =>
CheckIfRoomExists(_code, room =>
{
if (room == null)
{
Debug.LogError("The room doesn't exists");
roomError.text = "Error: the room doesn't exists";
roomError.gameObject.SetActive(true);
}
else
{
//if room exists, join it
JoinRoom(() =>
{
//then subscribe to it
myOnlineRoom = realtimeDB.Child("rooms").Child(_code);
myOnlineRoom.ChildChanged += OnRoomUpdate;
Debug.Log($"room {myRoom.code} exists, I subscribe to it");
});
}
});
}
private void CheckIfRoomExists(string _roomCode, Action<Room> callback_Room)
{
realtimeDB.Child("rooms").Child(_roomCode).GetValueAsync().ContinueWithOnMainThread(task =>
{
if (task.IsFaulted)
{
@ -100,23 +142,38 @@ public void PlayerValidateNameAndServerRoom(string _name, string _code)
DataSnapshot snapshot = task.Result;
if (snapshot == null)
{
Debug.LogError("The room doesn't exists");
roomError.text = "Error: the room doesn't exists";
roomError.gameObject.SetActive(true);
callback_Room?.Invoke(null);
}
else
{
myRoom = JsonUtility.FromJson<Room>(snapshot.GetRawJsonValue());
currentPlayer.SetName(name);
currentPlayer.id = "1";
realtimeDB.Child("rooms").Child(_code).ChildChanged += OnRoomUpdate;
callback_Room?.Invoke(JsonUtility.FromJson<Room>(snapshot.GetRawJsonValue()));
}
}
});
}
/// <summary>
/// Add this player to the room
/// </summary>
private void JoinRoom(Action callback_OnRoomJoined)
{
//TODO marine : uncomment aftter merge
/*
string JSON = JsonUtility.ToJson(currentPlayer);
myOnlineRoom.Child("players").Child(currentPlayer.id).SetRawJsonValueAsync(JSON).ContinueWithOnMainThread(task =>
{
if (task.IsFaulted)
{
Debug.LogException(task.Exception);
}
else
{
Debug.Log($"{currentPlayer.name} has been added to the room", this);
callback_OnRoomJoined?.Invoke();
}
});
*/
}
/// <summary>
@ -142,7 +199,7 @@ public void MakeAProposition(Prompt _prompt)
{
currentState = GameState.MakeProposition;
}
/// <summary>

View File

@ -2,6 +2,7 @@
"dependencies": {
"com.unity.collab-proxy": "2.2.0",
"com.unity.feature.development": "1.0.1",
"com.unity.memoryprofiler": "1.1.0",
"com.unity.textmeshpro": "3.0.6",
"com.unity.timeline": "1.7.6",
"com.unity.toolchain.linux-x86_64": "2.0.6",

View File

@ -60,6 +60,15 @@
"dependencies": {},
"url": "https://packages.unity.com"
},
"com.unity.memoryprofiler": {
"version": "1.1.0",
"depth": 0,
"source": "registry",
"dependencies": {
"com.unity.editorcoroutines": "1.0.0"
},
"url": "https://packages.unity.com"
},
"com.unity.performance.profile-analyzer": {
"version": "1.2.2",
"depth": 1,