MonoGameGameEngine/Game1.cs
/// <summary>
/// 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.
/// </summary>
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.
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()
        {
            StreamReader sr = new StreamReader(BASE_PATH+"Scenes/TestScenes.lua");
            string scene = sr.ReadToEnd();
            Debug.WriteLine(scene);
            sr.Close();
            DynValue val = Script.RunString("return {"+scene+"}");
            Table scenes = val.Table;
            foreach(DynValue key in scenes.Keys)
            {
                Debug.WriteLine(key.String + ": ");
                Scene newScene = new Scene();
                Table entities = (Table) scenes[key];
                foreach(DynValue key2 in entities.Keys)
                {
                    Entity newEntity = EntityFactory.LoadEntityFromTable((Table) entities[key2], newScene, Content);
                    if (newEntity != null) newScene.AddEntity(newEntity);
                }
                _scenes.Add(key.String, newScene);
            }
            _currentScene = _scenes["Room1"];
            base.Initialize();
        }
protected override void Initialize ( ) { StreamReader sr = new StreamReader ( BASE_PATH + " " ) ; string scene = sr . ReadToEnd ( ) ; Debug . WriteLine ( scene ) ; sr . Close ( ) ; DynValue val = Script . RunString ( " " + scene + " " ) ; Table scenes = val . Table ; foreach ( DynValue key in scenes . Keys ) { Debug . WriteLine ( key . String + " " ) ; Scene newScene = new Scene ( ) ; Table entities = ( Table ) scenes [ key ] ; foreach ( DynValue key2 in entities . Keys ) { Entity newEntity = EntityFactory . LoadEntityFromTable ( ( Table ) entities [ key2 ] , newScene , Content ) ; if ( newEntity != null ) newScene . AddEntity ( newEntity ) ; } _scenes . Add ( key . String , newScene ) ; } _currentScene = _scenes [ " " ] ; base . Initialize ( ) ; }
Allows the game to perform any initialization it needs to before starting to run.
Allows the game to perform any initialization it needs to before starting to run .
// TODO: Add your initialization logic here //Scene test = new Scene(); //Entity fake = new Entity("test", test); // fake.AddComponent(new Location2(fake)); //fake.AddComponent(new Texture2(fake)); //fake.RemoveComponent("Texture2"); //fake.AddComponent("Texture2"); //test.AddEntity(fake); //JObject obj = JObject.Parse("{test:'wow'}"); //Debug.WriteLine("\t" + key2.String + ": " + entities[key2].ToString()); //EntityFactory.LoadEntityFromTable(val.Table, test); //Debug.WriteLine(obj["test"]); //_scenes.Add(test);