修复了涂鸦礼物送多人计算错误的问题
This commit is contained in:
@@ -8,7 +8,12 @@
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "XPSendGiftView.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
@class XPGiftUserInfoModel;
|
||||
@class XPGiftUserInfoModel, XPGiftUsersView;
|
||||
@protocol XPGiftUsersViewDelegate <NSObject>
|
||||
///选中的用户
|
||||
- (void)xPGiftUsersView:(XPGiftUsersView *)view didSelectUsers:(NSArray *)selectUids;
|
||||
|
||||
@end
|
||||
@interface XPGiftUsersView : UIView
|
||||
///选中的人 送给谁礼物
|
||||
@property (nonatomic,strong, readonly) NSMutableArray<NSString *> *selectUserArray;
|
||||
@@ -16,6 +21,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property (nonatomic,assign, readonly) BOOL isSelectAll;
|
||||
///麦序变化 赋值使用
|
||||
- (void)configGiftUsers:(NSArray<XPGiftUserInfoModel *> *)users;
|
||||
///代理
|
||||
@property (nonatomic,weak) id<XPGiftUsersViewDelegate> delegate;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -67,6 +67,10 @@
|
||||
}];
|
||||
self.isSelectAll = sender.selected;
|
||||
[self.collectionView reloadData];
|
||||
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(xPGiftUsersView:didSelectUsers:)]) {
|
||||
[self.delegate xPGiftUsersView:self didSelectUsers:self.selectUserArray];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Private Method
|
||||
@@ -183,6 +187,10 @@
|
||||
self.allMicroButton.selected = NO;
|
||||
self.isSelectAll = NO;
|
||||
}
|
||||
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(xPGiftUsersView:didSelectUsers:)]) {
|
||||
[self.delegate xPGiftUsersView:self didSelectUsers:self.selectUserArray];
|
||||
}
|
||||
}
|
||||
#pragma mark - Getters And Setters
|
||||
- (UIStackView *)stackView {
|
||||
|
@@ -26,6 +26,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property (nonatomic,assign) double price;
|
||||
///动画的数据
|
||||
@property (nonatomic,strong) NSArray *animationArray;
|
||||
///选择的用户个数
|
||||
@property (nonatomic,assign) NSInteger selectUidNumber;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -12,7 +12,6 @@
|
||||
#import "ThemeColor.h"
|
||||
#import "XPMacro.h"
|
||||
#import "XCHUDTool.h"
|
||||
#import "XPHomeGradientLabel.h"
|
||||
|
||||
@interface XPGraffitiGiftView ()
|
||||
///回话的内容
|
||||
@@ -31,8 +30,6 @@
|
||||
@property (nonatomic,strong) UILabel *titleLabel;
|
||||
///类型
|
||||
@property (nonatomic,strong) UIStackView *toolStackView;
|
||||
///切换
|
||||
@property (nonatomic,strong) XPHomeGradientLabel *changeButton;
|
||||
///撤销
|
||||
@property (nonatomic,strong) UIButton *repealButton;
|
||||
///删除
|
||||
@@ -85,7 +82,6 @@
|
||||
[self.toolView addSubview:self.titleLabel];
|
||||
[self.toolView addSubview:self.toolStackView];
|
||||
|
||||
[self.toolStackView addArrangedSubview:self.changeButton];
|
||||
[self.toolStackView addArrangedSubview:self.repealButton];
|
||||
[self.toolStackView addArrangedSubview:self.deleteButton];
|
||||
[self.toolStackView addArrangedSubview:self.closeButton];
|
||||
@@ -136,10 +132,6 @@
|
||||
make.centerY.mas_equalTo(self.toolView);
|
||||
}];
|
||||
|
||||
[self.changeButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(50);
|
||||
}];
|
||||
|
||||
[self.repealButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(22);
|
||||
}];
|
||||
@@ -222,12 +214,6 @@
|
||||
[self.indexArray removeAllObjects];
|
||||
}
|
||||
#pragma mark - Event Response
|
||||
- (void)changeButtonAction{
|
||||
[self clearData];
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(xPGraffitiGiftView:didClickChange:)]) {
|
||||
[self.delegate xPGraffitiGiftView:self didClickChange:self.changeButton];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)repealButtonAction:(UIButton *)sender {
|
||||
NSInteger index = [self.indexArray lastObject].integerValue;
|
||||
@@ -272,8 +258,9 @@
|
||||
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] initWithString:title attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14], NSForegroundColorAttributeName:[UIColor whiteColor]}];
|
||||
self.titleLabel.attributedText = attribute;
|
||||
} else {
|
||||
NSInteger number = self.selectUidNumber > 0 ? self.selectUidNumber : 1;
|
||||
NSString * count = [NSString stringWithFormat:@"%ld", self.viewsArray.count];
|
||||
NSString * price = [NSString stringWithFormat:@"%.0f", self.viewsArray.count * self.price];
|
||||
NSString * price = [NSString stringWithFormat:@"%.0f", self.viewsArray.count * self.price * number];
|
||||
NSString * title = [NSString stringWithFormat:@"已画%@个,需花费%@钻石", count, price];
|
||||
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] initWithString:title attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14], NSForegroundColorAttributeName:[UIColor whiteColor]}];
|
||||
[attribute addAttribute:NSForegroundColorAttributeName value:[ThemeColor appMainColor] range:[title rangeOfString:count]];
|
||||
@@ -284,6 +271,11 @@
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (void)setSelectUidNumber:(NSInteger)selectUidNumber {
|
||||
_selectUidNumber = selectUidNumber;
|
||||
[self cratePriceAttribute];
|
||||
}
|
||||
|
||||
- (UIView *)contentView {
|
||||
if (!_contentView) {
|
||||
_contentView = [[UIView alloc] init];
|
||||
@@ -363,19 +355,6 @@
|
||||
return _toolStackView;
|
||||
}
|
||||
|
||||
- (XPHomeGradientLabel *)changeButton {
|
||||
if (!_changeButton) {
|
||||
_changeButton = [[XPHomeGradientLabel alloc] init];
|
||||
_changeButton.font = [UIFont systemFontOfSize:12];
|
||||
_changeButton.gradientColor = @[(id)UIColorFromRGB(0x33ECFF).CGColor, (id)UIColorFromRGB(0x57CF99).CGColor];
|
||||
_changeButton.text = @"切换涂鸦";
|
||||
_changeButton.userInteractionEnabled = YES;
|
||||
UITapGestureRecognizer * tap= [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(changeButtonAction)];
|
||||
[_changeButton addGestureRecognizer:tap];
|
||||
}
|
||||
return _changeButton;
|
||||
}
|
||||
|
||||
- (UIButton *)repealButton {
|
||||
if (!_repealButton) {
|
||||
_repealButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
|
@@ -40,7 +40,7 @@
|
||||
#import "XPFirstRechargeViewController.h"
|
||||
#import "XPNobleCenterViewController.h"
|
||||
|
||||
@interface XPSendGiftView ()< XPGiftBarViewDelegate, XPGiftProtocol, XPGiftInfoViewDelegate, XPGraffitiGiftViewDelegate>
|
||||
@interface XPSendGiftView ()< XPGiftBarViewDelegate, XPGiftProtocol, XPGiftInfoViewDelegate, XPGraffitiGiftViewDelegate, XPGiftUsersViewDelegate>
|
||||
///顶部的区域
|
||||
@property (nonatomic,strong) UIView * topView;
|
||||
///内容区域
|
||||
@@ -440,6 +440,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - XPGiftUsersViewDelegate
|
||||
- (void)xPGiftUsersView:(XPGiftUsersView *)view didSelectUsers:(NSArray *)selectUids {
|
||||
self.graffitiView.selectUidNumber = selectUids.count;
|
||||
}
|
||||
|
||||
#pragma mark - XPGraffitiGiftViewDelegate
|
||||
- (void)xPGraffitiGiftView:(XPGraffitiGiftView *)view didClickClose:(UIButton *)sender {
|
||||
[UIView animateWithDuration:0.2 animations:^{
|
||||
@@ -583,6 +588,7 @@
|
||||
- (XPGiftUsersView *)userView {
|
||||
if (!_userView) {
|
||||
_userView = [[XPGiftUsersView alloc] init];
|
||||
_userView.delegate = self;
|
||||
}
|
||||
return _userView;
|
||||
}
|
||||
|
@@ -157,6 +157,7 @@
|
||||
NSArray *luckyPoolGift = [GiftInfoModel modelsWithArray:data.data[@"luckyPoolGift"]];// 福袋奖池礼物
|
||||
NSArray *normalGift = [GiftInfoModel modelsWithArray:data.data[@"normalGift"]]; // 普通面板礼物
|
||||
NSArray *weekStarGift = [GiftInfoModel modelsWithArray:data.data[@"weekStarGift"]]; // 周星礼物
|
||||
NSArray *drawGift = [GiftInfoModel modelsWithArray:data.data[@"drawGift"]]; // 涂鸦礼物
|
||||
//TODO: luckyPoolGift 这个就是福袋礼物的所有的数据 只要保存这个就行了吧 以后需要改
|
||||
NSMutableArray *info = [NSMutableArray array];
|
||||
NSMutableArray *totalInfo = [NSMutableArray array];
|
||||
@@ -164,6 +165,7 @@
|
||||
[info addObjectsFromArray:vipGift];
|
||||
[info addObjectsFromArray:normalGift];
|
||||
[info addObjectsFromArray:weekStarGift];
|
||||
[info addObjectsFromArray:drawGift];
|
||||
[totalInfo addObjectsFromArray:info];
|
||||
[totalInfo addObjectsFromArray:luckyPoolGift];
|
||||
///把礼物信息保存一下
|
||||
|
@@ -52,7 +52,7 @@
|
||||
|
||||
|
||||
- (void)dramGraffitiAnimationView {
|
||||
if (self.index > (self.datasource.count -1)) {
|
||||
if (self.index >= (self.datasource.count -1)) {
|
||||
self.timer.fireDate = NSDate.distantFuture;
|
||||
[self.datasource removeAllObjects];
|
||||
self.index = 0;
|
||||
|
Reference in New Issue
Block a user