X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=Project06%2FCS%203505%20Project%2006%2FCS%203505%20Project%2006%2FNetworkGame.cs;h=55ab93d6b9be901526064126696dd82eb240b677;hb=ab22d765e9c289860859fe8645e9f9901012ebed;hp=3ce0372be2059e941415307532a715ece59d8055;hpb=8c50e423a4325590132a2e921c73ed3439db7bbc;p=chaz%2Fcarfire diff --git a/Project06/CS 3505 Project 06/CS 3505 Project 06/NetworkGame.cs b/Project06/CS 3505 Project 06/CS 3505 Project 06/NetworkGame.cs index 3ce0372..55ab93d 100644 --- a/Project06/CS 3505 Project 06/CS 3505 Project 06/NetworkGame.cs +++ b/Project06/CS 3505 Project 06/CS 3505 Project 06/NetworkGame.cs @@ -104,10 +104,17 @@ namespace CS_3505_Project_06 mNetworkSession = NetworkSession.EndCreate(result); mNetworkSession.AllowHostMigration = true; mNetworkSession.AllowJoinInProgress = false; - + mNetworkSession.GameStarted += new EventHandler(mNetworkSession_GameStarted); mJoinedSessionDelegate(mNetworkSession, this); } + + //gamestarted event + void mNetworkSession_GameStarted(object sender, GameStartedEventArgs e) + { + Reset(); + } + /// /// Determine whether or not the network game object is associated with any network session. /// @@ -210,7 +217,7 @@ namespace CS_3505_Project_06 mNetworkSession.StartGame(); mNetworkSession.ResetReady(); - Reset(); + //Reset(); } @@ -235,12 +242,18 @@ namespace CS_3505_Project_06 } else if (mNetworkSession.SessionState == NetworkSessionState.Playing) { - if (mGame.IsGameOver(LocalGamerInfo) || mGame.IsTerminated(LocalGamerInfo)) - { - // TODO: Should support moving back to the session lobby. - LeaveSession(); - return; - } + //TODO reset needs to be called for all players, currently LocalGamerInfo throughs exception for all nonhosts + // because in start game reset is only called on hosts games thus other clients never get an updated list + // gamers. + + +//thoughs exeption see TODO above + //if (mGame.IsGameOver(LocalGamerInfo) || mGame.IsTerminated(LocalGamerInfo)) + //{ + // // TODO: Should support moving back to the session lobby. + // LeaveSession(); + // return; + //} if (HaveNeededEvents) {