#region File Description
//-----------------------------------------------------------------------------
// Session.cs
//
// Microsoft XNA Community Game Platform
// Copyright (C) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
#endregion
#region Using Statements
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Xml;
using System.Xml.Serialization;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Storage;
using RolePlayingGameData;
#endregion
namespace RolePlaying
{
class Session
{
#region Singleton
///
/// The single Session instance that can be active at a time.
///
private static Session singleton;
#endregion
#region Party
///
/// The party that is playing the game right now.
///
private Party party;
///
/// The party that is playing the game right now.
///
public static Party Party
{
get { return (singleton == null ? null : singleton.party); }
}
#endregion
#region Map
///
/// Change the current map, arriving at the given portal if any.
///
/// The asset name of the new map.
/// The portal from the previous map.
public static void ChangeMap(string contentName, Portal originalPortal)
{
// make sure the content name is valid
string mapContentName = contentName;
if (!mapContentName.StartsWith(@"Maps\"))
{
mapContentName = Path.Combine(@"Maps", mapContentName);
}
// check for trivial movement - typically intra-map portals
if ((TileEngine.Map != null) && (TileEngine.Map.AssetName == mapContentName))
{
TileEngine.SetMap(TileEngine.Map, originalPortal == null ? null :
TileEngine.Map.FindPortal(originalPortal.DestinationMapPortalName));
}
// load the map
ContentManager content = singleton.screenManager.Game.Content;
Map map = content.Load