Esempio n. 1
0
        private static void PopulateLocations()
        {
            // Create each location
            Location home = new Location(1, "Home", "Your house. You really need to clean up the place.");
            Location townSquare = new Location(2, "Town square", "You see a fountain.");            

            // Link the locations together
            home.LocationToNorth = townSquare;
            townSquare.LocationToSouth = home;            

            // Add the locations to the static list
            Locations.Add(home);
            Locations.Add(townSquare);
        }
        public Gameplay()
        {
            InitializeComponent();

            using (SoundPlayer player = new SoundPlayer(@"..\..\Audio\theme.wav"))
            {
                player.Play();
            }

            List<InventoryItem> pInventory = new List<InventoryItem>();
            List<PlayerQuest> pQuest = new List<PlayerQuest>();

            pInventory.Add(new InventoryItem(new Longsword(1), 1));

            _player = new Player("Sorrow Woodentears");
            lblHitPoints.Content = _player.CurrentHitPoints.ToString();
            lblGold.Content = _player.Gold.ToString();
            lblExperience.Content = _player.ExperiencePoints.ToString();
            lblLevel.Content = _player.Level.ToString();
            lblName.Content = _player.Name;

            // Map Examples... we need to code this better. Inherit a baselocation, and have several .cs files with locations?
            // Also have random areas, where it takes X number of travels to get by.
            Location home = new Location(1, "Your house", "You really need to clean up the place.");
            Location townSquare = new Location(2, "Town square", "You see a fountain.");
            Location wilderness = new Location(3, "The Wilderness", "Nothing to be seen anywhere.");
            Location oldForest = new Location(4, "Old Forest", "This place is dark and creepy...");
            Location theTemple = new Location(5, "Dark Temple", "An eerie sound comes from the temple.");
            Location smallLake = new Location(6, "A Lake", "You feel like you are being watched.");

            // Link the locations together
            home.LocationToNorth = townSquare;
            townSquare.LocationToSouth = home;
            townSquare.LocationToNorth = wilderness;
            townSquare.LocationToWest = oldForest;
            wilderness.LocationToSouth = townSquare;
            oldForest.LocationToEast = townSquare;
            oldForest.LocationToNorth = theTemple;
            oldForest.LocationToWest = smallLake;
            theTemple.LocationToSouth = oldForest;
            smallLake.LocationToEast = oldForest;

            MoveTo(home);

            _player.CurrentLocation = home;
            _player.Inventory = pInventory;
        }
Esempio n. 3
0
        public static DisplayLocationViewModel  BindToLocation(Model.Location location, List <ResourceType> allResourceTypes)
        {
            if (location == null)
            {
                return(null);
            }

            var model = new DisplayLocationViewModel();

            model.ID          = location.ID;
            model.Name        = location.Name;
            model.Description = location.Description;

            model.Lat = (float)location.Lat;
            model.Lng = (float)location.Lng;

            if (location.LocationDisplaySetting != null)
            {
                model.DisplayName    = location.LocationDisplaySetting.Name;
                model.Zoom           = location.LocationDisplaySetting.Zoom;
                model.MapType        = location.LocationDisplaySetting.MapType;
                model.RenderControls = location.LocationDisplaySetting.RenderControls;
            }
            else
            {
                model.DisplayName    = location.LocationTypeObject.LocationDisplaySetting.Name;
                model.Zoom           = location.LocationTypeObject.LocationDisplaySetting.Zoom;
                model.MapType        = location.LocationTypeObject.LocationDisplaySetting.MapType;
                model.RenderControls = location.LocationTypeObject.LocationDisplaySetting.RenderControls;
            }

            model.Icon            = location.LocationTypeObject.Icon;
            model.TypeName        = location.LocationTypeObject.TypeName;
            model.TypeDescription = location.LocationTypeObject.TypeDescription;
            model.TypeColor       = location.LocationTypeObject.Color;

            // Bind the resources to the View Model
            model.AllResourceTypes = BindResources(allResourceTypes, location.ID);

            return(model);
        }
Esempio n. 4
0
 /// <summary>
 /// Saves the match.
 /// </summary>
 /// <param name="inputLocation">The input location.</param>
 /// <param name="gazetteerLocation">The gazetteer location.</param>
 public void SaveMatch(Location inputLocation, Location gazetteerLocation)
 {
     matchedNames.SaveMatch(inputLocation, gazetteerLocation, gazetteerNames);
     MatchSaved = true;
 }
Esempio n. 5
0
 /// <summary>
 /// Adds the geo codes for the given location
 /// </summary>
 /// <param name="location">The location.</param>
 /// <returns>Location with codes added where found.</returns>
 public CodedLocation AddLocationCodes(Location location)
 {
     return coder.GetCodes(location);
 }
        private void MoveTo(Location newLocation)
        {            
            _player.CurrentLocation = newLocation;

            // Show / Hide Movement buttons
            if (newLocation.LocationToNorth != null)
                btnNorth.Visibility = Visibility.Visible;
            else
                btnNorth.Visibility = Visibility.Hidden;
            if (newLocation.LocationToEast != null)
                btnEast.Visibility = Visibility.Visible;
            else
                btnEast.Visibility = Visibility.Hidden;
            if (newLocation.LocationToSouth != null)
                btnSouth.Visibility = Visibility.Visible;
            else
                btnSouth.Visibility = Visibility.Hidden;
            if (newLocation.LocationToWest != null)
                btnWest.Visibility = Visibility.Visible;
            else
                btnWest.Visibility = Visibility.Hidden;

            rtbLocation.Document.Blocks.Clear();
            rtbLocation.AppendText(newLocation.Name + "\r");

            rtbInformation.Document.Blocks.Clear();
            rtbInformation.AppendText(newLocation.Description);
        }