Beispiel #1
0
 private void client_SaveActorCompleted(object sender, SaveActorCompletedEventArgs e)
 {
     try
     {
         if (e.Result.Success)
         {
             RdlTagCollection tags = RdlTagCollection.FromString(e.Result.TagString);
             if (tags != null)
             {
                 foreach (var actor in tags.GetActors())
                 {
                     var tile = _tiles.Where(t => t.Place.ID == actor.OwnerID).FirstOrDefault();
                     if (tile != null)
                     {
                         tile.Place.Actors.Add(actor);
                         this.PlaceChanged(new PlaceEventArgs(tile.Place));
                     }
                 }
             }
         }
     }
     finally
     {
         ctlWait.Hide();
     }
 }
        private void ProcessQuestTemplates(RdlTagCollection tags)
        {
            // Templates will be actors.
            List <RdlActor> actors = tags.GetActors();

            if (actors.Count > 0)
            {
                this.QuestTemplates.Clear();
                this.QuestTemplates.AddRange(actors);
            }
        }
 private void client_SaveActorCompleted(object sender, SaveActorCompletedEventArgs e)
 {
     try
     {
         if (e.Result.Success)
         {
             RdlTagCollection tags = RdlTagCollection.FromString(e.Result.TagString);
             if (tags != null)
             {
                 foreach (var actor in tags.GetActors())
                 {
                     ctlMap.UpdateActor(actor);
                 }
             }
         }
     }
     finally
     {
         ctlWait.Hide();
     }
 }
        private void ProcessTags(RdlTagCollection tags)
        {
            // AuthKey tags
            this.UpdateAuthKeys(tags.Where(t => t.TagName == "AUTH").Select(t => t as RdlAuthKey));

            // Place Types
            var placeTypes = tags.Where(t => t.TagName == "PLACETYPE" && t.TypeName == "PLACETYPE");

            if (placeTypes.Count() > 0)
            {
                List <string> types = new List <string>();
                foreach (var pt in placeTypes)
                {
                    types.Add(pt.GetArg <string>(0));
                }
                ddlPlaceTypes.ItemsSource = types;
            }

            // Properties
            if (this.Player != null)
            {
                var properties = tags.GetProperties(_playerId);
                if (properties != null && properties.Count > 0)
                {
                    // Location
                    Point3 location = new Point3(this.Player.X, this.Player.Y, this.Player.Z);

                    // Loop through all of the properties.
                    foreach (var item in properties)
                    {
                        // All other properties.
                        this.Player.Properties.SetValue(item.Name, item.Value);
                    }

                    Point3 playerLoc = new Point3(this.Player.X, this.Player.Y, this.Player.Z);
                    if (location != playerLoc)
                    {
                        ctlMap.SetView(playerLoc);
                    }
                }
            }

            int count = tags.GetObjects <RdlPlace>().Count;

            if (count == 1)
            {
                // Place
                RdlPlace place = tags.GetObjects <RdlPlace>().FirstOrDefault();
                if (place != null)
                {
                    _placeId                   = place.ID;
                    _currentLocation           = new Point3(place.X, place.Y, place.Z);
                    txtPlaceName.Text          = place.Name;
                    txtPlaceDesc.Text          = place.Properties.GetValue <string>("Description") ?? String.Empty;
                    ddlPlaceTypes.SelectedItem = place.Properties.GetValue <string>("RuntimeType");
                    ddlTerrain.SelectedItem    = Game.Terrain.Where(t => t.ID == place.Properties.GetValue <int>("Terrain")).FirstOrDefault();
                    ctlMap.Tiles.Add(new Tile(place));
                    ctlMap.SetView(new Point3(this.Player.X, this.Player.Y, this.Player.Z));
                    ctlMap.HideLoading();
                }
                List <RdlActor> actors = tags.GetActors();
                if (actors.Count > 0)
                {
                    lstActors.ItemsSource = actors;
                }
            }
            else if (count > 1)
            {
                // Map
                ctlMap.LoadMap(tags);
                ctlMap.SetView(new Point3(this.Player.X, this.Player.Y, this.Player.Z));
                ctlMap.HideLoading();
            }

            // Chat Messages
            ctlChat.WriteMessages(tags);
        }