This commit is contained in:
启星
2025-11-28 22:43:06 +08:00
parent 8913ea6f48
commit 7eb4f8d3b8
197 changed files with 7315 additions and 666 deletions

View File

@@ -536,74 +536,98 @@ static NSInteger toSlowCount = 4;
dispatch_source_set_event_handler(_fastTimer, ^{
__strong typeof(weakSelf) strongSelf = weakSelf;
if (!strongSelf) return;
//
__block NSInteger roundCount = strongSelf.roundCount;
__block NSInteger currentIndex = strongSelf.currentIndex;
NSArray *finishTargetArrayIndex = [strongSelf.finishTargetArrayIndex copy];
NSMutableArray *targetArrayIndex = [strongSelf.targetArrayIndex mutableCopy];
__block QXSkyDrawBtnType startType = strongSelf.startType;
// UI线
dispatch_async(dispatch_get_main_queue(), ^{
strongSelf.roundCount++;
if ((strongSelf.roundCount / giftMaxCount == minRoundCount) && strongSelf.startType != QXSkyDrawBtnTypeOne) {
// strongSelf
__strong typeof(weakSelf) strongSelfInMain = weakSelf;
if (!strongSelfInMain) return;
// 使访
roundCount++;
NSInteger newCurrentIndex = roundCount % giftMaxCount;
if ((roundCount / giftMaxCount == minRoundCount) && startType != QXSkyDrawBtnTypeOne) {
BOOL has = NO;
for (NSNumber *index in self.finishTargetArrayIndex) {
if (index.integerValue == self.currentIndex) {
for (NSNumber *index in finishTargetArrayIndex) {
if (index.integerValue == currentIndex) {
has = YES;
break;
}
}
self.currentGiftView.isSelected = NO;
strongSelfInMain.currentGiftView.isSelected = NO;
QXSkyPraizeSubView *giftView = strongSelfInMain.allViewsArray[newCurrentIndex];
if (has) {
QXSkyPraizeSubView *giftView = strongSelf.allViewsArray[strongSelf.currentIndex];
giftView.isSelected = YES;
}else{
QXSkyPraizeSubView *giftView = strongSelf.allViewsArray[strongSelf.currentIndex];
} else {
giftView.isSelected = NO;
}
}else{
} else {
///
strongSelf.currentGiftView.isSelected = NO;
strongSelfInMain.currentGiftView.isSelected = NO;
}
///
strongSelf.currentIndex = strongSelf.roundCount%giftMaxCount;
strongSelfInMain.currentIndex = newCurrentIndex;
strongSelfInMain.roundCount = roundCount;
/// view
QXSkyPraizeSubView *giftView = strongSelf.allViewsArray[strongSelf.currentIndex];
giftView.isSelected = YES;
QXSkyPraizeSubView *currentGiftView = strongSelfInMain.allViewsArray[newCurrentIndex];
currentGiftView.isSelected = YES;
/// view
strongSelf.currentGiftView = giftView;
strongSelfInMain.currentGiftView = currentGiftView;
if (strongSelf.roundCount / giftMaxCount == minRoundCount) {
for (NSNumber *index in strongSelf.targetArrayIndex) {
if (strongSelf.currentIndex == index.integerValue) {
QXSkyPraizeSubView *giftView = strongSelf.allViewsArray[index.integerValue];
giftView.isSelected = YES;
giftView.resultView.hidden = NO;
[giftView startPulseAnimationWithLayer];
[strongSelf.targetArrayIndex removeObject:index];
[strongSelf.finishTargetArrayIndex addObject:index];
if (roundCount / giftMaxCount == minRoundCount) {
for (NSNumber *index in targetArrayIndex) {
if (newCurrentIndex == index.integerValue) {
QXSkyPraizeSubView *targetGiftView = strongSelfInMain.allViewsArray[index.integerValue];
targetGiftView.isSelected = YES;
targetGiftView.resultView.hidden = NO;
[targetGiftView startPulseAnimationWithLayer];
// 线
[strongSelfInMain.targetArrayIndex removeObject:index];
[strongSelfInMain.finishTargetArrayIndex addObject:index];
break;
}
}
dispatch_source_set_timer(strongSelf.fastTimer,
dispatch_time(DISPATCH_TIME_NOW, 0.03 * NSEC_PER_SEC),
DISPATCH_TIME_FOREVER,
0.01 * NSEC_PER_SEC);
if (strongSelf.targetArrayIndex.count == 0) {
strongSelf.isDrawing = NO;
[strongSelf stopFastAnimate];
[strongSelf animateFinishedSendGift];
dispatch_source_set_timer(strongSelfInMain.fastTimer,
dispatch_time(DISPATCH_TIME_NOW, 0.03 * NSEC_PER_SEC),
DISPATCH_TIME_FOREVER,
0.01 * NSEC_PER_SEC);
if (strongSelfInMain.targetArrayIndex.count == 0) {
strongSelfInMain.isDrawing = NO;
[strongSelfInMain stopFastAnimate];
[strongSelfInMain animateFinishedSendGift];
}
// }
}else{
strongSelf.delayTime = strongSelf.delayTime-0.02;
if (strongSelf.delayTime <= 0.03) {
strongSelf.delayTime = 0.03;
} else {
// 使访
NSTimeInterval delayTime = strongSelfInMain.delayTime - 0.02;
if (delayTime <= 0.03) {
delayTime = 0.03;
}
dispatch_source_set_timer(strongSelf.fastTimer,
dispatch_time(DISPATCH_TIME_NOW, strongSelf.delayTime * NSEC_PER_SEC),
DISPATCH_TIME_FOREVER,
0.01 * NSEC_PER_SEC);
strongSelfInMain.delayTime = delayTime;
dispatch_source_set_timer(strongSelfInMain.fastTimer,
dispatch_time(DISPATCH_TIME_NOW, delayTime * NSEC_PER_SEC),
DISPATCH_TIME_FOREVER,
0.01 * NSEC_PER_SEC);
}
});
});
dispatch_resume(_fastTimer);
}
-(void)animateFinishedSendGift{
@@ -724,6 +748,13 @@ static NSInteger toSlowCount = 4;
-(void)destroyViews{
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
- (void)dealloc {
if (_fastTimer) {
dispatch_source_cancel(_fastTimer);
_fastTimer = nil;
}
NSLog(@"%@ dealloc", NSStringFromClass([self class]));
}
@end

View File

@@ -568,74 +568,98 @@ static NSInteger toSlowCount = 4;
dispatch_source_set_event_handler(_fastTimer, ^{
__strong typeof(weakSelf) strongSelf = weakSelf;
if (!strongSelf) return;
//
__block NSInteger roundCount = strongSelf.roundCount;
__block NSInteger currentIndex = strongSelf.currentIndex;
NSArray *finishTargetArrayIndex = [strongSelf.finishTargetArrayIndex copy];
NSMutableArray *targetArrayIndex = [strongSelf.targetArrayIndex mutableCopy];
__block QXAgeDrawBtnType startType = strongSelf.startType;
// UI线
dispatch_async(dispatch_get_main_queue(), ^{
strongSelf.roundCount++;
if ((strongSelf.roundCount / giftMaxCount == minRoundCount) && strongSelf.startType != QXAgeDrawBtnTypeOne) {
// strongSelf
__strong typeof(weakSelf) strongSelfInMain = weakSelf;
if (!strongSelfInMain) return;
// 使访
roundCount++;
NSInteger newCurrentIndex = roundCount % giftMaxCount;
if ((roundCount / giftMaxCount == minRoundCount) && startType != QXSkyDrawBtnTypeOne) {
BOOL has = NO;
for (NSNumber *index in strongSelf.finishTargetArrayIndex) {
if (index.integerValue == strongSelf.currentIndex) {
for (NSNumber *index in finishTargetArrayIndex) {
if (index.integerValue == currentIndex) {
has = YES;
break;
}
}
self.currentGiftView.isSelected = NO;
strongSelfInMain.currentGiftView.isSelected = NO;
QXAgePraizeSubView *giftView = strongSelfInMain.allViewsArray[newCurrentIndex];
if (has) {
QXAgePraizeSubView *giftView = strongSelf.allViewsArray[strongSelf.currentIndex];
giftView.isSelected = YES;
}else{
QXAgePraizeSubView *giftView = strongSelf.allViewsArray[strongSelf.currentIndex];
} else {
giftView.isSelected = NO;
}
}else{
} else {
///
strongSelf.currentGiftView.isSelected = NO;
strongSelfInMain.currentGiftView.isSelected = NO;
}
///
strongSelf.currentIndex = strongSelf.roundCount%giftMaxCount;
strongSelfInMain.currentIndex = newCurrentIndex;
strongSelfInMain.roundCount = roundCount;
/// view
QXAgePraizeSubView *giftView = strongSelf.allViewsArray[strongSelf.currentIndex];
giftView.isSelected = YES;
QXAgePraizeSubView *currentGiftView = strongSelfInMain.allViewsArray[newCurrentIndex];
currentGiftView.isSelected = YES;
/// view
strongSelf.currentGiftView = giftView;
strongSelfInMain.currentGiftView = currentGiftView;
if (strongSelf.roundCount / giftMaxCount == minRoundCount) {
for (NSNumber *index in strongSelf.targetArrayIndex) {
if (strongSelf.currentIndex == index.integerValue) {
QXAgePraizeSubView *giftView = strongSelf.allViewsArray[index.integerValue];
giftView.isSelected = YES;
giftView.resultView.hidden = NO;
[giftView startPulseAnimationWithLayer];
[strongSelf.targetArrayIndex removeObject:index];
[strongSelf.finishTargetArrayIndex addObject:index];
if (roundCount / giftMaxCount == minRoundCount) {
for (NSNumber *index in targetArrayIndex) {
if (newCurrentIndex == index.integerValue) {
QXAgePraizeSubView *targetGiftView = strongSelfInMain.allViewsArray[index.integerValue];
targetGiftView.isSelected = YES;
targetGiftView.resultView.hidden = NO;
[targetGiftView startPulseAnimationWithLayer];
// 线
[strongSelfInMain.targetArrayIndex removeObject:index];
[strongSelfInMain.finishTargetArrayIndex addObject:index];
break;
}
}
dispatch_source_set_timer(strongSelf.fastTimer,
dispatch_time(DISPATCH_TIME_NOW, 0.03 * NSEC_PER_SEC),
DISPATCH_TIME_FOREVER,
0.01 * NSEC_PER_SEC);
if (strongSelf.targetArrayIndex.count == 0) {
strongSelf.isDrawing = NO;
[strongSelf stopFastAnimate];
[strongSelf animateFinishedSendGift];
dispatch_source_set_timer(strongSelfInMain.fastTimer,
dispatch_time(DISPATCH_TIME_NOW, 0.03 * NSEC_PER_SEC),
DISPATCH_TIME_FOREVER,
0.01 * NSEC_PER_SEC);
if (strongSelfInMain.targetArrayIndex.count == 0) {
strongSelfInMain.isDrawing = NO;
[strongSelfInMain stopFastAnimate];
[strongSelfInMain animateFinishedSendGift];
}
// }
}else{
strongSelf.delayTime = strongSelf.delayTime-0.02;
if (strongSelf.delayTime <= 0.03) {
strongSelf.delayTime = 0.03;
} else {
// 使访
NSTimeInterval delayTime = strongSelfInMain.delayTime - 0.02;
if (delayTime <= 0.03) {
delayTime = 0.03;
}
dispatch_source_set_timer(strongSelf.fastTimer,
dispatch_time(DISPATCH_TIME_NOW, strongSelf.delayTime * NSEC_PER_SEC),
DISPATCH_TIME_FOREVER,
0.01 * NSEC_PER_SEC);
strongSelfInMain.delayTime = delayTime;
dispatch_source_set_timer(strongSelfInMain.fastTimer,
dispatch_time(DISPATCH_TIME_NOW, delayTime * NSEC_PER_SEC),
DISPATCH_TIME_FOREVER,
0.01 * NSEC_PER_SEC);
}
});
});
dispatch_resume(_fastTimer);
}
-(void)animateFinishedSendGift{

View File

@@ -569,74 +569,98 @@ static NSInteger toSlowCount = 4;
dispatch_source_set_event_handler(_fastTimer, ^{
__strong typeof(weakSelf) strongSelf = weakSelf;
if (!strongSelf) return;
//
__block NSInteger roundCount = strongSelf.roundCount;
__block NSInteger currentIndex = strongSelf.currentIndex;
NSArray *finishTargetArrayIndex = [strongSelf.finishTargetArrayIndex copy];
NSMutableArray *targetArrayIndex = [strongSelf.targetArrayIndex mutableCopy];
__block QXTimeDrawBtnType startType = strongSelf.startType;
// UI线
dispatch_async(dispatch_get_main_queue(), ^{
strongSelf.roundCount++;
if ((strongSelf.roundCount / giftMaxCount == minRoundCount) && strongSelf.startType != QXTimeDrawBtnTypeOne) {
// strongSelf
__strong typeof(weakSelf) strongSelfInMain = weakSelf;
if (!strongSelfInMain) return;
// 使访
roundCount++;
NSInteger newCurrentIndex = roundCount % giftMaxCount;
if ((roundCount / giftMaxCount == minRoundCount) && startType != QXSkyDrawBtnTypeOne) {
BOOL has = NO;
for (NSNumber *index in strongSelf.finishTargetArrayIndex) {
if (index.integerValue == strongSelf.currentIndex) {
for (NSNumber *index in finishTargetArrayIndex) {
if (index.integerValue == currentIndex) {
has = YES;
break;
}
}
self.currentGiftView.isSelected = NO;
strongSelfInMain.currentGiftView.isSelected = NO;
QXTimePraizeSubView *giftView = strongSelfInMain.allViewsArray[newCurrentIndex];
if (has) {
QXTimePraizeSubView *giftView = strongSelf.allViewsArray[strongSelf.currentIndex];
giftView.isSelected = YES;
}else{
QXTimePraizeSubView *giftView = strongSelf.allViewsArray[strongSelf.currentIndex];
} else {
giftView.isSelected = NO;
}
}else{
} else {
///
strongSelf.currentGiftView.isSelected = NO;
strongSelfInMain.currentGiftView.isSelected = NO;
}
///
strongSelf.currentIndex = strongSelf.roundCount%giftMaxCount;
strongSelfInMain.currentIndex = newCurrentIndex;
strongSelfInMain.roundCount = roundCount;
/// view
QXTimePraizeSubView *giftView = strongSelf.allViewsArray[strongSelf.currentIndex];
giftView.isSelected = YES;
QXTimePraizeSubView *currentGiftView = strongSelfInMain.allViewsArray[newCurrentIndex];
currentGiftView.isSelected = YES;
/// view
strongSelf.currentGiftView = giftView;
strongSelfInMain.currentGiftView = currentGiftView;
if (strongSelf.roundCount / giftMaxCount == minRoundCount) {
for (NSNumber *index in strongSelf.targetArrayIndex) {
if (strongSelf.currentIndex == index.integerValue) {
QXTimePraizeSubView *giftView = strongSelf.allViewsArray[index.integerValue];
giftView.isSelected = YES;
giftView.resultView.hidden = NO;
[giftView startPulseAnimationWithLayer];
[strongSelf.targetArrayIndex removeObject:index];
[strongSelf.finishTargetArrayIndex addObject:index];
if (roundCount / giftMaxCount == minRoundCount) {
for (NSNumber *index in targetArrayIndex) {
if (newCurrentIndex == index.integerValue) {
QXTimePraizeSubView *targetGiftView = strongSelfInMain.allViewsArray[index.integerValue];
targetGiftView.isSelected = YES;
targetGiftView.resultView.hidden = NO;
[targetGiftView startPulseAnimationWithLayer];
// 线
[strongSelfInMain.targetArrayIndex removeObject:index];
[strongSelfInMain.finishTargetArrayIndex addObject:index];
break;
}
}
dispatch_source_set_timer(strongSelf.fastTimer,
dispatch_time(DISPATCH_TIME_NOW, 0.03 * NSEC_PER_SEC),
DISPATCH_TIME_FOREVER,
0.01 * NSEC_PER_SEC);
if (strongSelf.targetArrayIndex.count == 0) {
strongSelf.isDrawing = NO;
[strongSelf stopFastAnimate];
[strongSelf animateFinishedSendGift];
dispatch_source_set_timer(strongSelfInMain.fastTimer,
dispatch_time(DISPATCH_TIME_NOW, 0.03 * NSEC_PER_SEC),
DISPATCH_TIME_FOREVER,
0.01 * NSEC_PER_SEC);
if (strongSelfInMain.targetArrayIndex.count == 0) {
strongSelfInMain.isDrawing = NO;
[strongSelfInMain stopFastAnimate];
[strongSelfInMain animateFinishedSendGift];
}
// }
}else{
strongSelf.delayTime = strongSelf.delayTime-0.02;
if (strongSelf.delayTime <= 0.03) {
strongSelf.delayTime = 0.03;
} else {
// 使访
NSTimeInterval delayTime = strongSelfInMain.delayTime - 0.02;
if (delayTime <= 0.03) {
delayTime = 0.03;
}
dispatch_source_set_timer(strongSelf.fastTimer,
dispatch_time(DISPATCH_TIME_NOW, strongSelf.delayTime * NSEC_PER_SEC),
DISPATCH_TIME_FOREVER,
0.01 * NSEC_PER_SEC);
strongSelfInMain.delayTime = delayTime;
dispatch_source_set_timer(strongSelfInMain.fastTimer,
dispatch_time(DISPATCH_TIME_NOW, delayTime * NSEC_PER_SEC),
DISPATCH_TIME_FOREVER,
0.01 * NSEC_PER_SEC);
}
});
});
dispatch_resume(_fastTimer);
}
-(void)animateFinishedSendGift{