优化数组操作,新增 NSMutableArray 的安全方法,包括安全移除、插入和替换对象,确保在索引超出范围时不发生崩溃。更新相关文件以使用新方法,保持代码结构一致性。
This commit is contained in:
@@ -288,6 +288,7 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
||||
///自己的隐身进房提示
|
||||
- (void)createEnterHideAnimation {
|
||||
NSDictionary * dic= @{@"title":@"隐身进房",
|
||||
@"isMe":@"",
|
||||
@"experLevelSeq":@"",
|
||||
@"effectPath" : @""};
|
||||
[self.enterRoomAnimationQueue addObject:dic];
|
||||
@@ -315,7 +316,9 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
||||
|
||||
// 取出队列头部的动画信息并移除
|
||||
NSDictionary *dic = [self.enterRoomAnimationQueue firstObject];
|
||||
[self.enterRoomAnimationQueue removeObjectAtIndex:0];
|
||||
if (self.enterRoomAnimationQueue.count > 0) {
|
||||
[self.enterRoomAnimationQueue xpSafeRemoveObjectAtIndex:0];
|
||||
}
|
||||
|
||||
NSString *title = [dic objectForKey:@"title"];
|
||||
if ([title isEqualToString:@"隐身进房"]) {
|
||||
@@ -526,7 +529,9 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
||||
|
||||
// 从队列中取出第一个元素并移出队列
|
||||
AttachmentModel *nextAttachment = [self.roomBannertModelsQueueV2 firstObject];
|
||||
[self.roomBannertModelsQueueV2 removeObjectAtIndex:0];
|
||||
if (self.roomBannertModelsQueueV2.count > 0) {
|
||||
[self.roomBannertModelsQueueV2 xpSafeRemoveObjectAtIndex:0];
|
||||
}
|
||||
|
||||
// 设置为正在显示的状态
|
||||
self.isRoomBannerV2Displaying = YES;
|
||||
@@ -920,7 +925,9 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
||||
|
||||
- (void)nextCarEffect {
|
||||
if (self.carEffectQueue.count > 0) {
|
||||
[self.carEffectQueue removeObjectAtIndex:0];
|
||||
if (self.carEffectQueue.count > 0) {
|
||||
[self.carEffectQueue xpSafeRemoveObjectAtIndex:0];
|
||||
}
|
||||
}
|
||||
if (self.carEffectQueue.count > 0) {
|
||||
[self playCarEffect:self.carEffectQueue.firstObject];
|
||||
@@ -1552,7 +1559,7 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
||||
}
|
||||
if (model.enterHide) {
|
||||
//隐身进房
|
||||
if ([message.from isEqualToString:[AccountInfoStorage instance].getUid]) {
|
||||
if (model.uid == [AccountInfoStorage instance].getUid.integerValue) {
|
||||
[self createEnterHideAnimation];
|
||||
}
|
||||
} else {
|
||||
@@ -2268,7 +2275,9 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
||||
- (void)removeFromSvgaQueueAtIndex:(NSInteger)index {
|
||||
dispatch_async(self.giftEffectsQueue, ^{
|
||||
if (index < self.svgaQueue.count) {
|
||||
[self.svgaQueue removeObjectAtIndex:index];
|
||||
if (index < self.svgaQueue.count) {
|
||||
[self.svgaQueue xpSafeRemoveObjectAtIndex:index];
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2404,7 +2413,7 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
||||
[tarrowVeiw removeFromSuperview];
|
||||
self.isPlayOfB = NO;
|
||||
if (self.animationListB.count > 0) {
|
||||
[self.animationListB removeObjectAtIndex:0];
|
||||
[self.animationListB xpSafeRemoveObjectAtIndex:0];
|
||||
}
|
||||
[self playAnimationWithModel];
|
||||
}
|
||||
@@ -2455,7 +2464,7 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
||||
if (finished) {
|
||||
[luckyGiftEffectView removeFromSuperview];
|
||||
if (self.animationListB.count > 0) {
|
||||
[self.animationListB removeObjectAtIndex:0];
|
||||
[self.animationListB xpSafeRemoveObjectAtIndex:0];
|
||||
}
|
||||
self.isPlayOfB = NO;
|
||||
[self playAnimationWithModel];
|
||||
@@ -2510,7 +2519,7 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
||||
[candyTreeView removeFromSuperview];
|
||||
self.isPlayOfB = NO;
|
||||
if (self.animationListB.count > 0) {
|
||||
[self.animationListB removeObjectAtIndex:0];
|
||||
[self.animationListB xpSafeRemoveObjectAtIndex:0];
|
||||
}
|
||||
[self playAnimationWithModel];
|
||||
}
|
||||
@@ -2566,7 +2575,7 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
||||
self.isPlayOfB = NO;
|
||||
[nobleLevelUpView removeFromSuperview];
|
||||
if (self.animationListB.count > 0) {
|
||||
[self.animationListB removeObjectAtIndex:0];
|
||||
[self.animationListB xpSafeRemoveObjectAtIndex:0];
|
||||
}
|
||||
[self playAnimationWithModel];
|
||||
}
|
||||
@@ -2620,7 +2629,7 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
||||
self.isPlayOfB = NO;
|
||||
|
||||
if(self.animationListB.count > 0){
|
||||
[self.animationListB removeObjectAtIndex:0];
|
||||
[self.animationListB xpSafeRemoveObjectAtIndex:0];
|
||||
}
|
||||
[self playAnimationWithModel];
|
||||
}
|
||||
@@ -2658,7 +2667,7 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
||||
[anchorRankView removeFromSuperview];
|
||||
self.isPlayOfB = NO;
|
||||
if(self.animationListB.count > 0){
|
||||
[self.animationListB removeObjectAtIndex:0];
|
||||
[self.animationListB xpSafeRemoveObjectAtIndex:0];
|
||||
[self playAnimationWithModel];
|
||||
}
|
||||
}];
|
||||
@@ -2730,7 +2739,7 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
||||
[treasureView removeFromSuperview];
|
||||
self.isPlayOfB = NO;
|
||||
if (self.animationListB.count > 0) {
|
||||
[self.animationListB removeObjectAtIndex:0];
|
||||
[self.animationListB xpSafeRemoveObjectAtIndex:0];
|
||||
}
|
||||
[self playAnimationWithModel];
|
||||
}
|
||||
@@ -2784,7 +2793,7 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
||||
[tarrowVeiw removeFromSuperview];
|
||||
self.isPlayOfB = NO;
|
||||
if (self.animationListB.count > 0) {
|
||||
[self.animationListB removeObjectAtIndex:0];
|
||||
[self.animationListB xpSafeRemoveObjectAtIndex:0];
|
||||
}
|
||||
[self playAnimationWithModel];
|
||||
}
|
||||
@@ -2821,7 +2830,7 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
||||
[compoundGiftView removeFromSuperview];
|
||||
self.isPlayOfB = NO;
|
||||
if(self.animationListB.count > 0){
|
||||
[self.animationListB removeObjectAtIndex:0];
|
||||
[self.animationListB xpSafeRemoveObjectAtIndex:0];
|
||||
}
|
||||
[self playAnimationWithModel];
|
||||
}
|
||||
@@ -2860,7 +2869,7 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
||||
[bannerView removeFromSuperview];
|
||||
self.isPlayOfB = NO;
|
||||
if(self.animationListB.count > 0){
|
||||
[self.animationListB removeObjectAtIndex:0];
|
||||
[self.animationListB xpSafeRemoveObjectAtIndex:0];
|
||||
}
|
||||
[self playAnimationWithModel];
|
||||
}];
|
||||
@@ -2887,7 +2896,7 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
||||
[bannerView removeFromSuperview];
|
||||
self.isPlayOfB = NO;
|
||||
if(self.animationListB.count > 0){
|
||||
[self.animationListB removeObjectAtIndex:0];
|
||||
[self.animationListB xpSafeRemoveObjectAtIndex:0];
|
||||
}
|
||||
[self playAnimationWithModel];
|
||||
}];
|
||||
@@ -2931,7 +2940,7 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
||||
[self.universalBannerViewCaches removeObject:bannerView];
|
||||
self.isPlayOfB = NO;
|
||||
if(self.animationListB.count > 0){
|
||||
[self.animationListB removeObjectAtIndex:0];
|
||||
[self.animationListB xpSafeRemoveObjectAtIndex:0];
|
||||
}
|
||||
[self playAnimationWithModel];
|
||||
}
|
||||
@@ -3116,7 +3125,7 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
||||
if (finished) {
|
||||
[sailingView removeFromSuperview];
|
||||
if (self.sailingQueue.count > 0) {
|
||||
[self.sailingQueue removeObjectAtIndex:0];
|
||||
[self.sailingQueue xpSafeRemoveObjectAtIndex:0];
|
||||
}
|
||||
if (self.sailingQueue.count > 0) {
|
||||
[self createSailingBannerAnimation:self.sailingQueue.firstObject];
|
||||
|
Reference in New Issue
Block a user