示例#1
0
        //public static int CharacterCount { get { return _characterCount; } set {_characterCount = value; } }

        public MapCharacterForm(CharacterListManager characterListManager, MapManager mapManager, int mapIndex)
        {
            InitializeComponent();
            _characterListManager = characterListManager;
            _mapManager           = mapManager;
            _mapIndex             = mapIndex;
            //_characterIndex = characterIndex;
            //_mapForm = mapForm; // also shouldn't need this... I hope
        }
        // This constructor loads the mapManager, characterListManager, and the map index into their respective
        // instance variables
        public MapForm(MapManager mapManager, int mapIndex, CharacterListManager characterListManager)
        {
            InitializeComponent();
            _mapIndex             = mapIndex;
            _mapManager           = mapManager;
            _characterListManager = characterListManager;
            try
            {
                this.lstMap.BackgroundImage = Image.FromFile(AppData.MapDataPath + @"\" + _mapManager.MapList[mapIndex].ImageFilename);
            }
            catch (Exception)
            {
                // message shown if the map chosen is not in the appropriate file
                MessageBox.Show("Could not find the map you selected");

                this.Close();
            }
            //_characterListManager.addCharacters(0);
            PopulateList();
        }
示例#3
0
 // This button will take the highlighted map and use it to load a new map form.
 private void btnChooseMap_Click(object sender, EventArgs e)
 {
     if (this.lstMaps.SelectedIndices.Count > 0)
     {
         this.Hide();
         CharacterListManager characterListManager = new CharacterListManager();
         var mapForm = new MapForm(_mapManager, lstMaps.SelectedIndices[0], characterListManager);
         try
         {
             mapForm.ShowDialog();
             this.Close();
         }
         catch (Exception)
         {
         }
     }
     else
     {
         MessageBox.Show("Please make a selection.");
     }
 }
        // When the form is loaded a new empty character List manageger object is instantiated
        private void MapForm_Load(object sender, EventArgs e)
        {
            CharacterListManager _characterListManager = new CharacterListManager();

            PopulateMap();
        }