//-----------------------------------------------------------------------------
// 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
{
internal const int BACK_BUFFER_WIDTH = 1280;
internal const int BACK_BUFFER_HEIGHT = 720;
///
/// The single Session instance that can be active at a time.
///
private static Session singleton;
internal static Session Singleton => 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); }
}
static GameStartDescription gameStartDesc;
///
/// 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" + Path.DirectorySeparatorChar.ToString()))
{
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 contentManager = singleton.screenManager.Game.Content;
//TODO Map map = content.Load