示例#1
0
        public void Clear()
        {
            lock (window.draw_lock) {
                OnClearRemove?.Invoke();
                OnClearRemove = new Action(() => { });
                on_clear();

                lock (Orb.OrbLock) Orb.All.Clear();
                lock (Blast.BlastLock) Blast.All.Clear();
                lock (ActiveLock) ActiveKeys.AddRange(InactiveKeys);
                InactiveKeys.Clear();
            }
        }
示例#2
0
        public void Sort()
        {
            //Assuming all is alive
            List <Keys> SortedKeys   = new List <Keys>();
            List <int>  SortedPoints = new List <int>();

            SortedKeys.Add(Keys.None);
            SortedPoints.Add(0);

            int pts; byte i;

            lock (ActiveLock) {
                foreach (Keys key in ActiveKeys)
                {
                    pts = HEADS[key].Points;
                    i   = 0;
                    while (true)
                    {
                        if (pts > SortedPoints[i] || i == (byte)(SortedPoints.Count - 1))
                        {
                            SortedPoints.Insert(i, pts);
                            SortedKeys.Insert(i, key);
                            break;
                        }
                        else
                        {
                            i++;
                        }
                    }
                }
                SortedKeys.RemoveAt(SortedKeys.Count - 1);

                ActiveKeys.Clear();
                ActiveKeys.AddRange(SortedKeys);

                int l = ActiveKeys.Count;
                for (sbyte j = (sbyte)(l - 1); j >= 0; j--)
                {
                    HEADS[ActiveKeys[j]].index = (byte)j;
                }
                for (sbyte j = (sbyte)(InactiveKeys.Count - 1); j >= 0; j--)
                {
                    HEADS[InactiveKeys[j]].index = (byte)(j + l);
                }
            }
            IKey.UpdateAll();
        }