public void Init()
        {
            fa = new ObjectsAssembly(tilebank);

            // Grab tiles
            string[] files = Directory.GetFiles(Path.Combine(resDir, "tiles"), "*.png");
            files.ToList().ForEach(x =>
            {
                string tilename = Path.GetFileNameWithoutExtension(x);
                tilebank.LoadTile(tilename, x);
            });

            // Grab floor types
            string[] floors = Directory.GetFiles(Path.Combine(resDir, "floors"), "*.floor");
            floors.ToList().ForEach(x =>
            {
                string floorname = Path.GetFileNameWithoutExtension(x);
                fa.AddFloor(floorname, x);
            });

            // Grab object types
            string[] objects = Directory.GetFiles(Path.Combine(resDir, "objects"), "*.desc");
            objects.ToList().ForEach(x =>
            {
                string objname = Path.GetFileNameWithoutExtension(x);
                fa.AddObject(objname, x);
            });
            // Compile the types and prepare them
            fa.Compile();

            floortypes = fa.GetFloorTypes();
            objecttypes = fa.GetObjectTypes();

            string[] mapdirs = Directory.GetDirectories(Path.Combine(resDir, "maps"));
            mapdirs.ToList().ForEach(x =>
            {
                MapInfo mi = new MapInfo();
                mi.fulldir = x;
                mi.changed = false;
                mi.map = null;
                maps[Path.GetFileNameWithoutExtension(x)] = mi;
                //Map m = LoadMap(tilebank, x);
                //string mapname = Path.GetFileNameWithoutExtension(x);
                //this.maps[mapname] = m;
            });

            toolwindowtypes["MapList"] = typeof(MapList);
            toolwindowtypes["Floors"] = typeof(Floors);

            selectedFloor = floortypes.First().Value;
        }
Beispiel #2
0
        public Story(GameWindow g, string scriptpath)
        {
            this.game = g;
            this.tb = g.Tiles;
            this.scriptpath = scriptpath;

            // Grab images
            string[] imagefiles = Directory.GetFiles(Path.Combine(scriptpath, "images"), "*.*g");
            imagefiles.ToList().ForEach(x =>
            {
                string imagename = Path.GetFileName(x);
                images.Add(imagename, Image.FromFile(x));
            });

            // Grab tiles
            string[] files = Directory.GetFiles(Path.Combine(scriptpath, "tiles"), "*.png");
            files.ToList().ForEach(x =>
            {
                string tilename = Path.GetFileNameWithoutExtension(x);
                tb.LoadTile(tilename, x);
            });

            ObjectsAssembly fa = new ObjectsAssembly(tb);

            // Grab floor types
            string[] floors = Directory.GetFiles(Path.Combine(scriptpath, "floors"), "*.floor");
            floors.ToList().ForEach(x =>
            {
                string floorname = Path.GetFileNameWithoutExtension(x);
                fa.AddFloor(floorname, x);
            });

            // Grab object types
            string[] objects = Directory.GetFiles(Path.Combine(scriptpath, "objects"), "*.desc");
            objects.ToList().ForEach(x =>
            {
                string objname = Path.GetFileNameWithoutExtension(x);
                fa.AddObject(objname, x);
            });

            // Compile the types and prepare them
            fa.Compile();

            floortypes = fa.GetFloorTypes();
            objecttypes = fa.GetObjectTypes();

            // Grab maps
            string[] maps = Directory.GetDirectories(Path.Combine(scriptpath, "maps"));
            maps.ToList().ForEach(x =>
            {
                Map m = LoadMap(g.canvas,x);
                string mapname = Path.GetFileNameWithoutExtension(x);
                this.maps[mapname] = m;
            });

            currentscene = new PlayScene(null, null);
            g.Scene = currentscene;
            player = null;
            this.m = null;
            narrationdialog = new NarrationDialog(30, 400, 740, 200);
            menudialog = new MenuDialog(30, 400, 740, 200);
            staticImage = new StaticImage(images);
            staticOverlay = new StaticImage(images);

            currentscene.AddLayer(staticImage);
            currentscene.AddLayer(staticOverlay);
            currentscene.AddLayer(narrationdialog);
            currentscene.AddLayer(menudialog);

            //menudialog.SetQuestion("どうする?");
            //menudialog.AddMenuItem("a", "Run");
            //menudialog.AddMenuItem("b", "Pokemon");
            //menudialog.AddMenuItem("c", "LOL What?!");
            //menudialog.Visible = true;
        }