private async void OnAnimStarted(VisualElement sender, AnimationStartedEventArgs args) { if (_animatedElements.ContainsKey(sender)) { _animatedElements[sender].Cancel(); } var tokenSource = new CancellationTokenSource(); var token = tokenSource.Token; _animatedElements[sender] = tokenSource; var image = (sender as Frame).Content as Image; await Task.Delay(args.Duration / 2); if (token.IsCancellationRequested) { return; } image.Source = args.State == TouchState.Pressed ? "x.png" : "check.png"; _animatedElements.Remove(sender); }
private void OnAnimationStarted(object sender, AnimationStartedEventArgs e) { if (e.animation.Equals(m_animationName)) { m_animationStarted = true; m_onStart?.Invoke(); return; } m_onCancel?.Invoke(); m_animationStarted = false; m_onComplete = null; m_onCancel = null; m_onStart = null; }
public void SetAnimation(string animName, bool animLoops, bool async = true, bool restart = true) { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Expected O, but got Unknown //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Invalid comparison between Unknown and I4 //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Expected O, but got Unknown //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Expected O, but got Unknown bool reachedEndOfAnimation = this.reachedEndOfAnimation; AnimationClip currentAnimation = m_currentAnimation; string text; if (null != currentAnimation) { text = currentAnimation.get_name(); if (text.Equals(animName)) { if (!restart) { return; } m_currentLabel = string.Empty; AnimationState val = m_controller.get_Item(animName); if (val.get_enabled()) { val.set_time(0f); } else { m_controller.Play(animName, 4); } if ((int)m_controller.get_wrapMode() != 2) { this.reachedEndOfAnimation = Mathf.Approximately(0f, currentAnimation.get_length()); if (this.AnimationEnded != null && this.reachedEndOfAnimation) { AnimationEndedEventArgs val2 = new AnimationEndedEventArgs(animName); this.AnimationEnded.Invoke((object)this, val2); } } else { this.reachedEndOfAnimation = false; } return; } } else { text = string.Empty; } m_currentLabel = string.Empty; if (!m_controller.Play(animName, 4)) { Log.Warning("Could not play animation named '" + animName + "' on GameObject named '" + this.get_name() + "'.", 479, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Animations\\FloorMechanismAnimator.cs"); return; } AnimationState val3 = m_controller.get_Item(animName); if (null == val3) { Log.Warning("Could not play animation named '" + animName + "' on GameObject named '" + this.get_name() + "'.", 495, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Animations\\FloorMechanismAnimator.cs"); return; } m_currentAnimation = val3.get_clip(); if ((int)m_controller.get_wrapMode() != 2) { this.reachedEndOfAnimation = (val3.get_time() >= val3.get_length()); } else { this.reachedEndOfAnimation = false; } if (this.AnimationStarted != null) { AnimationStartedEventArgs val4 = new AnimationStartedEventArgs(animName, text, 0); this.AnimationStarted.Invoke((object)this, val4); } if (this.AnimationEnded != null && this.reachedEndOfAnimation && !reachedEndOfAnimation) { AnimationEndedEventArgs val5 = new AnimationEndedEventArgs(animName); this.AnimationEnded.Invoke((object)this, val5); } }