Ejemplo n.º 1
0
 /// <summary>
 /// Will attempt to add this Drawable to the given DrawSet.
 /// </summary>
 /// <param name="targetDrawSet">The DrawSet this object will be added to.
 /// Note, if this objects priority is not within the targetDrawSet's range of available priorities it will be adjusted to to the closest one</param>
 /// <returns>If True, this was successfully added to the drawSet, if false no changes were made</returns>
 public bool addToDrawSet(DrawSet targetDrawSet)
 {
     if (targetDrawSet != null && (currentDrawSet == null || targetDrawSet != currentDrawSet))
     {
         if (currentDrawSet != null)
         {
             removeFromDrawSet();
         }
         return(targetDrawSet.addToDrawSet(this));
     }
     return(false);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Will set this object priority.
 /// Priority is used to determine draw order, higher priority items are drawn first, lower priority items are drawn last.
 /// Priority is represented by an inteteger value ranging from zero to the max priority
 /// maxpriority is determined by the
 /// </summary>
 /// <returns>If True the prioirity was changed successfully, otherwise returns false</returns>
 public bool setPriority(int newPriority)
 {
     if (newPriority >= 0 && (currentDrawSet == null || newPriority < currentDrawSet.getAvailablePriorities()))
     {
         priority = newPriority;
         if (currentDrawSet != null)
         {
             DrawSet drawSet = currentDrawSet;
             removeFromDrawSet();
             drawSet.addToDrawSet(this);
         }
         return(true);
     }
     return(false);
 }