コード例 #1
0
        private void FinalizePlayerDataOnServer(NetworkConnection connection)
        {
            var id = connection.connectionId;

            try {
                // プレイヤーが存在しているかどうかチェックする
                if (!playerDataHolder.ExistPlayerData(id))
                {
                    Debug.LogWarningFormat("[FinalizePlayerDataOnServer] 存在しないプレイヤーが切断しようとしました\nid : {0}",
                                           id);
                    return;
                }

                // 部屋に入っている場合は退室処理を行う
                if (roomDataHolder.ExistRoomByContainPlayer(id))
                {
                    RequestedLeaveRoom(connection, new LeaveRoom.Request());
                }

                playerDataHolder.RemovePlayerData(connection);
            } catch (Exception e) {
                Debug.LogErrorFormat("[FinalizePlayerDataOnServer] 予期せぬエラーが発生しました\nid : {0}", id);
                Debug.LogException(e);
            }
        }