private void ChangeCooldown(SkillCooldown s)
        {
            Dispatcher.Invoke(() =>
            {
                if (s.Skill.Name != this.Skill.Name)
                {
                    return;
                }
                NumberTimer.Stop();
                NumberTimer.IsEnabled = true;
                CurrentCD             = (double)s.Cooldown / 1000;
                double newAngle       = (double)s.Cooldown / (double)Cooldown;
                if (newAngle > 1)
                {
                    newAngle = 1;
                }

                if (s.Cooldown > ending)
                {
                    MainTimer.Interval = TimeSpan.FromMilliseconds(s.Cooldown - ending);
                }
                else
                {
                    MainTimer.Interval = TimeSpan.FromMilliseconds(1);
                }

                //arc.BeginAnimation(Arc.EndAngleProperty, null);
                //Console.WriteLine("Animating to newAngle = {1}/{2} {0}", newAngle, s.Cooldown, Cooldown);
                arc.BeginAnimation(Arc.EndAngleProperty, new DoubleAnimation(359.9 * newAngle, 0, TimeSpan.FromMilliseconds(s.Cooldown)));
            });
        }
Exemple #2
0
        /// <summary>
        /// Executed when a new skill is added
        /// </summary>
        /// <param name="sender">Not used</param>
        /// <param name="e">Not used</param>
        /// <param name="sk">Skill cooldown info</param>
        void OnSkillAdded(SkillCooldown sk)
        {
            //sk.Timer.Elapsed += (s, ev) => RemoveSkill(null, null, sk);
            //switch (sk.Type)
            //{
            //    case CooldownType.Skill:
            //        if (sk.Cooldown < SkillManager.LongSkillTreshold)
            //        {
            //            CooldownWindow.AddNormalSkill(sk);
            //        }
            //        else
            //        {
            //            CooldownWindow.AddLongSkill(sk);
            //        }
            //        break;
            //    case CooldownType.Item:
            //        CooldownWindow.AddLongSkill(sk);
            //        break;
            //    default:
            //        break;
            //}

            //sk.Timer.Enabled = true;
            ////Console.WriteLine("Running {0}", sk.Id);
        }
 private static void RouteSkill(SkillCooldown skillCooldown)
 {
     if (skillCooldown.Cooldown == 0)
     {
         CooldownWindowViewModel.Instance.Remove(skillCooldown.Skill);
     }
     else
     {
         CooldownWindowViewModel.Instance.AddOrRefresh(skillCooldown);
     }
 }
Exemple #4
0
 private static void RouteSkill(SkillCooldown skillCooldown)
 {
     if (skillCooldown.Cooldown == 0)
     {
         CooldownWindowViewModel.Instance.Remove(skillCooldown.Skill);
     }
     else
     {
         CooldownWindowViewModel.Instance.AddOrRefresh(skillCooldown);
     }
     App.BaseDispatcher.Invoke(() => SkillStarted?.Invoke());
 }
Exemple #5
0
        void RemoveSkill(SkillCooldown sk)
        {
            //sk.Timer.Stop();
            //queue.Remove(sk);
            //string name = string.Empty;

            //if (SkillsDatabase.SkillIdToName(sk.Id, SessionManager.CurrentClass)!="Unknown")
            //{
            //    name = SkillsDatabase.SkillIdToName(sk.Id, SessionManager.CurrentClass);
            //}
            //else if (BroochesDatabase.GetBrooch(sk.Id) != null)
            //{
            //    name = BroochesDatabase.GetBrooch(sk.Id).Name;
            //}

            //SkillManager.LastSkills.Remove(name);
            //t.Elapsed += (s, o) => RemoveFromMainWindow(sk);
            //t.Start();
            //Console.WriteLine("{0} skill removed", sk.Id);
        }
        static void RouteSkill(SkillCooldown skillCooldown)
        {
            if (skillCooldown.Cooldown == 0)
            {
                ResetSkill(skillCooldown.Skill);
            }

            if (NormalSkillsQueue.ToList().Any(x => x.Skill.Name == skillCooldown.Skill.Name) || LongSkillsQueue.ToList().Any(x => x.Skill.Name == skillCooldown.Skill.Name))
            {
                Refresh?.Invoke(skillCooldown);
            }
            else
            {
                if (skillCooldown.Cooldown < LongSkillTreshold)
                {
                    App.Current.Dispatcher.Invoke(() => NormalSkillsQueue.Add(skillCooldown));
                }
                else
                {
                    App.Current.Dispatcher.Invoke(() => LongSkillsQueue.Add(skillCooldown));
                }
            }
        }