| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- //
- // SelectBankerView.m
- // BuguLive
- //
- // Created by yy on 17/2/22.
- // Copyright © 2017年 xfg. All rights reserved.
- //
- #import "SelectBankerView.h"
- @implementation SelectBankerView
- + (instancetype)EditNibFromXib
- {
- return [[NSBundle mainBundle] loadNibNamed:NSStringFromClass(self) owner:nil options:nil].lastObject;
- }
- - (void)createStyle
- {
- _dataArray = [[NSMutableArray alloc]init];
-
- self.layer.cornerRadius = 10;
- self.layer.masksToBounds = YES;
- _titleLabel.textColor = kAppGrayColor1;
- _horLabel.backgroundColor = kAppSpaceColor2;
- _verLabel.backgroundColor = kAppSpaceColor2;
- [_cancelButton setTitleColor:kGrayTransparentColor5 forState:UIControlStateNormal];
- [_confirmButton setTitleColor:kAppMainColor forState:UIControlStateNormal];
- [_cancelButton addTarget:self action:@selector(cancelAuction) forControlEvents:UIControlEventTouchUpInside];
- [_confirmButton addTarget:self action:@selector(confirmAuction) forControlEvents:UIControlEventTouchUpInside];
- _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
- [_tableView registerNib:[UINib nibWithNibName:@"SelectBankerTableViewCell" bundle:nil] forCellReuseIdentifier:@"SelectBankerTableViewCell"];
- }
- #pragma mark 选择玩家上庄请求
- - (void)selectBanker
- {
- NSMutableDictionary *mDict = [NSMutableDictionary dictionary];
- [mDict setObject:@"games" forKey:@"ctl"];
- [mDict setObject:@"chooseBanker" forKey:@"act"];
- [mDict setObject:_banker_log_id forKey:@"banker_log_id"];
- [self.httpsManager POSTWithParameters:mDict SuccessBlock:^(NSDictionary *responseJson) {
-
- if ([responseJson toInt:@"status"] ==1)
- {
- _banker_log_id = nil;
- }
-
- } FailureBlock:^(NSError *error) {
-
- }];
- }
- - (void)setDataArray:(NSMutableArray *)dataArray
- {
- _dataArray = dataArray;
- [_tableView reloadData];
- }
- - (void)cancelAuction
- {
- _banker_log_id = nil;
- if (_delegate && [_delegate respondsToSelector:@selector(selectBankerViewDown)])
- {
- [_delegate selectBankerViewDown];
- }
- }
- - (void)confirmAuction
- {
- if (_banker_log_id != nil) {
- [self selectBanker];
- }
- else
- {
- if (_dataArray.count > 0)
- {
- [[BGHUDHelper sharedInstance]tipMessage:ASLocalizedString(@"请选择玩家")];
- }
- else
- {
- [[BGHUDHelper sharedInstance]tipMessage:ASLocalizedString(@"暂时没有玩家上庄")];
- }
-
- return;
- }
-
- if (_delegate && [_delegate respondsToSelector:@selector(selectBankerViewDown)])
- {
- [_delegate selectBankerViewDown];
- }
- }
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
- {
- return _dataArray.count;
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- GameBankerModel *model;
- if (indexPath.row < _dataArray.count) {
- model = _dataArray[indexPath.row];
- }
- SelectBankerTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"SelectBankerTableViewCell" forIndexPath:indexPath];
- cell.selectionStyle = UITableViewCellSelectionStyleNone;
- cell.commentLabel.text = model.banker_name;
-
- if (self.BuguLive.appModel.open_diamond_game_module == 1)
- {
- cell.coinLabel.text = [NSString stringWithFormat:@"%@%@",model.coin,self.BuguLive.appModel.diamond_name];
- }
- else
- {
- cell.coinLabel.text = [NSString stringWithFormat:ASLocalizedString(@"%@游戏币"),model.coin];
- }
-
- if (model.isSelect )
- {
- cell.commentLabel.textColor = kAppGrayColor1;
- cell.coinLabel.textColor = kAppGrayColor1;
- cell.iconImageView.image = [UIImage imageNamed:@"ic_live_pop_choose_on"];
- }
- else
- {
- cell.commentLabel.textColor = kAppGrayColor1;
- cell.coinLabel.textColor = kAppGrayColor1;
- cell.iconImageView.image = [UIImage imageNamed:@"ic_live_pop_choose_off"];
- }
- return cell;
- }
- - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
- {
- [_tableView deselectRowAtIndexPath:indexPath animated:NO];
- GameBankerModel *model;
- if (indexPath.row < _dataArray.count) {
- model = _dataArray[indexPath.row];
- }
- _banker_log_id = model.banker_log_id;
-
- for (GameBankerModel *model in _dataArray) {
- model.isSelect = NO;
- }
- model.isSelect = YES;
- [_tableView reloadData];
- }
- @end
|