新功能开发

This commit is contained in:
liyuhua
2023-08-24 17:03:32 +08:00
parent d9234acb0c
commit 02d145bda7
104 changed files with 4806 additions and 727 deletions

View File

@@ -0,0 +1,149 @@
//
// MessageContentGameView.m
// xplan-ios
//
// Created by duoban on 2023/8/22.
//
#import "MessageContentGameView.h"
#import "UserGameInfoVo.h"
@interface MessageContentGameView()
///
@property(nonatomic,strong) NetImageView *bgImageView;
///
@property(nonatomic,strong) UILabel *titleView;
///
@property(nonatomic,strong) UILabel *subTitleView;
///
@property(nonatomic,strong) UIView *gameBgView;
///logo
@property(nonatomic,strong) NetImageView *gameIcomView;
///
@property(nonatomic,strong) UILabel *gameNameView;
///
@property(nonatomic,strong) UILabel *gameNumView;
@end
@implementation MessageContentGameView
+ (CGFloat)measureHeight:(NIMMessage *)message {
return (CONTENT_PADDING_V_TOTAL + kGetScaleWidth(136));
}
- (void)initSubViews {
[super initSubViews];
[self addSubview:self.backView];
[self.backView addSubview:self.bgImageView];
[self.bgImageView addSubview:self.titleView];
[self.bgImageView addSubview:self.subTitleView];
[self.bgImageView addSubview:self.gameBgView];
[self.gameBgView addSubview:self.gameIcomView];
[self.gameBgView addSubview:self.gameNameView];
[self.gameBgView addSubview:self.gameNumView];
}
- (void)initSubViewConstraints {
[super initSubViewConstraints];
[self.backView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(kGetScaleWidth(239), kGetScaleWidth(136)));
}];
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(kGetScaleWidth(239));
make.height.mas_equalTo(kGetScaleWidth(136));
make.top.leading.mas_equalTo(self.backView);
}];
[self.titleView mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.mas_equalTo(kGetScaleWidth(16));
make.top.mas_equalTo(kGetScaleWidth(12));
make.height.mas_equalTo(kGetScaleWidth(22));
}];
[self.subTitleView mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.mas_equalTo(kGetScaleWidth(16));
make.top.equalTo(self.titleView.mas_bottom).mas_offset(kGetScaleWidth(1));
make.height.mas_equalTo(kGetScaleWidth(17));
}];
[self.gameBgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.mas_equalTo(kGetScaleWidth(10));
make.top.equalTo(self.subTitleView.mas_bottom).mas_offset(kGetScaleWidth(6));
make.width.mas_equalTo(kGetScaleWidth(219));
make.height.mas_equalTo(kGetScaleWidth(68));
}];
[self.gameIcomView mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.width.mas_equalTo(kGetScaleWidth(44));
make.leading.mas_equalTo(kGetScaleWidth(16));
make.top.mas_equalTo(kGetScaleWidth(12));
}];
[self.gameNameView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(kGetScaleWidth(12));
make.leading.mas_equalTo(kGetScaleWidth(70));
make.height.mas_equalTo(kGetScaleWidth(22));
}];
[self.gameNumView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.gameNameView.mas_bottom).mas_offset(kGetScaleWidth(2));
make.leading.mas_equalTo(kGetScaleWidth(70));
make.height.mas_equalTo(kGetScaleWidth(20));
}];
}
- (void)render:(NIMMessage *)message {
NIMCustomObject *obj = (NIMCustomObject *)message.messageObject;
AttachmentModel * attach = obj.attachment;
UserGameInfoVo *gameInfo = [UserGameInfoVo modelWithDictionary:attach.data];
_gameIcomView.imageUrl = gameInfo.gameLogo;
_gameNameView.text = gameInfo.gameName;
_gameNumView.text = [NSString stringWithFormat:@"%@ 局",gameInfo.inning];
}
- (NetImageView *)bgImageView{
if(!_bgImageView){
_bgImageView = [NetImageView new];
_bgImageView.image = kImage(@"message_session_game_Invite_bg");
}
return _bgImageView;
}
- (UILabel *)titleView{
if(!_titleView){
_titleView = [UILabel labelInitWithText:@"开黑邀请" font:kFontMedium(16) textColor:[UIColor whiteColor]];
}
return _titleView;
}
-(UILabel *)subTitleView{
if(!_subTitleView){
_subTitleView = [UILabel labelInitWithText:@"和我一起玩游戏吧~" font:kFontRegular(12) textColor:UIColorFromRGB(0xCED1DB)];
}
return _subTitleView;
}
- (UIView *)gameBgView{
if(!_gameBgView){
_gameBgView = [UIView new];
_gameBgView.backgroundColor = [UIColor colorWithWhite:1 alpha:0.1];
_gameBgView.layer.cornerRadius = kGetScaleWidth(6);
_gameBgView.layer.masksToBounds = YES;
}
return _gameBgView;
}
- (NetImageView *)gameIcomView{
if(!_gameIcomView){
NetImageConfig *config = [[NetImageConfig alloc]init];
config.placeHolder = [UIImageConstant defaultEmptyAvatarPlaceholder];
_gameIcomView = [[NetImageView alloc]initWithConfig:config];
}
return _gameIcomView;
}
- (UILabel *)gameNameView{
if(!_gameNameView){
_gameNameView = [UILabel labelInitWithText:@"" font:kFontMedium(16) textColor:[UIColor whiteColor]];
}
return _gameNameView;
}
- (UILabel *)gameNumView{
if(!_gameNumView){
_gameNumView = [UILabel labelInitWithText:@"" font:kFontRegular(14) textColor:[UIColor colorWithWhite:1 alpha:0.8]];
}
return _gameNumView;
}
@end