private void ctlMap_DirectionClick(Perenthia.Controls.DirectionEventArgs e)
 {
     if (e.Direction == "Up" || e.Direction == "Down")
     {
         ctlMap.ShowLoading();
     }
     ServerManager.Instance.SendCommand("ADMINMOVE", e.Direction);
 }
Beispiel #2
0
        private void ctlNav_DirectionClick(DirectionEventArgs e)
        {
            if (_selectedTile != null)
            {
                Direction direction = Direction.FromName(e.Direction);

                // Attempt to create an exit in the specified direction.
                Point3 location = _centerPosition + direction.Value;

                var dest = _tiles.Where(t => t.Location == location).FirstOrDefault();
                if (dest != null && dest.Place != null)
                {
                    // Add an exit to the selected tile in the current direction.
                    _selectedTile.Place.Properties.SetValue(String.Concat("Exit_", direction.Name), true);
                    _selectedTile.IsModified = true;
                    _selectedTile.RefreshExits();

                    // Add an exit to the dest tile in the counter direction.
                    dest.Place.Properties.SetValue(String.Concat("Exit_", direction.CounterDirection.Name), true);
                    dest.IsModified = true;
                    dest.RefreshExits();

                    this.SetSelectedTile(dest);

                    // Move the map in the specified direction.
                    this.SetView(location);
                }
                else
                {
                    MessageBox.Show("A place does not exist in that direction.", "ERROR", MessageBoxButton.OK);
                }
            }
            else
            {
                MessageBox.Show("You must select a tile in order to create exits.", "ERROR", MessageBoxButton.OK);
            }
        }