public void NotifySkillUse(ActionLog log) { Application.Current.Dispatcher.Invoke((ThreadStart)delegate() { Trace.Assert(log.Source != null); PlayerViewBase player = playersMap[log.Source]; if (log.SkillAction != null) { string key1 = string.Format("{0}.Animation", log.SkillAction.GetType().Name); string key2 = key1 + ".Offset"; bool animPlayed = false; lock (equipAnimationResources) { if (equipAnimationResources.Contains(key1)) { AnimationBase animation = equipAnimationResources[key1] as AnimationBase; if (animation != null && animation.Parent == null) { Point offset = new Point(0, 0); if (equipAnimationResources.Contains(key2)) { offset = (Point)equipAnimationResources[key2]; } player.PlayAnimation(animation, 0, offset); animPlayed = true; } } } if (log.SkillAction.IsSingleUse || log.SkillAction.IsAwakening) { ExcitingSkillAnimation anim = new ExcitingSkillAnimation(); anim.SkillName = log.SkillAction.GetType().Name; anim.HeroName = log.Source.Hero.Name; gridRoot.Children.Add(anim); anim.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch; anim.VerticalAlignment = System.Windows.VerticalAlignment.Stretch; anim.Start(); animPlayed = true; } if (!animPlayed && player != mainPlayerPanel) { string s = LogFormatter.Translate(log.SkillAction); if (s != string.Empty) { ZoomTextAnimation anim = new ZoomTextAnimation() { Text = s }; player.PlayAnimation(anim, 1, new Point(0, 0)); animPlayed = true; } } string soundKey = log.SkillAction.GetType().Name; Uri uri = GameSoundLocator.GetSkillSound(soundKey, log.SpecialEffectHint); GameSoundPlayer.PlaySoundEffect(uri); } if (log.CardAction != null) { if (log.CardAction.Type is Shan) { player.PlayAnimation(new ShanAnimation(), 0, new Point(0, 0)); } else if (log.CardAction.Type is RegularSha) { AnimationBase sha; if (log.CardAction.SuitColor == SuitColorType.Red) { sha = new ShaAnimation(); } else { sha = new ShaAnimation2(); } player.PlayAnimation(sha, 0, new Point(0, 0)); } else if (log.CardAction.Type is TieSuoLianHuan) { foreach (var p in log.Targets) { playersMap[p].PlayIronShackleAnimation(); } } bool? isMale = null; if (log.Source != null) isMale = !log.Source.IsFemale; Uri cardSoundUri = GameSoundLocator.GetCardSound(log.CardAction.Type.CardType, isMale); var card = log.CardAction as Card; if (card != null) { bool play = true; if (card.Log != null && card.Log.SkillAction is IEquipmentSkill) { Uri uri = GameSoundLocator.GetSkillSound(card.Log.SkillAction.GetType().Name); if (uri != null) play = false; } if (play) GameSoundPlayer.PlaySoundEffect(cardSoundUri); } } if (log.Targets.Count > 0) { _LineUp(log.Source, log.Targets); foreach (var target in log.Targets) { target.IsTargeted = true; } } gameLogs.AppendLog(log); rtbLog.ScrollToEnd(); _AppendKeyEventLog(log); }); }
public void NotifySkillUse(ActionLog log) { Application.Current.Dispatcher.Invoke((ThreadStart)delegate() { Trace.Assert(log.Source != null); PlayerViewBase player = playersMap[log.Source]; if (log.SkillAction != null) { string key1 = string.Format("{0}.Animation", log.SkillAction.GetType().Name); string key2 = key1 + ".Offset"; bool animPlayed = false; lock (equipAnimationResources) { if (equipAnimationResources.Contains(key1)) { AnimationBase animation = equipAnimationResources[key1] as AnimationBase; if (animation != null && animation.Parent == null) { Point offset = new Point(0, 0); if (equipAnimationResources.Contains(key2)) { offset = (Point)equipAnimationResources[key2]; } player.PlayAnimation(animation, 0, offset); animPlayed = true; } } } if (!animPlayed && player != mainPlayerPanel) { string s = LogFormatter.Translate(log.SkillAction); if (s != string.Empty) { ZoomTextAnimation anim = new ZoomTextAnimation() { Text = s }; player.PlayAnimation(anim, 1, new Point(0, 0)); animPlayed = true; } } } if (log.CardAction != null) { if (log.CardAction.Type is Shan) { player.PlayAnimation(new ShanAnimation(), 0, new Point(0, 0)); } else if (log.CardAction.Type is RegularSha) { AnimationBase sha; if (log.CardAction.SuitColor == SuitColorType.Red) { sha = new ShaAnimation(); } else { sha = new ShaAnimation2(); } player.PlayAnimation(sha, 0, new Point(0, 0)); } else if (log.CardAction.Type is TieSuoLianHuan) { foreach (var p in log.Targets) { playersMap[p].PlayIronShackleAnimation(); } } } if (log.Targets.Count > 0) { _LineUp(log.Source, log.Targets); foreach (var target in log.Targets) { target.IsTargeted = true; } } gameLogs.AppendLog(log); rtbLog.ScrollToEnd(); }); }