520 lines
23 KiB
Mathematica
520 lines
23 KiB
Mathematica
|
|
//
|
|||
|
|
// SPBlindXunlehuiVC.m
|
|||
|
|
// SweetParty
|
|||
|
|
//
|
|||
|
|
// Created by yons on 2024/11/21.
|
|||
|
|
//
|
|||
|
|
|
|||
|
|
#import "SPBlindXunlehuiVC.h"
|
|||
|
|
#import "SPBlindXunlehuiCell.h"
|
|||
|
|
#import "SPWalletJinbiVC.h"
|
|||
|
|
#import "SPBlindXunlehuiRankAlert.h"
|
|||
|
|
#import "SPBlindXunlehuiRuleAlert.h"
|
|||
|
|
#import "SPBlindXunlehuiRecordAlert.h"
|
|||
|
|
#import "ZWTimer.h"
|
|||
|
|
#import "GiftTableView.h"
|
|||
|
|
|
|||
|
|
@interface SPBlindXunlehuiVC ()<UITableViewDelegate, UITableViewDataSource, ZWTimerDelegate>
|
|||
|
|
|
|||
|
|
@property (weak, nonatomic) IBOutlet UILabel *lockGiftNameL; //锁定礼物名
|
|||
|
|
@property (weak, nonatomic) IBOutlet UILabel *lineL; //锁定礼物下边的线条
|
|||
|
|
@property (weak, nonatomic) IBOutlet UILabel *daojishiL; //倒计时
|
|||
|
|
@property (weak, nonatomic) IBOutlet UILabel *normalModeL; //普通模式
|
|||
|
|
@property (weak, nonatomic) IBOutlet UILabel *speedModeL; //加速模式
|
|||
|
|
@property (weak, nonatomic) IBOutlet UILabel *superModeL; //极速模式
|
|||
|
|
@property (assign, nonatomic) NSInteger pattern_id; //模式id
|
|||
|
|
|
|||
|
|
@property (weak, nonatomic) IBOutlet UILabel *nowL;
|
|||
|
|
@property (weak, nonatomic) IBOutlet UIImageView *nowWinImgV; //本阶段奖励礼物图
|
|||
|
|
@property (weak, nonatomic) IBOutlet UILabel *nowWinNumL; //本阶段奖励倍数
|
|||
|
|
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *nowWinImgVcenterXcon; //如果没有下阶段了,让本阶段的图片居中
|
|||
|
|
|
|||
|
|
@property (weak, nonatomic) IBOutlet UILabel *nextL;
|
|||
|
|
@property (weak, nonatomic) IBOutlet UIImageView *nextWinImgV;//下阶段奖励礼物图
|
|||
|
|
@property (weak, nonatomic) IBOutlet UILabel *nextWinNumL; //下阶段奖励倍数
|
|||
|
|
@property (weak, nonatomic) IBOutlet UITableView *mainTableV; //tableView
|
|||
|
|
@property (weak, nonatomic) IBOutlet UIView *progressAllView; //总进度条
|
|||
|
|
@property (weak, nonatomic) IBOutlet UIView *progressPartView; //进度视图
|
|||
|
|
|
|||
|
|
|
|||
|
|
@property (weak, nonatomic) IBOutlet UIView *sendView; //送礼物视图
|
|||
|
|
@property (weak, nonatomic) IBOutlet UIImageView *sendIcon; //送礼物人头像
|
|||
|
|
@property (weak, nonatomic) IBOutlet UILabel *sendName; //送礼物人名
|
|||
|
|
@property (weak, nonatomic) IBOutlet UIImageView *sendGiftIcon; //送的礼物图
|
|||
|
|
@property (weak, nonatomic) IBOutlet UILabel *sendGiftMulti; //送的礼物倍数
|
|||
|
|
|
|||
|
|
@property (weak, nonatomic) IBOutlet UIView *receiveView; //收礼物视图
|
|||
|
|
@property (weak, nonatomic) IBOutlet UIImageView *receiveIcon; //收礼物人头像
|
|||
|
|
@property (weak, nonatomic) IBOutlet UILabel *receiveName; //收礼物人名
|
|||
|
|
@property (weak, nonatomic) IBOutlet UIImageView *receiveGiftIcon; //收的礼物图
|
|||
|
|
@property (weak, nonatomic) IBOutlet UILabel *receiveGiftMulti; //收的礼物倍数
|
|||
|
|
|
|||
|
|
|
|||
|
|
@property (weak, nonatomic) IBOutlet UIView *botView; //底部view
|
|||
|
|
@property (weak, nonatomic) IBOutlet UILabel *priceL; //底部价格
|
|||
|
|
@property (weak, nonatomic) IBOutlet UIImageView *botHeadIcon; //底部礼物图
|
|||
|
|
|
|||
|
|
@property (nonatomic, strong) NSMutableArray *dataArray; //数据源
|
|||
|
|
@property (nonatomic, strong) ZWTimer *timer;
|
|||
|
|
@property (nonatomic, assign) NSInteger leftSecond;
|
|||
|
|
|
|||
|
|
@property (nonatomic, assign) NSInteger maxValue;
|
|||
|
|
@property (nonatomic, assign) NSInteger minValue;
|
|||
|
|
|
|||
|
|
@property (nonatomic, assign) NSInteger currentValue;
|
|||
|
|
|
|||
|
|
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *progressViewCurrentWidth; //进度条宽度
|
|||
|
|
|
|||
|
|
@property (nonatomic, assign) BOOL isOpen;
|
|||
|
|
@property (nonatomic, strong) GiftTableView *lianjiView;
|
|||
|
|
@property (nonatomic, strong) RCMicRoomViewModel *viewModel; //
|
|||
|
|
|
|||
|
|
@property (nonatomic, assign) NSInteger wantSendNum; //用户当前想送入礼物数量
|
|||
|
|
@property (weak, nonatomic) IBOutlet UIButton *giftNumButton;
|
|||
|
|
@property (nonatomic, assign) NSInteger price;
|
|||
|
|
|
|||
|
|
@end
|
|||
|
|
|
|||
|
|
@implementation SPBlindXunlehuiVC
|
|||
|
|
|
|||
|
|
- (instancetype)initWithViewModel:(RCMicRoomViewModel *)viewModel {
|
|||
|
|
self = [super init];
|
|||
|
|
if (self) {
|
|||
|
|
self.viewModel = viewModel;
|
|||
|
|
WEAK_SELF
|
|||
|
|
[_viewModel setBlindReceivedGiftTuopan:^(NSDictionary * _Nonnull dict, BOOL isfrom) {
|
|||
|
|
RCMicMainThread(^{
|
|||
|
|
if ([[[dict safeDictionaryForKey:@"send_user_info"] safeStringForKey:@"uid"] isEqual:[BJUserManager userInfo].uid]) {
|
|||
|
|
// [weakSelf onShowGiftTuopanWith:dict];
|
|||
|
|
[weakSelf onShowGiftTuopanWith:dict fromSelf:isfrom];
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
}];
|
|||
|
|
}
|
|||
|
|
return self;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)viewWillAppear:(BOOL)animated {
|
|||
|
|
[super viewWillAppear:animated];
|
|||
|
|
LightContentStatusBar
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)viewDidLoad {
|
|||
|
|
[super viewDidLoad];
|
|||
|
|
self.isOpen = NO;
|
|||
|
|
self.wantSendNum = 1;
|
|||
|
|
[self creatUI];
|
|||
|
|
[self loadData];
|
|||
|
|
|
|||
|
|
//礼物托盘
|
|||
|
|
[self.view addSubview:self.lianjiView];
|
|||
|
|
[self.lianjiView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|||
|
|
make.left.right.mas_equalTo(self.view);
|
|||
|
|
make.height.mas_equalTo(140);
|
|||
|
|
make.top.mas_equalTo(self.view).offset(250);
|
|||
|
|
}];
|
|||
|
|
|
|||
|
|
//316 巡乐会结束
|
|||
|
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(BlindEndAction) name:@"BlindxunlehuiEnd" object:nil];
|
|||
|
|
//315 更新巡乐会进度条
|
|||
|
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onSocketChangeProgressLine:) name:@"BlindxunlehuiProgressLine" object:nil];
|
|||
|
|
//314 巡乐会进入下一阶段
|
|||
|
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onSocketEnterNext:) name:@"BlindxunlehuiEnterNext" object:nil];
|
|||
|
|
//313 巡乐会开到阶段锁定礼物推送
|
|||
|
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onSocketGetLockGift:) name:@"BlindxunlehuiGetLockGift" object:nil];
|
|||
|
|
|
|||
|
|
//302 更新送礼记录
|
|||
|
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onSocketUpdateSendData:) name:@"BlindXunlehuiSendRecord" object:nil];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//结束
|
|||
|
|
- (void)BlindEndAction {
|
|||
|
|
[self.navigationController popViewControllerAnimated:YES];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//改变进度条宽度
|
|||
|
|
- (void)onSocketChangeProgressLine:(NSNotification *)notify {
|
|||
|
|
NSDictionary *data = notify.userInfo;
|
|||
|
|
self.maxValue = [data safeIntForKey:@"max_num"];
|
|||
|
|
self.minValue = [data safeIntForKey:@"min_num"];
|
|||
|
|
if (self.maxValue != 0) {
|
|||
|
|
self.progressViewCurrentWidth.constant = self.minValue * 1.0 / self.maxValue * 300; //进度条总长度300
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//进入下一阶段
|
|||
|
|
- (void)onSocketEnterNext:(NSNotification *)notify {
|
|||
|
|
NSDictionary *data = notify.userInfo;
|
|||
|
|
self.lockGiftNameL.text = [NSString stringWithFormat:@"得到%@即可锁定奖励", [data safeStringForKey:@"lock_gift_name"]];
|
|||
|
|
[self.nowWinImgV sd_setImageWithURL:[NSURL URLWithString:[data safeStringForKey:@"now_gift_image"]] placeholderImage:kDefaultUserIcon];
|
|||
|
|
self.nowWinNumL.text = [NSString stringWithFormat:@"X%ld", [data safeIntForKey:@"now_multi"]];
|
|||
|
|
|
|||
|
|
if ([data safeIntForKey:@"next_multi"] == 0) {
|
|||
|
|
self.nextWinImgV.hidden = YES;
|
|||
|
|
self.nextWinNumL.hidden = YES;
|
|||
|
|
self.nextL.hidden = YES;
|
|||
|
|
self.nowWinImgVcenterXcon.constant = 0;
|
|||
|
|
}
|
|||
|
|
[self.nextWinImgV sd_setImageWithURL:[NSURL URLWithString:[data safeStringForKey:@"next_gift_image"]] placeholderImage:kDefaultUserIcon];
|
|||
|
|
self.nextWinNumL.text = [NSString stringWithFormat:@"X%ld", [data safeIntForKey:@"next_multi"]];
|
|||
|
|
self.pattern_id = [data safeIntForKey:@"pattern_id"];
|
|||
|
|
|
|||
|
|
[self updateStageUI];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//开到阶段锁定礼物推送
|
|||
|
|
- (void)onSocketGetLockGift:(NSNotification *)notify {
|
|||
|
|
NSDictionary *data = notify.userInfo;
|
|||
|
|
|
|||
|
|
[self.sendIcon sd_setImageWithURL:[NSURL URLWithString:[data safeStringForKey:@"send_head_pic"]] placeholderImage:kDefaultUserIcon];
|
|||
|
|
self.sendName.text = [data safeStringForKey:@"send_nick_name"];
|
|||
|
|
[self.sendGiftIcon sd_setImageWithURL:[NSURL URLWithString:[data safeStringForKey:@"base_image"]] placeholderImage:kDefaultUserIcon];
|
|||
|
|
self.sendGiftMulti.text = [NSString stringWithFormat:@"X%ld", [data safeIntForKey:@"multi"]];
|
|||
|
|
|
|||
|
|
|
|||
|
|
[self.receiveIcon sd_setImageWithURL:[NSURL URLWithString:[data safeStringForKey:@"receive_head_pic"]] placeholderImage:kDefaultUserIcon];
|
|||
|
|
self.receiveName.text = [data safeStringForKey:@"receive_nick_name"];
|
|||
|
|
[self.receiveGiftIcon sd_setImageWithURL:[NSURL URLWithString:[data safeStringForKey:@"receive_base_image"]] placeholderImage:kDefaultUserIcon];
|
|||
|
|
self.receiveGiftMulti.text = [NSString stringWithFormat:@"X%ld", [data safeIntForKey:@"multi"]];
|
|||
|
|
|
|||
|
|
self.leftSecond = [data safeIntForKey:@"end_time"];
|
|||
|
|
self.daojishiL.text = [NSString minuteAndSecStringWithTime:[data safeIntForKey:@"end_time"]];
|
|||
|
|
[self.timer startGCDTimer:1 delegate:self];
|
|||
|
|
|
|||
|
|
self.sendView.hidden = NO;
|
|||
|
|
self.receiveView.hidden = NO;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)onSocketUpdateSendData:(NSNotification *)notify {
|
|||
|
|
NSDictionary *data = notify.userInfo;
|
|||
|
|
NSString *infoStr = [NSString stringWithFormat:@"你赠送%@ %@x%@", [data safeStringForKey:@"receiveName"], [data safeStringForKey:@"giftName"], [data safeStringForKey:@"num"]];
|
|||
|
|
[self.dataArray addObject:infoStr];
|
|||
|
|
[self.mainTableV reloadData];
|
|||
|
|
[self.mainTableV scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:self.dataArray.count - 1 inSection:0] atScrollPosition:UITableViewScrollPositionBottom animated:YES];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
- (void)loadData {
|
|||
|
|
NSDictionary *param = @{
|
|||
|
|
@"to_uid" : self.to_uid,
|
|||
|
|
@"gid" : self.gid,
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
[BJHttpTool getBlindXunlehui_initWithParameters:param success:^(id response) {
|
|||
|
|
NSDictionary *data = [response safeDictionaryForKey:@"data"];
|
|||
|
|
if ([[data safeStringForKey:@"is_open"] isEqualToString:@"1"]) {
|
|||
|
|
self.isOpen = YES;
|
|||
|
|
NSDictionary *blind_info = [data safeDictionaryForKey:@"blind_info"];
|
|||
|
|
NSDictionary *lock_user_info = [data safeDictionaryForKey:@"lock_user_info"];
|
|||
|
|
self.lockGiftNameL.text = [NSString stringWithFormat:@"得到%@即可锁定奖励", [data safeStringForKey:@"lock_gift_name"]];
|
|||
|
|
self.pattern_id = [data safeIntForKey:@"pattern_id"];
|
|||
|
|
[self.nowWinImgV sd_setImageWithURL:[NSURL URLWithString:[data safeStringForKey:@"now_gift_image"]] placeholderImage:kDefaultUserIcon];
|
|||
|
|
self.nowWinNumL.text = [NSString stringWithFormat:@"X%@", [data safeStringForKey:@"now_multi"]];
|
|||
|
|
[self.nextWinImgV sd_setImageWithURL:[NSURL URLWithString:[data safeStringForKey:@"next_gift_image"]] placeholderImage:kDefaultUserIcon];
|
|||
|
|
self.nextWinNumL.text = [NSString stringWithFormat:@"X%@", [data safeStringForKey:@"next_multi"]];
|
|||
|
|
|
|||
|
|
self.price = [[blind_info safeStringForKey:@"gift_price"] intValue];
|
|||
|
|
self.priceL.text = [NSString stringWithFormat:@"%ld", self.price * self.wantSendNum];
|
|||
|
|
[self.botHeadIcon sd_setImageWithURL:[NSURL URLWithString:[data safeStringForKey:@"head_pic"]] placeholderImage:kDefaultUserIcon];
|
|||
|
|
self.daojishiL.text = [NSString minuteAndSecStringWithTime:[data safeIntForKey:@"end_time"]];
|
|||
|
|
NSArray *sendArray = [[data safeArrayForKey:@"send_gift_list"] mutableCopy];
|
|||
|
|
for (NSDictionary *sendDic in sendArray) {
|
|||
|
|
[self.dataArray addObject:[NSString stringWithFormat:@"你赠送%@ %@x%@", [sendDic safeStringForKey:@"nick_name"], [sendDic safeStringForKey:@"gift_name"], [sendDic safeStringForKey:@"gift_num"]]];
|
|||
|
|
}
|
|||
|
|
[self.mainTableV reloadData];
|
|||
|
|
|
|||
|
|
//左下角收礼物和送礼物
|
|||
|
|
NSString *sendHeadPic = [[data safeDictionaryForKey:@"lock_user_info"] safeStringForKey:@"send_head_pic"];
|
|||
|
|
|
|||
|
|
if (sendHeadPic != nil && sendHeadPic.length > 0) {
|
|||
|
|
[self.sendIcon sd_setImageWithURL:[NSURL URLWithString:[lock_user_info safeStringForKey:@"send_head_pic"]] placeholderImage:kDefaultUserIcon];
|
|||
|
|
self.sendName.text = [lock_user_info safeStringForKey:@"send_nick_name"];
|
|||
|
|
[self.sendGiftIcon sd_setImageWithURL:[NSURL URLWithString:[lock_user_info safeStringForKey:@"base_image"]] placeholderImage:kDefaultUserIcon];
|
|||
|
|
self.sendGiftMulti.text = [NSString stringWithFormat:@"X%ld", [lock_user_info safeIntForKey:@"multi"]];
|
|||
|
|
|
|||
|
|
[self.receiveIcon sd_setImageWithURL:[NSURL URLWithString:[lock_user_info safeStringForKey:@"receive_head_pic"]] placeholderImage:kDefaultUserIcon];
|
|||
|
|
self.receiveGiftMulti.text = [NSString stringWithFormat:@"X%ld", [lock_user_info safeIntForKey:@"multi"]];
|
|||
|
|
self.receiveName.text = [lock_user_info safeStringForKey:@"receive_nick_name"];
|
|||
|
|
[self.receiveGiftIcon sd_setImageWithURL:[NSURL URLWithString:[lock_user_info safeStringForKey:@"receive_base_image"]] placeholderImage:kDefaultUserIcon];
|
|||
|
|
|
|||
|
|
self.sendView.hidden = NO;
|
|||
|
|
self.receiveView.hidden = NO;
|
|||
|
|
}else {
|
|||
|
|
self.sendView.hidden = YES;
|
|||
|
|
self.receiveView.hidden = YES;
|
|||
|
|
}
|
|||
|
|
//倒计时
|
|||
|
|
self.leftSecond = [data safeIntForKey:@"end_time"];
|
|||
|
|
[self.timer startGCDTimer:1 delegate:self];
|
|||
|
|
|
|||
|
|
self.maxValue = [data safeIntForKey:@"max_num"];
|
|||
|
|
self.minValue = [data safeIntForKey:@"min_num"];
|
|||
|
|
//进度条
|
|||
|
|
self.progressViewCurrentWidth.constant = self.minValue / self.maxValue * 300; //进度条总长度300
|
|||
|
|
|
|||
|
|
if ([data safeIntForKey:@"next_multi"] == 0) {
|
|||
|
|
self.nextWinImgV.hidden = YES;
|
|||
|
|
self.nextWinNumL.hidden = YES;
|
|||
|
|
self.nextL.hidden = YES;
|
|||
|
|
self.nowWinImgVcenterXcon.constant = 0;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
[self updateStageUI];
|
|||
|
|
}else {
|
|||
|
|
self.isOpen = NO;
|
|||
|
|
self.daojishiL.text = @"未开始";
|
|||
|
|
self.nowL.hidden = YES;
|
|||
|
|
self.nowWinImgV.hidden = YES;
|
|||
|
|
self.nowWinNumL.hidden = YES;
|
|||
|
|
self.nextL.hidden = YES;
|
|||
|
|
self.nextWinImgV.hidden = YES;
|
|||
|
|
self.nextWinNumL.hidden = YES;
|
|||
|
|
self.sendView.hidden = YES;
|
|||
|
|
self.receiveView.hidden = YES;
|
|||
|
|
self.progressAllView.hidden = YES;
|
|||
|
|
self.lockGiftNameL.hidden = YES;
|
|||
|
|
self.lineL.hidden = YES;
|
|||
|
|
}
|
|||
|
|
} failure:^(NSError *error) {
|
|||
|
|
|
|||
|
|
}];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)creatUI {
|
|||
|
|
WEAK_SELF
|
|||
|
|
[self.botView dg_Tapped:^{
|
|||
|
|
self.botView.userInteractionEnabled = NO;
|
|||
|
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|||
|
|
weakSelf.botView.userInteractionEnabled = YES;
|
|||
|
|
});
|
|||
|
|
if (self.isOpen == NO) {
|
|||
|
|
[HelpPageDefine showMessage:@"未开始"];
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
NSDictionary *dict = @{@"rid":C_string(self.rid),
|
|||
|
|
@"gid":C_string(self.gid),
|
|||
|
|
@"num":@(self.wantSendNum),
|
|||
|
|
@"to_uid_list":C_string(self.to_uid),
|
|||
|
|
@"pack":@(1),
|
|||
|
|
};
|
|||
|
|
NSMutableDictionary *paras = [NSMutableDictionary dictionary];
|
|||
|
|
[paras addEntriesFromDictionary:dict];
|
|||
|
|
[RCMicHTTP postWithURLString:@"/api/gift/send_gift" parameters:paras response:^(RCMicHTTPResult *result) {
|
|||
|
|
if (result.success) {
|
|||
|
|
if (result.errorCode == 200) {
|
|||
|
|
NSArray *arr = [result.content safeArrayForKey:@"data"];
|
|||
|
|
for (NSDictionary *dict in arr) {
|
|||
|
|
//礼物托盘
|
|||
|
|
self.viewModel.blindReceivedGiftTuopan? self.viewModel.blindReceivedGiftTuopan(dict, YES) : nil;
|
|||
|
|
}
|
|||
|
|
}else {
|
|||
|
|
if (result.message.length > 0) {
|
|||
|
|
[MBProgressHUD showAutoMessage:result.message];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}];
|
|||
|
|
}];
|
|||
|
|
|
|||
|
|
|
|||
|
|
self.mainTableV.delegate = self;
|
|||
|
|
self.mainTableV.dataSource = self;
|
|||
|
|
self.mainTableV.rowHeight = 30;
|
|||
|
|
[self.mainTableV registerNib:[UINib nibWithNibName:@"SPBlindXunlehuiCell" bundle:nil] forCellReuseIdentifier:@"SPBlindXunlehuiCell"];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//更新每个模式的UI
|
|||
|
|
- (void)updateStageUI {
|
|||
|
|
if (self.pattern_id == 1) {
|
|||
|
|
_normalModeL.layer.borderWidth = 1;
|
|||
|
|
_normalModeL.textColor = HEXCOLOR(0xFF84BA);
|
|||
|
|
|
|||
|
|
_speedModeL.textColor = kWhiteColor;
|
|||
|
|
_speedModeL.layer.borderWidth = 0;
|
|||
|
|
|
|||
|
|
_superModeL.textColor = kWhiteColor;
|
|||
|
|
_superModeL.layer.borderWidth = 0;
|
|||
|
|
|
|||
|
|
}else if (self.pattern_id == 2) {
|
|||
|
|
_normalModeL.layer.borderWidth = 0;
|
|||
|
|
_normalModeL.textColor = kWhiteColor;
|
|||
|
|
|
|||
|
|
_speedModeL.textColor = HEXCOLOR(0xFF84BA);
|
|||
|
|
_speedModeL.layer.borderWidth = 1;
|
|||
|
|
|
|||
|
|
_superModeL.textColor = kWhiteColor;
|
|||
|
|
_superModeL.layer.borderWidth = 0;
|
|||
|
|
} else if (self.pattern_id == 3) {
|
|||
|
|
_normalModeL.layer.borderWidth = 0;
|
|||
|
|
_normalModeL.textColor = kWhiteColor;
|
|||
|
|
|
|||
|
|
_speedModeL.textColor = kWhiteColor;
|
|||
|
|
_speedModeL.layer.borderWidth = 0;
|
|||
|
|
|
|||
|
|
_superModeL.textColor = HEXCOLOR(0xFF84BA);
|
|||
|
|
_superModeL.layer.borderWidth = 1;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)onTimerFired:(ZWTimer *)timer {
|
|||
|
|
self.leftSecond -= 1;
|
|||
|
|
if (self.leftSecond < 0) {
|
|||
|
|
self.leftSecond = 0;
|
|||
|
|
[self.timer stopTimer];
|
|||
|
|
}
|
|||
|
|
self.daojishiL.text = [NSString stringWithFormat:@"%02ld:%02ld", self.leftSecond/60, self.leftSecond%60];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)setWantSendNum:(NSInteger)wantSendNum {
|
|||
|
|
_wantSendNum = wantSendNum;
|
|||
|
|
|
|||
|
|
NSString *btnText = [NSString stringWithFormat:@"x%@", @(wantSendNum).stringValue];
|
|||
|
|
[self.giftNumButton setTitle:btnText forState:UIControlStateNormal];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (IBAction)selectNumAction:(id)sender {
|
|||
|
|
UIAlertController *sheet = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
|
|||
|
|
NSArray<NSString *> *titleArr = @[@"10", @"1"];
|
|||
|
|
for (NSString *btnText in titleArr) {
|
|||
|
|
NSString *fixText = [NSString stringWithFormat:@"x%@", btnText];
|
|||
|
|
[sheet addAction:[UIAlertAction actionWithTitle:fixText style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
|
|||
|
|
self.wantSendNum = btnText.integerValue;
|
|||
|
|
self.priceL.text = [NSString stringWithFormat:@"%ld", self.price * self.wantSendNum];
|
|||
|
|
|
|||
|
|
}]];
|
|||
|
|
}
|
|||
|
|
[sheet addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil]];
|
|||
|
|
[UIViewController.currentViewController presentViewController:sheet animated:YES completion:nil];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
#pragma mark -UITableViewDelegate
|
|||
|
|
|
|||
|
|
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
|||
|
|
return self.dataArray.count;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
|||
|
|
SPBlindXunlehuiCell *cell = [tableView dequeueReusableCellWithIdentifier:@"SPBlindXunlehuiCell"];
|
|||
|
|
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
|||
|
|
NSString *info = self.dataArray[indexPath.row];
|
|||
|
|
cell.contentL.text = info;
|
|||
|
|
return cell;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (IBAction)blindRuleAction:(id)sender {
|
|||
|
|
SPBlindXunlehuiRuleAlert *alert = LoadNib(@"SPBlindXunlehuiRuleAlert");
|
|||
|
|
alert.frame = [UIScreen mainScreen].bounds;
|
|||
|
|
[MainWindow() addSubview:alert];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (IBAction)blindRankAction:(id)sender {
|
|||
|
|
SPBlindXunlehuiRankAlert *alert = LoadNib(@"SPBlindXunlehuiRankAlert");
|
|||
|
|
alert.frame = [UIScreen mainScreen].bounds;
|
|||
|
|
[MainWindow() addSubview:alert];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (IBAction)blindRecordAction:(id)sender {
|
|||
|
|
SPBlindXunlehuiRecordAlert *alert = LoadNib(@"SPBlindXunlehuiRecordAlert");
|
|||
|
|
alert.frame = [UIScreen mainScreen].bounds;
|
|||
|
|
[MainWindow() addSubview:alert];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (IBAction)chargeAction:(id)sender {
|
|||
|
|
SPWalletJinbiVC *vc = [SPWalletJinbiVC new];
|
|||
|
|
[vc pushSelf];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (IBAction)backAction:(id)sender {
|
|||
|
|
[self.navigationController popViewControllerAnimated:YES];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
- (ZWTimer *)timer {
|
|||
|
|
if (!_timer) {
|
|||
|
|
_timer = [[ZWTimer alloc] init];
|
|||
|
|
}
|
|||
|
|
return _timer;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (NSMutableArray *)dataArray {
|
|||
|
|
if (!_dataArray) {
|
|||
|
|
self.dataArray = [NSMutableArray array];
|
|||
|
|
}
|
|||
|
|
return _dataArray;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)dealloc {
|
|||
|
|
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
- (GiftTableView *)lianjiView {
|
|||
|
|
if (!_lianjiView) {
|
|||
|
|
_lianjiView = [[GiftTableView alloc] init];
|
|||
|
|
_lianjiView.backgroundColor = [UIColor clearColor];
|
|||
|
|
_lianjiView.userInteractionEnabled = NO;
|
|||
|
|
}
|
|||
|
|
return _lianjiView;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
#pragma mark -------------爆币礼物托盘-------------
|
|||
|
|
|
|||
|
|
//- (void)onShowGiftTuopanWith:(NSDictionary *)dict {
|
|||
|
|
// TCCustomMessageModel *model = [[TCCustomMessageModel alloc] init];
|
|||
|
|
// NSString *identity = [NSString stringWithFormat:@"%@%@%@", dict[@"send_user_info"][@"uid"], dict[@"recived_user_info"][@"uid"], [dict safeStringForKey:@"gift_name"]];
|
|||
|
|
// model.imUserId = identity;
|
|||
|
|
// model.imUserName = C_string(dict[@"send_user_info"][@"nick_name"]);
|
|||
|
|
// model.imUserIconUrl = C_string(dict[@"send_user_info"][@"head_pic"]);
|
|||
|
|
// model.giftUrl = [dict safeStringForKey:@"base_image"];
|
|||
|
|
// model.msg = [NSString stringWithFormat:@"赠送了 %@", dict[@"recived_user_info"][@"nick_name"]];
|
|||
|
|
// model.win_multiple = [dict safeIntForKey:@"win_multiple"];
|
|||
|
|
// model.combo = [dict safeIntForKey:@"num"];
|
|||
|
|
// [self.lianjiView sendGiftWith:model];
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
- (void)onShowGiftTuopanWith:(NSDictionary *)dict fromSelf:(BOOL)fromSelf{
|
|||
|
|
if (fromSelf) {
|
|||
|
|
TCCustomMessageModel *model = [[TCCustomMessageModel alloc] init];
|
|||
|
|
NSString *identity = [NSString stringWithFormat:@"%@%@%@", dict[@"send_user_info"][@"uid"], dict[@"recived_user_info"][@"uid"], [dict safeStringForKey:@"gift_name"]];
|
|||
|
|
model.imUserId = identity;
|
|||
|
|
model.imUserName = C_string(dict[@"send_user_info"][@"nick_name"]);
|
|||
|
|
model.imUserIconUrl = C_string(dict[@"send_user_info"][@"head_pic"]);
|
|||
|
|
model.giftUrl = [dict safeStringForKey:@"base_image"];
|
|||
|
|
model.msg = [NSString stringWithFormat:@"赠送了 %@", dict[@"recived_user_info"][@"nick_name"]];
|
|||
|
|
model.win_multiple = [dict safeIntForKey:@"win_multiple"];
|
|||
|
|
model.combo = [dict safeIntForKey:@"num"];
|
|||
|
|
[self.lianjiView sendGiftWith:model];
|
|||
|
|
|
|||
|
|
|
|||
|
|
//往群组发送托盘IM消息
|
|||
|
|
NSMutableDictionary *mDict = [NSMutableDictionary dictionaryWithDictionary:dict];
|
|||
|
|
[mDict setValue:@(self.lianjiView.currentShowNum).stringValue forKey:@"show_num"];
|
|||
|
|
NSDictionary *body = @{@"messageType":@(BJIMMsgType_GiftTuopan).stringValue, @"giftBean":mDict};
|
|||
|
|
[[V2TIMManager sharedInstance] sendGroupCustomMessage:body.mj_JSONData to:self.viewModel.roomInfo.roomId priority:V2TIM_PRIORITY_NORMAL succ:^{
|
|||
|
|
|
|||
|
|
} fail:^(int code, NSString *msg) {
|
|||
|
|
// 群聊文本消息发送失败
|
|||
|
|
}];
|
|||
|
|
}else {
|
|||
|
|
TCCustomMessageModel *model = [[TCCustomMessageModel alloc] init];
|
|||
|
|
NSString *identity = [NSString stringWithFormat:@"%@%@%@", dict[@"send_user_info"][@"uid"], dict[@"recived_user_info"][@"uid"], [dict safeStringForKey:@"gift_name"]];
|
|||
|
|
model.imUserId = identity;
|
|||
|
|
model.imUserName = C_string(dict[@"send_user_info"][@"nick_name"]);
|
|||
|
|
model.imUserIconUrl = C_string(dict[@"send_user_info"][@"head_pic"]);
|
|||
|
|
model.giftUrl = [dict safeStringForKey:@"base_image"];
|
|||
|
|
model.msg = [NSString stringWithFormat:@"赠送了 %@", dict[@"recived_user_info"][@"nick_name"]];
|
|||
|
|
model.win_multiple = [dict safeIntForKey:@"win_multiple"];
|
|||
|
|
//强制同步
|
|||
|
|
model.needTongbu = YES;
|
|||
|
|
model.tongbuNum = [dict safeIntForKey:@"show_num"];
|
|||
|
|
[self.lianjiView sendGiftWith:model];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
@end
|