Exemplo n.º 1
0
 /// <summary>
 /// 飞出提示文字
 /// </summary>
 /// <param name="text"></param>
 void ShowTipText(string text)
 {
     FlyableText flyableText = new FlyableText() { SpaceLayer = leader.SpaceLayer, Z = leader.Z };
     flyableText.SetNormalText(text, new SolidColorBrush(Colors.Yellow), FontWeights.Bold, 26);
     double x1 = leader.Position.X - flyableText.ContentWidth / 2;
     double y1 = leader.Position.Y - (leader.State == States.Riding ? 185 : 145);
     EventHandler handler = null;
     flyableText.MoveCompleted += handler = delegate {
         flyableText.MoveCompleted -= handler;
         space.RemoveUIElement(flyableText);
     };
     space.AddUIElement(flyableText);
     flyableText.Move(new Point(x1, y1), new Point(x1, y1 - 130), 17, MoveModes.Opacity);
 }
Exemplo n.º 2
0
 /// <summary>
 /// 角色生命值改变
 /// </summary>
 void role_LifeChanged(object sender, ValueEffectEventArgs e)
 {
     RoleBase role = sender as RoleBase;
     if (role != null) {
         if (e.Effect == ValueEffects.Death) {
             space.RemoveRole(role);
         } else {
             FlyableText flyableText = new FlyableText() { SpaceLayer = role.SpaceLayer, Z = role.Z };
             flyableText.SetAttackText(e.Effect, e.ChangedValue);
             double x = role.Position.X - flyableText.ContentWidth / 2;
             double y = role.Position.Y - (role.State == States.Riding ? 185 : 145);
             EventHandler handler = null;
             flyableText.MoveCompleted += handler = delegate {
                 flyableText.MoveCompleted -= handler;
                 space.RemoveUIElement(flyableText);
             };
             space.AddUIElement(flyableText);
             flyableText.Move(new Point(x, y), new Point(x, y - 80), 6.5, MoveModes.InjureText);
         }
     }
 }