diff --git a/Assets/Scenes/PhoneView.unity b/Assets/Scenes/PhoneView.unity
index 857ae98..cb956fd 100644
--- a/Assets/Scenes/PhoneView.unity
+++ b/Assets/Scenes/PhoneView.unity
@@ -152,7 +152,8 @@ RectTransform:
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1.8068042, y: 1.8068042, z: 1.8068042}
m_ConstrainProportionsScale: 1
- m_Children: []
+ m_Children:
+ - {fileID: 2103733877}
m_Father: {fileID: 531335862}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
@@ -180,7 +181,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
- m_Sprite: {fileID: 0}
+ m_Sprite: {fileID: 21300000, guid: 8ce21f9a93b91764ea7ce3f5f295c927, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
@@ -354,8 +355,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 1, y: 1}
- m_AnchoredPosition: {x: 0, y: -61}
- m_SizeDelta: {x: 0, y: 50}
+ m_AnchoredPosition: {x: 0, y: -66.941}
+ m_SizeDelta: {x: 0, y: 112.377}
m_Pivot: {x: 0.5, y: 1}
--- !u!114 &204401156
MonoBehaviour:
@@ -620,8 +621,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 1, y: 0.5}
- m_AnchoredPosition: {x: 0, y: -230}
- m_SizeDelta: {x: 0, y: 50}
+ m_AnchoredPosition: {x: 0, y: -269.436}
+ m_SizeDelta: {x: 0, y: 128.871}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &339389581
MonoBehaviour:
@@ -908,18 +909,18 @@ RectTransform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 436596783}
- m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalRotation: {x: -0, y: -0, z: 0.0040257527, w: -0.99999195}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 2.4098437, y: 2.4098437, z: 2.4098437}
m_ConstrainProportionsScale: 1
m_Children:
- {fileID: 1891690321}
m_Father: {fileID: 1590939978}
- m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: -0.461}
m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 0, y: 0.5}
- m_AnchoredPosition: {x: 345, y: 575}
- m_SizeDelta: {x: 100, y: 100}
+ m_AnchoredPosition: {x: 548.876, y: 125.955}
+ m_SizeDelta: {x: 419.287, y: 511.83}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &475172432
GameObject:
@@ -1301,8 +1302,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 1, y: 0.5}
- m_AnchoredPosition: {x: 0, y: 689}
- m_SizeDelta: {x: 0, y: 50}
+ m_AnchoredPosition: {x: 0, y: 652.9936}
+ m_SizeDelta: {x: 0, y: 122.013}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &668577475
MonoBehaviour:
@@ -1569,8 +1570,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 1, y: 0.5}
- m_AnchoredPosition: {x: 0, y: 689}
- m_SizeDelta: {x: 0, y: 50}
+ m_AnchoredPosition: {x: 0, y: 659.2964}
+ m_SizeDelta: {x: 0, y: 109.407}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &751581717
MonoBehaviour:
@@ -2160,8 +2161,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 1, y: 0.5}
- m_AnchoredPosition: {x: 0, y: 335}
- m_SizeDelta: {x: 0, y: 50}
+ m_AnchoredPosition: {x: 0, y: 235.55392}
+ m_SizeDelta: {x: 0, y: 248.892}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &903645290
MonoBehaviour:
@@ -3947,8 +3948,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 0}
- m_AnchoredPosition: {x: 0, y: 477}
- m_SizeDelta: {x: 0, y: 50}
+ m_AnchoredPosition: {x: 0, y: 434.13525}
+ m_SizeDelta: {x: 0, y: 135.73}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1360529142
MonoBehaviour:
@@ -4081,8 +4082,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 0}
- m_AnchoredPosition: {x: 0, y: 424}
- m_SizeDelta: {x: 0, y: 50}
+ m_AnchoredPosition: {x: 0, y: 386.279}
+ m_SizeDelta: {x: 0, y: 125.442}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1383251891
MonoBehaviour:
@@ -4636,8 +4637,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 1, y: 0.5}
- m_AnchoredPosition: {x: 0, y: 689}
- m_SizeDelta: {x: 0, y: 50}
+ m_AnchoredPosition: {x: 0, y: 659.7693}
+ m_SizeDelta: {x: 0, y: 108.462}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1575113405
MonoBehaviour:
@@ -4810,7 +4811,7 @@ RectTransform:
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: -61}
- m_SizeDelta: {x: 0, y: 50}
+ m_SizeDelta: {x: 0, y: 125.442}
m_Pivot: {x: 0.5, y: 1}
--- !u!114 &1611727550
MonoBehaviour:
@@ -4944,7 +4945,7 @@ RectTransform:
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: -61}
- m_SizeDelta: {x: 0, y: 50}
+ m_SizeDelta: {x: 0, y: 114.701}
m_Pivot: {x: 0.5, y: 1}
--- !u!114 &1680408690
MonoBehaviour:
@@ -5859,10 +5860,10 @@ RectTransform:
m_Children: []
m_Father: {fileID: 436596784}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
- m_AnchorMin: {x: 0.5, y: 0.5}
- m_AnchorMax: {x: 0.5, y: 0.5}
- m_AnchoredPosition: {x: -81, y: 0}
- m_SizeDelta: {x: 200, y: 50}
+ m_AnchorMin: {x: 0, y: 0.5}
+ m_AnchorMax: {x: 0, y: 0.5}
+ m_AnchoredPosition: {x: 209.645, y: -0.0000076293945}
+ m_SizeDelta: {x: 419.29, y: 511.83}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1891690322
MonoBehaviour:
@@ -5932,7 +5933,7 @@ MonoBehaviour:
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 0
- m_HorizontalAlignment: 2
+ m_HorizontalAlignment: 1
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
@@ -5961,7 +5962,7 @@ MonoBehaviour:
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
- m_margin: {x: 0, y: 0, z: 0, w: -369.03137}
+ m_margin: {x: 0, y: 0, z: 0, w: 1.9035797}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
@@ -6473,7 +6474,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
- m_IsActive: 1
+ m_IsActive: 0
--- !u!224 &2027556832
RectTransform:
m_ObjectHideFlags: 0
@@ -6705,8 +6706,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 0}
- m_AnchoredPosition: {x: 0, y: 295}
- m_SizeDelta: {x: 0, y: 50}
+ m_AnchoredPosition: {x: 0, y: 256.318}
+ m_SizeDelta: {x: 0, y: 127.364}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &2098267450
MonoBehaviour:
@@ -6805,6 +6806,140 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2098267448}
m_CullTransparentMesh: 1
+--- !u!1 &2103733876
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 2103733877}
+ - component: {fileID: 2103733879}
+ - component: {fileID: 2103733878}
+ m_Layer: 5
+ m_Name: Text (TMP)
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &2103733877
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 2103733876}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_ConstrainProportionsScale: 0
+ m_Children: []
+ m_Father: {fileID: 105416811}
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0.5, y: 0.5}
+ m_AnchorMax: {x: 0.5, y: 0.5}
+ m_AnchoredPosition: {x: -2.731, y: -2.341}
+ m_SizeDelta: {x: 94.539, y: 46.1}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!114 &2103733878
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 2103733876}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 1, g: 1, b: 1, a: 1}
+ m_RaycastTarget: 1
+ m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
+ m_Maskable: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_text: 20
+ m_isRightToLeft: 0
+ m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
+ m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
+ m_fontSharedMaterials: []
+ m_fontMaterial: {fileID: 0}
+ m_fontMaterials: []
+ m_fontColor32:
+ serializedVersion: 2
+ rgba: 4278190080
+ m_fontColor: {r: 0, g: 0, b: 0, a: 1}
+ m_enableVertexGradient: 0
+ m_colorMode: 3
+ m_fontColorGradient:
+ topLeft: {r: 1, g: 1, b: 1, a: 1}
+ topRight: {r: 1, g: 1, b: 1, a: 1}
+ bottomLeft: {r: 1, g: 1, b: 1, a: 1}
+ bottomRight: {r: 1, g: 1, b: 1, a: 1}
+ m_fontColorGradientPreset: {fileID: 0}
+ m_spriteAsset: {fileID: 0}
+ m_tintAllSprites: 0
+ m_StyleSheet: {fileID: 0}
+ m_TextStyleHashCode: -1183493901
+ m_overrideHtmlColors: 0
+ m_faceColor:
+ serializedVersion: 2
+ rgba: 4294967295
+ m_fontSize: 26.7
+ m_fontSizeBase: 26.7
+ m_fontWeight: 400
+ m_enableAutoSizing: 0
+ m_fontSizeMin: 18
+ m_fontSizeMax: 72
+ m_fontStyle: 0
+ m_HorizontalAlignment: 2
+ m_VerticalAlignment: 512
+ m_textAlignment: 65535
+ m_characterSpacing: 0
+ m_wordSpacing: 0
+ m_lineSpacing: 0
+ m_lineSpacingMax: 0
+ m_paragraphSpacing: 0
+ m_charWidthMaxAdj: 0
+ m_enableWordWrapping: 1
+ m_wordWrappingRatios: 0.4
+ m_overflowMode: 0
+ m_linkedTextComponent: {fileID: 0}
+ parentLinkedComponent: {fileID: 0}
+ m_enableKerning: 1
+ m_enableExtraPadding: 0
+ checkPaddingRequired: 0
+ m_isRichText: 1
+ m_parseCtrlCharacters: 1
+ m_isOrthographic: 1
+ m_isCullingEnabled: 0
+ m_horizontalMapping: 0
+ m_verticalMapping: 0
+ m_uvLineOffset: 0
+ m_geometrySortingOrder: 0
+ m_IsTextObjectScaleStatic: 0
+ m_VertexBufferAutoSizeReduction: 0
+ m_useMaxVisibleDescender: 1
+ m_pageToDisplay: 1
+ m_margin: {x: 0, y: 0, z: 0, w: 0}
+ m_isUsingLegacyAnimationComponent: 0
+ m_isVolumetricText: 0
+ m_hasFontAssetChanged: 0
+ m_baseMaterial: {fileID: 0}
+ m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
+--- !u!222 &2103733879
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 2103733876}
+ m_CullTransparentMesh: 1
--- !u!1 &2139867525
GameObject:
m_ObjectHideFlags: 0
diff --git a/Assets/Scripts/DatabaseClasses/Player.cs b/Assets/Scripts/DatabaseClasses/Player.cs
index d03d3a8..b315a7b 100644
--- a/Assets/Scripts/DatabaseClasses/Player.cs
+++ b/Assets/Scripts/DatabaseClasses/Player.cs
@@ -11,7 +11,7 @@ public class Player
public Player(string _name)
{
id = System.Guid.NewGuid().ToString();
- name = _name;
+ SetName( _name);
}
///
diff --git a/Assets/Scripts/GameManager.cs b/Assets/Scripts/GameManager.cs
index 3411685..87a6ee2 100644
--- a/Assets/Scripts/GameManager.cs
+++ b/Assets/Scripts/GameManager.cs
@@ -89,9 +89,15 @@ private void Initialize()
///
public void PlayerValidateNameAndServerRoom(string _name, string _code)
{
+ nameError.gameObject.SetActive(false);
+ roomError.gameObject.SetActive(false);
if (string.IsNullOrEmpty(_name))
{
Debug.LogError("Player name is empty", this);
+
+ nameError.text = "You have to put a valid name";
+ nameError.gameObject.SetActive(true);
+
//TODO : MARINE : use the error label to explain to the user that they have forget to put a name
return;
}
@@ -99,6 +105,9 @@ public void PlayerValidateNameAndServerRoom(string _name, string _code)
if (string.IsNullOrEmpty(_code))
{
Debug.LogError("Room code is empty", this);
+ roomError.text = "You have to put a room code";
+ roomError.gameObject.SetActive(true);
+
//TODO : MARINE : use the error label to explain to the user that they have forget to put a room code
return;
}
@@ -116,13 +125,12 @@ public void PlayerValidateNameAndServerRoom(string _name, string _code)
else
{
myOnlineRoom = realtimeDB.Child("rooms").Child(_code);
- Debug.Log("Before join room");
//if room exists, join it
JoinRoom(() =>
{
//then subscribe to it
- myOnlineRoom.ChildChanged += OnRoomUpdate;
+ myOnlineRoom.ValueChanged += OnRoomUpdate;
currentState = GameState.WaitingForOtherPlayersToJoin;
players.Add(currentPlayer);
@@ -206,6 +214,7 @@ public void StartGame()
BeforeStart.SetActive(true);
+
}
///
@@ -258,56 +267,24 @@ public void DisplayEndScreen()
///
/// Automatically called when something change in your room
///
- private void OnRoomUpdate(object sender, ChildChangedEventArgs e)
+ private void OnRoomUpdate(object sender, ValueChangedEventArgs e)
{
- myRoom = JsonUtility.FromJson(e.Snapshot.GetRawJsonValue());
+ try
+ {
+ myRoom = JsonUtility.FromJson(e.Snapshot.GetRawJsonValue());
+ }
+ catch (Exception ex)
+ {
+ Debug.LogException(ex);
+ }
+
switch (currentState)
{
case GameState.WaitingForOtherPlayersToJoin:
{
-
// players = new list en fonction de ce qu'envoie fangh
UpdateDisplayedListUser();
- break;
- }
- case GameState.EnteringName:
- {
- currentState = GameState.WaitingForOtherPlayersToJoin;
-
-
- //TEMP
-
- players.Add(currentPlayer);
- if (players.Count == 1)
- {
- submitStartGame.SetActive(true);
- }
-
- Player player2 = new Player("3J");
- player2.SetName("3J");
- player2.id = "2";
- Player player3 = new Player("3J");
- player3.SetName("3J");
- player3.id = "3";
- Player player4 = new Player("3J");
- player4.SetName("3J");
- player4.id = "4";
- Player player5 = new Player("3J");
- player5.SetName("3J");
- player5.id = "5";
- Player player6 = new Player("3J");
- player6.SetName("3J");
- player6.id = "6";
-
-
- players.Add(player2);
- players.Add(player3);
- players.Add(player4);
- players.Add(player5);
- players.Add(player6);
- UpdateDisplayedListUser();
-
break;
}
}
@@ -328,7 +305,6 @@ public void OnClickSubmitSignIn()
{
string playerName = playerNameField.text;
string roomCode = roomCodeField.text;
- Debug.Log("click btn");
PlayerValidateNameAndServerRoom(playerName, roomCode);
}
}