+ * - 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:
Nathan Adams
2012-05-28 17:01:03 -05:00
parent b828694e69
commit e31ccc4ed4
6 changed files with 43 additions and 38 deletions

View File

@@ -59,25 +59,5 @@ namespace Axios.Engine
}
}
#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

View File

@@ -40,16 +40,18 @@ namespace Axios.Engine
protected Level Level;
private Camera camera;
#if WINDOWS
AxiosCommandConsole _console = null;
#endif
protected bool AllowKeyboardWhileConsoleIsActive = false;
#if WINDOWS
public AxiosCommandConsole Console
{
get { return _console; }
private set { _console = value; }
}
#endif
public AxiosGameScreen()
: base()
@@ -104,23 +106,23 @@ namespace Axios.Engine
public void AddGameObject(object obj)
{
#if WINDOWS
if (obj is AxiosCommandConsole)
{
if (_console != null)
{
//remove the current one first
#if WINDOWS
ScreenManager.Game.Components.Remove(_console);
_console.Dispose();
#endif
_console = null;
}
_console = (AxiosCommandConsole)obj;
#if WINDOWS
ScreenManager.Game.Components.Add(_console);
_console.LoadContent(ScreenManager.Game.Content);
#endif
}
#endif
if (obj is AxiosGameObject || obj is AxiosUIObject || obj is AxiosTimer)
{
AxiosGameObject tmp = obj as AxiosGameObject;
@@ -388,7 +390,9 @@ namespace Axios.Engine
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);

View File

@@ -1,4 +1,6 @@

using System.Text.RegularExpressions;
namespace Axios.Engine.Extensions
{
public static class AxiosExtensions_String
@@ -16,5 +18,16 @@ namespace Axios.Engine.Extensions
int len = end - start; // Calculate 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;
}
}
}