| 
									
										
										
										
											2012-05-26 18:50:49 -05:00
										 |  |  |  | #if WINDOWS | 
					
						
							|  |  |  |  | using System; | 
					
						
							|  |  |  |  | using System.Collections.Generic; | 
					
						
							|  |  |  |  | using System.Linq; | 
					
						
							|  |  |  |  | using System.Text; | 
					
						
							|  |  |  |  | using XNACC.Console; | 
					
						
							|  |  |  |  | using Microsoft.Xna.Framework.Graphics; | 
					
						
							| 
									
										
										
										
											2012-05-26 19:08:33 -05:00
										 |  |  |  | using Microsoft.Xna.Framework.Content; | 
					
						
							|  |  |  |  | using Microsoft.Xna.Framework; | 
					
						
							| 
									
										
										
										
											2012-05-28 22:31:46 -05:00
										 |  |  |  | using Axios.Engine.Log; | 
					
						
							| 
									
										
										
										
											2015-01-02 20:14:38 -06:00
										 |  |  |  | using Axios.Engine.Data; | 
					
						
							| 
									
										
										
										
											2012-05-26 19:08:33 -05:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | /* | 
					
						
							|  |  |  |  |  * The empty AxiosCommandConsole is so that when you use the comamnd console | 
					
						
							|  |  |  |  |  * in your game you don't need #if WINDOWS/#endif precompiler - when you attempt | 
					
						
							|  |  |  |  |  * to use it on WP7/Xbox 360 it just won't do anything. | 
					
						
							|  |  |  |  |  *  | 
					
						
							|  |  |  |  |  * Perhaps one day we should develop a customized console that doesn't require keyboard input | 
					
						
							|  |  |  |  |  * to still allow debugging on WP7/Xbox 360 | 
					
						
							|  |  |  |  |  *  -- Nathan Adams [adamsna@datanethost.net] - 5/26/2012 | 
					
						
							|  |  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2012-05-26 18:50:49 -05:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | namespace Axios.Engine | 
					
						
							|  |  |  |  | { | 
					
						
							| 
									
										
										
										
											2012-05-26 22:53:55 -05:00
										 |  |  |  |     public class AxiosCommandConsole : CommandConsoleBase | 
					
						
							| 
									
										
										
										
											2012-05-26 18:50:49 -05:00
										 |  |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-01-02 20:14:38 -06:00
										 |  |  |  |         public AxiosGameScreen GameScreen; | 
					
						
							| 
									
										
										
										
											2012-06-03 16:58:30 -05:00
										 |  |  |  |         protected List<string> RestrictedCommands = new List<string>(); | 
					
						
							| 
									
										
										
										
											2015-01-02 20:14:38 -06:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |         public bool KeepRunning = false; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-26 18:50:49 -05:00
										 |  |  |  |         public AxiosCommandConsole(AxiosGameScreen gameScreen) | 
					
						
							|  |  |  |  |             : base(gameScreen.ScreenManager.Game) | 
					
						
							|  |  |  |  |         { | 
					
						
							| 
									
										
										
										
											2012-05-29 16:43:50 -05:00
										 |  |  |  |             GameScreen = gameScreen; | 
					
						
							| 
									
										
										
										
											2012-05-26 18:50:49 -05:00
										 |  |  |  |             Keyboard = gameScreen.ScreenManager.InputState; | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         public AxiosCommandConsole(AxiosGameScreen gameScreen, SpriteFont font) | 
					
						
							|  |  |  |  |             : base(gameScreen.ScreenManager.Game, font) | 
					
						
							|  |  |  |  |         { | 
					
						
							| 
									
										
										
										
											2012-05-29 16:43:50 -05:00
										 |  |  |  |             GameScreen = gameScreen; | 
					
						
							| 
									
										
										
										
											2012-05-26 18:50:49 -05:00
										 |  |  |  |             Keyboard = gameScreen.ScreenManager.InputState; | 
					
						
							|  |  |  |  |         } | 
					
						
							| 
									
										
										
										
											2012-05-26 19:08:33 -05:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-26 22:53:55 -05:00
										 |  |  |  |         protected void LoadDefault() | 
					
						
							| 
									
										
										
										
											2012-05-26 19:08:33 -05:00
										 |  |  |  |         { | 
					
						
							|  |  |  |  |             FadeColor = Color.White * 0.5f; | 
					
						
							|  |  |  |  |             Texture2D tmp = new Texture2D(GraphicsDevice, 1, 1); | 
					
						
							|  |  |  |  |             tmp.SetData<Color>(new Color[] { Color.Black }); | 
					
						
							|  |  |  |  |             FadeImage = tmp; | 
					
						
							| 
									
										
										
										
											2012-05-26 22:53:55 -05:00
										 |  |  |  |         } | 
					
						
							| 
									
										
										
										
											2012-05-26 19:08:33 -05:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-28 22:31:46 -05:00
										 |  |  |  |         private void ShowAxiosLog() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             AddOutputToLog("============"); | 
					
						
							|  |  |  |  |             foreach (string l in AxiosLog.Instance.GetLogList()) | 
					
						
							|  |  |  |  |                 AddOutputToLog(l); | 
					
						
							|  |  |  |  |             AddOutputToLog("============"); | 
					
						
							|  |  |  |  |         } | 
					
						
							| 
									
										
										
										
											2012-05-26 22:53:55 -05:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-03 16:58:30 -05:00
										 |  |  |  |         public void ToggleCamera() | 
					
						
							|  |  |  |  |         { | 
					
						
							| 
									
										
										
										
											2012-06-16 17:30:09 -05:00
										 |  |  |  |             AddOutputToLog("Camera user control was: " + ((GameScreen.EnableCameraControl) ? "Disabled" : "Enabled")); | 
					
						
							| 
									
										
										
										
											2012-06-03 16:58:30 -05:00
										 |  |  |  |             GameScreen.EnableCameraControl = !GameScreen.EnableCameraControl; | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-28 22:31:46 -05:00
										 |  |  |  |         public override void InitializeCustomCommands() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             AddCommand(new CmdObject("axioslog", "Displays the current Axios Log", input => { ShowAxiosLog(); })); | 
					
						
							| 
									
										
										
										
											2012-06-03 16:58:30 -05:00
										 |  |  |  |             AddCommand(new CmdObject("tcc", "Toggles user camera control", input => { ToggleCamera(); })); | 
					
						
							| 
									
										
										
										
											2015-01-02 20:14:38 -06:00
										 |  |  |  |             AddCommand(new CmdObject("axiosloglevel", "Outputs axios log level", input => { AddOutputToLog(Settings.Loglevel.ToString()); })); | 
					
						
							|  |  |  |  |             AddCommand(new CmdObject("saveaxiosextlog", "Saves Axios Engine extended log (any log events)", input => { AxiosLog.Instance.writeExtendedLog(); })); | 
					
						
							| 
									
										
										
										
											2012-05-28 22:31:46 -05:00
										 |  |  |  |             base.InitializeCustomCommands(); | 
					
						
							| 
									
										
										
										
											2012-06-03 16:58:30 -05:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-28 22:31:46 -05:00
										 |  |  |  |         } | 
					
						
							| 
									
										
										
										
											2012-05-26 22:53:55 -05:00
										 |  |  |  |         public override void LoadContent(ContentManager content) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             base.LoadContent(content); | 
					
						
							| 
									
										
										
										
											2012-06-03 16:58:30 -05:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |             foreach (string cmd in RestrictedCommands) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 if (ms_commands.Keys.Contains(cmd)) | 
					
						
							|  |  |  |  |                     ms_commands.Remove(cmd); | 
					
						
							|  |  |  |  |             } | 
					
						
							| 
									
										
										
										
											2012-05-26 22:53:55 -05:00
										 |  |  |  |         } | 
					
						
							| 
									
										
										
										
											2012-05-28 22:31:46 -05:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-26 22:53:55 -05:00
										 |  |  |  |         protected override void LoadContent() | 
					
						
							|  |  |  |  |         { | 
					
						
							| 
									
										
										
										
											2012-05-28 22:31:46 -05:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-26 22:53:55 -05:00
										 |  |  |  |             if (Font == null) | 
					
						
							|  |  |  |  |                 Font = Game.Content.Load<SpriteFont>("Console"); | 
					
						
							| 
									
										
										
										
											2012-05-26 19:08:33 -05:00
										 |  |  |  |             base.LoadContent(); | 
					
						
							|  |  |  |  |         } | 
					
						
							| 
									
										
										
										
											2012-05-28 22:31:46 -05:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |         protected override void UnloadContent() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             base.UnloadContent(); | 
					
						
							| 
									
										
										
										
											2012-05-29 16:43:50 -05:00
										 |  |  |  |             //ms_commands.Remove("axioslog"); | 
					
						
							| 
									
										
										
										
											2012-05-28 22:31:46 -05:00
										 |  |  |  |         } | 
					
						
							| 
									
										
										
										
											2012-06-03 16:58:30 -05:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-26 19:08:33 -05:00
										 |  |  |  |     } | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | #else | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-26 18:50:49 -05:00
										 |  |  |  | #endif |