Пример #1
0
        public MapEditor(TileBank tb, MapEditorState mes, string mapname)
        {
            InitializeComponent();
            pictureBox1.TileBank = tb;
            this.FormClosing += new FormClosingEventHandler((o, e) => { mes.CloseMapEditor(mapname); });
            vScrollBar1.LargeChange = 1;
            hScrollBar1.LargeChange = 1;

            pictureBox1.MouseMove += new MouseEventHandler((o, e) => {
                mes.coordlabel.Text = "Coords: x=" + mouseoverpointx + ", y=" + mouseoverpointy;
                m_map.ScreenToMapCoords(e.X, e.Y, out mouseoverpointx, out mouseoverpointy);

                if (e.Button == MouseButtons.Left)
                {
                    mes.ApplyFloor(m_map, mouseoverpointx, mouseoverpointy);
                }
            });

            pictureBox1.MouseDown += new MouseEventHandler((o, e) =>
            {
                m_map.ScreenToMapCoords(e.X, e.Y, out mouseoverpointx, out mouseoverpointy);

                if (e.Button == MouseButtons.Left)
                {
                    mes.ApplyFloor(m_map, mouseoverpointx, mouseoverpointy);
                }
            });
        }
Пример #2
0
        public ObjectsAssembly(TileBank gw)
        {
            sb.Append("using System;\n");
            sb.Append("using EmeraldDream;\n");
            sb.Append("using EmeraldLibrary;\n");
            sb.Append("using System.Windows.Forms;\n");
            sb.Append("using System.Collections.Generic;\n");

            sb.Append("namespace EmeraldDream\n");
            sb.Append("{\n");

            this.gw = gw;
        }
Пример #3
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;
        }
Пример #4
0
 public GameControl(TileBank tb)
     : this()
 {
     this.tiles = tb;
 }