diff --git a/DepthsBelow/DepthsBelow/Core.cs b/DepthsBelow/DepthsBelow/Core.cs index a9ad307..938c6d4 100755 --- a/DepthsBelow/DepthsBelow/Core.cs +++ b/DepthsBelow/DepthsBelow/Core.cs @@ -1,201 +1,210 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using DepthsBelow.GUI; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Audio; -using Microsoft.Xna.Framework.Content; -using Microsoft.Xna.Framework.GamerServices; -using Microsoft.Xna.Framework.Graphics; -using Microsoft.Xna.Framework.Input; -using Microsoft.Xna.Framework.Media; - -namespace DepthsBelow -{ - /// - /// This is the main type for your game - /// - public class Core : Microsoft.Xna.Framework.Game - { - public static GraphicsDeviceManager GraphicsDeviceManager; - SpriteBatch spriteBatch; - - public Camera Camera; - - public bool PlayerTurn = true; - public static MouseInput MouseInput; - public static KeyboardInput KeyboardInput; - public List Squad; - public List Swarm; - public List Volley; - public static Map Map; - - public SmallEnemy TestMonster; - - public Core() - { - GraphicsDeviceManager = new GraphicsDeviceManager(this); - Content.RootDirectory = "Content"; - - GraphicsDeviceManager.PreferredBackBufferWidth = 1280; - GraphicsDeviceManager.PreferredBackBufferHeight = 720; - GraphicsDeviceManager.IsFullScreen = false; - - //graphics.SynchronizeWithVerticalRetrace = false; - this.IsFixedTimeStep = false; - GraphicsDeviceManager.ApplyChanges(); - - this.IsMouseVisible = true; - } - - /// - /// Allows the game to perform any initialization it needs to before starting to run. - /// This is where it can query for any required services and load any non-graphic - /// related content. Calling base.Initialize will enumerate through any components - /// and initialize them as well. - /// - protected override void Initialize() - { - // TEST LUA - new Lua(); - - // TODO: Add your initialization logic here - Camera = new Camera(this); - Squad = new List(); - Swarm = new List(); - Volley = new List(); - - TestMonster = new SmallEnemy(this, ref Swarm); - - base.Initialize(); - } - - /// - /// LoadContent will be called once per game and is the place to load - /// all of your content. - /// - protected override void LoadContent() - { - // Create a new SpriteBatch, which can be used to draw textures. - spriteBatch = new SpriteBatch(GraphicsDevice); - - Map = Content.Load("maps/Cave.Level1"); - // Load map objects - Map.ParseObjects(this); - - // TODO: use this.Content to load your game content here - Soldier.LoadContent(this); - SmallEnemy.LoadContent(this); - Shot.LoadContent(this); - - MouseInput = new MouseInput(this); - MouseInput.LoadContent(); - KeyboardInput = new KeyboardInput(this); - - TestMonster.X = 12; - TestMonster.Y = 4; - - //frame.Add(text); - } - - /// - /// UnloadContent will be called once per game and is the place to unload - /// all content. - /// - protected override void UnloadContent() - { - // TODO: Unload any non ContentManager content here - } - - /// - /// Allows the game to run logic such as updating the world, - /// checking for collisions, gathering input, and playing audio. - /// - /// Provides a snapshot of timing values. - protected override void Update(GameTime gameTime) - { - // Allows the game to exit - if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) - this.Exit(); - - Camera.Update(gameTime); - MouseInput.Update(gameTime); - KeyboardInput.Update(gameTime); - - // Update soldiers in squad - foreach (var soldier in Squad) - soldier.Update(gameTime); - - foreach (var body in Swarm) - body.Update(gameTime); - - TestMonster.Update(gameTime); - GUIManager.Update(gameTime); - - base.Update(gameTime); - } - - public int FindDistance(Vector2 target, Vector2 start) - { - Vector2 combine = new Vector2(target.X - start.X, target.Y - start.Y); - - int result = 0; - int firstRestult = (int)Math.Sqrt((int)combine.X^2 + (int)combine.Y^2); - - result = (int)Vector2.Distance(target, start); - - return result; - } - - /// - /// This is called when the game should draw itself. - /// - /// Provides a snapshot of timing values. - protected override void Draw(GameTime gameTime) - { - GraphicsDevice.Clear(Color.Black); - - // Start drawing using the Camera transform - spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null, null, - Camera.Transform); - - // Draw the level - Map.Draw(spriteBatch); - - // Draw units - foreach (var soldier in Squad) - { - var sr = soldier.GetComponent(); - if (sr != null) - sr.Draw(spriteBatch); - } - foreach (var body in Swarm) - { - var sr = body.GetComponent(); - if (sr != null) - sr.Draw(spriteBatch); - } - foreach (var bullet in Volley) - { - var sr = bullet.GetComponent(); - if (sr != null) - sr.Draw(spriteBatch); - } - - // Draw mouse input visuals - MouseInput.Draw(spriteBatch); - - TestMonster.GetComponent().Draw(spriteBatch); - - spriteBatch.End(); - - // Start drawing GUI components - spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.AnisotropicClamp, null, null, null, Matrix.Identity); - GUIManager.Draw(spriteBatch); - spriteBatch.End(); - - base.Draw(gameTime); - } - } -} +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using DepthsBelow.GUI; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Audio; +using Microsoft.Xna.Framework.Content; +using Microsoft.Xna.Framework.GamerServices; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Input; +using Microsoft.Xna.Framework.Media; + +namespace DepthsBelow +{ + /// + /// This is the main type for your game + /// + public class Core : Microsoft.Xna.Framework.Game + { + public static GraphicsDeviceManager GraphicsDeviceManager; + SpriteBatch spriteBatch; + + public Lua Lua; + + public Camera Camera; + + public bool PlayerTurn = true; + public static MouseInput MouseInput; + public static KeyboardInput KeyboardInput; + public List Squad; + public List Swarm; + public List Volley; + public static Map Map; + + public SmallEnemy TestMonster; + + public Core() + { + GraphicsDeviceManager = new GraphicsDeviceManager(this); + Content.RootDirectory = "Content"; + + GraphicsDeviceManager.PreferredBackBufferWidth = 1280; + GraphicsDeviceManager.PreferredBackBufferHeight = 720; + GraphicsDeviceManager.IsFullScreen = false; + + //graphics.SynchronizeWithVerticalRetrace = false; + this.IsFixedTimeStep = false; + GraphicsDeviceManager.ApplyChanges(); + + this.IsMouseVisible = true; + + GameServices.AddService(GraphicsDevice); + GameServices.AddService(Content); + } + + /// + /// Allows the game to perform any initialization it needs to before starting to run. + /// This is where it can query for any required services and load any non-graphic + /// related content. Calling base.Initialize will enumerate through any components + /// and initialize them as well. + /// + protected override void Initialize() + { + // TODO: Add your initialization logic here + Camera = new Camera(this); + Squad = new List(); + Swarm = new List(); + Volley = new List(); + + TestMonster = new SmallEnemy(this, ref Swarm); + + // Run scripts after everything is initialized + Lua = new Lua(); + Lua.LoadScripts(); + + base.Initialize(); + } + + /// + /// LoadContent will be called once per game and is the place to load + /// all of your content. + /// + protected override void LoadContent() + { + // Create a new SpriteBatch, which can be used to draw textures. + spriteBatch = new SpriteBatch(GraphicsDevice); + + Map = Content.Load("maps/Cave.Level1"); + // Load map objects + Map.ParseObjects(this); + + // TODO: use this.Content to load your game content here + Soldier.LoadContent(this); + SmallEnemy.LoadContent(this); + Shot.LoadContent(this); + + MouseInput = new MouseInput(this); + MouseInput.LoadContent(); + KeyboardInput = new KeyboardInput(this); + + TestMonster.X = 12; + TestMonster.Y = 4; + + //frame.Add(text); + } + + /// + /// UnloadContent will be called once per game and is the place to unload + /// all content. + /// + protected override void UnloadContent() + { + // TODO: Unload any non ContentManager content here + } + + /// + /// Allows the game to run logic such as updating the world, + /// checking for collisions, gathering input, and playing audio. + /// + /// Provides a snapshot of timing values. + protected override void Update(GameTime gameTime) + { + // Allows the game to exit + if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) + this.Exit(); + + Camera.Update(gameTime); + MouseInput.Update(gameTime); + KeyboardInput.Update(gameTime); + + // Update soldiers in squad + foreach (var soldier in Squad) + soldier.Update(gameTime); + + foreach (var body in Swarm) + body.Update(gameTime); + + TestMonster.Update(gameTime); + GUIManager.Update(gameTime); + + base.Update(gameTime); + } + + public int FindDistance(Vector2 target, Vector2 start) + { + Vector2 combine = new Vector2(target.X - start.X, target.Y - start.Y); + + int result = 0; + int firstRestult = (int)Math.Sqrt((int)combine.X^2 + (int)combine.Y^2); + + result = (int)Vector2.Distance(target, start); + + return result; + } + + /// + /// This is called when the game should draw itself. + /// + /// Provides a snapshot of timing values. + protected override void Draw(GameTime gameTime) + { + GraphicsDevice.Clear(Color.Black); + + // Start drawing using the Camera transform + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null, null, + Camera.Transform); + + // Draw the level + Map.Draw(spriteBatch); + + // Draw units + foreach (var soldier in Squad) + { + var sr = soldier.GetComponent(); + if (sr != null) + sr.Draw(spriteBatch); + } + foreach (var body in Swarm) + { + var sr = body.GetComponent(); + if (sr != null) + sr.Draw(spriteBatch); + } + foreach (var bullet in Volley) + { + var sr = bullet.GetComponent(); + if (sr != null) + sr.Draw(spriteBatch); + } + + // Draw mouse input visuals + MouseInput.Draw(spriteBatch); + + TestMonster.GetComponent().Draw(spriteBatch); + + spriteBatch.End(); + + // Start drawing GUI components + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.AnisotropicClamp, null, null, null, Matrix.Identity); + GUIManager.Draw(spriteBatch); + spriteBatch.End(); + + base.Draw(gameTime); + } + + + } +} diff --git a/DepthsBelow/DepthsBelow/CustomExtensions.cs b/DepthsBelow/DepthsBelow/CustomExtensions.cs new file mode 100755 index 0000000..e597947 --- /dev/null +++ b/DepthsBelow/DepthsBelow/CustomExtensions.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using Microsoft.Xna.Framework.Content; + +namespace DepthsBelow +{ + static class CustomExtensions + { + /// + /// Load all content within a certain folder. The function + /// returns a dictionary where the file name, without type + /// extension, is the key and the texture object is the value. + /// + /// The contentFolder parameter has to be relative to the + /// game.Content.RootDirectory folder. + /// + /// http://danielsaidi.wordpress.com/2010/01/26/xna-load-all-content-files-in-a-folder/ + /// + /// The content type. + /// The content manager for which content is to be loaded. + /// The game project root folder relative folder path. + /// A list of loaded content objects. + public static Dictionary LoadContent(this ContentManager contentManager, string contentFolder) + { + //Load directory info, abort if none + DirectoryInfo dir = new DirectoryInfo(contentManager.RootDirectory + "\\" + contentFolder); + if (!dir.Exists) + throw new DirectoryNotFoundException(); + //Init the resulting list + Dictionary result = new Dictionary(); + + //Load all files that matches the file filter + FileInfo[] files = dir.GetFiles("*.*"); + foreach (FileInfo file in files) + { + string key = Path.GetFileNameWithoutExtension(file.Name); + + result[key] = contentManager.Load(contentFolder + "/" + key); + } + //Return the result + return result; + } + } +} diff --git a/DepthsBelow/DepthsBelow/DepthsBelow.csproj b/DepthsBelow/DepthsBelow/DepthsBelow.csproj index 8de7c25..a11ea38 100644 --- a/DepthsBelow/DepthsBelow/DepthsBelow.csproj +++ b/DepthsBelow/DepthsBelow/DepthsBelow.csproj @@ -10,7 +10,7 @@ DepthsBelow DepthsBelow v4.0 - Client + Client v4.0 Windows HiDef @@ -73,9 +73,6 @@ true - - ..\..\LuaInterface\lua51.dll - ..\..\LuaInterface\LuaInterface.dll False @@ -114,21 +111,17 @@ False - - False - False - - False - False + + diff --git a/DepthsBelow/DepthsBelow/GUI/Frame.cs b/DepthsBelow/DepthsBelow/GUI/Frame.cs index 8f511fa..31ab36f 100755 --- a/DepthsBelow/DepthsBelow/GUI/Frame.cs +++ b/DepthsBelow/DepthsBelow/GUI/Frame.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.Graphics; namespace DepthsBelow.GUI @@ -86,6 +87,11 @@ namespace DepthsBelow.GUI GUIManager.Remove(this); } + public void SetTexture(string fileName) + { + Texture = GameServices.GetService().Load(fileName); + } + public virtual void Update(GameTime gameTime) { foreach (var child in Children) diff --git a/DepthsBelow/DepthsBelow/GameServices.cs b/DepthsBelow/DepthsBelow/GameServices.cs new file mode 100755 index 0000000..afdd61b --- /dev/null +++ b/DepthsBelow/DepthsBelow/GameServices.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.Xna.Framework; + +namespace DepthsBelow +{ + /* + * http://roy-t.nl/index.php/2010/08/25/xna-accessing-contentmanager-and-graphicsdevice-anywhere-anytime-the-gameservicecontainer/ + */ + public static class GameServices + { + private static GameServiceContainer container; + public static GameServiceContainer Instance + { + get { return container ?? (container = new GameServiceContainer()); } + } + + public static T GetService() + { + return (T)Instance.GetService(typeof(T)); + } + + public static void AddService(T service) + { + Instance.AddService(typeof(T), service); + } + + public static void RemoveService() + { + Instance.RemoveService(typeof(T)); + } + } +} diff --git a/DepthsBelow/DepthsBelow/Lua.cs b/DepthsBelow/DepthsBelow/Lua.cs index 46c45ef..18f8792 100755 --- a/DepthsBelow/DepthsBelow/Lua.cs +++ b/DepthsBelow/DepthsBelow/Lua.cs @@ -2,26 +2,110 @@ using System.Collections.Generic; using System.Linq; using System.Text; +using DepthsBelow.GUI; +using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.Input; namespace DepthsBelow { - class Lua + // TODO: The frames created here must be disposed correctly when the Lua context is disposed + static class LuaGUI { + public static GUI.Frame CreateFrame() + { + return new Frame(); + } + public static GUI.Frame CreateFrame(GUI.Frame parent) + { + return new GUI.Frame(parent); + } + + public static GUI.Button CreateButton() + { + return new Button(); + } + public static GUI.Button CreateButton(GUI.Frame parent) + { + return new GUI.Button(parent); + } + } + + public class Lua + { + private LuaInterface.Lua lua; + public Lua() { - LuaInterface.Lua lua = new LuaInterface.Lua(); + ResetContext(); + ExposeLibraries(); - lua.RegisterFunction("GetKeyboardState", null, typeof(DepthsBelow.Lua).GetMethod("GetKeyboardState")); - object[] ret = lua.DoString("return GetKeyboardState()"); - Console.WriteLine(((KeyboardState)ret[0]).ToString()); + /*lua.DoString(@" + local frame = CreateFrame('Frame'); + frame.X = 100; + local button = CreateFrame('Button', frame); + button:SetTexture('images/Enter'); + button.Width = 100; + button.Height = 50; + button.OnClick = function(clickPos) + Console.WriteLine(clickPos.X .. ' ' .. clickPos.Y); + end + ");*/ } - public KeyboardState GetKeyboardState() + public void ExposeLibraries() { - return Keyboard.GetState(); + lua.NewTable("Console"); + lua.RegisterFunction("Console.Write", null, typeof(System.Console).GetMethod("Write", new Type[] { typeof(string) })); + lua.RegisterFunction("Console.WriteLine", null, typeof(System.Console).GetMethod("WriteLine", new Type[] { typeof(string) })); + + // Register GUI creation functions + lua.RegisterFunction("_CreateFrame", null, typeof(LuaGUI).GetMethod("CreateFrame", new Type[] { })); + lua.RegisterFunction("_CreateFrameAsChild", null, typeof(LuaGUI).GetMethod("CreateFrame", new Type[] { typeof(GUI.Frame) })); + lua.RegisterFunction("_CreateButton", null, typeof(LuaGUI).GetMethod("CreateButton", new Type[] { })); + lua.RegisterFunction("_CreateButtonAsChild", null, typeof(LuaGUI).GetMethod("CreateButton", new Type[] { typeof(GUI.Frame) })); + lua.NewTable("GUI"); + /* + * Because Lua can't dynamically call overloads of registered functions, a generic Lua function needs to do the decision making. + * This way we can also dynamically create different frame classes with the same function. + */ + lua.DoString(@" + CreateFrame = function(frameType, parent) + frameType = string.lower(frameType):gsub('^%l', string.upper) + if (parent == nil) then + return _G['_Create' .. frameType]() + else + return _G['_Create' .. frameType .. 'AsChild'](parent) + end + end + "); } + public void ResetContext() + { + if (lua != null) + lua.Dispose(); + lua = new LuaInterface.Lua(); + } + + public void LoadScripts() + { + // Load scripts from script folder + // HACK: This needs to load files on the fly instead of loading precompiled files by the content manager. + // http://xbox.create.msdn.com/en-US/education/catalog/sample/winforms_series_2 maybe? + var scripts = GameServices.GetService().LoadContent("scripts"); + foreach (var script in scripts) + { + try + { + lua.DoString(script.Value); + } + catch (LuaInterface.LuaException e) + { + Console.WriteLine("Lua error: " + e.Message); + } + + } + } } } diff --git a/DepthsBelow/DepthsBelowContent/DepthsBelowContent.contentproj b/DepthsBelow/DepthsBelowContent/DepthsBelowContent.contentproj index d879969..40ea2bf 100644 --- a/DepthsBelow/DepthsBelowContent/DepthsBelowContent.contentproj +++ b/DepthsBelow/DepthsBelowContent/DepthsBelowContent.contentproj @@ -1,138 +1,149 @@ - - - - {433A77A2-DE52-4875-A4EF-232CF59C2DD3} - {96E2B04D-8817-42c6-938A-82C39BA4D311};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Debug - x86 - Library - Properties - v4.0 - v4.0 - bin\$(Platform)\$(Configuration) - Content - - - x86 - - - x86 - - - DepthsBelowContent - - - - False - - - False - - - False - - - False - - - False - - - False - - - - - soldier - TextureImporter - TextureProcessor - - - test - TmxImporter - MapProcessor - - - - - {EC3F6988-459C-4783-89E9-F34C0CC731C7} - TiledLib - - - {D054E3A6-7E05-4255-984F-69FE40D9137F} - DepthsBelowContentPipeline - - - - - aztek - TextureImporter - TextureProcessor - - - - - soldier2 - TextureImporter - TextureProcessor - - - - - collision - TextureImporter - TextureProcessor - - - - - Cave.Level1 - MapProcessor - TmxImporter - Designer - - - - - cave - TextureImporter - TextureProcessor - - - - - Monster - TextureImporter - TextureProcessor - - - - - Enter - TextureImporter - TextureProcessor - - - - - Arial - FontDescriptionImporter - FontDescriptionProcessor - - - - - Shot - TextureImporter - TextureProcessor - - - + + + + {433A77A2-DE52-4875-A4EF-232CF59C2DD3} + {96E2B04D-8817-42c6-938A-82C39BA4D311};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Debug + x86 + Library + Properties + v4.0 + v4.0 + bin\$(Platform)\$(Configuration) + Content + + + x86 + + + x86 + + + DepthsBelowContent + + + + False + + + False + + + False + + + False + + + False + + + False + + + + + soldier + TextureImporter + TextureProcessor + + + test + TmxImporter + MapProcessor + + + + + {EC3F6988-459C-4783-89E9-F34C0CC731C7} + TiledLib + + + {D054E3A6-7E05-4255-984F-69FE40D9137F} + DepthsBelowContentPipeline + + + + + aztek + TextureImporter + TextureProcessor + + + + + soldier2 + TextureImporter + TextureProcessor + + + + + collision + TextureImporter + TextureProcessor + + + + + Cave.Level1 + MapProcessor + TmxImporter + Designer + + + + + cave + TextureImporter + TextureProcessor + + + + + Monster + TextureImporter + TextureProcessor + + + + + Enter + TextureImporter + TextureProcessor + + + + + Arial + FontDescriptionImporter + FontDescriptionProcessor + Designer + + + + + Shot + TextureImporter + TextureProcessor + + + + + gui + LuaImporter + + + test + LuaImporter + + + + --> \ No newline at end of file diff --git a/DepthsBelow/DepthsBelowContent/scripts/gui.lua b/DepthsBelow/DepthsBelowContent/scripts/gui.lua new file mode 100755 index 0000000..f734002 --- /dev/null +++ b/DepthsBelow/DepthsBelowContent/scripts/gui.lua @@ -0,0 +1,10 @@ +local frame = CreateFrame('Frame'); +frame.X = 100; + +local button = CreateFrame('Button', frame); +button:SetTexture('images/Enter'); +button.Width = 100; +button.Height = 50; +button.OnClick = function(clickPos) + Console.WriteLine(clickPos.X .. ' ' .. clickPos.Y); +end \ No newline at end of file diff --git a/DepthsBelow/DepthsBelowContent/scripts/test.lua b/DepthsBelow/DepthsBelowContent/scripts/test.lua new file mode 100755 index 0000000..6a95420 --- /dev/null +++ b/DepthsBelow/DepthsBelowContent/scripts/test.lua @@ -0,0 +1 @@ +Console.WriteLine("Test.lua loaded"); \ No newline at end of file diff --git a/DepthsBelow/DepthsBelowContentPipeline/DepthsBelowContentPipeline.csproj b/DepthsBelow/DepthsBelowContentPipeline/DepthsBelowContentPipeline.csproj index 7ea4248..2d3cea2 100755 --- a/DepthsBelow/DepthsBelowContentPipeline/DepthsBelowContentPipeline.csproj +++ b/DepthsBelow/DepthsBelowContentPipeline/DepthsBelowContentPipeline.csproj @@ -27,6 +27,7 @@ False True + False True @@ -49,6 +50,7 @@ + diff --git a/DepthsBelow/DepthsBelowContentPipeline/LuaImporter.cs b/DepthsBelow/DepthsBelowContentPipeline/LuaImporter.cs new file mode 100755 index 0000000..36c84eb --- /dev/null +++ b/DepthsBelow/DepthsBelowContentPipeline/LuaImporter.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Content.Pipeline; +using Microsoft.Xna.Framework.Content.Pipeline.Graphics; + +// TODO: replace this with the type you want to import. +using TImport = System.String; + +namespace DepthsBelowContentPipeline +{ + /// + /// This class will be instantiated by the XNA Framework Content Pipeline + /// to import a file from disk into the specified type, TImport. + /// + /// This should be part of a Content Pipeline Extension Library project. + /// + /// TODO: change the ContentImporter attribute to specify the correct file + /// extension, display name, and default processor for this importer. + /// + [ContentImporter(".lua", DisplayName = "LUA Importer", DefaultProcessor = "LuaProcessor")] + public class LuaImporter : ContentImporter + { + public override TImport Import(string filename, ContentImporterContext context) + { + return System.IO.File.ReadAllText(filename); + } + } +} \ No newline at end of file