Esempio n. 1
0
        private void LoadMap()
        {
            frmOpen      o;
            DialogResult result;
            bool         bResult;

            m_DObj.Clear();
            m_DMonstre.Clear();
            m_DItem.Clear();
            m_OBJ.Clear();
            m_li.Clear();
            m_Mons.Clear();

            o = new frmOpen();

            result         = o.ShowDialog(this);
            m_bOpen        = false;
            picMap.Visible = false;
            this.Cursor    = Cursors.WaitCursor;
            if (result == DialogResult.OK)
            {
                m_CurrentWorld = o.CurrentWorld;
                m_bOpen        = false;
                picMap.Visible = false;
                this.Cursor    = Cursors.WaitCursor;
                try
                {
                    m_Map.Load(m_CurrentWorld);
                    FillLists();
                    m_bOpen        = true;
                    m_bRefresh     = true;
                    m_bResize      = true;
                    picMap.Visible = true;
                    m_WorldOpen    = true;
                    m_worldNew     = false;
                }
                catch
                {
                    Console.WriteLine("Error Loading...");
                }
            }
            m_MenuLogic();
            this.Cursor = Cursors.Default;


            //DialogResult result;

            //dlgLoadMap.Title = "Load Map";
            //dlgLoadMap.Filter = "Map Files (*.map)|*.map|All Files (*.*)|*.*";

            //result = dlgLoadMap.ShowDialog();
            //if (result == DialogResult.OK)
            //{
            //    m_bOpen = false;
            //    picMap.Visible = false;
            //    this.Cursor = Cursors.WaitCursor;
            //    try
            //    {
            //        m_Map.Load(dlgLoadMap.FileName);
            //        m_bOpen = true;
            //        m_bRefresh = true;
            //        picMap.Visible = true;
            //    }
            //    catch
            //    {
            //        Console.WriteLine("Error Loading...");
            //    }
            //    m_MenuLogic();
            //    this.Cursor = Cursors.Default;
            //}
        }
Esempio n. 2
0
        /// <summary>
        /// Auteur : ???
        /// Description : Open a window allowing the user to select a *.map file to load.
        /// Update : Joëlle Boyer -> Added "m_ResizeMap()" so that the map immediately shows the changes made. 2019/11/03
        /// Date : ???
        /// </summary>
        private void LoadMap()
        {
            frmOpen f = new frmOpen();

            f.ShowDialog(this);

            if (f.DialogResult == DialogResult.OK)
            {
                DialogResult   result;
                HugoLand.Monde monde   = f.MyWorld;
                string         myWorld = monde.Id.ToString() + ".map";

                if (File.Exists(myWorld) && f.MyWorld.Id != -1)
                {
                    try
                    {
                        m_Map.Load(myWorld);
                        m_bOpen        = true;
                        m_bRefresh     = true;
                        picMap.Visible = true;
                    }
                    catch
                    {
                        Console.WriteLine("Error Loading Existing File ...");
                    }
                }

                else if (!f.NoFile)
                {
                    dlgLoadMap.Title  = "Load Map";
                    dlgLoadMap.Filter = "Map Files (*.map)|*.map|All Files (*.*)|*.*";

                    result = dlgLoadMap.ShowDialog();

                    if (result == DialogResult.OK)
                    {
                        m_bOpen        = false;
                        picMap.Visible = false;
                        this.Cursor    = Cursors.WaitCursor;
                        try
                        {
                            m_Map.Load(dlgLoadMap.FileName);
                            m_bOpen        = true;
                            m_bRefresh     = true;
                            picMap.Visible = true;
                        }
                        catch
                        {
                            Console.WriteLine("Error Loading Chosen File ...");
                        }
                    }
                }
                else if (f.NoFile && f.MyWorld.Id != -1)
                {
                    m_bOpen        = false;
                    picMap.Visible = false;
                    this.Cursor    = Cursors.WaitCursor;
                    try
                    {
                        m_Map.MapExistingWorld(f.MyWorld.Id);
                        m_bOpen        = true;
                        m_bRefresh     = true;
                        picMap.Visible = true;
                    }
                    catch
                    {
                        Console.WriteLine("Error Loading Chosen File ...");
                    }
                }

                m_ResizeMap();
                m_MenuLogic();
                world       = f.MyWorld;
                this.Cursor = Cursors.Default;
            }
            else
            {
                MessageBox.Show("You have cancelled the opening of a new world.", "Cancelled", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }