示例#1
0
 public void AddSpriteSheetListener(ISpriteSheetListener listener, int secuence, int frame)
 {
     if(secuence >= 0 && secuence < SecuenceCount){
         if(frame >= 0 && frame < sequenceFrameCount[secuence]){
             int absoluteFrame = sequences[secuence].InitFrame + frame;
             List<ISpriteSheetListener> list;
             if(frameListeners.ContainsKey(absoluteFrame)){
                 list = frameListeners[absoluteFrame];
             }else{
                 list = new List<ISpriteSheetListener>();
                 frameListeners.Add(absoluteFrame, list);
             }
             if(!list.Contains(listener)){
                 list.Add(listener);
             }
         }else{
             throw new InvalidFrameException(frame);
         }
     }else{
         throw new InvalidSecuenceException(secuence);
     }
 }
示例#2
0
 public void AddSpriteSheetListener(ISpriteSheetListener listener, Enum secuence, int frame)
 {
     int requested = Convert.ToInt32(secuence);
     if(requested >= 0 && requested < SecuenceCount){
         if(frame >= 0 && frame < sequenceFrameCount[requested]){
             int absoluteFrame = sequences[requested].InitFrame + frame;
             List<ISpriteSheetListener> list;
             if(frameListeners.ContainsKey(absoluteFrame)){
                 list = frameListeners[absoluteFrame];
             }else{
                 list = new List<ISpriteSheetListener>();
                 frameListeners.Add(absoluteFrame, list);
             }
             if(!list.Contains(listener)){
                 list.Add(listener);
             }
         }else{
             throw new InvalidFrameException(frame);
         }
     }else{
         throw new InvalidSecuenceException(secuence);
     }
 }
示例#3
0
 public void AddSpriteSheetListener(ISpriteSheetListener listener)
 {
     if (!listeners.Contains(listener)){
         listeners.Add(listener);
     }
 }
示例#4
0
 public void RemoveSpriteSheetListener(ISpriteSheetListener listener)
 {
     listeners.Remove(listener);
     foreach(List<ISpriteSheetListener> list in frameListeners.Values){
         if(list.Contains(listener)){
             list.Remove(listener);
         }
     }
 }