Skip to content

Commit

Permalink
Clients now only see their own cards
Browse files Browse the repository at this point in the history
  • Loading branch information
victorsuleiman committed Feb 1, 2021
1 parent a0cd61a commit 5f4b6e1
Show file tree
Hide file tree
Showing 10 changed files with 1,013 additions and 1,606 deletions.
2 changes: 0 additions & 2 deletions Assets/Scripts/CardDealer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ public static void dealCards(GameObject[] playerList, int numberOfCards)
{

List<string> hands = new List<string>();
Debug.Log(p.GetComponent<Player>().getDisplayName());

for (int i = 0; i < numberOfCards; i++)
{
Expand All @@ -74,7 +73,6 @@ public static void dealCards(GameObject[] playerList, int numberOfCards)
hands.Add(newCard);
deck.RemoveAt(k);
numberOfCardsStillInTheDeck--;
Debug.Log(newCard);
}

matchManager.playerHands.Add(hands);
Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/CartilhaOnline.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class CartilhaOnline : NetworkManager
//Dynamic naming of players - done!
//Have a button to begin match. Log that the match has begun - done!
//When the match has begun, deal cards to the player and sync them (cards need to be the same between clients) - done!
//Make the player see their cards only (and the board)
//Make the player see their cards only (and the board) - done!

public override void OnServerAddPlayer(NetworkConnection conn)
{
Expand Down
8 changes: 7 additions & 1 deletion Assets/Scripts/UpdateSprite.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,24 +41,30 @@ void Start()
}


//if you're assigned to a player or the board, your face is up. if not, it should remain down.
//if you're assigned to a player or the board, your face is up. if not, it should remain down.
if (transform.parent.name == "Player" || transform.parent.name == "Board")
{
spriteRenderer = GetComponent<SpriteRenderer>();
spriteRenderer.sprite = cardFace;
}

//for multiplayer
if (cartilha == null)
{
spriteRenderer = GetComponent<SpriteRenderer>();
spriteRenderer.sprite = cardFace;
if (transform.parent.GetComponent<Player>().hasAuthority) spriteRenderer.sprite = cardFace;
else spriteRenderer.sprite = cardBack;


}




}


// Update is called once per frame
void Update()
{
Expand Down
83 changes: 43 additions & 40 deletions Logs/AssetImportWorker0-prev.log
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ D:/Arquivos/Documentos/Udemy/Unity 2D/Repos/Unity 2D/Cartilha
-logFile
Logs/AssetImportWorker0.log
-srvPort
56689
24434
Successfully changed project path to: D:/Arquivos/Documentos/Udemy/Unity 2D/Repos/Unity 2D/Cartilha
D:/Arquivos/Documentos/Udemy/Unity 2D/Repos/Unity 2D/Cartilha
Using Asset Import Pipeline V2.
Refreshing native plugins compatible for Editor in 66.49 ms, found 1 plugins.
Refreshing native plugins compatible for Editor in 71.99 ms, found 1 plugins.
Preloading 0 native plugins for Editor in 0.00 ms.
Initialize engine version: 2020.2.1f1 (270dd8c3da1c)
[Subsystems] Discovering subsystems at path C:/Program Files (x86)/2020.2.1f1/Editor/Data/Resources/UnitySubsystems
Expand All @@ -35,51 +35,51 @@ Initialize mono
Mono path[0] = 'C:/Program Files (x86)/2020.2.1f1/Editor/Data/Managed'
Mono path[1] = 'C:/Program Files (x86)/2020.2.1f1/Editor/Data/MonoBleedingEdge/lib/mono/unityjit'
Mono config path = 'C:/Program Files (x86)/2020.2.1f1/Editor/Data/MonoBleedingEdge/etc'
Using monoOptions --debugger-agent=transport=dt_socket,embedding=1,server=y,suspend=n,address=127.0.0.1:56252
Using monoOptions --debugger-agent=transport=dt_socket,embedding=1,server=y,suspend=n,address=127.0.0.1:56680
Begin MonoManager ReloadAssembly
Registering precompiled unity dll's ...
Register platform support module: C:/Program Files (x86)/2020.2.1f1/Editor/Data/PlaybackEngines/WebGLSupport/UnityEditor.WebGL.Extensions.dll
Register platform support module: C:/Program Files (x86)/2020.2.1f1/Editor/Data/PlaybackEngines/WindowsStandaloneSupport/UnityEditor.WindowsStandalone.Extensions.dll
Registered in 0.023197 seconds.
Registered in 0.029400 seconds.
Native extension for WindowsStandalone target not found
Native extension for WebGL target not found
Refreshing native plugins compatible for Editor in 58.68 ms, found 1 plugins.
Refreshing native plugins compatible for Editor in 72.00 ms, found 1 plugins.
Preloading 0 native plugins for Editor in 0.00 ms.
Invoked RoslynAnalysisRunner static constructor.
RoslynAnalysisRunner will not be running.
RoslynAnalysisRunner has terminated.
Mono: successfully reloaded assembly
- Completed reload, in 9.291 seconds
- Completed reload, in 10.042 seconds
Platform modules already initialized, skipping
Registering precompiled user dll's ...
Registered in 0.018495 seconds.
Registered in 0.033996 seconds.
Begin MonoManager ReloadAssembly
Native extension for WindowsStandalone target not found
Native extension for WebGL target not found
Refreshing native plugins compatible for Editor in 71.02 ms, found 1 plugins.
Refreshing native plugins compatible for Editor in 53.85 ms, found 1 plugins.
Preloading 0 native plugins for Editor in 0.00 ms.
Invoked RoslynAnalysisRunner static constructor.
RoslynAnalysisRunner will not be running.
RoslynAnalysisRunner has terminated.
Find all reader and writers took 254 milliseconds
Find all reader and writers took 218 milliseconds
Script Module: UnityEngine.UI.dll
Weave behaviours and messages took182 milliseconds
Find all reader and writers took 227 milliseconds
Weave behaviours and messages took93 milliseconds
Find all reader and writers took 171 milliseconds
Script Module: UnityEngine.TestRunner.dll
Weave behaviours and messages took30 milliseconds
Find all reader and writers took 187 milliseconds
Weave behaviours and messages took23 milliseconds
Find all reader and writers took 167 milliseconds
Script Module: Unity.Mathematics.dll
Weave behaviours and messages took227 milliseconds
Find all reader and writers took 191 milliseconds
Weave behaviours and messages took189 milliseconds
Find all reader and writers took 171 milliseconds
Script Module: Unity.2D.Animation.Triangle.Runtime.dll
Weave behaviours and messages took54 milliseconds
Find all reader and writers took 190 milliseconds
Weave behaviours and messages took47 milliseconds
Find all reader and writers took 177 milliseconds
Script Module: SimpleWebTransport.dll
Weave behaviours and messages took5 milliseconds
Weave behaviours and messages took8 milliseconds
Find all reader and writers took 174 milliseconds
Script Module: Unity.Timeline.dll
Weave behaviours and messages took30 milliseconds
Find all reader and writers took 214 milliseconds
Weave behaviours and messages took31 milliseconds
Find all reader and writers took 198 milliseconds
Script Module: Mirror.Examples.dll
[Projectile] NetworkBehaviourProcessor
[Tank] NetworkBehaviourProcessor
Expand All @@ -105,9 +105,9 @@ Script Module: Mirror.Examples.dll
[PlayerController] NetworkBehaviourProcessor
[RandomColor] NetworkBehaviourProcessor
[ShootingTankBehaviour] NetworkBehaviourProcessor
Weave behaviours and messages took78 milliseconds
ProcessSitesModule Mirror.Examples.dll elapsed time:00:00:00.0149601
Find all reader and writers took 179 milliseconds
Weave behaviours and messages took26 milliseconds
ProcessSitesModule Mirror.Examples.dll elapsed time:00:00:00.0089765
Find all reader and writers took 169 milliseconds
Script Module: Mirror.Components.dll
[NetworkAnimator] NetworkBehaviourProcessor
[NetworkRoomPlayer] NetworkBehaviourProcessor
Expand Down Expand Up @@ -137,27 +137,30 @@ Script Module: Mirror.Components.dll
[NetworkTransformBase] NetworkBehaviourProcessor
[NetworkTransformBase] NetworkBehaviourProcessor
[NetworkTransformChild] NetworkBehaviourProcessor
Weave behaviours and messages took52 milliseconds
ProcessSitesModule Mirror.Components.dll elapsed time:00:00:00.0019953
Find all reader and writers took 229 milliseconds
Weave behaviours and messages took33 milliseconds
ProcessSitesModule Mirror.Components.dll elapsed time:00:00:00.0009971
Find all reader and writers took 215 milliseconds
Script Module: Unity.TextMeshPro.dll
Weave behaviours and messages took179 milliseconds
Find all reader and writers took 176 milliseconds
Weave behaviours and messages took274 milliseconds
Find all reader and writers took 179 milliseconds
Script Module: Unity.2D.Animation.Runtime.dll
Weave behaviours and messages took5 milliseconds
Find all reader and writers took 171 milliseconds
Weave behaviours and messages took8 milliseconds
Find all reader and writers took 999 milliseconds
Script Module: Unity.2D.IK.Runtime.dll
Weave behaviours and messages took6 milliseconds
Find all reader and writers took 264 milliseconds
Weave behaviours and messages took7 milliseconds
Find all reader and writers took 301 milliseconds
Script Module: Unity.2D.SpriteShape.Runtime.dll
Weave behaviours and messages took63 milliseconds
Find all reader and writers took 170 milliseconds
Weave behaviours and messages took68 milliseconds
Find all reader and writers took 288 milliseconds
Script Module: Telepathy.dll
Weave behaviours and messages took1 milliseconds
Find all reader and writers took 255 milliseconds
Weave behaviours and messages took3 milliseconds
Find all reader and writers took 219 milliseconds
Script Module: Mirror.Authenticators.dll
Weave behaviours and messages took159 milliseconds
ProcessSitesModule Mirror.Authenticators.dll elapsed time:00:00:00.0029918
Find all reader and writers took 2813 milliseconds
Weave behaviours and messages took7 milliseconds
ProcessSitesModule Mirror.Authenticators.dll elapsed time:00:00:00.0009951
Find all reader and writers took 215 milliseconds
Script Module: Unity.2D.PixelPerfect.dll
Weave behaviours and messages took4 milliseconds
Weave behaviours and messages took2 milliseconds
Find all reader and writers took 331 milliseconds
Script Module: Mirror.Examples.Cloud.GUI.dll
Weave behaviours and messages took12 milliseconds
81 changes: 39 additions & 42 deletions Logs/AssetImportWorker0.log
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ D:/Arquivos/Documentos/Udemy/Unity 2D/Repos/Unity 2D/Cartilha
-logFile
Logs/AssetImportWorker0.log
-srvPort
24434
27813
Successfully changed project path to: D:/Arquivos/Documentos/Udemy/Unity 2D/Repos/Unity 2D/Cartilha
D:/Arquivos/Documentos/Udemy/Unity 2D/Repos/Unity 2D/Cartilha
Using Asset Import Pipeline V2.
Refreshing native plugins compatible for Editor in 71.99 ms, found 1 plugins.
Refreshing native plugins compatible for Editor in 63.63 ms, found 1 plugins.
Preloading 0 native plugins for Editor in 0.00 ms.
Initialize engine version: 2020.2.1f1 (270dd8c3da1c)
[Subsystems] Discovering subsystems at path C:/Program Files (x86)/2020.2.1f1/Editor/Data/Resources/UnitySubsystems
Expand All @@ -35,51 +35,51 @@ Initialize mono
Mono path[0] = 'C:/Program Files (x86)/2020.2.1f1/Editor/Data/Managed'
Mono path[1] = 'C:/Program Files (x86)/2020.2.1f1/Editor/Data/MonoBleedingEdge/lib/mono/unityjit'
Mono config path = 'C:/Program Files (x86)/2020.2.1f1/Editor/Data/MonoBleedingEdge/etc'
Using monoOptions --debugger-agent=transport=dt_socket,embedding=1,server=y,suspend=n,address=127.0.0.1:56680
Using monoOptions --debugger-agent=transport=dt_socket,embedding=1,server=y,suspend=n,address=127.0.0.1:56684
Begin MonoManager ReloadAssembly
Registering precompiled unity dll's ...
Register platform support module: C:/Program Files (x86)/2020.2.1f1/Editor/Data/PlaybackEngines/WebGLSupport/UnityEditor.WebGL.Extensions.dll
Register platform support module: C:/Program Files (x86)/2020.2.1f1/Editor/Data/PlaybackEngines/WindowsStandaloneSupport/UnityEditor.WindowsStandalone.Extensions.dll
Registered in 0.029400 seconds.
Registered in 0.019748 seconds.
Native extension for WindowsStandalone target not found
Native extension for WebGL target not found
Refreshing native plugins compatible for Editor in 72.00 ms, found 1 plugins.
Refreshing native plugins compatible for Editor in 93.18 ms, found 1 plugins.
Preloading 0 native plugins for Editor in 0.00 ms.
Invoked RoslynAnalysisRunner static constructor.
RoslynAnalysisRunner will not be running.
RoslynAnalysisRunner has terminated.
Mono: successfully reloaded assembly
- Completed reload, in 10.042 seconds
- Completed reload, in 9.249 seconds
Platform modules already initialized, skipping
Registering precompiled user dll's ...
Registered in 0.033996 seconds.
Registered in 0.019455 seconds.
Begin MonoManager ReloadAssembly
Native extension for WindowsStandalone target not found
Native extension for WebGL target not found
Refreshing native plugins compatible for Editor in 53.85 ms, found 1 plugins.
Refreshing native plugins compatible for Editor in 73.49 ms, found 1 plugins.
Preloading 0 native plugins for Editor in 0.00 ms.
Invoked RoslynAnalysisRunner static constructor.
RoslynAnalysisRunner will not be running.
RoslynAnalysisRunner has terminated.
Find all reader and writers took 218 milliseconds
Find all reader and writers took 196 milliseconds
Script Module: UnityEngine.UI.dll
Weave behaviours and messages took93 milliseconds
Find all reader and writers took 171 milliseconds
Weave behaviours and messages took95 milliseconds
Find all reader and writers took 187 milliseconds
Script Module: UnityEngine.TestRunner.dll
Weave behaviours and messages took23 milliseconds
Find all reader and writers took 167 milliseconds
Weave behaviours and messages took34 milliseconds
Find all reader and writers took 183 milliseconds
Script Module: Unity.Mathematics.dll
Weave behaviours and messages took189 milliseconds
Find all reader and writers took 171 milliseconds
Weave behaviours and messages took195 milliseconds
Find all reader and writers took 150 milliseconds
Script Module: Unity.2D.Animation.Triangle.Runtime.dll
Weave behaviours and messages took47 milliseconds
Find all reader and writers took 177 milliseconds
Weave behaviours and messages took33 milliseconds
Find all reader and writers took 186 milliseconds
Script Module: SimpleWebTransport.dll
Weave behaviours and messages took8 milliseconds
Find all reader and writers took 174 milliseconds
Find all reader and writers took 182 milliseconds
Script Module: Unity.Timeline.dll
Weave behaviours and messages took31 milliseconds
Find all reader and writers took 198 milliseconds
Weave behaviours and messages took29 milliseconds
Find all reader and writers took 180 milliseconds
Script Module: Mirror.Examples.dll
[Projectile] NetworkBehaviourProcessor
[Tank] NetworkBehaviourProcessor
Expand All @@ -105,9 +105,9 @@ Script Module: Mirror.Examples.dll
[PlayerController] NetworkBehaviourProcessor
[RandomColor] NetworkBehaviourProcessor
[ShootingTankBehaviour] NetworkBehaviourProcessor
Weave behaviours and messages took26 milliseconds
ProcessSitesModule Mirror.Examples.dll elapsed time:00:00:00.0089765
Find all reader and writers took 169 milliseconds
Weave behaviours and messages took29 milliseconds
ProcessSitesModule Mirror.Examples.dll elapsed time:00:00:00.0100040
Find all reader and writers took 203 milliseconds
Script Module: Mirror.Components.dll
[NetworkAnimator] NetworkBehaviourProcessor
[NetworkRoomPlayer] NetworkBehaviourProcessor
Expand Down Expand Up @@ -137,30 +137,27 @@ Script Module: Mirror.Components.dll
[NetworkTransformBase] NetworkBehaviourProcessor
[NetworkTransformBase] NetworkBehaviourProcessor
[NetworkTransformChild] NetworkBehaviourProcessor
Weave behaviours and messages took33 milliseconds
ProcessSitesModule Mirror.Components.dll elapsed time:00:00:00.0009971
Find all reader and writers took 215 milliseconds
Weave behaviours and messages took39 milliseconds
ProcessSitesModule Mirror.Components.dll elapsed time:00:00:00.0009975
Find all reader and writers took 204 milliseconds
Script Module: Unity.TextMeshPro.dll
Weave behaviours and messages took274 milliseconds
Find all reader and writers took 179 milliseconds
Weave behaviours and messages took100 milliseconds
Find all reader and writers took 217 milliseconds
Script Module: Unity.2D.Animation.Runtime.dll
Weave behaviours and messages took8 milliseconds
Find all reader and writers took 999 milliseconds
Weave behaviours and messages took49 milliseconds
Find all reader and writers took 213 milliseconds
Script Module: Unity.2D.IK.Runtime.dll
Weave behaviours and messages took7 milliseconds
Find all reader and writers took 301 milliseconds
Weave behaviours and messages took5 milliseconds
Find all reader and writers took 547 milliseconds
Script Module: Unity.2D.SpriteShape.Runtime.dll
Weave behaviours and messages took68 milliseconds
Find all reader and writers took 288 milliseconds
Weave behaviours and messages took147 milliseconds
Find all reader and writers took 576 milliseconds
Script Module: Telepathy.dll
Weave behaviours and messages took3 milliseconds
Find all reader and writers took 219 milliseconds
Find all reader and writers took 1277 milliseconds
Script Module: Mirror.Authenticators.dll
Weave behaviours and messages took7 milliseconds
ProcessSitesModule Mirror.Authenticators.dll elapsed time:00:00:00.0009951
Find all reader and writers took 215 milliseconds
Weave behaviours and messages took68 milliseconds
ProcessSitesModule Mirror.Authenticators.dll elapsed time:00:00:00.0009971
Find all reader and writers took 255 milliseconds
Script Module: Unity.2D.PixelPerfect.dll
Weave behaviours and messages took2 milliseconds
Find all reader and writers took 331 milliseconds
Script Module: Mirror.Examples.Cloud.GUI.dll
Weave behaviours and messages took12 milliseconds
Weave behaviours and messages took3 milliseconds
Loading

0 comments on commit 5f4b6e1

Please sign in to comment.