コード例 #1
0
 public void OnGameEndRPC()
 {
     HudView.Close();
     EndGameView.EndGame(new List <Photon.Realtime.Player>(PhotonNetwork.PlayerList));
     ScoreExtensions.SetScore(PhotonNetwork.LocalPlayer, 0);
     if (PhotonNetwork.IsMasterClient)
     {
         Controller.Base.Health.DieEvent -= OnGameEnd;
         Controller.StopGame();
         PhotonNetwork.DestroyAll();
     }
 }
コード例 #2
0
ファイル: HudViewManager.cs プロジェクト: Outworldz/waterwars
        /// <summary>
        /// Deregister a hud by its local id
        /// </summary>
        /// <param name="localId"></param>
        /// <returns>The deregistered hud, null if there was no hud registered for this local id.</returns>
        protected HudView DeregisterHudByLocalId(uint localId)
        {
            lock (m_localIdToHud)
            {
                if (m_localIdToHud.ContainsKey(localId))
                {
                    HudView hud = m_localIdToHud[localId];
                    m_localIdToHud.Remove(localId);
                    m_playerIdToHud.Remove(hud.UserId);
                    hud.Close();

                    return(hud);
                }
            }

            return(null);
        }
コード例 #3
0
ファイル: HudViewManager.cs プロジェクト: Outworldz/waterwars
        /// <summary>
        /// Deregister the current hud given a player id
        /// </summary>
        /// <param name="playerId"></param>
        /// <returns>The deregistered hud, null if there was no hud registered for this player.</returns>
        protected HudView DeregisterHudByPlayerId(UUID playerId)
        {
//            m_log.DebugFormat("[WATER WARS]: Deregistering hud for player {0}", playerId);

            lock (m_localIdToHud)
            {
//                // When crossing region borders within the game, we receive the detach event after the attach for the
//                // new region.  To stop things getting complicated, we'll just check whether we can find the player in
//                // any region before taking action.
//                ScenePresence scenePresence = null;
//
//                // Look for the presence in every scene.  If this kind of thing becomes common we will need to refactor the
//                // code
//                foreach (Scene scene in m_controller.Scenes)
//                {
//                    ScenePresence sp = scene.GetScenePresence(playerId);
//                    if (sp != null)
//                    {
//                        scenePresence = sp;
//                        break;
//                    }
//                }

                // and OnIncomingSceneObject messages arrive the other way around!
                if (m_playerIdToHud.ContainsKey(playerId))
                {
                    HudView hud = m_playerIdToHud[playerId];
                    m_localIdToHud.Remove(hud.RootLocalId);
                    m_playerIdToHud.Remove(playerId);
                    hud.Close();

                    return(hud);
                }
            }

            return(null);
        }