MOCrazyShowView.m 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542
  1. //
  2. // MOCrazyShowView.m
  3. // MiMoLive
  4. //
  5. // Created by SuperC on 2024/1/15.
  6. //
  7. #define kShowViewHeight 25.0
  8. #define kShowTimeViewWidth 40.0
  9. #define kShowHeadWidth 22.0
  10. #define kShowGiftWidth 30.0
  11. #define kShowGiftFont 12.0
  12. #define kShowGiftBigFont 16.0
  13. #define kMOSuperGiftViewWidth (SCREENWIDTH - 32.0 * 2.0)
  14. #define kMOSuperGiftViewLeftAndRightSpacing ((SCREENWIDTH - kMOSuperGiftViewWidth) / 2.0)
  15. #define kMoBannerHeight 32.0
  16. #define kLeftSpacing kScaleWidth(26.0)
  17. #define kRightSpacing kScaleWidth(32.0)
  18. #import "MOCrazyShowView.h"
  19. #import "MOSuperNumView.h"
  20. #import "MOLevelUpNoticeView.h"//升级
  21. #import "MOLuckyFloatingView.h"//幸运礼物 / 红包
  22. #import "UIImageView+Gift.h"
  23. @interface MOCrazyShowView ()
  24. @property (nonatomic, strong) UIView *bgView;
  25. @property (nonatomic, strong) UIImageView *bgImgView;
  26. @property (nonatomic, strong) UIImageView *timeImgView;
  27. @property (nonatomic, strong) UIImageView *headImgView;
  28. @property (nonatomic, strong) UILabel *contentLab;
  29. @property (nonatomic, strong) UIImageView *giftImgView;
  30. @property (nonatomic, strong) UIButton *throughBtn;
  31. @property (nonatomic, strong) UIImageView *rightTagImgView;
  32. @property (nonatomic, strong) UIScrollView *contentScrollView;
  33. @property (nonatomic, strong) MOSuperNumView *superNumView;
  34. @property (nonatomic, strong) MOLevelUpNoticeView *levelUpNoticeView;//升级
  35. @property (nonatomic, strong) MOLuckyFloatingView *luckyFloatingView;//宝箱 / 红包
  36. @end
  37. @implementation MOCrazyShowView
  38. - (instancetype)initWithFrame:(CGRect)frame{
  39. self = [super initWithFrame:frame];
  40. if (self)
  41. {
  42. self.backgroundColor = [UIColor clearColor];
  43. [self setupUI];
  44. }
  45. return self;
  46. }
  47. - (void)setupUI{
  48. [self addSubview:self.bgView];
  49. [self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
  50. make.left.right.equalTo(self);
  51. make.height.equalTo(@(kShowViewHeight));
  52. make.centerY.equalTo(self);
  53. }];
  54. self.bgView.layer.cornerRadius = kShowViewHeight / 2.0;
  55. // self.bgView.layer.borderWidth = 1.0;
  56. // self.bgView.layer.borderColor = [MOTools colorWithHexString:@"#FFFFFF" alpha:1.0].CGColor;
  57. CGFloat bgImgViewWidth = kMOSuperGiftViewWidth;
  58. CGFloat bgImgViewHeight = bgImgViewWidth * 64.0 / 630.0;
  59. [self.bgView addSubview:self.bgImgView];
  60. [self.bgImgView mas_makeConstraints:^(MASConstraintMaker *make) {
  61. make.center.equalTo(self.bgView);
  62. make.height.equalTo(@(bgImgViewHeight));
  63. make.width.equalTo(@(bgImgViewWidth));
  64. }];
  65. [self addSubview:self.timeImgView];
  66. [self.timeImgView mas_makeConstraints:^(MASConstraintMaker *make) {
  67. make.left.equalTo(self).offset(-kLeftSpacing);
  68. make.width.equalTo(@(kShowTimeViewWidth));
  69. make.height.equalTo(@30.0);
  70. make.centerY.equalTo(self);
  71. }];
  72. [self addSubview:self.headImgView];
  73. [self.headImgView mas_makeConstraints:^(MASConstraintMaker *make) {
  74. make.left.equalTo(self.timeImgView.mas_right).offset(10.0);
  75. make.width.height.equalTo(@(kShowHeadWidth));
  76. make.centerY.equalTo(self);
  77. }];
  78. self.headImgView.layer.cornerRadius = kShowHeadWidth / 2.0;
  79. self.headImgView.layer.masksToBounds = YES;
  80. [self addSubview:self.superNumView];
  81. [self.superNumView mas_makeConstraints:^(MASConstraintMaker *make) {
  82. make.height.equalTo(@29.0);
  83. make.width.equalTo(@45.0);
  84. make.centerX.equalTo(self.timeImgView.mas_centerX);
  85. make.centerY.equalTo(self.timeImgView.mas_centerY);
  86. }];
  87. [self addSubview:self.giftImgView];
  88. [self.giftImgView mas_makeConstraints:^(MASConstraintMaker *make) {
  89. make.right.equalTo(self).offset(kRightSpacing);
  90. make.height.width.equalTo(@(kShowGiftWidth));
  91. make.centerY.equalTo(self);
  92. }];
  93. [self addSubview:self.rightTagImgView];
  94. [self.rightTagImgView mas_makeConstraints:^(MASConstraintMaker *make) {
  95. make.right.equalTo(self.giftImgView.mas_left).offset(-5.0);
  96. make.height.equalTo(@9.0);
  97. make.width.equalTo(@6.0);
  98. make.centerY.equalTo(self);
  99. }];
  100. [self.bgView addSubview:self.contentScrollView];
  101. [self.contentScrollView mas_makeConstraints:^(MASConstraintMaker *make) {
  102. make.left.equalTo(self.headImgView.mas_right).offset(5.0);
  103. make.right.equalTo(self.rightTagImgView.mas_left).offset(-5.0);
  104. make.centerY.equalTo(self.bgView);
  105. make.height.equalTo(@(kShowViewHeight));
  106. }];
  107. [self.contentScrollView addSubview:self.contentLab];
  108. [self.contentLab mas_makeConstraints:^(MASConstraintMaker *make) {
  109. make.left.equalTo(self.contentScrollView).offset(0.0);
  110. make.right.equalTo(self.contentScrollView).offset(0.0);
  111. make.centerY.equalTo(self.bgView);
  112. make.height.equalTo(@(kShowViewHeight));
  113. }];
  114. // [self.bgView addSubview:self.contentLab];
  115. // [self.contentLab mas_makeConstraints:^(MASConstraintMaker *make) {
  116. // make.left.equalTo(self.headImgView.mas_right).offset(5.0);
  117. // make.right.equalTo(self.giftImgView.mas_left).offset(-5.0);
  118. // make.centerY.equalTo(self.bgView);
  119. // }];
  120. [self addSubview:self.throughBtn];
  121. [self.throughBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  122. make.edges.equalTo(self);
  123. }];
  124. CGFloat vipWidth = SCREENWIDTH - 30.0 * 2.0;
  125. [self addSubview:self.levelUpNoticeView];
  126. [self.levelUpNoticeView mas_makeConstraints:^(MASConstraintMaker *make) {
  127. make.centerX.equalTo(self);
  128. make.centerY.equalTo(self);
  129. make.width.equalTo(@(vipWidth));
  130. make.height.equalTo(@(30.0));
  131. }];
  132. [self addSubview:self.luckyFloatingView];
  133. [self.luckyFloatingView mas_makeConstraints:^(MASConstraintMaker *make) {
  134. make.centerX.equalTo(self);
  135. make.centerY.equalTo(self);
  136. make.width.equalTo(@(kMOSuperGiftViewWidth));
  137. make.height.equalTo(@(kMoBannerHeight));
  138. }];
  139. self.luckyFloatingView.hidden = YES;
  140. }
  141. - (void)setViewModel:(MORtmEntity *)viewModel{
  142. _viewModel = viewModel;
  143. MORtmJosnEntity *jsonEntity = (MORtmJosnEntity *)viewModel.data;
  144. self.levelUpNoticeView.hidden = YES;
  145. self.luckyFloatingView.hidden = YES;
  146. self.bgView.hidden = NO;
  147. self.timeImgView.hidden = NO;
  148. self.superNumView.hidden = NO;
  149. self.headImgView.hidden = NO;
  150. self.giftImgView.hidden = NO;
  151. self.rightTagImgView.hidden = NO;
  152. if(jsonEntity.type == 26){
  153. self.bgView.hidden = YES;
  154. self.timeImgView.hidden = YES;
  155. self.superNumView.hidden = YES;
  156. self.headImgView.hidden = YES;
  157. self.giftImgView.hidden = YES;
  158. self.rightTagImgView.hidden = YES;
  159. self.levelUpNoticeView.hidden = NO;
  160. self.levelUpNoticeView.viewModel = viewModel;
  161. return;
  162. }
  163. if(jsonEntity.type == 4 || jsonEntity.type == 17 || jsonEntity.type == 10){ // 4 / 17 SuperLucky 10 红包
  164. self.bgView.hidden = YES;
  165. self.timeImgView.hidden = YES;
  166. self.superNumView.hidden = YES;
  167. self.headImgView.hidden = YES;
  168. self.giftImgView.hidden = YES;
  169. self.rightTagImgView.hidden = YES;
  170. self.luckyFloatingView.hidden = NO;
  171. self.luckyFloatingView.viewModel = viewModel;
  172. return;
  173. }
  174. if(jsonEntity.type == 4){
  175. //Super Lucky 飘屏
  176. self.timeImgView.hidden = NO;
  177. self.superNumView.hidden = YES;
  178. self.giftImgView.hidden = YES;
  179. CGFloat needOffset = 10.0 + kShowGiftWidth;
  180. // [self.giftImgView mas_updateConstraints:^(MASConstraintMaker *make) {
  181. // make.right.equalTo(self.rightTagImgView.mas_left).offset(needOffset);
  182. // }];
  183. self.rightTagImgView.hidden = YES;
  184. [self.bgImgView setImage:[UIImage imageNamed:@"icon_super_lucky_bg_top"]];
  185. [self.timeImgView setImage:[UIImage imageNamed:@"icon_super_lucky_treasure"]];
  186. MORtmUser *user = jsonEntity.activitySuperLucky2.user;
  187. [self.headImgView sd_setImageWithURL:[NSURL URLWithString:user.avatar] placeholderImage:[UIImage imageNamed:@"icon_mine_placeHolder"]];
  188. NSString *contentStr = [NSString stringWithFormat:@"%@ is happy to win the Superlucky %zd diamonds",user.username,jsonEntity.activitySuperLucky2.diamond];
  189. self.contentLab.attributedText = [self colorfulStringWith:contentStr Num:jsonEntity.activitySuperLucky2.diamond name:user.username];
  190. }
  191. else{
  192. self.timeImgView.hidden = YES;
  193. self.superNumView.hidden = NO;
  194. CGFloat theSuperNumViewWidth = [MOSuperNumView getTheViewWidth:jsonEntity.giftSuperLucky.multiple];
  195. [self.superNumView mas_updateConstraints:^(MASConstraintMaker *make) {
  196. make.width.equalTo(@(theSuperNumViewWidth));
  197. }];
  198. self.superNumView.theNum = jsonEntity.giftSuperLucky.multiple;
  199. [self.superNumView toShowNewNumber];
  200. //礼物暴击 一般500倍以上才会收到
  201. MORtmUser *user = jsonEntity.giftSuperLucky.user;
  202. MOGiftInfo *giftInfo = [[MOSvgaSourceManage shareManager] getGiftInfoWithCode:jsonEntity.giftSuperLucky.giftCode];
  203. [self.headImgView sd_setImageWithURL:[NSURL URLWithString:user.avatar] placeholderImage:[UIImage imageNamed:@"icon_mine_placeHolder"]];
  204. [self.giftImgView mo_setGiftImageWith:giftInfo.giftPath];
  205. NSString *contentStr = [NSString stringWithFormat:@"%@ win %zd diamonds with",user.username,jsonEntity.giftSuperLucky.diamond];
  206. self.contentLab.attributedText = [self colorfulStringWith:contentStr Num:jsonEntity.giftSuperLucky.diamond];
  207. if(jsonEntity.giftSuperLucky.multiple >= 1000){
  208. [self.timeImgView setImage:[UIImage imageNamed:@"icon_live_re_1000_time"]];
  209. [self.bgImgView setImage:[UIImage imageNamed:@"icon_live_re_1000_time_new_bg"]];
  210. }
  211. else{
  212. [self.timeImgView setImage:[UIImage imageNamed:@"icon_live_re_500_time"]];
  213. [self.bgImgView setImage:[UIImage imageNamed:@"icon_live_re_500_time_new_bg"]];
  214. }
  215. self.giftImgView.hidden = NO;
  216. self.rightTagImgView.hidden = NO;
  217. }
  218. }
  219. - (void)toJudgeNeedAnimationScrollView{
  220. MORtmJosnEntity *jsonEntity = (MORtmJosnEntity *)self.viewModel.data;
  221. if(jsonEntity.type == 26){//升级提示
  222. [self.levelUpNoticeView toJudgeNeedAnimationScrollView];
  223. return;
  224. }
  225. if(jsonEntity.type == 4 || jsonEntity.type == 17 || jsonEntity.type == 10){ // 4 / 17 SuperLucky 10 红包
  226. [self.luckyFloatingView toJudgeNeedAnimationScrollView];
  227. return;
  228. }
  229. // 取消之前的动画
  230. [self.contentScrollView.layer removeAllAnimations];
  231. self.contentScrollView.contentOffset = CGPointZero;
  232. if(jsonEntity.type == 4){
  233. MORtmUser *user = jsonEntity.activitySuperLucky2.user;
  234. NSString *contentStr = [NSString stringWithFormat:@"%@ is happy to win the Superlucky %zd diamonds",user.username,jsonEntity.activitySuperLucky2.diamond];
  235. NSAttributedString *tempStr = [self colorfulStringWith:contentStr Num:jsonEntity.activitySuperLucky2.diamond name:user.username];
  236. CGFloat contentWidth = [MOTextTools getTheAttributedTextWidthWith:tempStr] + 15.0;
  237. CGFloat realSpacing = kMOCrazyShowViewWidth + 10.0 - kShowTimeViewWidth - 10.0 - kShowHeadWidth - 5.0 - 5.0 * 2;
  238. self.contentScrollView.contentSize = CGSizeMake(contentWidth, kShowViewHeight);
  239. if(contentWidth > realSpacing){
  240. [UIView animateKeyframesWithDuration:2
  241. delay:0
  242. options:UIViewAnimationOptionAutoreverse //动画重复自动反向,需要和上面这个一起用
  243. |UIViewAnimationOptionCurveLinear //动画的时间曲线,滚动字幕线性比较合理
  244. animations:^{
  245. // 计算移动的距离
  246. CGPoint point = self.contentScrollView.contentOffset;
  247. point.x = contentWidth - realSpacing;
  248. self.contentScrollView.contentOffset = point;
  249. }
  250. completion:^(BOOL finished) {
  251. // 重置动画,将 contentOffset 重置为初始值
  252. self.contentScrollView.contentOffset = CGPointZero;
  253. }];
  254. }
  255. }
  256. else{
  257. MORtmUser *user = jsonEntity.giftSuperLucky.user;
  258. NSString *contentStr = [NSString stringWithFormat:@"%@ win %zd diamonds with",user.username,jsonEntity.giftSuperLucky.diamond];
  259. NSAttributedString *tempStr = [self colorfulStringWith:contentStr Num:jsonEntity.giftSuperLucky.diamond];
  260. CGFloat contentWidth = [MOTextTools getTheAttributedTextWidthWith:tempStr] + 15.0;
  261. CGFloat realSpacing = kMOCrazyShowViewWidth + kLeftSpacing - kShowTimeViewWidth - 10.0 - kShowHeadWidth + kRightSpacing - kShowGiftWidth - 5.0 - 6.0 - 5.0 * 2;
  262. self.contentScrollView.contentSize = CGSizeMake(contentWidth, kShowViewHeight);
  263. if(contentWidth > realSpacing){
  264. [UIView animateKeyframesWithDuration:2
  265. delay:0
  266. options:UIViewAnimationOptionAutoreverse //动画重复自动反向,需要和上面这个一起用
  267. |UIViewAnimationOptionCurveLinear //动画的时间曲线,滚动字幕线性比较合理
  268. animations:^{
  269. // 计算移动的距离
  270. CGPoint point = self.contentScrollView.contentOffset;
  271. point.x = contentWidth - realSpacing;
  272. self.contentScrollView.contentOffset = point;
  273. }
  274. completion:^(BOOL finished) {
  275. // 重置动画,将 contentOffset 重置为初始值
  276. self.contentScrollView.contentOffset = CGPointZero;
  277. }];
  278. }
  279. }
  280. }
  281. - (NSAttributedString *)colorfulStringWith:(NSString *)contentStr Num:(NSInteger)num name:(NSString *)nameStr{
  282. NSString *needStr;
  283. if(num == 0){
  284. needStr = contentStr;
  285. // 创建属性字符串,整体颜色为白色
  286. NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:needStr attributes:@{NSForegroundColorAttributeName: [MOTools colorWithHexString:@"#F4AEFF" alpha:1.0],NSFontAttributeName : [MOTextTools getTheFontWithSize:kShowGiftFont AndFontName:kNormalContentFontStr]}];
  287. return attributedString;
  288. }
  289. else{
  290. NSString *numStr = [NSString stringWithFormat:@"%zd",num];
  291. needStr = contentStr;
  292. // 创建属性字符串,整体颜色为白色
  293. NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:needStr attributes:@{NSForegroundColorAttributeName: [MOTools colorWithHexString:@"#F4AEFF" alpha:1.0],NSFontAttributeName : [MOTextTools getTheFontWithSize:kShowGiftFont AndFontName:kNormalContentFontStr]}];
  294. NSRange blueRange = [needStr rangeOfString:nameStr];
  295. if(blueRange.location != NSNotFound){
  296. // 将最后三个字符的颜色设置为红色
  297. [attributedString addAttribute:NSForegroundColorAttributeName value:[MOTools colorWithHexString:@"#1EE2BB" alpha:1.0] range:blueRange];
  298. }
  299. NSRange redRange = [needStr rangeOfString:numStr];
  300. if(redRange.location != NSNotFound){
  301. // 将最后三个字符的颜色设置为红色
  302. [attributedString addAttribute:NSForegroundColorAttributeName value:[MOTools colorWithHexString:@"#FFDC9D" alpha:1.0] range:redRange];
  303. // 设置字体大小的属性
  304. [attributedString addAttribute:NSFontAttributeName value:[MOTextTools getTheFontWithSize:kShowGiftBigFont AndFontName:kNormalContentBlodFontStr] range:redRange];
  305. }
  306. return attributedString;
  307. }
  308. }
  309. - (NSAttributedString *)colorfulStringWith:(NSString *)nameStr Num:(NSInteger)num{
  310. NSString *needStr;
  311. if(num == 0){
  312. needStr = nameStr;
  313. // 创建属性字符串,整体颜色为白色
  314. NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:needStr attributes:@{NSForegroundColorAttributeName: [MOTools colorWithHexString:@"#FFC4C3" alpha:1.0],NSFontAttributeName : [MOTextTools getTheFontWithSize:kShowGiftFont AndFontName:kNormalContentFontStr]}];
  315. return attributedString;
  316. }
  317. else{
  318. NSString *numStr = [NSString stringWithFormat:@"%zd",num];
  319. needStr = nameStr;
  320. // 创建属性字符串,整体颜色为白色
  321. NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:needStr attributes:@{NSForegroundColorAttributeName: [MOTools colorWithHexString:@"#FFC4C3" alpha:1.0],NSFontAttributeName : [MOTextTools getTheFontWithSize:kShowGiftFont AndFontName:kNormalContentFontStr]}];
  322. NSRange redRange = [needStr rangeOfString:numStr];
  323. if(redRange.location != NSNotFound){
  324. // 将最后三个字符的颜色设置为红色
  325. [attributedString addAttribute:NSForegroundColorAttributeName value:[MOTools colorWithHexString:@"#FFDC9D" alpha:1.0] range:redRange];
  326. // 设置字体大小的属性
  327. [attributedString addAttribute:NSFontAttributeName value:[MOTextTools getTheFontWithSize:kShowGiftBigFont AndFontName:kNormalContentBlodFontStr] range:redRange];
  328. }
  329. return attributedString;
  330. }
  331. }
  332. #pragma mark - Lazy
  333. - (UIView *)bgView{
  334. if(!_bgView){
  335. _bgView = [[UIView alloc] init];
  336. _bgView.backgroundColor = [UIColor clearColor];
  337. }
  338. return _bgView;
  339. }
  340. - (UIImageView *)timeImgView{
  341. if (!_timeImgView)
  342. {
  343. _timeImgView = [[UIImageView alloc] init];
  344. _timeImgView.contentMode = UIViewContentModeScaleAspectFill;
  345. [_timeImgView setImage:[UIImage imageNamed:@"icon_live_re_500_time"]];
  346. }
  347. return _timeImgView;
  348. }
  349. - (UIImageView *)bgImgView{
  350. if (!_bgImgView)
  351. {
  352. _bgImgView = [[UIImageView alloc] init];
  353. _bgImgView.contentMode = UIViewContentModeScaleToFill;
  354. [_bgImgView setImage:[UIImage imageNamed:@"icon_live_re_500_time_bg"]];
  355. }
  356. return _bgImgView;
  357. }
  358. - (UIImageView *)headImgView{
  359. if (!_headImgView)
  360. {
  361. _headImgView = [[UIImageView alloc] init];
  362. _headImgView.contentMode = UIViewContentModeScaleAspectFill;
  363. [_headImgView setImage:[UIImage imageNamed:@"icon_mine_placeHolder"]];
  364. }
  365. return _headImgView;
  366. }
  367. - (UIImageView *)rightTagImgView{
  368. if (!_rightTagImgView)
  369. {
  370. _rightTagImgView = [[UIImageView alloc] init];
  371. _rightTagImgView.contentMode = UIViewContentModeScaleAspectFit;
  372. [_rightTagImgView setImage:[UIImage imageNamed:@"icon_live_right_white"]];
  373. }
  374. return _rightTagImgView;
  375. }
  376. - (UILabel *)contentLab{
  377. if (!_contentLab)
  378. {
  379. _contentLab = [[UILabel alloc] init];
  380. _contentLab.text = @"";
  381. _contentLab.font = [MOTextTools getTheFontWithSize:kShowGiftFont AndFontName:kNormalContentFontStr];
  382. _contentLab.textColor = [MOTools colorWithHexString:@"#FFC4C3" alpha:1.0];
  383. _contentLab.textAlignment = NSTextAlignmentRight;
  384. _contentLab.numberOfLines = 1;
  385. }
  386. return _contentLab;
  387. }
  388. - (UIImageView *)giftImgView{
  389. if (!_giftImgView)
  390. {
  391. _giftImgView = [[UIImageView alloc] init];
  392. _giftImgView.contentMode = UIViewContentModeScaleAspectFit;
  393. [_giftImgView setImage:[UIImage imageNamed:@"icon_mine_placeHolder"]];
  394. }
  395. return _giftImgView;
  396. }
  397. - (UIButton *)throughBtn{
  398. if(!_throughBtn){
  399. _throughBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  400. [_throughBtn setTitle:@"" forState:UIControlStateNormal];
  401. [_throughBtn addTarget:self action:@selector(allBtnClick) forControlEvents:UIControlEventTouchUpInside];
  402. }
  403. return _throughBtn;
  404. }
  405. - (void)allBtnClick{
  406. self.throughRoomBlock ? self.throughRoomBlock(self.viewModel) : nil;
  407. }
  408. - (UIScrollView *)contentScrollView{
  409. if(!_contentScrollView){
  410. _contentScrollView = [[UIScrollView alloc] init];
  411. _contentScrollView.contentSize = CGSizeMake(kMOCrazyShowViewWidth, kShowViewHeight);
  412. _contentScrollView.showsHorizontalScrollIndicator = NO;
  413. }
  414. return _contentScrollView;
  415. }
  416. - (MOSuperNumView *)superNumView{
  417. if(!_superNumView){
  418. _superNumView = [MOSuperNumView moSuperNumView];
  419. }
  420. return _superNumView;
  421. }
  422. - (MOLevelUpNoticeView *)levelUpNoticeView{
  423. if(!_levelUpNoticeView){
  424. CGFloat width = SCREENWIDTH - 30.0 * 2.0;
  425. _levelUpNoticeView = [[MOLevelUpNoticeView alloc] initWithFrame:CGRectMake(0.0, 0.0, width, 30.0)];
  426. }
  427. return _levelUpNoticeView;
  428. }
  429. - (MOLuckyFloatingView *)luckyFloatingView{
  430. if(!_luckyFloatingView){
  431. _luckyFloatingView = [[MOLuckyFloatingView alloc] initWithFrame:CGRectMake(SCREENWIDTH + kMOSuperGiftViewLeftAndRightSpacing, 0, SCREENWIDTH - 2 * kMOSuperGiftViewLeftAndRightSpacing, kMoBannerHeight)];
  432. }
  433. return _luckyFloatingView;
  434. }
  435. @end