diff --git a/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_avatar_bg.imageset/Contents.json b/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_avatar_bg.imageset/Contents.json deleted file mode 100644 index 16722c11..00000000 --- a/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_avatar_bg.imageset/Contents.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "home_new_user_greet_avatar_bg@2x.png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "filename" : "home_new_user_greet_avatar_bg@3x.png", - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_avatar_bg.imageset/home_new_user_greet_avatar_bg@2x.png b/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_avatar_bg.imageset/home_new_user_greet_avatar_bg@2x.png deleted file mode 100644 index 21477ace..00000000 Binary files a/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_avatar_bg.imageset/home_new_user_greet_avatar_bg@2x.png and /dev/null differ diff --git a/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_avatar_bg.imageset/home_new_user_greet_avatar_bg@3x.png b/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_avatar_bg.imageset/home_new_user_greet_avatar_bg@3x.png deleted file mode 100644 index 1d2460e9..00000000 Binary files a/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_avatar_bg.imageset/home_new_user_greet_avatar_bg@3x.png and /dev/null differ diff --git a/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_bg.imageset/home_new_user_greet_bg@2x.png b/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_bg.imageset/home_new_user_greet_bg@2x.png deleted file mode 100644 index ed703d3e..00000000 Binary files a/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_bg.imageset/home_new_user_greet_bg@2x.png and /dev/null differ diff --git a/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_bg.imageset/home_new_user_greet_bg@3x.png b/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_bg.imageset/home_new_user_greet_bg@3x.png deleted file mode 100644 index e7939817..00000000 Binary files a/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_bg.imageset/home_new_user_greet_bg@3x.png and /dev/null differ diff --git a/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_close.imageset/home_new_user_greet_close@2x.png b/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_close.imageset/home_new_user_greet_close@2x.png deleted file mode 100644 index 0378fa74..00000000 Binary files a/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_close.imageset/home_new_user_greet_close@2x.png and /dev/null differ diff --git a/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_close.imageset/home_new_user_greet_close@3x.png b/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_close.imageset/home_new_user_greet_close@3x.png deleted file mode 100644 index 00349dc5..00000000 Binary files a/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_close.imageset/home_new_user_greet_close@3x.png and /dev/null differ diff --git a/xplan-ios/Assets.xcassets/Home/Greet/room_new_user_greet_bg.imageset/Contents.json b/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_icon.imageset/Contents.json similarity index 71% rename from xplan-ios/Assets.xcassets/Home/Greet/room_new_user_greet_bg.imageset/Contents.json rename to xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_icon.imageset/Contents.json index 05da95ad..80d98449 100644 --- a/xplan-ios/Assets.xcassets/Home/Greet/room_new_user_greet_bg.imageset/Contents.json +++ b/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_icon.imageset/Contents.json @@ -5,12 +5,12 @@ "scale" : "1x" }, { - "filename" : "room_new_user_greet_bg@2x.png", + "filename" : "home_new_user_greet_icon@2x.png", "idiom" : "universal", "scale" : "2x" }, { - "filename" : "room_new_user_greet_bg@3x.png", + "filename" : "home_new_user_greet_icon@3x.png", "idiom" : "universal", "scale" : "3x" } diff --git a/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_icon.imageset/home_new_user_greet_icon@2x.png b/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_icon.imageset/home_new_user_greet_icon@2x.png new file mode 100644 index 00000000..02dc9ee5 Binary files /dev/null and b/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_icon.imageset/home_new_user_greet_icon@2x.png differ diff --git a/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_icon.imageset/home_new_user_greet_icon@3x.png b/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_icon.imageset/home_new_user_greet_icon@3x.png new file mode 100644 index 00000000..b8de4a4d Binary files /dev/null and b/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_icon.imageset/home_new_user_greet_icon@3x.png differ diff --git a/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_nick_bg.imageset/home_new_user_greet_nick_bg@2x.png b/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_nick_bg.imageset/home_new_user_greet_nick_bg@2x.png deleted file mode 100644 index 54fb84d7..00000000 Binary files a/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_nick_bg.imageset/home_new_user_greet_nick_bg@2x.png and /dev/null differ diff --git a/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_nick_bg.imageset/home_new_user_greet_nick_bg@3x.png b/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_nick_bg.imageset/home_new_user_greet_nick_bg@3x.png deleted file mode 100644 index 7ba229d0..00000000 Binary files a/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_nick_bg.imageset/home_new_user_greet_nick_bg@3x.png and /dev/null differ diff --git a/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_bg.imageset/Contents.json b/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_play.imageset/Contents.json similarity index 71% rename from xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_bg.imageset/Contents.json rename to xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_play.imageset/Contents.json index 37297ba3..03e14a32 100644 --- a/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_bg.imageset/Contents.json +++ b/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_play.imageset/Contents.json @@ -5,12 +5,12 @@ "scale" : "1x" }, { - "filename" : "home_new_user_greet_bg@2x.png", + "filename" : "home_new_user_greet_play@2x.png", "idiom" : "universal", "scale" : "2x" }, { - "filename" : "home_new_user_greet_bg@3x.png", + "filename" : "home_new_user_greet_play@3x.png", "idiom" : "universal", "scale" : "3x" } diff --git a/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_play.imageset/home_new_user_greet_play@2x.png b/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_play.imageset/home_new_user_greet_play@2x.png new file mode 100644 index 00000000..b76d9912 Binary files /dev/null and b/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_play.imageset/home_new_user_greet_play@2x.png differ diff --git a/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_play.imageset/home_new_user_greet_play@3x.png b/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_play.imageset/home_new_user_greet_play@3x.png new file mode 100644 index 00000000..c5da8c72 Binary files /dev/null and b/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_play.imageset/home_new_user_greet_play@3x.png differ diff --git a/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_close.imageset/Contents.json b/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_start.imageset/Contents.json similarity index 71% rename from xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_close.imageset/Contents.json rename to xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_start.imageset/Contents.json index 37b54acd..f655d3f3 100644 --- a/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_close.imageset/Contents.json +++ b/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_start.imageset/Contents.json @@ -5,12 +5,12 @@ "scale" : "1x" }, { - "filename" : "home_new_user_greet_close@2x.png", + "filename" : "home_new_user_greet_start@2x.png", "idiom" : "universal", "scale" : "2x" }, { - "filename" : "home_new_user_greet_close@3x.png", + "filename" : "home_new_user_greet_start@3x.png", "idiom" : "universal", "scale" : "3x" } diff --git a/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_start.imageset/home_new_user_greet_start@2x.png b/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_start.imageset/home_new_user_greet_start@2x.png new file mode 100644 index 00000000..92ba52bb Binary files /dev/null and b/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_start.imageset/home_new_user_greet_start@2x.png differ diff --git a/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_start.imageset/home_new_user_greet_start@3x.png b/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_start.imageset/home_new_user_greet_start@3x.png new file mode 100644 index 00000000..a68cbeeb Binary files /dev/null and b/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_start.imageset/home_new_user_greet_start@3x.png differ diff --git a/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_start_bg.imageset/Contents.json b/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_start_bg.imageset/Contents.json deleted file mode 100644 index a1a4b97d..00000000 --- a/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_start_bg.imageset/Contents.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "home_new_user_greet_start_bg@2x.png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "filename" : "home_new_user_greet_start_bg@3x.png", - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_start_bg.imageset/home_new_user_greet_start_bg@2x.png b/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_start_bg.imageset/home_new_user_greet_start_bg@2x.png deleted file mode 100644 index a78eab65..00000000 Binary files a/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_start_bg.imageset/home_new_user_greet_start_bg@2x.png and /dev/null differ diff --git a/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_start_bg.imageset/home_new_user_greet_start_bg@3x.png b/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_start_bg.imageset/home_new_user_greet_start_bg@3x.png deleted file mode 100644 index 64c42c26..00000000 Binary files a/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_start_bg.imageset/home_new_user_greet_start_bg@3x.png and /dev/null differ diff --git a/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_nick_bg.imageset/Contents.json b/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_wave.imageset/Contents.json similarity index 70% rename from xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_nick_bg.imageset/Contents.json rename to xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_wave.imageset/Contents.json index b38d64a4..55ab8bf5 100644 --- a/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_nick_bg.imageset/Contents.json +++ b/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_wave.imageset/Contents.json @@ -5,12 +5,12 @@ "scale" : "1x" }, { - "filename" : "home_new_user_greet_nick_bg@2x.png", + "filename" : "home_new_user_greet_wave@2x.png", "idiom" : "universal", "scale" : "2x" }, { - "filename" : "home_new_user_greet_nick_bg@3x.png", + "filename" : "home_new_user_greet_wave@3x.png", "idiom" : "universal", "scale" : "3x" } diff --git a/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_wave.imageset/home_new_user_greet_wave@2x.png b/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_wave.imageset/home_new_user_greet_wave@2x.png new file mode 100644 index 00000000..2879f6f6 Binary files /dev/null and b/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_wave.imageset/home_new_user_greet_wave@2x.png differ diff --git a/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_wave.imageset/home_new_user_greet_wave@3x.png b/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_wave.imageset/home_new_user_greet_wave@3x.png new file mode 100644 index 00000000..951b2c57 Binary files /dev/null and b/xplan-ios/Assets.xcassets/Home/Greet/home_new_user_greet_wave.imageset/home_new_user_greet_wave@3x.png differ diff --git a/xplan-ios/Assets.xcassets/Home/Greet/room_new_user_greet_bg.imageset/room_new_user_greet_bg@2x.png b/xplan-ios/Assets.xcassets/Home/Greet/room_new_user_greet_bg.imageset/room_new_user_greet_bg@2x.png deleted file mode 100644 index 8e7c0b76..00000000 Binary files a/xplan-ios/Assets.xcassets/Home/Greet/room_new_user_greet_bg.imageset/room_new_user_greet_bg@2x.png and /dev/null differ diff --git a/xplan-ios/Assets.xcassets/Home/Greet/room_new_user_greet_bg.imageset/room_new_user_greet_bg@3x.png b/xplan-ios/Assets.xcassets/Home/Greet/room_new_user_greet_bg.imageset/room_new_user_greet_bg@3x.png deleted file mode 100644 index a502bea2..00000000 Binary files a/xplan-ios/Assets.xcassets/Home/Greet/room_new_user_greet_bg.imageset/room_new_user_greet_bg@3x.png and /dev/null differ diff --git a/xplan-ios/Main/Tabbar/Model/NewUserGreetModel.h b/xplan-ios/Main/Tabbar/Model/NewUserGreetModel.h index 744f864f..ffc600c8 100644 --- a/xplan-ios/Main/Tabbar/Model/NewUserGreetModel.h +++ b/xplan-ios/Main/Tabbar/Model/NewUserGreetModel.h @@ -22,6 +22,9 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic,copy) NSString *sayHelloUserNickname; ///是否可以打招呼 @property (nonatomic,assign) BOOL sayHello; +///性别 +@property (nonatomic, assign) NSInteger gender; + @end NS_ASSUME_NONNULL_END diff --git a/xplan-ios/Main/Tabbar/View/NewUserRecharge/XPNewUserGreetRoomAlertView.m b/xplan-ios/Main/Tabbar/View/NewUserRecharge/XPNewUserGreetRoomAlertView.m index 034fcf42..59b146cf 100644 --- a/xplan-ios/Main/Tabbar/View/NewUserRecharge/XPNewUserGreetRoomAlertView.m +++ b/xplan-ios/Main/Tabbar/View/NewUserRecharge/XPNewUserGreetRoomAlertView.m @@ -13,33 +13,55 @@ #import "NetImageView.h" #import "XPMacro.h" #import "TTPopup.h" +#import "UIImage+Utils.h" +#import +#import "XPSkillCardPlayerManager.h" ///Model #import "NewUserGreetModel.h" ///View #import "XPRoomViewController.h" @interface XPNewUserGreetRoomAlertView () -///关闭按钮 -@property (nonatomic,strong) UIButton *closeButton; + +@property (nonatomic, strong) UIImageView *logoImageView; +@property (nonatomic, strong) UIView *avatarAlphaView; ///头像覆盖 @property (nonatomic,strong) UIImageView *avatarCoverView; ///头像 @property (nonatomic,strong) NetImageView *avatarImageView; +///渐变背景 +@property (nonatomic, strong) UIImageView *effectView; ///昵称 @property (nonatomic,strong) UIButton *nickButton; -///id -@property (nonatomic,strong) UILabel *idLabel; -///打招呼 -@property (nonatomic,strong) UIImageView *greetImageView; +///性别 +@property (nonatomic, strong) UIImageView *genderImageView; ///打招呼文案 @property (nonatomic,strong) UILabel *greetLabel; ///开始浪漫之旅 @property (nonatomic,strong) UIButton *startButton; +///声音秀背景 +@property (nonatomic, strong) UIImageView *voiceShowBgImage; +///播放按钮 +@property (nonatomic, strong) UIButton *playButton; +///声音秀波纹 +@property (nonatomic, strong) UIImageView *voiceImage; +///播放中 +@property (nonatomic,assign) BOOL isPlaying; + @end @implementation XPNewUserGreetRoomAlertView +- (void)dealloc { + [[XPSkillCardPlayerManager shareInstance] stopMusic]; +} + +- (void)removeFromSuperview { + [super removeFromSuperview]; + [[XPSkillCardPlayerManager shareInstance] stopMusic]; +} + - (instancetype)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { @@ -51,73 +73,88 @@ #pragma mark - Private Method - (void)initSubViews { - [self addSubview:self.closeButton]; - [self addSubview:self.avatarImageView]; - [self addSubview:self.avatarCoverView]; - [self addSubview:self.nickButton]; - [self addSubview:self.idLabel]; - [self addSubview:self.greetImageView]; - [self addSubview:self.greetLabel]; + [self addSubview:self.logoImageView]; + [self addSubview:self.avatarAlphaView]; + [self addSubview:self.avatarCoverView]; + [self addSubview:self.avatarImageView]; + [self.avatarImageView addSubview:self.effectView]; + [self.avatarImageView addSubview:self.nickButton]; + [self.avatarImageView addSubview:self.genderImageView]; + [self.avatarImageView addSubview:self.greetLabel]; [self addSubview:self.startButton]; + + [self addSubview:self.voiceShowBgImage]; + [self.voiceShowBgImage addSubview:self.playButton]; + [self.voiceShowBgImage addSubview:self.voiceImage]; } - (void)initSubViewConstraints { [self mas_makeConstraints:^(MASConstraintMaker *make) { - make.width.mas_equalTo(KScreenWidth); - make.bottom.mas_equalTo(self.startButton.mas_bottom); - }]; - - [self.closeButton mas_makeConstraints:^(MASConstraintMaker *make) { - make.size.mas_equalTo(CGSizeMake(22, 22)); - make.top.mas_equalTo(self); - make.right.mas_equalTo(self).offset(-52); - }]; - - [self.avatarCoverView mas_makeConstraints:^(MASConstraintMaker *make) { - make.size.mas_equalTo(CGSizeMake(253, 219)); - make.centerX.mas_equalTo(self); - make.top.mas_equalTo(self.closeButton.mas_bottom).offset(32); + make.size.mas_equalTo(CGSizeMake(250, 74+6+290+28+44)); }]; + [self.logoImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(0); + make.size.mas_equalTo(CGSizeMake(211, 74)); + make.centerX.mas_equalTo(self); + }]; + [self.avatarAlphaView mas_makeConstraints:^(MASConstraintMaker *make) { + make.size.mas_equalTo(CGSizeMake(250, 290)); + make.centerX.mas_equalTo(self); + make.top.mas_equalTo(self.logoImageView.mas_bottom).offset(6); + }]; + [self.avatarCoverView mas_makeConstraints:^(MASConstraintMaker *make) { + make.size.mas_equalTo(CGSizeMake(240, 280)); + make.centerX.centerY.mas_equalTo(self.avatarAlphaView); + }]; [self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) { - make.size.mas_equalTo(CGSizeMake(150, 150)); - make.centerX.mas_equalTo(self.avatarCoverView); - make.top.mas_equalTo(self.avatarCoverView).offset(60); + make.size.mas_equalTo(CGSizeMake(230, 270)); + make.centerX.centerY.mas_equalTo(self.avatarAlphaView); }]; - + [self.effectView mas_makeConstraints:^(MASConstraintMaker *make) { + make.bottom.left.right.mas_equalTo(self.avatarImageView); + make.height.mas_equalTo(115); + }]; [self.nickButton mas_makeConstraints:^(MASConstraintMaker *make) { - make.size.mas_equalTo(CGSizeMake(165, 28)); - make.centerX.mas_equalTo(self); - make.top.mas_equalTo(self.avatarCoverView.mas_bottom).offset(3); + make.left.mas_equalTo(self.avatarImageView).mas_offset(6); + make.bottom.mas_equalTo(self.greetLabel.mas_top).mas_offset(-8); }]; - [self.idLabel mas_makeConstraints:^(MASConstraintMaker *make) { - make.centerX.mas_equalTo(self); - make.top.mas_equalTo(self.nickButton.mas_bottom).offset(7); - }]; - - [self.greetImageView mas_makeConstraints:^(MASConstraintMaker *make) { - make.size.mas_equalTo(CGSizeMake(289, 86)); - make.centerX.mas_equalTo(self); - make.top.mas_equalTo(self.idLabel.mas_bottom).offset(15); + [self.genderImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.size.mas_equalTo(CGSizeMake(14, 14)); + make.centerY.mas_equalTo(self.nickButton); + make.left.mas_equalTo(self.nickButton.mas_right).mas_offset(4); }]; [self.greetLabel mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.right.mas_equalTo(self.greetImageView).inset(48); - make.centerY.mas_equalTo(self.greetImageView); + make.left.right.mas_equalTo(self.avatarImageView).inset(6); + make.bottom.mas_equalTo(self.avatarImageView).mas_offset(-8); }]; [self.startButton mas_makeConstraints:^(MASConstraintMaker *make) { - make.size.mas_equalTo(CGSizeMake(240, 47)); + make.size.mas_equalTo(CGSizeMake(200, 44)); make.centerX.mas_equalTo(self); - make.top.mas_equalTo(self.greetImageView.mas_bottom).offset(36); + make.top.mas_equalTo(self.avatarAlphaView.mas_bottom).offset(28); }]; + + [self.voiceShowBgImage mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.mas_equalTo(self.avatarAlphaView).mas_offset(-14); + make.top.mas_equalTo(self.avatarAlphaView).mas_offset(17); + make.size.mas_equalTo(CGSizeMake(44, 21)); + }]; + [self.playButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.voiceShowBgImage).mas_offset(3); + make.centerY.mas_equalTo(self.voiceShowBgImage); + make.size.mas_equalTo(CGSizeMake(14, 14)); + }]; + [self.voiceImage mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.mas_equalTo(self.voiceShowBgImage).mas_offset(-5); + make.centerY.mas_equalTo(self.voiceShowBgImage); + make.size.mas_equalTo(CGSizeMake(20, 10)); + }]; + } #pragma mark - Event Response -- (void)closeButtonAction:(UIButton *)sender { - [TTPopup dismiss]; -} - - (void)startButtonAction:(UIButton *)sender { [TTPopup dismiss]; if (self.greetInfo.roomUid.length > 0) { @@ -125,6 +162,62 @@ } } +- (void)playButtonAction:(UIButton *)sender { + sender.selected = !sender.selected; + if (!self.isPlaying) { +// NSString *fileName = [[self.greetInfo.voiceCard.name componentsSeparatedByString:@"/"] lastObject]; +// fileName = [NSString stringWithFormat:@"%zd_%@", self.cardInfo.uid, fileName]; +// NSString * url = [self.greetInfo.voiceCard.propVals safeObjectAtIndex1:0]; +// NSString *filePath = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0] stringByAppendingPathComponent:@"mineSkillCardVoice"]; +// NSString *fullPath = [filePath stringByAppendingPathComponent:fileName]; +// if ([[NSFileManager defaultManager] fileExistsAtPath:fullPath]) { +// self.isPlaying = YES; +// sender.selected = YES; +// +// [[XPSkillCardPlayerManager shareInstance] playerVoiceWithPath:fullPath completionBlock:^{ +// self.isPlaying = NO; +// sender.selected = NO; +// [[XPSkillCardPlayerManager shareInstance] stopMusic]; +// }]; +// } else { +// if (![[NSFileManager defaultManager] fileExistsAtPath:filePath]) { +// NSFileManager *fileMgr = [[NSFileManager alloc] init]; +// [fileMgr createDirectoryAtPath:filePath withIntermediateDirectories:YES attributes:nil error:nil]; +// } +// [self downloadAudioWithFileName:fileName musicUrl:url completion:^(BOOL isSuccess, NSString *editAudioPath) { +// self.isPlaying = YES; +// sender.selected = YES; +// [[XPSkillCardPlayerManager shareInstance] playerVoiceWithPath:fullPath completionBlock:^{ +// self.isPlaying = NO; +// sender.selected = NO; +// [[XPSkillCardPlayerManager shareInstance] stopMusic]; +// }]; +// }]; +// } + } else { + self.isPlaying = NO; + sender.selected = NO; + [[XPSkillCardPlayerManager shareInstance] stopMusic]; + } +} + +- (void)downloadAudioWithFileName:(NSString *)fileName musicUrl:(NSString *)musicUrl completion:(void (^) (BOOL isSuccess, NSString *editAudioPath))completion { + AFHTTPSessionManager *manager = [AFHTTPSessionManager manager]; + NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:musicUrl]]; + NSURLSessionDownloadTask *download = [manager downloadTaskWithRequest:request progress:^(NSProgress * _Nonnull downloadProgress) { + } destination:^NSURL * _Nonnull(NSURL * _Nonnull targetPath, NSURLResponse * _Nonnull response) { + NSString *filePath = [[[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0] stringByAppendingPathComponent:@"mineSkillCardVoice"] stringByAppendingPathComponent:fileName]; + return [NSURL fileURLWithPath:filePath]; + } completionHandler:^(NSURLResponse * _Nonnull response, NSURL * _Nullable filePath, NSError * _Nullable error) { + if (!error) { + completion(YES, filePath.path); + } else { + completion(NO, nil); + } + }]; + [download resume]; +} + #pragma mark - Getters And Setters - (void)setGreetInfo:(NewUserGreetModel *)greetInfo { _greetInfo = greetInfo; @@ -135,26 +228,36 @@ nick = [nick substringToIndex:6]; } [self.nickButton setTitle:nick forState:UIControlStateNormal]; - self.idLabel.text = [NSString stringWithFormat:@"ID:%@", _greetInfo.sayHelloUserErbanNo]; self.greetLabel.text = _greetInfo.sayHelloMsg.length > 0 ? _greetInfo.sayHelloMsg : @"欢迎来到魔力,Ta已经等待你很久啦,快来一起玩吧~"; + self.genderImageView.image = greetInfo.gender == 1 ? [UIImage imageNamed:@"common_male"] : [UIImage imageNamed:@"common_female"]; } } -- (UIButton *)closeButton { - if (!_closeButton) { - _closeButton = [UIButton buttonWithType:UIButtonTypeCustom]; - [_closeButton setImage:[UIImage imageNamed:@"home_new_user_greet_close"] forState:UIControlStateNormal]; - [_closeButton setImage:[UIImage imageNamed:@"home_new_user_greet_close"] forState:UIControlStateSelected]; - [_closeButton addTarget:self action:@selector(closeButtonAction:) forControlEvents:UIControlEventTouchUpInside]; - } - return _closeButton; +- (UIImageView *)logoImageView { + if (!_logoImageView) { + _logoImageView = [[UIImageView alloc] init]; + _logoImageView.image = [UIImage imageNamed:@"home_new_user_greet_icon"]; + } + return _logoImageView; +} + +- (UIView *)avatarAlphaView { + if (!_avatarAlphaView) { + _avatarAlphaView = [[UIView alloc] init]; + _avatarAlphaView.backgroundColor = UIColorRGBAlpha(0xffffff, 0.5); + _avatarAlphaView.layer.masksToBounds = YES; + _avatarAlphaView.layer.cornerRadius = 24; + } + return _avatarAlphaView; } - (UIImageView *)avatarCoverView { if (!_avatarCoverView) { _avatarCoverView = [[UIImageView alloc] init]; _avatarCoverView.userInteractionEnabled = YES; - _avatarCoverView.image = [UIImage imageNamed:@"home_new_user_greet_avatar_bg"]; + _avatarCoverView.image = [UIImage gradientColorImageFromColors:@[UIColorFromRGB(0x7BFFD9), UIColorFromRGB(0x3BE4FF)] gradientType:GradientTypeTopToBottom imgSize:CGSizeMake(10, 10)]; + _avatarCoverView.layer.masksToBounds = YES; + _avatarCoverView.layer.cornerRadius = 20; } return _avatarCoverView; } @@ -164,8 +267,9 @@ NetImageConfig * config = [[NetImageConfig alloc]init]; config.placeHolder = [UIImageConstant defaultAvatarPlaceholder]; _avatarImageView = [[NetImageView alloc] initWithConfig:config]; + _avatarImageView.contentMode = UIViewContentModeScaleAspectFill; _avatarImageView.layer.masksToBounds = YES; - _avatarImageView.layer.cornerRadius = 150/2; + _avatarImageView.layer.cornerRadius = 16; } return _avatarImageView; } @@ -173,38 +277,26 @@ - (UIButton *)nickButton { if (!_nickButton) { _nickButton = [UIButton buttonWithType:UIButtonTypeCustom]; - [_nickButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; - _nickButton.titleLabel.font = [UIFont systemFontOfSize:14]; - [_nickButton setBackgroundImage:[UIImage imageNamed:@"home_new_user_greet_nick_bg"] forState:UIControlStateNormal]; + _nickButton.titleLabel.textColor = [UIColor whiteColor]; + _nickButton.titleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium]; } return _nickButton; } -- (UILabel *)idLabel { - if (!_idLabel) { - _idLabel = [[UILabel alloc] init]; - _idLabel.font = [UIFont systemFontOfSize:12]; - _idLabel.textColor = [UIColor whiteColor]; +- (UIImageView *)genderImageView { + if (!_genderImageView) { + _genderImageView = [[UIImageView alloc] init]; } - return _idLabel; -} - -- (UIImageView *)greetImageView { - if (!_greetImageView) { - _greetImageView = [[UIImageView alloc] init]; - _greetImageView.userInteractionEnabled = YES; - _greetImageView.image = [UIImage imageNamed:@"home_new_user_greet_bg"]; - } - return _greetImageView; + return _genderImageView; } - (UILabel *)greetLabel { if (!_greetLabel) { _greetLabel = [[UILabel alloc] init]; _greetLabel.font = [UIFont systemFontOfSize:12]; - _greetLabel.textColor = UIColorFromRGB(0xA00BBB); - _greetLabel.numberOfLines = 3; - + _greetLabel.textColor = UIColorFromRGB(0xFFFFFF); + _greetLabel.numberOfLines = 2; + [_greetLabel sizeToFit]; } return _greetLabel; } @@ -212,12 +304,52 @@ - (UIButton *)startButton { if (!_startButton) { _startButton = [UIButton buttonWithType:UIButtonTypeCustom]; - [_startButton setTitle:@"开启浪漫之旅" forState:UIControlStateNormal]; - [_startButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; - _startButton.titleLabel.font = [UIFont systemFontOfSize:20 weight:UIFontWeightBold]; - [_startButton setBackgroundImage:[UIImage imageNamed:@"home_new_user_greet_start_bg"] forState:UIControlStateNormal]; + [_startButton setBackgroundImage:[UIImage imageNamed:@"home_new_user_greet_start"] forState:UIControlStateNormal]; [_startButton addTarget:self action:@selector(startButtonAction:) forControlEvents:UIControlEventTouchUpInside]; } return _startButton; } + +- (UIImageView *)voiceShowBgImage { + if (!_voiceShowBgImage) { + _voiceShowBgImage = [[UIImageView alloc] init]; + _voiceShowBgImage.image = [UIImage gradientColorImageFromColors:@[UIColorFromRGB(0xF3F4ED), UIColorFromRGB(0xDFF8FC)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(44, 21)]; + _voiceShowBgImage.userInteractionEnabled = YES; + _voiceShowBgImage.layer.cornerRadius = 10.5f; + _voiceShowBgImage.layer.masksToBounds = YES; + } + return _voiceShowBgImage; +} + +- (UIButton *)playButton { + if (!_playButton) { + _playButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [_playButton setBackgroundImage:[UIImage imageNamed:@"home_new_user_greet_play"] forState:UIControlStateNormal]; + [_playButton addTarget:self action:@selector(playButtonAction:) forControlEvents:UIControlEventTouchUpInside]; + } + return _playButton; +} + +- (UIImageView *)voiceImage { + if (!_voiceImage) { + _voiceImage = [[UIImageView alloc] init]; + _voiceImage.image = [UIImage imageNamed:@"home_new_user_greet_wave"]; + } + return _voiceImage; +} + +- (UIImageView *)effectView { + if (!_effectView) { + _effectView = [[UIImageView alloc] init]; + CAGradientLayer *gradientLayer = [CAGradientLayer layer]; + gradientLayer.colors = @[(__bridge id)UIColorRGBAlpha(0xffffff, 0).CGColor, (__bridge id)UIColorRGBAlpha(0x000000, 0.75).CGColor]; + gradientLayer.locations = @[@0, @1.0]; + gradientLayer.startPoint = CGPointMake(0, 0); + gradientLayer.endPoint = CGPointMake(0, 1); + gradientLayer.frame = CGRectMake(0, 0, 240, 115); + [_effectView.layer addSublayer:gradientLayer]; + } + return _effectView; +} + @end