MOGiftListView.m 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131
  1. //
  2. // MOGiftListView.m
  3. // MiMoLive
  4. //
  5. // Created by SuperC on 2023/11/23.
  6. //
  7. #import "MOGiftListView.h"
  8. #import "JXCategoryView.h"
  9. #import "MOGiftCollectionView.h"
  10. #import "MOGiftUserView.h"
  11. #import "MOStripeView.h"
  12. #import "MOGuideMaskView.h"
  13. #import "MOShowBubbleTool.h"
  14. #import "MOExpProgressView.h"//经验View
  15. #import "MOCustomGiftNumView.h"//自定义数量view
  16. #import "MOGiftListBagView.h"//背包view
  17. #import "MORemindAlertView.h"
  18. #import "MOBlindBoxTool.h"
  19. #import "MOBlindboxLottery.h"
  20. #import "MOShopList.h"
  21. #import "MOPropInfo.h"
  22. @interface MOGiftListView ()<MOGiftBottomMenuViewDelegate,
  23. MOGiftPanelsViewDelegate, MOGiftListViewModelDelegate,
  24. MOGiftComboViewDelegate>
  25. @property (strong, nonatomic) UIView *bgView;
  26. @property (strong, nonatomic) MASConstraint *bgViewHeight;
  27. @property (strong, nonatomic) UIView *bottomView;
  28. @property (strong, nonatomic) MASConstraint *bottomViewTop;
  29. @property (strong, nonatomic) UIImageView *bgImgView;
  30. @property (nonatomic, assign) NSInteger category;
  31. @property (nonatomic, strong) MOBaseLevelView *levelImgView;
  32. @property (nonatomic, strong) BigBtn *nextLevelBtn;
  33. @property (nonatomic, strong) BigBtn *vipBtn;
  34. @property (nonatomic, strong) BigBtn *zuanTagBtn;
  35. @property (nonatomic, strong) UILabel *expTipLab;
  36. @property (nonatomic, strong) MOGiftUserView *giftUserView;
  37. //震动反馈
  38. @property (nonatomic, strong) UIImpactFeedbackGenerator *generator;
  39. @property (nonatomic, strong) MOExpProgressView *expView;//经验View
  40. @property (nonatomic, strong) MOCustomGiftNumView *customNumView;//自定义礼物数量view
  41. @property (nonatomic, strong) MOGiftListBagView *bagView;//背包view
  42. @property (nonatomic, strong) UIImageView *susuImageView;
  43. @property (nonatomic, assign) MOBlindBoxRecordType blindBoxType;//盲盒礼物选中的处理方式
  44. @property (nonatomic, assign) BOOL showBlindBoxGiftAlert;//是否展示盲盒礼盒礼物选中的弹窗
  45. @property (nonatomic, strong) MOGiftListViewModel *listViewModel;
  46. @property (nonatomic, strong) MOGiftPanelsView* giftPanelsView;
  47. @property (nonatomic, strong) MOGiftBottomMenuView *bottomMenuView;
  48. @property (nonatomic, strong) MOGiftComboView *comboView;
  49. @property (nonatomic, strong) MOShopList *selectedProp;
  50. @end
  51. @implementation MOGiftListView
  52. - (instancetype)initWith:(MOGiftListViewModel *)listViewModel {
  53. self = [super init];
  54. if (self) {
  55. self.listViewModel = listViewModel;
  56. [self setupViews];
  57. [listViewModel addObserver:self];
  58. }
  59. return self;
  60. }
  61. - (void)setupViews {
  62. UIButton *dismiss = [UIButton new];
  63. [dismiss addTarget:self action:@selector(dismissBtnClick:) forControlEvents:UIControlEventTouchUpInside];
  64. [self addSubview:dismiss];
  65. [dismiss mas_makeConstraints:^(MASConstraintMaker *make) {
  66. make.edges.equalTo(self);
  67. }];
  68. self.bgView = [UIView new];
  69. [self addSubview:self.bgView];
  70. [self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
  71. make.leading.trailing.equalTo(self);
  72. make.bottom.equalTo(self);
  73. make.height.equalTo(@(kScaleWidth(430.0)));
  74. }];
  75. self.bgImgView = [UIImageView new];
  76. [self.bgView addSubview:self.bgImgView];
  77. [self.bgImgView mas_makeConstraints:^(MASConstraintMaker *make) {
  78. make.edges.equalTo(self.bgView);
  79. }];
  80. self.bottomView = [UIView new];
  81. [self.bgView addSubview:self.bottomView];
  82. [self.bottomView mas_makeConstraints:^(MASConstraintMaker *make) {
  83. make.leading.trailing.bottom.equalTo(self.bgView);
  84. self.bottomViewTop = make.top.equalTo(self.bgView).offset(56);
  85. }];
  86. self.viewType = MOGiftListViewTypeVideo;
  87. self.tag = TagLiveGiftListView;
  88. self.bgView.layer.cornerRadius = 16.0;
  89. self.bgView.layer.maskedCorners = kCALayerMinXMinYCorner | kCALayerMaxXMinYCorner;
  90. // self.bgView.layer.masksToBounds = YES;
  91. NSArray *bgColorArr = @[[MOTools colorWithHexString:@"#12121F" alpha:1.0],[MOTools colorWithHexString:@"#12121F" alpha:1.0]];
  92. UIImage *bgImage = [MOTools createGradientRectImageWithBounds:CGRectMake(0, 0, SCREENWIDTH, 400.0) Colors:bgColorArr GradientType:1];
  93. [self.bgImgView setImage:bgImage];
  94. self.bgImgView.layer.cornerRadius = 16.0;
  95. self.bgImgView.layer.maskedCorners = kCALayerMinXMinYCorner | kCALayerMaxXMinYCorner;
  96. self.bgImgView.hidden = YES;
  97. self.bottomView.backgroundColor = [MOTools colorWithHexString:@"#12121F" alpha:1.0];
  98. self.bottomView.layer.cornerRadius = 16.0;
  99. self.bottomView.layer.maskedCorners = kCALayerMinXMinYCorner | kCALayerMaxXMinYCorner;
  100. CGFloat giftUserViewHeight = kScaleWidth(56.0);
  101. self.bottomViewTop.mas_equalTo(giftUserViewHeight);
  102. [self.bgView addSubview:self.giftUserView];
  103. [self.giftUserView mas_makeConstraints:^(MASConstraintMaker *make) {
  104. make.top.equalTo(self.bgView).offset(0.0);
  105. make.left.equalTo(self.bgView).offset(0.0);
  106. make.right.equalTo(self.bgView).offset(0.0);
  107. make.height.equalTo(@(kScaleWidth(56.0)));
  108. }];
  109. self.giftUserView.hidden = YES;
  110. MOMeDataInfo *userInfoData = (MOMeDataInfo *)[[MODataCache sharedYYCache] objectForKey:kMineUserInfo];
  111. CGFloat vipTopSpac = giftUserViewHeight + 9.0;
  112. [self.bgView addSubview:self.vipBtn];
  113. [self.vipBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  114. make.top.equalTo(self.bgView).offset(vipTopSpac);
  115. make.right.equalTo(self.bgView).offset(-12.0);
  116. make.height.equalTo(@24.0);
  117. make.width.equalTo(@24.0);
  118. }];
  119. UIImageView *tagOneImgView = [[UIImageView alloc] init];
  120. tagOneImgView.contentMode = UIViewContentModeScaleToFill;
  121. NSArray *tagOneImgColorArr = @[[MOTools colorWithHexString:@"#FFFFFF" alpha:0],[MOTools colorWithHexString:@"#FFFFFF" alpha:0.1],[MOTools colorWithHexString:@"#FFFFFF" alpha:0.1],[MOTools colorWithHexString:@"#FFFFFF" alpha:0]];
  122. UIImage *tagOneImage = [MOTools createGradientRectImageWithBounds:CGRectMake(0, 0, 26.0, 0.5) Colors:tagOneImgColorArr GradientType:1];
  123. [tagOneImgView setImage:tagOneImage];
  124. [self.bgView addSubview:tagOneImgView];
  125. [tagOneImgView mas_makeConstraints:^(MASConstraintMaker *make) {
  126. make.height.equalTo(@26.0);
  127. make.width.equalTo(@1);
  128. make.right.equalTo(self.vipBtn.mas_left).offset(-12.0);
  129. make.centerY.equalTo(self.vipBtn.mas_centerY);
  130. }];
  131. [self.bgView addSubview:self.zuanTagBtn];
  132. [self.zuanTagBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  133. make.right.equalTo(tagOneImgView.mas_left).offset(-12.0);
  134. make.height.equalTo(@24.0);
  135. make.width.equalTo(@24.0);
  136. make.centerY.equalTo(self.vipBtn.mas_centerY);
  137. }];
  138. UIImageView *tagTwoImgView = [[UIImageView alloc] init];
  139. tagTwoImgView.contentMode = UIViewContentModeScaleToFill;
  140. [tagTwoImgView setImage:tagOneImage];
  141. [self.bgView addSubview:tagTwoImgView];
  142. [tagTwoImgView mas_makeConstraints:^(MASConstraintMaker *make) {
  143. make.height.equalTo(@26.0);
  144. make.width.equalTo(@1);
  145. make.right.equalTo(self.zuanTagBtn.mas_left).offset(-12.0);
  146. make.centerY.equalTo(self.vipBtn.mas_centerY);
  147. }];
  148. [self.bgView addSubview:self.levelImgView];
  149. [self.levelImgView mas_makeConstraints:^(MASConstraintMaker *make) {
  150. make.width.equalTo(@(MOLevelNormalWidth));
  151. make.height.equalTo(@(MOLevelNormalHeight));
  152. make.centerY.equalTo(self.vipBtn.mas_centerY);
  153. make.left.equalTo(self.bgView).offset(12.0);
  154. }];
  155. self.levelImgView.levelNum = userInfoData.level;
  156. if(userInfoData.level >= 100){
  157. [self.levelImgView mas_updateConstraints:^(MASConstraintMaker *make) {
  158. make.width.equalTo(@(MOLevelMaxWidth));
  159. }];
  160. }
  161. else{
  162. [self.levelImgView mas_updateConstraints:^(MASConstraintMaker *make) {
  163. make.width.equalTo(@(MOLevelNormalWidth));
  164. }];
  165. }
  166. [self.bgView addSubview:self.expView];
  167. [self.expView mas_makeConstraints:^(MASConstraintMaker *make) {
  168. make.centerY.equalTo(self.levelImgView.mas_centerY).offset(-8.0);
  169. make.left.equalTo(self.levelImgView.mas_right).offset(10.0);
  170. make.width.equalTo(@190.0);
  171. make.height.equalTo(@10.0);
  172. }];
  173. if(userInfoData.nextExp != 0){
  174. self.expView.nextExp = userInfoData.nextExp;
  175. self.expView.currExp = userInfoData.currExp;
  176. [self.expView updateViewData];
  177. }
  178. else{
  179. self.expView.progress = 0.03;
  180. }
  181. [self.bgView addSubview:self.expTipLab];
  182. [self.expTipLab mas_makeConstraints:^(MASConstraintMaker *make) {
  183. make.left.equalTo(self.levelImgView.mas_right).offset(10.0);
  184. make.top.equalTo(self.expView.mas_bottom).offset(2.0);
  185. make.right.equalTo(self.expView.mas_right);
  186. }];
  187. [self updateTheExpTipLab];
  188. [self.bgView addSubview:self.nextLevelBtn];
  189. [self.nextLevelBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  190. make.centerY.equalTo(self.vipBtn.mas_centerY);
  191. make.right.equalTo(tagTwoImgView.mas_left).offset(-12.0);
  192. make.height.width.equalTo(@12.0);
  193. }];
  194. CGFloat titleCategoryTop = giftUserViewHeight + 52.0;
  195. MOGiftPanelsView *panelsView = [[MOGiftPanelsView alloc] init:self.listViewModel];
  196. panelsView.delegate = self;
  197. [self.bgView addSubview:panelsView];
  198. [panelsView mas_makeConstraints:^(MASConstraintMaker *make) {
  199. make.top.equalTo(self.bgView).offset(titleCategoryTop);
  200. make.leading.trailing.equalTo(self.bgView);
  201. make.bottom.equalTo(self.bgView);
  202. }];
  203. self.giftPanelsView = panelsView;
  204. [self.bgView addSubview:self.susuImageView];
  205. [self.susuImageView mas_makeConstraints:^(MASConstraintMaker *make) {
  206. make.left.right.equalTo(self.bgView);
  207. make.bottom.equalTo(self.bgView).offset(0);
  208. make.height.equalTo(@90.0);
  209. }];
  210. self.bottomMenuView = [[MOGiftBottomMenuView alloc] init];
  211. self.bottomMenuView.delegate = self;
  212. [self.bgView addSubview:self.bottomMenuView];
  213. [self.bottomMenuView mas_makeConstraints:^(MASConstraintMaker *make) {
  214. make.leading.trailing.equalTo(self.bgView);
  215. make.bottom.equalTo(self.bgView).offset(-kBottomSafeAreaInset);
  216. }];
  217. [self addSubview:self.customNumView];
  218. [self.customNumView mas_makeConstraints:^(MASConstraintMaker *make) {
  219. make.edges.equalTo(self);
  220. }];
  221. [self setZuanNumBtnTitleWith:userInfoData.userWallet.diamond];
  222. }
  223. - (void)setZuanNumBtnTitleWith:(double)diamond{
  224. [self.bottomMenuView updateUserDiamond:diamond];
  225. }
  226. - (void)setIsSingleLinkMic:(BOOL)isSingleLinkMic{
  227. _isSingleLinkMic = isSingleLinkMic;
  228. self.giftUserView.isSingleLinkMic = isSingleLinkMic;
  229. }
  230. - (void)setMultiple:(BOOL)multiple{
  231. _multiple = multiple;
  232. if(multiple){
  233. self.giftUserView.hidden = NO;
  234. self.bottomView.layer.cornerRadius = 0;
  235. }
  236. else{
  237. self.giftUserView.hidden = YES;
  238. self.bottomView.layer.cornerRadius = 16;
  239. }
  240. [UIView animateWithDuration:0.3 animations:^{
  241. [self layoutIfNeeded];
  242. }];
  243. }
  244. - (void)setAnchorUser:(MOUserProfile *)anchorUser{
  245. _anchorUser = anchorUser;
  246. self.giftUserView.anchorUser = anchorUser;
  247. }
  248. - (void)setLinkMics:(NSArray *)linkMics{
  249. _linkMics = linkMics;
  250. self.giftUserView.linkMics = linkMics;
  251. }
  252. - (void)setSelectUserArr:(NSArray *)selectUserArr{
  253. _selectUserArr = selectUserArr;
  254. self.giftUserView.oldSelectUserArr = [selectUserArr copy];
  255. }
  256. - (void)toUpdateTheCurrentCollectionData{
  257. if(self.bagView.hidden == NO){
  258. [self.bagView toUpdataTheSelectIndexPathCell];
  259. } else{
  260. [self.giftPanelsView toUpdateTheCurrentCollectionData];
  261. }
  262. }
  263. - (void)updateStripViewWith:(MOStripe *)stripe OrSkins:(NSArray *)skins{
  264. [self.giftPanelsView updateStripViewWithSelected:self.chooseGiftModel stripe:stripe or:skins];
  265. }
  266. - (void)handleSelectGift:(MOGiftlist *)gift {
  267. self.selectedProp = nil;
  268. self.chooseGiftModel = gift;
  269. self.chooseGiftModel.giftInfo.selectSkin = nil;
  270. [self.comboView stopCombo];
  271. [self.bottomMenuView updateSelectItem:gift];
  272. [self.bottomMenuView selectGiftNum:1];
  273. self.expView.giftNum = 1;
  274. self.expView.moreExp = gift.basicExp + gift.additionExp;
  275. }
  276. - (void)handleSelectProp:(MOShopList *)prop {
  277. self.selectedProp = prop;
  278. self.chooseGiftModel = nil;
  279. self.chooseGiftModel.giftInfo.selectSkin = nil;
  280. [self.comboView stopCombo];
  281. [self.bottomMenuView updateSelectItem:prop];
  282. }
  283. - (void)toUpdateTheBaseCacheAndUse:(BOOL)isUsed {
  284. //道具分类\n * 1: 头饰\n * 2: 气泡\n * 3: 入场座驾(旧:进场条)\n * 4: 名片框\n * 5: 直播徽章\n * 6: 用户徽章\n * 7: 进场条(旧:进场飘屏)\n * 8: 打赏横幅\n * 9: 连麦边框\n * 10: 直播弹幕
  285. NSInteger type = (NSInteger)self.selectedProp.category;
  286. if(isUsed){
  287. //使用的时候, code必不为0
  288. NSInteger code = self.selectedProp.propInfo.storeInfo.code;
  289. if(code == 0){
  290. return;
  291. }
  292. }
  293. switch (type) {
  294. case 1:
  295. {
  296. //头饰 - 刷新房间自己的头饰
  297. if(isUsed){
  298. self.headDressChangeBlock ? self.headDressChangeBlock(self.selectedProp.propInfo.storeInfo) : nil;
  299. }
  300. else{
  301. self.headDressChangeBlock ? self.headDressChangeBlock(nil) : nil;
  302. }
  303. }
  304. break;
  305. case 2:
  306. {
  307. NSInteger bubbleCode;
  308. //进场条
  309. if(isUsed){
  310. bubbleCode = self.selectedProp.propInfo.storeInfo.code;
  311. }
  312. else{
  313. bubbleCode = 0;
  314. }
  315. [[NSUserDefaults standardUserDefaults] setObject:@(bubbleCode) forKey:kUserBubbleCode];
  316. [[NSUserDefaults standardUserDefaults] synchronize];
  317. }
  318. break;
  319. case 3:
  320. {
  321. //入场特效
  322. NSInteger enterBar;
  323. //进场条
  324. if(isUsed){
  325. enterBar = self.selectedProp.propInfo.storeInfo.code;
  326. }
  327. else{
  328. enterBar = 0;
  329. }
  330. [[NSUserDefaults standardUserDefaults] setObject:@(enterBar) forKey:kUserEnterBar];
  331. [[NSUserDefaults standardUserDefaults] synchronize];
  332. }
  333. break;
  334. case 4:
  335. {
  336. //名片框
  337. NSInteger cardFrame;
  338. //进场条
  339. if(isUsed){
  340. cardFrame = self.selectedProp.propInfo.storeInfo.code;
  341. }
  342. else{
  343. cardFrame = 0;
  344. }
  345. [[NSUserDefaults standardUserDefaults] setObject:@(cardFrame) forKey:kCardFrameCode];
  346. [[NSUserDefaults standardUserDefaults] synchronize];
  347. }
  348. break;
  349. case 7:
  350. {
  351. NSInteger enterFloating;
  352. //进场条 - 进场飘屏
  353. if(isUsed){
  354. enterFloating = self.selectedProp.propInfo.storeInfo.code;
  355. }
  356. else{
  357. enterFloating = 0;
  358. }
  359. [[NSUserDefaults standardUserDefaults] setObject:@(enterFloating) forKey:kEnterFloatingCode];
  360. [[NSUserDefaults standardUserDefaults] synchronize];
  361. }
  362. break;
  363. case 8:
  364. {
  365. //打赏横幅
  366. NSInteger rewardBanner;
  367. if(isUsed){
  368. rewardBanner = self.selectedProp.propInfo.storeInfo.code;
  369. }
  370. else{
  371. rewardBanner = 0;
  372. }
  373. [[NSUserDefaults standardUserDefaults] setObject:@(rewardBanner) forKey:kRewardBannerCode];
  374. [[NSUserDefaults standardUserDefaults] synchronize];
  375. }
  376. break;
  377. case 9:
  378. {
  379. //连麦边框
  380. NSInteger linkMicFrame;
  381. if(isUsed){
  382. linkMicFrame = self.selectedProp.propInfo.storeInfo.code;
  383. }
  384. else{
  385. linkMicFrame = 0;
  386. }
  387. [[NSUserDefaults standardUserDefaults] setObject:@(linkMicFrame) forKey:kLinkMicFrameCode];
  388. [[NSUserDefaults standardUserDefaults] synchronize];
  389. if(isUsed){
  390. self.linkMicPropChangeBlock ? self.linkMicPropChangeBlock(self.selectedProp.propInfo.storeInfo) : nil;
  391. }
  392. else{
  393. self.linkMicPropChangeBlock ? self.linkMicPropChangeBlock(nil) : nil;
  394. }
  395. }
  396. break;
  397. case 10:
  398. {
  399. //直播弹幕
  400. NSInteger liveBarrage;
  401. if(isUsed){
  402. liveBarrage = self.selectedProp.propInfo.storeInfo.code;
  403. }
  404. else{
  405. liveBarrage = 0;
  406. }
  407. [[NSUserDefaults standardUserDefaults] setObject:@(liveBarrage) forKey:kLiveBarrageCode];
  408. [[NSUserDefaults standardUserDefaults] synchronize];
  409. }
  410. break;
  411. default:
  412. break;
  413. }
  414. }
  415. #pragma mark - My Mothed
  416. - (void)sendGiftAction{
  417. if(!self.chooseGiftModel){
  418. [MBProgressHUD showTipMessageInWindow:NSLocalString(@"mimo_room_living_send_gift")];
  419. return;
  420. }
  421. if(self.multiple && self.giftUserView.selectUserArr.count == 0){
  422. [MBProgressHUD showTipMessageInWindow:NSLocalString(@"mimo_voice_at_least_one")];
  423. return;
  424. }
  425. WEAKSELF
  426. // [self.generator impactOccurred];
  427. if (self.chooseGiftModel.giftInfo.blindBoxGift && !self.showBlindBoxGiftAlert) {
  428. BOOL canShow = [MOBlindBoxTool canShowRemindAlertView];
  429. MOBlindBoxRecordType recordType = [MOBlindBoxTool getRecordType];
  430. self.blindBoxType = recordType;
  431. if (!canShow) {
  432. self.showBlindBoxGiftAlert = YES;
  433. [self sendGiftAction];
  434. return;
  435. }
  436. WEAKSELF
  437. MORemindAlertView *view = [[MORemindAlertView alloc] init];
  438. [view hideRemindButton];
  439. view.leftButtonBlock = ^(BOOL notRemind) {
  440. weakSelf.blindBoxType = MOBlindBoxRecordTypeBag;
  441. if (notRemind) {//不再提醒
  442. [MOBlindBoxTool saveBlinBoxRecordType:MOBlindBoxRecordTypeBag];
  443. }
  444. [weakSelf sendGiftAction];
  445. };
  446. view.rightButtonBlock = ^(BOOL notRemind) {
  447. weakSelf.blindBoxType = MOBlindBoxRecordTypeSend;
  448. if (notRemind) {//不再提醒
  449. [MOBlindBoxTool saveBlinBoxRecordType:MOBlindBoxRecordTypeSend];
  450. }
  451. [weakSelf sendGiftAction];
  452. };
  453. [view show];
  454. self.showBlindBoxGiftAlert = YES;
  455. return;
  456. }
  457. if(self.multiple){
  458. if(self.chooseGiftModel.isBag){
  459. [self.listViewModel sendBagToUids:self.giftUserView.selectUserArr category:self.category gift:self.chooseGiftModel num:[self.bottomMenuView curGiftNum] completion:nil];
  460. }
  461. else{
  462. if (self.chooseGiftModel.giftInfo.blindBoxGift && self.blindBoxType == MOBlindBoxRecordTypeBag) {//盲盒礼物选中了放入背包,调用盲盒礼物抽奖
  463. [self drawBlindBox:self.chooseGiftModel];
  464. } else {
  465. [self.listViewModel sendGiftToUids:self.giftUserView.selectUserArr category:self.category gift:self.chooseGiftModel num:[self.bottomMenuView curGiftNum] completion:nil];
  466. }
  467. }
  468. }
  469. else{
  470. if(self.chooseGiftModel.isBag){
  471. [self.listViewModel sendBagToUid:self.targetUserId category:self.category gift:self.chooseGiftModel num:[self.bottomMenuView curGiftNum] completion:nil];
  472. }
  473. else{
  474. if (self.chooseGiftModel.giftInfo.blindBoxGift && self.blindBoxType == MOBlindBoxRecordTypeBag) {//盲盒礼物选中了放入背包,调用盲盒礼物抽奖
  475. [self drawBlindBox:self.chooseGiftModel];
  476. } else {
  477. [self.listViewModel sendGiftToUid:self.targetUserId category:self.category gift:self.chooseGiftModel num:[self.bottomMenuView curGiftNum] completion:nil];
  478. }
  479. }
  480. }
  481. }
  482. - (void)toUpdataTheViewExpViewDataWithLevel:(NSInteger)level AndCurrExp:(NSInteger)currExp AndNextExp:(NSInteger)nextExp{
  483. if(nextExp <= 0 || level <= 0){
  484. return;
  485. }
  486. //更新本地等级数据
  487. MOMeDataInfo *userInfoData = (MOMeDataInfo *)[[MODataCache sharedYYCache] objectForKey:kMineUserInfo];
  488. userInfoData.level = level;
  489. userInfoData.currExp = currExp;
  490. userInfoData.nextExp = nextExp;
  491. [[MODataCache sharedYYCache] setObject:userInfoData forKey:kMineUserInfo];
  492. NSInteger theLevel = GetUserLevel;//更新Rtm Level
  493. if(theLevel != level){
  494. [[NSUserDefaults standardUserDefaults] setObject:@(level) forKey:kUserLevel];
  495. [[NSUserDefaults standardUserDefaults] synchronize];
  496. }
  497. self.levelImgView.levelNum = level;
  498. if(userInfoData.level >= 100){
  499. [self.levelImgView mas_updateConstraints:^(MASConstraintMaker *make) {
  500. make.width.equalTo(@(MOLevelMaxWidth));
  501. }];
  502. }
  503. else{
  504. [self.levelImgView mas_updateConstraints:^(MASConstraintMaker *make) {
  505. make.width.equalTo(@(MOLevelNormalWidth));
  506. }];
  507. }
  508. self.expView.currExp = currExp;
  509. self.expView.nextExp = nextExp;
  510. [self.expView updateViewData];
  511. }
  512. - (void)toUseTheProps{
  513. MOShopList *curProp = self.selectedProp;
  514. if(!curProp || curProp.id.length == 0){
  515. return;
  516. }
  517. BOOL isUsed = !curProp.used;
  518. WEAKSELF
  519. NSDictionary *dict = @{@"id":curProp.id,
  520. @"use":@(isUsed)};
  521. [kHttpManager toUseThePropWithParams:dict andBlock:^(id _Nonnull data, NSError * _Nonnull error) {
  522. if(kCode_Success){
  523. //刷新当前界面
  524. curProp.used = isUsed;
  525. [weakSelf.bagView updatePropCollectionBy:weakSelf.selectedProp];
  526. //更新本地 缓存
  527. [weakSelf toUpdateTheBaseCacheAndUse:isUsed];
  528. if (weakSelf.selectedProp == curProp) {
  529. // 避免请求过程中选择了其他物品
  530. [weakSelf.bottomMenuView updateSelectItem:curProp];
  531. }
  532. if(isUsed){
  533. [MBProgressHUD showTipMessageInWindow:NSLocalString(@"mimo_2_bag_prop_equip_tip")];
  534. }
  535. else{
  536. [MBProgressHUD showTipMessageInWindow:NSLocalString(@"mimo_2_bag_prop_un_equip_tip")];
  537. }
  538. }
  539. else{
  540. kShowNetError(data)
  541. // weakSelf.theUseBtn.selected = !isUse;//报错 - 重置为原来
  542. // TODO: cwy
  543. }
  544. }];
  545. }
  546. - (void)drawBlindBox:(MOGiftlist *)giftModel {
  547. NSDictionary *dict = @{@"giftId": giftModel.giftInfo.id, @"roomId": self.listViewModel.curRoomId};
  548. [kHttpManager drawBlindBoxWithParams:dict andBlock:^(id _Nonnull data, NSError * _Nonnull error) {
  549. if(kCode_Success) {
  550. MOLogV(@"drawBlindBox: %@",[[NSString alloc] initWithData:[NSJSONSerialization dataWithJSONObject:data options:0 error:nil] encoding:NSUTF8StringEncoding]);
  551. } else {
  552. kShowNetError(data)
  553. }
  554. }];
  555. }
  556. - (void)toUpdataBagGiftWith:(MOGiftlist *)giftModel{
  557. [self.bagView toUpdataBagGiftWith:giftModel];
  558. }
  559. - (void)toDeleteBagGiftWith:(MOGiftlist *)giftModel Num:(NSInteger)num{
  560. [self.bagView toDeleteBagGiftWith:giftModel Num:num];
  561. }
  562. - (IBAction)dismissBtnClick:(id)sender {
  563. [self dismissGiftListView];
  564. }
  565. - (void)showGiftListView{
  566. [self setHidden:NO];
  567. self.frame = CGRectMake(0, 0, SCREENWIDTH, SCREENHEIGHT);
  568. CGRect actionViewRect = self.bgView.frame;
  569. actionViewRect.origin.y = SCREENHEIGHT;
  570. self.bgView.frame = actionViewRect;
  571. CGFloat moveHeight = kScaleWidth(430.0);
  572. if(self.multiple){
  573. moveHeight = kScaleWidth(430.0);
  574. }
  575. WEAKSELF
  576. [UIView animateWithDuration:0.3 animations:^{
  577. CGRect actionViewRect = weakSelf.bgView.frame;
  578. actionViewRect.origin.y = SCREENHEIGHT - moveHeight;
  579. weakSelf.bgView.frame = actionViewRect;
  580. } completion:^(BOOL finished) {
  581. [weakSelf.listViewModel preloadGiftList];
  582. weakSelf.showUpBlock();
  583. }];
  584. [self.giftPanelsView toJudgeIsNeedChangeTheSelectTitle];//判断是否有滑动到特定分类的需求
  585. //不能滑动
  586. SendNotification(@"MOShowLivePagesVCCannotScroll")
  587. if([MOSvgaSourceManage shareManager].giftCategoryArr.count == 0){
  588. [[MOSvgaSourceManage shareManager] toGetGiftCategoryListDataAndNeedShowError:YES];
  589. }
  590. [self toJudgeNeedShowBagRed];//判断背包红点逻辑
  591. self.showBlindBoxGiftAlert = NO; // 重制盲盒弹窗开关
  592. }
  593. - (void)toJudgeNeedShowBagRed{
  594. [self.giftPanelsView enableBagRedDot:self.giftRedCount > 0 || self.propRedCount > 0];
  595. }
  596. - (void)dismissGiftListView{
  597. [MOSvgaSourceManage shareManager].hitGiftModel = nil;
  598. //完成下移动画
  599. WEAKSELF
  600. [UIView animateWithDuration:0.3 animations:^
  601. {
  602. CGRect actionSheetViewRect = weakSelf.bgView.frame;
  603. actionSheetViewRect.origin.y = SCREENHEIGHT;
  604. weakSelf.bgView.frame = actionSheetViewRect;
  605. } completion:^(BOOL finished)
  606. {
  607. [self setHidden:YES];
  608. }];
  609. self.dismissBlock ? self.dismissBlock() : nil;
  610. //可以滑动
  611. SendNotification(@"MOShowLivePagesVCCanScroll")
  612. }
  613. #pragma mark - MOGiftListViewModelDelegate
  614. - (void)onUserBalanceChangedBySendGiftWithCurrent:(NSInteger)current {
  615. [self setZuanNumBtnTitleWith:current];
  616. }
  617. - (void)onUserLevelChangedBySendGiftWithLevel:(NSInteger)level curExp:(NSInteger)curExp nextExp:(NSInteger)nextExp {
  618. [self toUpdataTheViewExpViewDataWithLevel:level AndCurrExp:curExp AndNextExp:nextExp];
  619. }
  620. - (void)onSendGiftSuccessWithCategory:(NSInteger)category num:(NSInteger)num gift:(MOGiftlist *)gift info:(MOGiftInfo *)info {
  621. self.sentGiftBlock(gift, num, category, info);
  622. }
  623. - (void)onSendBagSuccessWithCategory:(NSInteger)category num:(NSInteger)num
  624. gift:(MOGiftlist *)gift info:(MOGiftInfo *)info
  625. newItem:(MOGiftlist * _Nullable)newItem {
  626. if (newItem != nil) {
  627. [self toUpdataBagGiftWith:newItem];
  628. } else {
  629. [self toDeleteBagGiftWith:gift Num:num];
  630. }
  631. self.sentGiftBlock(gift, num, category, info);
  632. }
  633. #pragma mark - Lazy
  634. - (MOBaseLevelView *)levelImgView{
  635. if(!_levelImgView){
  636. _levelImgView = [[MOBaseLevelView alloc] init];
  637. }
  638. return _levelImgView;
  639. }
  640. - (BigBtn *)nextLevelBtn{
  641. if(!_nextLevelBtn){
  642. _nextLevelBtn = [BigBtn buttonWithType:UIButtonTypeCustom];
  643. [_nextLevelBtn setImage:[UIImage imageNamed:@"v_2_mine_white_right"] forState:UIControlStateNormal];
  644. [_nextLevelBtn setTitleColor:[MOTools colorWithHexString:@"#29FFD4" alpha:1.0] forState:UIControlStateNormal];
  645. _nextLevelBtn.titleLabel.font = [MOTextTools getTheFontWithSize:10.0 AndFontName:kNormalContentFontStr];
  646. [_nextLevelBtn addTarget:self action:@selector(nextLevelBtnClick) forControlEvents:UIControlEventTouchUpInside];
  647. }
  648. return _nextLevelBtn;
  649. }
  650. - (void)nextLevelBtnClick{
  651. self.levelBtnBlock ? self.levelBtnBlock() : nil;
  652. [self dismissGiftListView];
  653. }
  654. - (BigBtn *)vipBtn{
  655. if(!_vipBtn){
  656. _vipBtn = [BigBtn buttonWithType:UIButtonTypeCustom];
  657. [_vipBtn setImage:[UIImage imageNamed:@"icon_live_gift_vip"] forState:UIControlStateNormal];
  658. [_vipBtn addTarget:self action:@selector(vipBtnClick) forControlEvents:UIControlEventTouchUpInside];
  659. }
  660. return _vipBtn;
  661. }
  662. - (void)vipBtnClick{
  663. self.vipBtnBlock ? self.vipBtnBlock() : nil;
  664. [self dismissGiftListView];
  665. }
  666. - (BigBtn *)zuanTagBtn{
  667. if(!_zuanTagBtn){
  668. _zuanTagBtn = [BigBtn buttonWithType:UIButtonTypeCustom];
  669. [_zuanTagBtn setImage:[UIImage imageNamed:@"icon_gift_zuan_48"] forState:UIControlStateNormal];
  670. [_zuanTagBtn addTarget:self action:@selector(zuanBtnClick) forControlEvents:UIControlEventTouchUpInside];
  671. }
  672. return _zuanTagBtn;
  673. }
  674. - (void)zuanBtnClick{
  675. [self topUpBtnClick:nil];
  676. }
  677. - (IBAction)topUpBtnClick:(id)sender {
  678. self.topUpBtnBlock ? self.topUpBtnBlock() : nil;
  679. // [self dismissGiftListView];
  680. }
  681. - (MOGiftUserView *)giftUserView{
  682. if(!_giftUserView){
  683. _giftUserView = [MOGiftUserView moGiftUserView];
  684. }
  685. return _giftUserView;
  686. }
  687. - (UIImpactFeedbackGenerator *)generator{
  688. if (!_generator){
  689. _generator = [[UIImpactFeedbackGenerator alloc] initWithStyle:UIImpactFeedbackStyleMedium];
  690. }
  691. return _generator;
  692. }
  693. - (MOExpProgressView *)expView{
  694. if(!_expView){
  695. _expView = [[MOExpProgressView alloc] initWithFrame:CGRectMake(0.0, 0.0, 190.0, 10.0)];
  696. WEAKSELF
  697. _expView.moreExpChangeBlock = ^{
  698. [weakSelf updateTheExpTipLab];
  699. };
  700. }
  701. return _expView;
  702. }
  703. - (UILabel *)expTipLab{
  704. if(!_expTipLab){
  705. _expTipLab = [[UILabel alloc] init];
  706. _expTipLab.font = [MOTextTools regularFont:10.0];
  707. _expTipLab.textColor = [MOTools colorWithHexString:@"#FFFFFF" alpha:0.5];
  708. _expTipLab.numberOfLines = 2;
  709. }
  710. return _expTipLab;
  711. }
  712. - (void)updateTheExpTipLab{
  713. CGFloat giftNum = self.expView.giftNum;
  714. if(giftNum == 0){
  715. giftNum = 1;
  716. }
  717. CGFloat moreExp = self.expView.moreExp * giftNum;
  718. CGFloat baseExp = 0.0;
  719. CGFloat xExp = 0.0;
  720. if(moreExp == 0){//基础经验 + 额外经验
  721. baseExp = 0.0;
  722. xExp = 0.0;
  723. }
  724. else{
  725. baseExp = self.chooseGiftModel.basicExp * giftNum;
  726. xExp = self.chooseGiftModel.additionExp * giftNum;
  727. }
  728. NSMutableAttributedString *attri = [[NSMutableAttributedString alloc] initWithString:@" "];
  729. if(baseExp > 0){
  730. NSString *expStr = [NSString stringWithFormat:@"+%.f",baseExp];
  731. NSString *contentStr = [NSString stringWithFormat:NSLocalString(@"mimo_send_gift_exp_1"),expStr];
  732. attri = [MOGiftListView base_colorfulStringWith:contentStr AndNameStr:expStr AndBaseColor:[MOTools colorWithHexString:@"#FFFFFF" alpha:0.5] AndNameColor:[MOTools colorWithHexString:@"#03FFB2" alpha:1.0]];
  733. [attri addAttribute:NSFontAttributeName value:[MOTextTools regularFont:10.0] range:NSMakeRange(0, attri.length)];
  734. }
  735. if(xExp > 0){
  736. NSString *moreStr = [NSString stringWithFormat:@"+%.f",xExp];
  737. NSString *contentStrTwo = [NSString stringWithFormat:NSLocalString(@"mimo_send_gift_exp_2"),moreStr];
  738. NSMutableAttributedString *attriTwo = [MOGiftListView base_colorfulStringWith:contentStrTwo AndNameStr:moreStr AndBaseColor:[MOTools colorWithHexString:@"#FFFFFF" alpha:0.5] AndNameColor:[MOTools colorWithHexString:@"#03FFB2" alpha:1.0]];
  739. [attriTwo addAttribute:NSFontAttributeName value:[MOTextTools regularFont:10.0] range:NSMakeRange(0, attriTwo.length)];
  740. [attri appendAttributedString:attriTwo];
  741. }
  742. if(self.expView.isLevelUp){
  743. NSString *tempStr = [NSString stringWithFormat:@" %@",NSLocalString(@"mimo_2_level_up")];
  744. NSMutableAttributedString *levelStr = [[NSMutableAttributedString alloc] initWithString:tempStr];
  745. [levelStr addAttribute:NSForegroundColorAttributeName value:[MOTools colorWithHexString:@"#03FFB2" alpha:1.0] range:NSMakeRange(0, levelStr.length)];
  746. [levelStr addAttribute:NSFontAttributeName value:[MOTextTools regularFont:10.0] range:NSMakeRange(0, levelStr.length)];
  747. [attri appendAttributedString:levelStr];
  748. }
  749. self.expTipLab.attributedText = attri;
  750. }
  751. + (NSMutableAttributedString *)base_colorfulStringWith:(NSString *)contentStr AndNameStr:(NSString *)nameStr AndBaseColor:(UIColor *)baseColor AndNameColor:(UIColor *)nameColor {
  752. // 创建属性字符串,整体颜色为白色
  753. NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:contentStr attributes:@{NSForegroundColorAttributeName:baseColor}];
  754. if(nameStr.length != 0){
  755. NSRange redRange = [contentStr rangeOfString:nameStr];
  756. if(redRange.location != NSNotFound){
  757. // 将最后三个字符的颜色设置为红色
  758. [attributedString addAttribute:NSForegroundColorAttributeName value:nameColor range:redRange];
  759. }
  760. }
  761. return attributedString;
  762. }
  763. - (MOCustomGiftNumView *)customNumView{
  764. if(!_customNumView){
  765. _customNumView = [[MOCustomGiftNumView alloc] initWithFrame:CGRectMake(0.0, 0.0, SCREENWIDTH, SCREENHEIGHT)];
  766. _customNumView.hidden = YES;
  767. WEAKSELF
  768. _customNumView.sureNumBlock = ^(NSInteger customNum) {
  769. if(customNum > weakSelf.chooseGiftModel.giftInfo.diyGiftNumberMax){
  770. customNum = weakSelf.chooseGiftModel.giftInfo.diyGiftNumberMax;
  771. NSString *tipStr = [NSString stringWithFormat:NSLocalString(@"mimo_2_live_custom_tip_2"),customNum];
  772. [MBProgressHUD showTipMessageInWindow:tipStr];
  773. return;
  774. }
  775. [weakSelf.customNumView.textField resignFirstResponder];//收回键盘
  776. [weakSelf.bottomMenuView updateCustomNum:customNum];
  777. weakSelf.expView.giftNum = customNum;
  778. [weakSelf toUpdateTheCurrentCollectionData];
  779. };
  780. }
  781. return _customNumView;
  782. }
  783. - (MOGiftListBagView *)bagView{
  784. if(!_bagView){
  785. WEAKSELF
  786. _bagView = [[MOGiftListBagView alloc] initWith:self.listViewModel];
  787. _bagView.frame =CGRectMake(0, 0, SCREENWIDTH, SCREENHEIGHT);
  788. _bagView.selectGiftBlock = ^(MOGiftlist * _Nonnull selectGiftModel, NSInteger giftType) {
  789. weakSelf.category = giftType;
  790. [weakSelf handleSelectGift:selectGiftModel];
  791. [weakSelf updateStripViewWith:selectGiftModel.giftInfo.stripe OrSkins:selectGiftModel.giftInfo.skins];
  792. };
  793. //选中回调
  794. _bagView.selectCellBlock = ^(MOShopList * _Nonnull selectGiftModel) {
  795. [weakSelf handleSelectProp:selectGiftModel];
  796. };
  797. _bagView.theFirstGiftBlock = ^{
  798. weakSelf.chooseGiftModel = nil;
  799. weakSelf.expView.moreExp = 0;
  800. [weakSelf updateStripViewWith:nil OrSkins:nil];
  801. };
  802. _bagView.redChangeBlock = ^(NSInteger giftRedCount, NSInteger propRedCount, NSInteger propNearExpiryPropCount) {
  803. weakSelf.redChangeBlock ? weakSelf.redChangeBlock(giftRedCount,propRedCount,propNearExpiryPropCount) : nil;
  804. };
  805. _bagView.headDressChangeBlock = ^(MOStoreInfo * _Nonnull stroeInfo) {
  806. weakSelf.headDressChangeBlock ? weakSelf.headDressChangeBlock(stroeInfo) : nil;
  807. };
  808. _bagView.linkMicPropChangeBlock = ^(MOStoreInfo * _Nonnull stroeInfo) {
  809. weakSelf.linkMicPropChangeBlock ? weakSelf.linkMicPropChangeBlock(stroeInfo) : nil;
  810. };
  811. _bagView.toShopBlock = ^{
  812. weakSelf.toShopBlock ? weakSelf.toShopBlock() : nil;
  813. [weakSelf dismissGiftListView];
  814. };
  815. _bagView.dismissBlock = ^{
  816. [weakSelf.giftPanelsView handleResume];
  817. };
  818. _bagView.hidden = YES;
  819. }
  820. return _bagView;
  821. }
  822. - (void)oneSecondPassed{
  823. //时间戳逻辑
  824. if(!self.bagView.hidden){
  825. [self.bagView oneSecondPassed];
  826. }
  827. }
  828. - (UIImageView *)susuImageView{
  829. if(!_susuImageView){
  830. _susuImageView = [[UIImageView alloc] init];
  831. NSArray *colorArr = @[[MOTools colorWithHexString:@"#12121F" alpha:0.0],[MOTools colorWithHexString:@"#12121F" alpha:0.96],[MOTools colorWithHexString:@"#12121F" alpha:0.96],[MOTools colorWithHexString:@"#12121F" alpha:1.0]];
  832. UIImage *image = [MOTools createGradientRectImageWithBounds:CGRectMake(0, 0, SCREENWIDTH, 50.0) Colors:colorArr GradientType:1];
  833. [_susuImageView setImage:image];
  834. _susuImageView.contentMode = UIViewContentModeScaleToFill;
  835. }
  836. return _susuImageView;
  837. }
  838. #pragma mark - MOGiftBottomMenuViewDelegate
  839. - (void)giftBottomMenuViewDidSelectNumWithView:(MOGiftBottomMenuView *)view num:(NSInteger)num isCustom:(BOOL)isCustom {
  840. if(isCustom && self.chooseGiftModel.giftInfo.diyGiftNumberMax == 0){
  841. [self.bottomMenuView selectGiftNum:1];
  842. [MBProgressHUD showTipMessageInWindow:NSLocalString(@"mimo_2_live_custom_tip")];
  843. return;
  844. }
  845. self.expView.giftNum = num;
  846. [self toUpdateTheCurrentCollectionData];
  847. SendObjNotification(@"kNotification_SelectSendGiftNumber", @(num));
  848. }
  849. - (void)giftBottomMenuViewClickSendGiftWithView:(MOGiftBottomMenuView *)view {
  850. if (self.comboView == nil) {
  851. self.comboView = [[MOGiftComboView alloc] init];
  852. self.comboView.delegate = self;
  853. [self.superview addSubview:self.comboView];
  854. [self.comboView mas_makeConstraints:^(MASConstraintMaker *make) {
  855. make.trailing.equalTo(self.superview);
  856. make.bottom.equalTo(self.superview).offset(-kBottomSafeAreaInset);
  857. }];
  858. }
  859. [self.comboView setHidden:NO];
  860. [self.comboView startCombo];
  861. [self.bottomMenuView enableGiftSendView:NO];
  862. [self sendGiftAction];
  863. }
  864. - (void)giftBottomMenuViewClickCustomWithView:(MOGiftBottomMenuView *)view {
  865. if(self.chooseGiftModel.giftInfo.diyGiftNumberMax == 0){
  866. [self.bottomMenuView selectGiftNum:1];
  867. [MBProgressHUD showTipMessageInWindow:NSLocalString(@"mimo_2_live_custom_tip")];
  868. return;
  869. }
  870. self.customNumView.hidden = NO;
  871. self.customNumView.maxNum = self.chooseGiftModel.giftInfo.diyGiftNumberMax;
  872. [self.customNumView.textField becomeFirstResponder];
  873. }
  874. - (void)giftBottomMenuViewClickUseWithView:(MOGiftBottomMenuView *)view {
  875. [self toUseTheProps];
  876. }
  877. - (void)giftBottomMenuViewClickSendBagWithView:(MOGiftBottomMenuView *)view {
  878. [self sendGiftAction];
  879. }
  880. - (void)giftBottomMenuViewClickRechargeWithView:(MOGiftBottomMenuView *)view {
  881. [self topUpBtnClick:nil];
  882. }
  883. #pragma mark - MOGiftComboViewDelegate
  884. - (void)giftComboViewOnCountdownFinishedWithView:(MOGiftComboView *)view {
  885. [view setHidden:YES];
  886. [self.bottomMenuView enableGiftSendView:YES];
  887. if (view.needResumeGiftPanel) {
  888. [self showGiftListView];
  889. }
  890. }
  891. - (void)giftComboViewOnComboFiredWithView:(MOGiftComboView *)view combo:(NSInteger)combo {
  892. [self sendGiftAction];
  893. }
  894. - (void)giftComboViewRequireHideGiftPanelWithView:(MOGiftComboView *)view {
  895. [self dismissGiftListView];
  896. }
  897. #pragma mark - MOGiftPanelsViewDelegate
  898. - (void)onGiftPanelsViewSelectGiftWithView:(MOGiftPanelsView *)view category:(MOGiftCategoryList *)category
  899. giftMode:(MOGiftlist *)selectGiftMode giftType:(NSInteger)giftType {
  900. [self handleSelectGift:selectGiftMode];
  901. MOStripe *theStripe;
  902. NSString *stripetitle = selectGiftMode.giftInfo.stripe.title;
  903. if(stripetitle.length > 0){
  904. theStripe = selectGiftMode.giftInfo.stripe;
  905. } else{
  906. theStripe = category.stripe;
  907. }
  908. [self updateStripViewWith:theStripe OrSkins:selectGiftMode.giftInfo.skins];
  909. if (selectGiftMode.giftInfo.blindBoxGift) {
  910. [self.bottomMenuView enableGiftNum:NO];
  911. } else {
  912. [self.bottomMenuView enableGiftNum:YES];
  913. }
  914. }
  915. - (void)onGiftPanelsViewFirstGiftSelectedWithCategory:(MOGiftCategoryList *)category {
  916. self.chooseGiftModel = nil;
  917. [self.bottomMenuView updateViewType:GiftBottomMenuTypeGift];
  918. [self.bottomMenuView enableGiftSendView:NO];
  919. self.expView.moreExp = 0;
  920. if(category.stripe.title.length > 0){
  921. [self updateStripViewWith:category.stripe OrSkins:nil];
  922. }
  923. else{
  924. [self updateStripViewWith:nil OrSkins:nil];
  925. }
  926. }
  927. - (void)onGiftPanelsViewScripeClickWithScript:(MOStripe *)script {
  928. self.stripeClickBlock(script);
  929. }
  930. - (void)onGiftPanelsViewSkinClickWithSkin:(MOEffect *)skin {
  931. if(!skin.lock){
  932. self.chooseGiftModel.giftInfo.selectSkin = skin;
  933. }
  934. }
  935. - (void)onGiftPanelsViewClickBagButton {
  936. [self.bottomMenuView updateSelectItem:nil];
  937. if (self.bagView.superview == nil) {
  938. [self.bgView insertSubview:self.bagView belowSubview:self.susuImageView];
  939. [self.bagView mas_makeConstraints:^(MASConstraintMaker *make) {
  940. make.edges.equalTo(self);
  941. }];
  942. }
  943. self.bagView.hidden = NO;
  944. self.bagView.multiple = self.multiple;
  945. self.bagView.giftRedCount = self.giftRedCount;
  946. self.bagView.propRedCount = self.propRedCount;
  947. [self.bagView showGiftListBagView];
  948. }
  949. @end