Example #1
0
 /// <summary>
 /// 移除容器中的遮挡物
 /// </summary>
 /// <param name="mask">遮挡物对象</param>
 void RemoveContainerMask(Mask mask)
 {
     container.Children.Remove(mask);
     mask = null;
 }
Example #2
0
 /// <summary>
 /// 移除遮挡物
 /// </summary>
 /// <param name="mask">遮挡物对象</param>
 public void RemoveMask(Mask mask)
 {
     masks.Remove(mask);
     RemoveContainerMask(mask);
 }
Example #3
0
 /// <summary>
 /// 实际地图背景下载完毕
 /// </summary>
 void realMapDownloader_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
 {
     WebClient realMapDownloader = sender as WebClient;
     realMapDownloader.OpenReadCompleted -= realMapDownloader_OpenReadCompleted;
     string[] args = e.UserState.ToString().Split(',');
     //如果异步与同步一致
     if (Convert.ToInt32(args[1]) == index) {
         //呈现实际地图背景
         BodyStretch = Stretch.None;
         BodySource = Global.GetWebImage(string.Format("Scene/{0}/RealMap.jpg", args[0]));
         //加载遮挡物
         IEnumerable<XElement> iMask = info.Element("Masks").Elements();
         for (int i = 0; i < iMask.Count(); i++) {
             XElement xMask = iMask.ElementAt(i);
             Mask mask = new Mask() {
                 BodySource = Global.GetWebImage(string.Format("Scene/{0}/Mask/{1}.png", args[0], xMask.Attribute("Code").Value)),
                 Opacity = (double)xMask.Attribute("Opacity"),
                 Coordinate = new Point((double)xMask.Attribute("X") - Offset.X, (double)xMask.Attribute("Y") - Offset.Y),
                 Z = (int)xMask.Attribute("Z") - Offset.Y
             };
             AddMask(mask);
         }
         //加载动画
         IEnumerable<XElement> iAnimation = info.Element("Animations").Elements();
         for (int i = 0; i < iAnimation.Count(); i++) {
             XElement xAnimation = iAnimation.ElementAt(i);
             Animation animation = new Animation() {
                 Code = (int)xAnimation.Attribute("Code"),
                 Opacity = (double)xAnimation.Attribute("Opacity"),
                 Coordinate = new Point((double)xAnimation.Attribute("X") - Offset.X, (double)xAnimation.Attribute("Y") - Offset.Y),
                 Z = (int)xAnimation.Attribute("Z") - Offset.Y,
                 Tip = xAnimation.Attribute("Tip").Value,
             };
             AddAnimation(animation);
         }
     }
 }
Example #4
0
 /// <summary>
 /// 添加遮挡物
 /// </summary>
 /// <param name="mask">遮挡物对象</param>
 public void AddMask(Mask mask)
 {
     masks.Add(mask);
     container.Children.Add(mask);
 }