+ * - Adding IsNullOrWhiteSpace extension for support for Xbox 360
+ * - Upon some testing - developers will need to use #if WINDOWS/#endif tags to make sure they can't use XNACC in WP7/Xbox360
This commit is contained in:
parent
b828694e69
commit
e31ccc4ed4
@ -93,6 +93,9 @@
|
|||||||
* - Changing IAxiosFile.GetStream() to return Stream instead of FileStream
|
* - Changing IAxiosFile.GetStream() to return Stream instead of FileStream
|
||||||
* - Adding support for XNACC
|
* - Adding support for XNACC
|
||||||
* - Fixed a bug where cleanup actions were being performed in Deactivate instead of Unload in AxiosGameScreen
|
* - Fixed a bug where cleanup actions were being performed in Deactivate instead of Unload in AxiosGameScreen
|
||||||
|
* - Adding IsNullOrWhiteSpace extension for support for Xbox 360
|
||||||
|
* - Upon some testing - developers will need to use #if WINDOWS/#endif tags to make sure they can't use XNACC in WP7/Xbox360
|
||||||
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -59,25 +59,5 @@ namespace Axios.Engine
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
|
||||||
namespace Axios.Engine
|
|
||||||
{
|
|
||||||
public class AxiosCommandConsole
|
|
||||||
{
|
|
||||||
public bool Active = false;
|
|
||||||
public AxiosCommandConsole(AxiosGameScreen gameScreen)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public AxiosCommandConsole(AxiosGameScreen gameScreen, SpriteFont font)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
@ -40,16 +40,18 @@ namespace Axios.Engine
|
|||||||
protected Level Level;
|
protected Level Level;
|
||||||
|
|
||||||
private Camera camera;
|
private Camera camera;
|
||||||
|
#if WINDOWS
|
||||||
AxiosCommandConsole _console = null;
|
AxiosCommandConsole _console = null;
|
||||||
|
#endif
|
||||||
protected bool AllowKeyboardWhileConsoleIsActive = false;
|
protected bool AllowKeyboardWhileConsoleIsActive = false;
|
||||||
|
|
||||||
|
#if WINDOWS
|
||||||
public AxiosCommandConsole Console
|
public AxiosCommandConsole Console
|
||||||
{
|
{
|
||||||
get { return _console; }
|
get { return _console; }
|
||||||
private set { _console = value; }
|
private set { _console = value; }
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
public AxiosGameScreen()
|
public AxiosGameScreen()
|
||||||
: base()
|
: base()
|
||||||
@ -104,23 +106,23 @@ namespace Axios.Engine
|
|||||||
|
|
||||||
public void AddGameObject(object obj)
|
public void AddGameObject(object obj)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
#if WINDOWS
|
||||||
if (obj is AxiosCommandConsole)
|
if (obj is AxiosCommandConsole)
|
||||||
{
|
{
|
||||||
if (_console != null)
|
if (_console != null)
|
||||||
{
|
{
|
||||||
//remove the current one first
|
//remove the current one first
|
||||||
#if WINDOWS
|
|
||||||
ScreenManager.Game.Components.Remove(_console);
|
ScreenManager.Game.Components.Remove(_console);
|
||||||
_console.Dispose();
|
_console.Dispose();
|
||||||
#endif
|
|
||||||
_console = null;
|
_console = null;
|
||||||
}
|
}
|
||||||
_console = (AxiosCommandConsole)obj;
|
_console = (AxiosCommandConsole)obj;
|
||||||
#if WINDOWS
|
|
||||||
ScreenManager.Game.Components.Add(_console);
|
ScreenManager.Game.Components.Add(_console);
|
||||||
_console.LoadContent(ScreenManager.Game.Content);
|
_console.LoadContent(ScreenManager.Game.Content);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if (obj is AxiosGameObject || obj is AxiosUIObject || obj is AxiosTimer)
|
if (obj is AxiosGameObject || obj is AxiosUIObject || obj is AxiosTimer)
|
||||||
{
|
{
|
||||||
AxiosGameObject tmp = obj as AxiosGameObject;
|
AxiosGameObject tmp = obj as AxiosGameObject;
|
||||||
@ -388,7 +390,9 @@ namespace Axios.Engine
|
|||||||
|
|
||||||
public override void HandleInput(GameTime gameTime, InputState input)
|
public override void HandleInput(GameTime gameTime, InputState input)
|
||||||
{
|
{
|
||||||
if ((AllowKeyboardWhileConsoleIsActive && _console.Active) || !_console.Active)
|
#if WINDOWS
|
||||||
|
if (_console == null || !_console.Active || (AllowKeyboardWhileConsoleIsActive && _console.Active) )
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
base.HandleInput(gameTime, input);
|
base.HandleInput(gameTime, input);
|
||||||
|
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
|
|
||||||
namespace Axios.Engine.Extensions
|
namespace Axios.Engine.Extensions
|
||||||
{
|
{
|
||||||
public static class AxiosExtensions_String
|
public static class AxiosExtensions_String
|
||||||
@ -16,5 +18,16 @@ namespace Axios.Engine.Extensions
|
|||||||
int len = end - start; // Calculate length
|
int len = end - start; // Calculate length
|
||||||
return source.Substring(start, len); // Return Substring of length
|
return source.Substring(start, len); // Return Substring of length
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool IsNullOrWhiteSpace(this string str)
|
||||||
|
{
|
||||||
|
if (str == null || str == string.Empty)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (Regex.Match(str, "([:blank:])").Success)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,5 +1,6 @@
|
|||||||
#region Using Statements
|
#if WINDOWS
|
||||||
#if WINDOWS
|
#region Using Statements
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
@ -13,7 +14,6 @@ using System.ComponentModel;
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using XNACC.BaseTypes;
|
using XNACC.BaseTypes;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
#endif
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -69,7 +69,7 @@ using System.Diagnostics;
|
|||||||
|
|
||||||
//NA: XNACC currently is only supported on Windows due to the fact that SortedDictionary is not avaiable on WP7/Xbox 360
|
//NA: XNACC currently is only supported on Windows due to the fact that SortedDictionary is not avaiable on WP7/Xbox 360
|
||||||
//NA: Seriously Microsoft?
|
//NA: Seriously Microsoft?
|
||||||
#if WINDOWS
|
|
||||||
/// <summary>Namespace that contains code related to the XNACC (CommandConsole) component</summary>
|
/// <summary>Namespace that contains code related to the XNACC (CommandConsole) component</summary>
|
||||||
namespace XNACC.Console
|
namespace XNACC.Console
|
||||||
{
|
{
|
||||||
@ -120,7 +120,6 @@ namespace XNACC.Console
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Command Object
|
#region Command Object
|
||||||
/// <summary>This object contains information on a single Command that the console understands.</summary>
|
/// <summary>This object contains information on a single Command that the console understands.</summary>
|
||||||
protected class CmdObject : IComparable< CmdObject >
|
protected class CmdObject : IComparable< CmdObject >
|
||||||
@ -709,7 +708,6 @@ namespace XNACC.Console
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Initialization
|
#region Initialization
|
||||||
/// <summary>Constructor for this base class</summary>
|
/// <summary>Constructor for this base class</summary>
|
||||||
/// <param name="game">The Game object for the owning/managing game</param>
|
/// <param name="game">The Game object for the owning/managing game</param>
|
||||||
@ -818,7 +816,6 @@ namespace XNACC.Console
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Graphics Content
|
#region Graphics Content
|
||||||
/// <summary>Load content for this component</summary>
|
/// <summary>Load content for this component</summary>
|
||||||
/// <param name="content">The ContentManager that should be used </param>
|
/// <param name="content">The ContentManager that should be used </param>
|
||||||
@ -2946,6 +2943,7 @@ namespace XNACC.Console
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
@ -1,10 +1,13 @@
|
|||||||
using System;
|
#if WINDOWS
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Microsoft.Xna.Framework.Input;
|
using Microsoft.Xna.Framework.Input;
|
||||||
|
using Axios.Engine.Extensions;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if WINDOWS
|
|
||||||
/// <summary>Namespace that contains shared types related to the XNACC (CommandConsole) component</summary>
|
/// <summary>Namespace that contains shared types related to the XNACC (CommandConsole) component</summary>
|
||||||
namespace XNACC.BaseTypes
|
namespace XNACC.BaseTypes
|
||||||
{
|
{
|
||||||
@ -53,7 +56,11 @@ namespace XNACC.BaseTypes
|
|||||||
}
|
}
|
||||||
protected set
|
protected set
|
||||||
{
|
{
|
||||||
|
#if WINDOWS || WINDOWS_PHONE7
|
||||||
if (String.IsNullOrWhiteSpace(value))
|
if (String.IsNullOrWhiteSpace(value))
|
||||||
|
#else
|
||||||
|
if (value.IsNullOrWhiteSpace())
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("The name for a console variable cannot be null, empty, or whitespace");
|
throw new ArgumentNullException("The name for a console variable cannot be null, empty, or whitespace");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user