static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); GameWindow g = new GameWindow(); Story s = new Story(g, "res"); s.LoadNew(); //Scene s = new Scene(null); //g.Scene = s; //NarrationDialog d = new NarrationDialog(50, 400, 700, 200); //d.ResetAnimation(); //s.AddLayer(d); //s.KeyDown += new EventHandler<KeyEventArgs>((o, e) => //{ // d.Visible = true; // string[] lines = new string[] { "Hello", "I am a narration dialog", "wahaha", "こんにちは","私は今日あなたのゲームのナレータです。ここから私の声だけを聞こえます。","ご協力してくれてありがとうございました" }; // d.SetNarration(lines); //}); Application.Run(g); }
public TileSelection(GameWindow win) { InitializeComponent(); this.win = win; // Grab tiles string[] files = Directory.GetFiles("res/res/tiles", "*.png"); files.ToList().ForEach(x => { RadioButton cb = new RadioButton(); cb.Appearance = Appearance.Button; cb.Image = Bitmap.FromFile(x); cb.Size = new Size(32, 32); flow_tiles.Controls.Add(cb); string tilename = Path.GetFileNameWithoutExtension(x); cb.Tag = win.LoadTile(tilename, x); cb.CheckedChanged += new EventHandler((ob, ev) => { selectedtile = (int)cb.Tag; }); }); MapList ml = new MapList(); ml.Show(); (flow_tiles.Controls[0] as RadioButton).Checked = true; // Make the selection box Bitmap box = new Bitmap(32, 32); using (Graphics gfx = Graphics.FromImage(box)) { gfx.FillRectangle(new SolidBrush(Color.FromArgb(0, Color.Black)), new Rectangle(0, 0, 32, 32)); gfx.DrawRectangle(new Pen(Color.Cyan), new Rectangle(0, 0, 31, 31)); } selectionbox = new AnObject(win.LoadTile("selection", box)); m = new Map(win, 30, 30); m.CheckPassable = false; m.SetCeiling(selectionbox, 0, 0); m.FillFloor(new FloorTile(0)); s = new Scene(m); win.Scene = s; // Set up the keys s.KeyDown += new EventHandler<KeyEventArgs>((o, e) => { m.SetCeiling(null, m.CameraX, m.CameraY); switch (e.KeyCode) { case Keys.Up: m.CameraY--; break; case Keys.Down: m.CameraY++; break; case Keys.Left: m.CameraX--; break; case Keys.Right: m.CameraX++; break; case Keys.Space: m.SetFloor(new FloorTile(selectedtile), m.CameraX, m.CameraY); break; //case Keys.Escape: // mnu.Visible = !mnu.Visible; // break; } m.SetCeiling(selectionbox, m.CameraX, m.CameraY); }); }
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; }