Пример #1
0
        public List<Node> GetPossibleNode(Map map, Tile Destination)
        {
            List<Node> result = new List<Node>();
            // Bottom
             if (map.ValidCoordinate(tile.X, tile.Y + 1) && map.Tilelist[tile.X, tile.Y + 1].Type != Templar.Tile.TileType.wall)
            {
                result.Add(new Node(map.Tilelist[tile.X, tile.Y + 1], this, Destination));
            }
            // Right
            if (map.ValidCoordinate((tile.X  + 1), tile.Y ) && map.Tilelist[tile.X + 1, tile.Y].Type != Templar.Tile.TileType.wall)
            {
                // result.Add(new Node(map.Tilelist[tile.Y, tile.X+1], this, Destination));
                result.Add(new Node(map.Tilelist[tile.X + 1, tile.Y], this, Destination));
            }

            // Top
            if (map.ValidCoordinate(tile.X, tile.Y - 1) && map.Tilelist[tile.X, tile.Y - 1].Type != Templar.Tile.TileType.wall)
            {
                //result.Add(new Node(map.Tilelist[tile.Y-1, tile.X], this, Destination));
                result.Add(new Node(map.Tilelist[tile.X, tile.Y - 1], this, Destination));
            }
            //Left
            if (map.ValidCoordinate(tile.X - 1, tile.Y) && map.Tilelist[tile.X - 1, tile.Y].Type != Templar.Tile.TileType.wall)
            {
                //result.Add(new Node(map.Tilelist[tile.Y , tile.X - 1], this, Destination));
                result.Add(new Node(map.Tilelist[tile.X - 1, tile.Y], this, Destination));
            }

            return result;
        }
Пример #2
0
        public Donjon(string path)
        {
            int x = 0;
            int y = 0;
            _maps = new Map[5, 5];

            if (System.IO.Directory.GetDirectories(path) != null)
                foreach (string dr in System.IO.Directory.GetDirectories(path))
                {
                    for (int i = 0; i <= Convert.ToInt32(Convert.ToString(dr[5])); i++)
                    {
                        x++;
                        if (x > 4)
                        {
                            x = 0;
                            y++;
                        }
                    }
                    foreach (string file in System.IO.Directory.GetFiles(dr))
                        if (file[7] == 'M')
                        {
                            _maps[x, y] = new Map();
                            _maps[x, y].load(file);
                        }
                }
        }
Пример #3
0
 public EDM(Game game, SpriteBatch spriteBatch)
     : base(game, spriteBatch)
 {
     tile_list = new List<Button>();
     map = new Map();
     cursor = new Cursor(ressource.ARBRE);
     fenetre = new Rectangle(0, 0, game.Window.ClientBounds.Width, game.Window.ClientBounds.Height); //taille de la fenetre
     MediaPlayer.IsMuted = true;
 }
Пример #4
0
 public void Ajout_map(int i, int j, int nb, string path)
 {
     System.IO.Directory.CreateDirectory(@path + @"\Map" + @nb);
     Stream sr = new FileStream(@path + @"\Map" + @nb + @"\Map" + @nb + @".txt", FileMode.Create, FileAccess.ReadWrite);
     sr.Close();
     _maps[i, j] = new Map();
     this.Map[i, j].init(@path + @"\Map" + @nb + @"\Map" + @nb + @".txt");
     this.Map[i, j].isCreate = true;
 }
Пример #5
0
 public switch_map(GamePlayer Player/*, gamemain Main*/, Donjon donjon, string directori)
 {
     player = Player;
     //main = Main;
        Directorie = directori;
     listes_map = new Map[5, 5];
     for (int i = 0; i < 5; i++)
         for (int j = 0; j < 5; j++)
             listes_map[i, j] = donjon.Map[i, j];
     x = (int)donjon.map.X;
     y = (int)donjon.map.Y;
     active_map = listes_map[x, y];
        // active_map.mob = donjon.Map[x, y].mob;
        // active_map.load_mob(@"Donjons\" + @Directorie + @"\Map" + active_map.Nb + @"\creature" + @".txt", main);
 }
Пример #6
0
        public static List<Tile> Astar(Map map, Tile Start, Tile End)
        {
            Nodelist<Node> openlist = new Nodelist<Node>();
            Nodelist<Node> closelist = new Nodelist<Node>();
            List<Node> possibleNode;
            int possibleNodeCount;
            Node StartNode = new Node(Start, null, End);
            List<Tile> sol = new List<Tile>();
            openlist.Add(StartNode);

              while (openlist.Count>0)
            {
                Node current = openlist[0];
                openlist.RemoveAt(0);
                closelist.Add(current);

                if (current.Tile.X==End.X && current.Tile.Y == End.Y)
                {
                    while (current.Parent != null)
                    {
                        sol.Insert(0, current.Tile);
                        current = current.Parent;

                    }
                    return sol;
                }
                possibleNode = current.GetPossibleNode(map, End);
                possibleNodeCount = possibleNode.Count;
                for (int i = 0; i < possibleNodeCount; i++)
                {
                    if (!closelist.Contains(possibleNode[i]))
                    {
                        if (openlist.Contains(possibleNode[i]))
                        {
                            if (possibleNode[i].Heuristic < openlist[possibleNode[i]].Heuristic)
                                openlist[possibleNode[i]].Parent = current;
                        }
                        else
                            openlist.DichotomicInsertion(possibleNode[i]);
                    }
                }

            }
               sol.Add(Start);
               return sol;
        }
        public override void Update(GameTime gameTime)
        {
            lastKeyboardState = keyboardState;
            keyboardState = Keyboard.GetState();

            if (text.Is_shown == false)
                cursor.Update(gameTime, new Vector2(800, 1200));

            text.update();

            //initialise une nouvelle map en faisant aparaitre la textbox
            if (map == null)
                text.Is_shown = true;

            //initialise une nouvelle map
            if (text.Is_shown && keyboardState.IsKeyDown(Keys.Enter))
            {
                Stream sr = new FileStream(text.Saisie + ".txt", FileMode.Create, FileAccess.ReadWrite);
                sr.Close();
                map = new Map(text.Saisie + ".txt");

                text.Is_shown = false;
            }

            //fait l'update de la map si elle existe
            if (map != null)
                map.Update(gameTime, text.Saisie + ".txt",cursor);
            mouse = Mouse.GetState();
        }
Пример #8
0
 public Donjon ReceiveDungeon(gamemain main)
 {
     Thread.Sleep(500);
     MemoryStream m = new MemoryStream();
     Donjon sol = new Donjon();
     Sentstream = client.GetStream();
     BinaryReader t;
     for (int i = 0; i < 5; i++)
     {
         for (int j = 0; j < 5; j++)
         {
             t = new BinaryReader(Sentstream);
             if (t.ReadInt32() == 1)
             {
                 Map transit = new Map();
                 transit.Coffres = /*(Templar.Coffre[,])*/Serialiseur.Deserialize(Sentstream) as Templar.Coffre[,];
                 transit.colision = (int[,])Serialiseur.Deserialize(Sentstream);
                 transit.mob = (Vector2[,])Serialiseur.Deserialize(Sentstream);
                 int caca = t.ReadInt32();
                 for (int k = 0; k < caca; k++)
                 {
                     int a = t.ReadInt32();
                     Vector2 re = (Vector2)Serialiseur.Deserialize(Sentstream);
                     transit.monstre.Add(new NPC(32, 48, 4, 3, a, 15, 2, re, ressource.mob, main.player, transit));
                 }
                 transit.objet = (Vector2[,])Serialiseur.Deserialize(Sentstream);
                 transit.tiles = (Vector2[,])Serialiseur.Deserialize(Sentstream);
                 transit.Tilelist = (Tile[,])Serialiseur.Deserialize(Sentstream);
                 sol.Map[i, j] = transit;
             }
             else
                 sol.Map[i, j] = null;
         }
     }
     sol.map = (Vector2)Serialiseur.Deserialize(client.GetStream());
     sol.position_J = (Vector2)Serialiseur.Deserialize(client.GetStream());
     return sol;
 }
Пример #9
0
 bool coll(Map map)
 {
     bool poissible = false;
     for (int i = 0; i < 32; i++)
         for (int j = 0; j < 32; j++)
             poissible = this.newHitbox.Intersects(new Rectangle(map.Tilelist[i, j].X, map.Tilelist[i, j].Y, 32, 32)) && map.Tilelist[i, j].Type == Templar.Tile.TileType.wall;
     return poissible;
 }
Пример #10
0
        public Donjon(string path, bool edm)
        {
            name = path;
            int x = 0;
            int y = 0;
            _maps = new Map[5, 5];
            if (edm == false)
            {
                load_position(path + @"\autre" + @".txt");
                foreach (string dr in System.IO.Directory.GetDirectories(path))
                {
                    for (int i = 0; i < Convert.ToInt32(Convert.ToString(dr[dr.Length - 2])) * 10 + Convert.ToInt32(Convert.ToString(dr[dr.Length - 1])); i++)
                    {
                        x++;
                        if (x > 4)
                        {
                            x = 0;
                            y++;
                        }
                    }
                    foreach (string file in System.IO.Directory.GetFiles(dr))
                    {
                        if (file[file.Length - 7] == 'b')//1
                        {
                            if (_maps[x, y] == null)
                                _maps[x, y] = new Map();
                            load_coffre(file, @dr + @"\Boxes", _maps[x, y]);
                        }
                        else
                            if (file[file.Length - 9] == 'M')//4
                            {
                                if (_maps[x, y] == null)
                                    _maps[x, y] = new Map();
                                _maps[x, y].Nb = Convert.ToString(file[file.Length - 6]) + Convert.ToString(file[file.Length - 5]);

                                _maps[x, y].load_objet(file);// bug ?oO
                            }
                            else
                                if (file[file.Length - 10] == 'f')//3
                                {
                                    if (_maps[x, y] == null)
                                        _maps[x, y] = new Map();
                                    _maps[x, y].load(file);
                                }
                                else
                                    if (file[file.Length - 13] == 'm')//5
                                    {
                                        if (_maps[x, y] == null)
                                            _maps[x, y] = new Map();
                                        _maps[x, y].load_message(file);
                                        x = 0;
                                        y = 0;
                                    }
                                    else
                                        if (file[file.Length - 15] == 'c')//2
                                        {
                                            if (_maps[x, y] == null)
                                                _maps[x, y] = new Map();
                                            _maps[x, y].load_collision(file);
                                        }
                    }
                }
            }
        }
Пример #11
0
        public void load_coffre(string path, string dr, Map map)
        {
            int nb = 0;
            StreamReader sr = new StreamReader(path);
            for (int j = 0; j < 18; j++)
            {
                for (int i = 0; i < 25; i++)
                {
                    if (sr.Read() == '1')
                    {
                        map.Coffres[i, j] = new Coffre(new Vector2(i * 32, j * 32));
                        if (nb < 10)
                            load_objet(@dr + @"\Box" + @"0" + @nb + @".txt", map.Coffres[i, j]);
                        else
                            load_objet(@dr + @"\Box" + @nb + @".txt", map.Coffres[i, j]);
                        nb++;
                    }
                }
                sr.ReadLine();
            }

            sr.Close();
        }
Пример #12
0
        public void update(GamePlayer player, gamemain main)
        {
            active_map = listes_map[x, y];
            if (player != null)
            {
                if ((active_map.objet[(int)player.Position.X / 32, (int)player.position_player.Y / 32] == new Vector2(0, 4) ||
                    active_map.objet[(int)player.Position.X / 32, (int)player.position_player.Y / 32] == new Vector2(0, 7))
                    && x - 1 >= 0 && listes_map[x - 1, y] != null)
                {
                    x--;
                    player.Position = new Vector2(25 * 32 - 64, player.Position.Y);
                    main.List_Objet_Map.Clear();
                    main.List_Zombie.Clear();
                    main.List_Sort.Clear();
                    main.List_wall.Clear();
                    active_map = listes_map[x, y];
                    //active_map.load_mob(@"Donjons\" + @Directorie + @"\Map" + active_map.Nb + @"\creature" + @".txt", main);
                    main.List_Zombie = active_map.monstre;
                }
                else
                    if ((active_map.objet[(int)player.Position.X / 32, (int)player.position_player.Y / 32] == new Vector2(1, 7) ||
                active_map.objet[(int)player.Position.X / 32, (int)player.position_player.Y / 32] == new Vector2(0, 6))
                && y - 1 >= 0 && listes_map[x, y - 1] != null)
                    {
                        y--;
                        player.Position = new Vector2(player.Position.X, 18 * 32 - 64);
                        main.List_Objet_Map.Clear();
                        main.List_Zombie.Clear();
                        main.List_Sort.Clear();
                        main.List_wall.Clear();
                        active_map = listes_map[x, y];
                        //active_map.load_mob(@"Donjons\" + @Directorie + @"\Map" + active_map.Nb + @"\creature" + @".txt", main);
                        main.List_Zombie = active_map.monstre;
                    }
                    else
                        if ((active_map.objet[(int)player.Position.X / 32, (int)player.position_player.Y / 32] == new Vector2(0, 5) ||
            active_map.objet[(int)player.Position.X / 32, (int)player.position_player.Y / 32] == new Vector2(1, 4))
            && listes_map[x + 1, y] != null)
                        {
                            x++;
                            player.Position = new Vector2(0 + 32, player.Position.Y);
                            if (main.List_Objet_Map != null && main.List_Zombie != null && main.List_Sort != null & main.List_wall != null)
                            {
                                main.List_Objet_Map.Clear();
                                main.List_Zombie.Clear();
                                main.List_Sort.Clear();
                                main.List_wall.Clear();
                            }
                            active_map = listes_map[x, y];
                            //active_map.load_mob(@"Donjons\" + @Directorie + @"\Map" + active_map.Nb + @"\creature" + @".txt", main);
                            main.List_Zombie = active_map.monstre;
                        }
                        else
                            if ((active_map.objet[(int)player.Position.X / 32, (int)player.position_player.Y / 32] == new Vector2(1, 5) ||
            active_map.objet[(int)player.Position.X / 32, (int)player.position_player.Y / 32] == new Vector2(1, 4))
            && listes_map[x, y + 1] != null)
                            {
                                y++;
                                player.Position = new Vector2(player.Position.X, 0 + 32);
                                main.List_Objet_Map.Clear();
                                main.List_Zombie.Clear();
                                main.List_Sort.Clear();
                                main.List_wall.Clear();
                                active_map = listes_map[x, y];
                                //active_map.load_mob(@"Donjons\" + @Directorie + @"\Map" + active_map.Nb + @"\creature" + @".txt", main);
                                main.List_Zombie = active_map.monstre;
                            }

            }
        }
Пример #13
0
 public static void Update(GameTime gameTime, Rectangle tileset, Rectangle fenetre, string path, Map map)
 {
     if (new Rectangle(Data.mouseState.X, Data.mouseState.Y, 1, 1).Intersects(tileset) &&
         Data.mouseState.LeftButton == ButtonState.Pressed &&
         Data.prevMouseState.LeftButton == ButtonState.Released)
     {
         selected = true;
         selected_mob = false;
         selec_obj = false;
         position = false;
         tuto = false;
         ID.X = Math.Abs(((fenetre.Width - Data.mouseState.X) / 32) - 5);
         ID.Y = Data.mouseState.Y / 32;
     }
     if (new Rectangle(Data.mouseState.X, Data.mouseState.Y, 1, 1).Intersects(mobs) &&
         Data.mouseState.LeftButton == ButtonState.Pressed &&
         Data.prevMouseState.LeftButton == ButtonState.Released)
     {
         selected = false;
         selec_obj = false;
         selected_mob = true;
         position = false;
         tuto = false;
         ID.X = (Data.mouseState.X) / 32;
         if (ID.X == 4)
             ID.X = 3;
         ID.Y = 0;
     }
     if (new Rectangle(Data.mouseState.X, Data.mouseState.Y, 1, 1).Intersects(obj) &&
        Data.mouseState.LeftButton == ButtonState.Pressed &&
        Data.prevMouseState.LeftButton == ButtonState.Released && map.active_coffre != null && map.active_coffre.is_open)
     {
         display_name = true;
         selected = false;
         selec_obj = true;
         selected_mob = false;
         tuto = false;
         ID.X = (Data.mouseState.X - obj.X) / 32;
         ID.Y = (Data.mouseState.Y - obj.Y) / 32;
         for (int i = 0; i < 5; i++)
             for (int j = 0; j < 5; j++)
                 if (map.active_coffre.tab[j, i] == null)
                 {
                     map.active_coffre.tab[j, i] = new Items(new Vector2(cursor.ID.X, cursor.ID.Y), cursor.langue);
                     ecrire_coffre(path, map);
                     i = 5;
                     j = 5;
                 }
     }
     if (new Rectangle(Data.mouseState.X, Data.mouseState.Y, 1, 1).Intersects(obj))
         display_name = true;
 }
Пример #14
0
 //ecrit les items dans le coffre
 public static void ecrire_coffre(string path, Map map)
 {
     int nb = 0;
     for (int j = 0; j < 18; j++)
         for (int i = 0; i < 25; i++)
             if (map.Coffres[i, j] != null)
             {
                 StreamWriter sw;
                 if (nb < 10)
                 {
                     Stream Sr = new FileStream(path + @"\box0" + @nb + @".txt", FileMode.Create);
                     Sr.Close();
                     sw = new StreamWriter(path + @"\box0" + @nb + @".txt");
                 }
                 else
                 {
                     Stream Sr = new FileStream(path + @"\box" + nb + @".txt", FileMode.Create);
                     Sr.Close();
                     sw = new StreamWriter(path + @"\box" + @nb + @".txt");
                 }
                 for (int k = 0; k < 5; k++)
                 {
                     for (int l = 0; l < 5; l++)
                         if (map.Coffres[i, j].tab[l, k] != null)
                             sw.Write(vec_to_id(map.Coffres[i, j].tab[l, k].positin_tile));
                         else
                             sw.Write(vec_to_id(new Vector2(15, 15)));
                     sw.WriteLine();
                 }
                 nb++;
                 sw.Close();
             }
 }
Пример #15
0
 public NPC(int taille_image_x, int taille_image_y, int nb_frameLine, int nb__framecolumn, int frame_start, int animation_speed, int speed, Vector2 position,
     Texture2D image, GamePlayer player, Map map)
     : base(taille_image_x, taille_image_y, nb_frameLine, nb__framecolumn, frame_start, animation_speed, speed, position, image)
 {
     this.frameline = nb_frameLine;
     this.position = position;
     this.player = player;
     //partie pour L'A*
     PlayerMoved = false;
     OldPosition = player.Position;
     CanMove = true;
     direction = Direction.None;
     //Fin Partie pour l'A*
     Pv = 100;
     this.Map = map;
     Deleg = new Thread(new ThreadStart(cheminement));
     switch (frame_start)
     {
         case 1:
             Pv = 100;
             attaque = 5;
             defense = 5;
             break;
         case 4:
             Pv = 50;
             attaque = 5;
             defense = 5;
             break;
         case 7:
             attaque = 7;
             defense = 5;
             Pv = 50;
             break;
         case 10:
             attaque = 10;
             defense = 5;
             Pv = 200;
             break;
         case 16:
             attaque = 5;
             defense = 5;
             Pv = 100;
             break;
         case 19:
             attaque = 5;
             defense = 5;
             Pv = 100;
             break;
         case 22:
             attaque = 5;
             defense = 5;
             Pv = 100;
             break;
         case 25:
             attaque = 5;
             defense = 5;
             Pv = 100;
             break;
         case 28:
             attaque = 5;
             defense = 5;
             Pv = 100;
             break;
         case 31:
             attaque = 5;
             defense = 5;
             Pv = 100;
             break;
         case 34:
             attaque = 5;
             defense = 5;
             Pv = 100;
             break;
     }
 }
Пример #16
0
 public override void Update(GameTime gameTime)
 {
     lastKeyboardState = keyboardState;
     keyboardState = Keyboard.GetState();
     text.update();
     //permet de creer le donjon
     if (Donjon == null)
         text.Is_shown = true;
     //donjon creer
     if (text.Is_shown && keyboardState.IsKeyDown(Keys.F1))
     {
         creation_donjon(text.Saisie);
         message.Is_shown = true;
         text.Is_shown = false;
     }
     //si donfon creer alors on update
     if (Donjon != null)
     {
         creation_map();
         selectionmap();
         selectiomessage();
         //met a jour le message de la map
         Donjon.Map[actuel.X, actuel.Y].Message = message.Saisie;
         //check le cursor position joueur
         if (Data.mouseState.LeftButton == ButtonState.Pressed &&
                 Data.prevMouseState.LeftButton == ButtonState.Released &&
                     new Rectangle(Data.mouseState.X, Data.mouseState.Y, 1, 1).Intersects(
                         new Rectangle((int)tileset.X - (int)ressource.ecriture.MeasureString(op1).X, 0, (int)ressource.ecriture.MeasureString(op1).X, (int)ressource.ecriture.MeasureString(op1).Y)))
         {
             cursor.position = true;
             cursor.selected = false;
             cursor.selec_obj = false;
             cursor.selected_mob = false;
             cursor.tuto = false;
         }
         if (Data.mouseState.LeftButton == ButtonState.Pressed &&
                 Data.prevMouseState.LeftButton == ButtonState.Released &&
                     new Rectangle(Data.mouseState.X, Data.mouseState.Y, 1, 1).Intersects(
                         new Rectangle((int)tileset.X - (int)ressource.ecriture.MeasureString(op1).X - (int)ressource.ecriture.MeasureString("Tuto").X - 32, 0, (int)ressource.ecriture.MeasureString("Tuto").X, (int)ressource.ecriture.MeasureString("Tuto").Y)))
         {
             cursor.position = false;
             cursor.selected = false;
             cursor.selec_obj = false;
             cursor.selected_mob = false;
             cursor.tuto = true;
         }
             //sinon on a selectionner la textbox
         if (selec == true)
             message.update();
         //fait l'update de la map
         if (nb < 10)
         {
             Donjon.Map[actuel.X, actuel.Y].Update(gameTime,
                 @"Donjons\" + @text.Saisie + @"\Map" + @"0" + @nb + @"\Map" + @"0" + @nb + @".txt",
                 @"Donjons\" + @text.Saisie + @"\Map" + @"0" + @nb + @"\collision" + @"0" + @nb + @".txt",
                 @"Donjons\" + @text.Saisie + @"\Map" + @"0" + @nb + @"\message" + @"0" + @nb + @".txt",
                 @"Donjons\" + @text.Saisie + @"\Map" + @"0" + @nb + @"\creature" + @".txt",
                 @"Donjons\" + @text.Saisie + @"\Map" + @"0" + @nb + @"\box" + @".txt",
                 @"Donjons\" + @text.Saisie + @"\Map" + @"0" + @nb + @"\Boxes", text);
             cursor.Update(gameTime, tileset, fenetre, @"Donjons\" + @text.Saisie + @"\Map" + @"0" + @nb + @"\Boxes", Donjon.Map[actuel.X, actuel.Y]);
         }
         else
         {
             Donjon.Map[actuel.X, actuel.Y].Update(gameTime,
                 @"Donjons\" + @text.Saisie + @"\Map" + @nb + @"\Map" + @nb + @".txt",
                 @"Donjons\" + @text.Saisie + @"\Map" + @nb + @"\collision" + @nb + @".txt",
                 @"Donjons\" + @text.Saisie + @"\Map" + @nb + @"\message" + @nb + @".txt",
                 @"Donjons\" + @text.Saisie + @"\Map" + @nb + @"\creature" + @".txt",
                 @"Donjons\" + @text.Saisie + @"\Map" + @nb + @"\box" + @".txt",
                 @"Donjons\" + @text.Saisie + @"\Map" + @nb + @"\Boxes", text);
             cursor.Update(gameTime, tileset, fenetre, @"Donjons\" + @text.Saisie + @"\Map" + @nb + @"\Boxes", Donjon.Map[actuel.X, actuel.Y]);
         }
         //change l'endroit de pop du joueur
         if (Data.mouseState.LeftButton == ButtonState.Pressed &&
                 Data.prevMouseState.LeftButton == ButtonState.Released &&
                     new Rectangle(Data.mouseState.X, Data.mouseState.Y, 1, 1).Intersects(new Rectangle(0, 0, 16 * 25, 16 * 18)) &&
                          text.Is_shown == false && cursor.position == true)
         {
             if (prevfirst != null)
             {
                 prevfirst.isfirst = false;
                 position = new Vector2(Data.mouseState.X - Data.mouseState.X % 16, Data.mouseState.Y - Data.mouseState.Y % 16);
                 Donjon.Map[actuel.X, actuel.Y].isfirst = true;
                 prevfirst = Donjon.Map[actuel.X, actuel.Y];
                 ecrire_position(@"Donjons\" + @text.Saisie + @"\autre" + @".txt");
                 cursor.position = false;
             }
             else
             {
                 position = new Vector2(Data.mouseState.X - Data.mouseState.X % 16, Data.mouseState.Y - Data.mouseState.Y % 16);
                 Donjon.Map[actuel.X, actuel.Y].isfirst = true;
                 prevfirst = Donjon.Map[actuel.X, actuel.Y];
                 ecrire_position(@"Donjons\" + @text.Saisie + @"\autre" + @".txt");
                 cursor.position = false;
             }
         }
     }
 }
Пример #17
0
 public void Ajout_map(int i, int j, int nb, string path)
 {
     string nombre;
     if (nb < 10)
         nombre = "0" + Convert.ToString(nb);
     else
         nombre = Convert.ToString(nb);
     System.IO.Directory.CreateDirectory(@"Donjons\" + @path + @"\Map" + @nombre);
     System.IO.Directory.CreateDirectory(@"Donjons\" + @path + @"\Map" + @nombre + @"\Boxes");
     Stream sr1 = new FileStream(@"Donjons\" + @path + @"\Map" + @nombre + @"\Map" + @nombre + @".txt", FileMode.Create, FileAccess.ReadWrite);
     sr1.Close();
     Stream sr2 = new FileStream(@"Donjons\" + @path + @"\Map" + @nombre + @"\fond" + @nombre + @".txt", FileMode.Create, FileAccess.ReadWrite);
     sr2.Close();
     Stream sr3 = new FileStream(@"Donjons\" + @path + @"\Map" + @nombre + @"\collision" + @nombre + @".txt", FileMode.Create, FileAccess.ReadWrite);
     sr3.Close();
     Stream sr4 = new FileStream(@"Donjons\" + @path + @"\Map" + @nombre + @"\message" + @nombre + @".txt", FileMode.Create, FileAccess.ReadWrite);
     sr4.Close();
     _maps[i, j] = new Map();
     this.Map[i, j].init(@"Donjons\" + @path + @"\Map" + @nombre + @"\fond" + @nombre + @".txt");
     this.Map[i, j].init_objet(@"Donjons\" + @path + @"\Map" + @nombre + @"\Map" + @nombre + @".txt");
     this.Map[i, j].init_coll(@"Donjons\" + @path + @"\Map" + @nombre + @"\collision" + @nombre + @".txt");
     this.Map[i, j].init_mob(@"Donjons\" + @path + @"\Map" + @nombre + @"\creature" + @".txt");
     this.Map[i, j].init_box(@"Donjons\" + @path + @"\Map" + @nombre + @"\box" + @".txt");
     this.Map[i, j].isCreate = true;
 }