Merge branch 'main' of github.com:LeGall29/GGJ2024

This commit is contained in:
Michel Roux 2024-01-27 18:11:12 +01:00
commit 5743d4cacc
5 changed files with 258 additions and 66 deletions

BIN
Assets/2DAssets/timer_white.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,153 @@
fileFormatVersion: 2
guid: 8ce21f9a93b91764ea7ce3f5f295c927
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: iPhone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -794,6 +794,50 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 428468130} m_GameObject: {fileID: 428468130}
m_CullTransparentMesh: 1 m_CullTransparentMesh: 1
--- !u!1 &429358648
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 429358650}
- component: {fileID: 429358649}
m_Layer: 0
m_Name: '[FirebaseInitialise'
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &429358649
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 429358648}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 153bd176c0ad8f82692512264f5245ba, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!4 &429358650
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 429358648}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 117.24013, y: 248.68315, z: -1.7392539}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &436596783 --- !u!1 &436596783
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -6384,7 +6428,7 @@ GameObject:
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 0 m_IsActive: 1
--- !u!224 &2027556832 --- !u!224 &2027556832
RectTransform: RectTransform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -6856,5 +6900,6 @@ SceneRoots:
m_Roots: m_Roots:
- {fileID: 916979487} - {fileID: 916979487}
- {fileID: 1174378092} - {fileID: 1174378092}
- {fileID: 429358650}
- {fileID: 1202782730} - {fileID: 1202782730}
- {fileID: 865098996} - {fileID: 865098996}

View File

@ -15,10 +15,8 @@ public class GameManager : MonoBehaviour
{ {
private GameState currentState; private GameState currentState;
private List<Player> players = new List<Player>(); private List<Player> players = new List<Player>();
private Player currentPlayer= null;
[Header("Temp variables")]
public bool isRoomExist = true;
public bool isPlayerExist = true;
[Header("Other component")] [Header("Other component")]
@ -69,6 +67,7 @@ private void Start()
{ {
currentExplanationTime = explanationTime; currentExplanationTime = explanationTime;
HomeConnection.SetActive(true); HomeConnection.SetActive(true);
submitNewPlayer.GetComponent<UnityEngine.UI.Button>().interactable = false;
} }
public GameState GetCurrentState() public GameState GetCurrentState()
@ -82,7 +81,7 @@ private void Initialize()
realtimeDB = FirebaseDatabase.DefaultInstance.RootReference; realtimeDB = FirebaseDatabase.DefaultInstance.RootReference;
Debug.Log("Realtime DB initialized"); Debug.Log("Realtime DB initialized");
//TODO MARINE : enable the submit button here. Disabled it at start submitNewPlayer.GetComponent<UnityEngine.UI.Button>().interactable = true;
} }
/// <summary> /// <summary>
@ -128,63 +127,6 @@ public void PlayerValidateNameAndServerRoom(string _name, string _code)
string playerName = playerNameField.text;
string roomCode = roomCodeField.text;
// send to the server the room code and the player name
// MORGANE ENVOIE AU SERV
// answer isPlayerExist and isRoomExist
//if succeed, then the player to the server
if (isPlayerExist && isRoomExist)
{
currentState = GameState.WaitingForOtherPlayersToJoin;
WaitingRoom.SetActive(true);
HomeConnection.SetActive(false);
//TEMP
Player player = new Player(playerName);
player.SetName(playerName);
player.id = "1";
players.Add(player);
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();
}
// else we show the errors
roomError.gameObject.SetActive(!isRoomExist);
nameError.gameObject.SetActive(!isPlayerExist);
} }
private void CheckIfRoomExists(string _roomCode, Action<Room> callback_Room) private void CheckIfRoomExists(string _roomCode, Action<Room> callback_Room)
@ -216,8 +158,7 @@ private void CheckIfRoomExists(string _roomCode, Action<Room> callback_Room)
/// </summary> /// </summary>
private void JoinRoom(Action callback_OnRoomJoined) private void JoinRoom(Action callback_OnRoomJoined)
{ {
//TODO marine : uncomment aftter merge
/*
string JSON = JsonUtility.ToJson(currentPlayer); string JSON = JsonUtility.ToJson(currentPlayer);
myOnlineRoom.Child("players").Child(currentPlayer.id).SetRawJsonValueAsync(JSON).ContinueWithOnMainThread(task => myOnlineRoom.Child("players").Child(currentPlayer.id).SetRawJsonValueAsync(JSON).ContinueWithOnMainThread(task =>
{ {
@ -231,7 +172,7 @@ private void JoinRoom(Action callback_OnRoomJoined)
callback_OnRoomJoined?.Invoke(); callback_OnRoomJoined?.Invoke();
} }
}); });
*/
} }
/// <summary> /// <summary>
@ -305,8 +246,50 @@ private void OnRoomUpdate(object sender, ChildChangedEventArgs e)
{ {
case GameState.WaitingForOtherPlayersToJoin: case GameState.WaitingForOtherPlayersToJoin:
{ {
WaitingRoom.SetActive(true);
HomeConnection.SetActive(false);
// players = new list en fonction de ce qu'envoie fangh // players = new list en fonction de ce qu'envoie fangh
UpdateDisplayedListUser(); 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; break;
} }
} }
@ -322,6 +305,14 @@ private void UpdateDisplayedListUser()
} }
} }
public void OnClickSubmitSignIn()
{
string playerName = playerNameField.text;
string roomCode = roomCodeField.text;
PlayerValidateNameAndServerRoom(playerName, roomCode);
}
} }
public enum GameState public enum GameState

View File

@ -227,7 +227,7 @@ public void PlayerConnect(object sender, ChildChangedEventArgs args)
[ContextMenu("Fake Player Connection")] [ContextMenu("Fake Player Connection")]
private void FakePlayerConnection() private void FakePlayerConnection()
{ {
Player temp = new Player(); Player temp = new Player("Momo");
temp.id = System.Guid.NewGuid().ToString(); temp.id = System.Guid.NewGuid().ToString();
temp.SetName("Momo"); temp.SetName("Momo");
} }