//-----------------------------------------------------------------------------
// Session.cs
//
// Microsoft XNA Community Game Platform
// Copyright (C) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Xml.Linq;
using System.Xml.Serialization;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using RolePlaying.Data;
namespace RolePlaying
{
class Session
{
///
/// The single Session instance that can be active at a time.
///
private static Session singleton;
///
/// 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); }
}
///
/// 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