Exemplo n.º 1
0
        /// <summary>
        /// Loads the correct "level" data to each of the grid elements,
        /// </summary>
        /// <param name="cursor"></param>
        public void Reload(ILevelSetCursor cursor)
        {
            Log("Begin Reload");

            for (int i = 0; i < kWidth; ++i)
            {
                LevelMetadata level = cursor[i - kFront];

                UIGridLevelElement existing = Get(i);

                // If they already match then we're good.
                if (existing != null && existing.Level == level)
                {
                    continue;
                }

                // If there's no element and no level, also good.
                if (existing == null && level == null)
                {
                    continue;
                }

                if (level != null)
                {
                    // Need to create a new element
                    if (existing == null)
                    {
                        existing = CreateElement(level);
                        Add(existing, i, 0);
                        existing.SetOrientation(baseOrients[i]);
                    }
                    existing.Level = level;
                }
                else
                {
                    // No level, so set element's ref to null.
                    existing.Level = null;
                }
            }

            Log("End Reload");
        }
Exemplo n.º 2
0
        public void StartJumpingCursor(ILevelSetCursor cursor, string searchString)
        {
            if (searchString.Length > 0)
            {
                lock (Synch)
                {
                    int minCompatibility = 0;
                    for (int i = 0; i < levels.Count; ++i)
                    {
                        int compatibility = sorter.JumpCompatibility(levels[i], searchString);
                        if (compatibility > minCompatibility)
                        {
                            cursor.QueryPointer = i;
                            minCompatibility    = compatibility;
                        }
                    }
                }
            }

            cursor.JumpComplete();
        }
        public void CloseCursor(ref ILevelSetCursor icursor)
        {
            LevelSetCursor cursor = icursor as LevelSetCursor;

            if (cursor != null)
            {
                lock (Synch)
                {
                    int index = queries.IndexOf(cursor.Query);

                    if (index >= 0)
                    {
                        ILevelSetQuery query = queries[index];
                        if (0 == query.RemoveCursor(cursor))
                        {
                            queries.RemoveAt(index);
                        }
                    }
                }

                icursor = null;
            }
        }
Exemplo n.º 4
0
 public int RemoveCursor(ILevelSetCursor cursor)
 {
     cursors.Remove((LevelSetCursor)cursor);
     return(cursors.Count);
 }
Exemplo n.º 5
0
 public void AddCursor(ILevelSetCursor cursor)
 {
     cursors.Add((LevelSetCursor)cursor);
 }