Пример #1
0
        public World()
        {
            this.assetFile = "";
            this.name = "";
            this.eventFile = "";
            this.mapFile = "";
            this.scriptFile = "";

            this.assets = new AssetsKeeper();
            this.map = new MapInformation();
            this.eventMap = new EventMap();
        }
Пример #2
0
        public World(String name,String assets,String events,String map)
        {
            this.assetFile = assets;
            this.name = name;
            this.eventFile = events;
            this.mapFile = map;
            this.scriptFile = "";

            this.assets = new AssetsKeeper();
            this.map = new MapInformation();
            this.eventMap = new EventMap();
        }
Пример #3
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            //Register the scripting
            PythonObject.getInstance().register();

            //Load the world
            WorldsKeeper.getInstance().init("worlds/world_info.xml");

            //Load the skins
            AssetsKeeper skinnerAssets = new AssetsKeeper();
            skinnerAssets.init("style/assets.xml");
            skinner = new Skinner();
            Style style=new Style();
            style.init("style/style.xml");

            //Connect the style

            //Connect python

            PythonObject.getInstance().getScope().SetVariable("WORLDSKEEPER", WorldsKeeper.getInstance());
            PythonObject.getInstance().getScope().SetVariable("LOG", Log.getInstance());
            PythonObject.getInstance().getScope().SetVariable("WINDOWCONTROL", gController);
            PythonObject.getInstance().getScope().SetVariable("WINDOWSKINNER", skinner);
            PythonObject.getInstance().getScope().SetVariable("MINDER", swMinder);
            PythonObject.getInstance().getScope().SetVariable("WINDOWSTYLE", style);
            PythonObject.getInstance().getScope().SetVariable("PLAYERS", playerCollection);

            PythonObject.getInstance().getScope().SetVariable("ANIMATIONSSPACE", AnimationAssets.getInstance());

            //Load the SimpleGameLib
            string path = Assembly.GetExecutingAssembly().Location;
            string dir = Directory.GetParent(path).FullName;
            string libPath = Path.Combine(dir, "SimpleGameLib.dll");

            Assembly assembly = Assembly.LoadFile(libPath);

            PythonObject.getInstance().getRuntime().LoadAssembly(assembly);

            //Load the SimpleWindowLib
            path = Assembly.GetExecutingAssembly().Location;
            dir = Directory.GetParent(path).FullName;
            libPath = Path.Combine(dir, "SimpleWindow.dll");

            assembly = Assembly.LoadFile(libPath);

            PythonObject.getInstance().getRuntime().LoadAssembly(assembly);

            //The animations

            //Add all animations here
            AnimationAssets.getInstance().addAsset(new AnimationWrapper("idle_animation", new List<string> {"dungeon","lava" }));

            //Player a = new Player("player two", "idle_animation", 50, 200);

            //playerCollection.add(a);

            //Load the start up script

            PythonObject.getInstance().executeString(ScriptKeeper.getInstance().getScript("start_up"));
        }