Commit 95dc75cf cgx

优化首页

1 个父辈 92efa994
正在显示 22 个修改的文件 包含 96 行增加49 行删除
......@@ -202,7 +202,7 @@
D0E6600828080F97006562F2 /* SystemSetController.m in Sources */ = {isa = PBXBuildFile; fileRef = D0E6600728080F97006562F2 /* SystemSetController.m */; };
D0E6F1FD28290128004150E5 /* TimingView.m in Sources */ = {isa = PBXBuildFile; fileRef = D0E6F1FC28290128004150E5 /* TimingView.m */; };
D0F808F52803D4E70097899F /* Track.m in Sources */ = {isa = PBXBuildFile; fileRef = D0F808F32803D4E70097899F /* Track.m */; };
D0F808FE280421C20097899F /* ThreeMinuteController.m in Sources */ = {isa = PBXBuildFile; fileRef = D0F808FD280421C20097899F /* ThreeMinuteController.m */; };
D0F808FE280421C20097899F /* UnityGameController.m in Sources */ = {isa = PBXBuildFile; fileRef = D0F808FD280421C20097899F /* UnityGameController.m */; };
D0F80907280431100097899F /* UILabel+Extras.m in Sources */ = {isa = PBXBuildFile; fileRef = D0F80906280431100097899F /* UILabel+Extras.m */; };
D0F82286280C44D10039F586 /* SetTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = D0F82285280C44D10039F586 /* SetTableView.m */; };
D0F9AC542826563400FD7A3B /* MusicPlayerController.m in Sources */ = {isa = PBXBuildFile; fileRef = D0F9AC532826563400FD7A3B /* MusicPlayerController.m */; };
......@@ -619,8 +619,8 @@
D0E6F1FC28290128004150E5 /* TimingView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TimingView.m; sourceTree = "<group>"; };
D0F808F32803D4E70097899F /* Track.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Track.m; sourceTree = "<group>"; };
D0F808F42803D4E70097899F /* Track.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Track.h; sourceTree = "<group>"; };
D0F808FC280421C20097899F /* ThreeMinuteController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ThreeMinuteController.h; sourceTree = "<group>"; };
D0F808FD280421C20097899F /* ThreeMinuteController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ThreeMinuteController.m; sourceTree = "<group>"; };
D0F808FC280421C20097899F /* UnityGameController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UnityGameController.h; sourceTree = "<group>"; };
D0F808FD280421C20097899F /* UnityGameController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = UnityGameController.m; sourceTree = "<group>"; };
D0F80905280431100097899F /* UILabel+Extras.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UILabel+Extras.h"; sourceTree = "<group>"; };
D0F80906280431100097899F /* UILabel+Extras.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "UILabel+Extras.m"; sourceTree = "<group>"; };
D0F82284280C44D10039F586 /* SetTableView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SetTableView.h; sourceTree = "<group>"; };
......@@ -957,7 +957,7 @@
children = (
D0F808F72804204B0097899F /* Home */,
D0A72E30282B4FE300EED7BE /* Course */,
D0F808FB280421160097899F /* FallAsleep */,
D0F808FB280421160097899F /* UnityGame */,
D0A72E36282B539200EED7BE /* WhiteNoise */,
D0F808F628041FB60097899F /* BreathingMethod */,
);
......@@ -1600,13 +1600,13 @@
path = Model;
sourceTree = "<group>";
};
D0F808FB280421160097899F /* FallAsleep */ = {
D0F808FB280421160097899F /* UnityGame */ = {
isa = PBXGroup;
children = (
D0F808FC280421C20097899F /* ThreeMinuteController.h */,
D0F808FD280421C20097899F /* ThreeMinuteController.m */,
D0F808FC280421C20097899F /* UnityGameController.h */,
D0F808FD280421C20097899F /* UnityGameController.m */,
);
path = FallAsleep;
path = UnityGame;
sourceTree = "<group>";
};
D0F9AC552826602400FD7A3B /* SPButton */ = {
......@@ -2083,7 +2083,7 @@
D0E6F1FD28290128004150E5 /* TimingView.m in Sources */,
D091E677283F614900D3279E /* ScoreDetailCell.m in Sources */,
D08F79DF281A1838000D99DD /* TZPhotoPreviewCell.m in Sources */,
D0F808FE280421C20097899F /* ThreeMinuteController.m in Sources */,
D0F808FE280421C20097899F /* UnityGameController.m in Sources */,
D07A4B27280E9BAA00BA0EC0 /* AccountController.m in Sources */,
D062A09E281838B800B4F48A /* FeedbackRequestModel.m in Sources */,
D08F79D5281A1838000D99DD /* TZAssetCell.m in Sources */,
......
......@@ -10,7 +10,7 @@
#import <JavaScriptCore/JavaScriptCore.h>
#import "RelaxTrainController.h"
#import "SomeProxy.h"
#import "ThreeMinuteController.h"
#import "UnityGameController.h"
#import "UserRequestModel.h"
#import "DsMaskView.h"
......@@ -145,7 +145,9 @@
break;
case 3: // 轻拍哄睡
{
[self.navigationController pushViewController:[ThreeMinuteController new] animated:YES];
UnityGameController *gameVC = [UnityGameController new];
gameVC.gameType = GameTypeCoax;
[self.navigationController pushViewController:gameVC animated:YES];
}
break;
case 4: // 安心记事本
......
......@@ -11,7 +11,7 @@
#import "FirstLeadAlertView.h"
#import "UserRequestModel.h"
#import "HomeRequestModel.h"
#import "ThreeMinuteController.h"
#import "UnityGameController.h"
#import "SafeSleepRequestModel.h"
#import "WhiteNoiseRequestModel.h"
#import "NoisePlayBar.h"
......@@ -215,8 +215,9 @@
} else if (type == 2) { // 首页
self.tabBarController.selectedIndex = 0;
} else if (type == 3) { // 哄睡页面(未登录就可以进去)
ThreeMinuteController *threeVC = [[ThreeMinuteController alloc] init];
[self.navigationController pushViewController:threeVC animated:YES];
UnityGameController *gameVC = [UnityGameController new];
gameVC.gameType = GameTypeCoax;
[self.navigationController pushViewController:gameVC animated:YES];
}
} else {
// 跳转到H5页面
......
......@@ -9,6 +9,6 @@
@implementation HeaderDataModel
+ (NSArray *)getDsMiddleImages {
return @[@"btn_home_qpsleep_normal", @"btn_home_jhrelax_normal", @"btn_home_478relax_normal"];;
return @[@"btn_home_qpsleep_normal", @"btn_home_jhrelax_normal", @"btn_home_478relax_normal", @"btn_home_xiaoqiu_normal"];;
}
@end
......@@ -113,9 +113,9 @@
if (!_headerView) {
// banner高度
CGFloat bannerH = 2*(kScreenWidth - 48)/5.0;
// 三分钟即刻入睡按钮宽度
CGFloat width = (kScreenWidth - 2*15 - 14)/2;
CGFloat height = 15 + bannerH + 24 + 133*width/165.0;
// 睡按钮宽度
CGFloat width = kScreenWidth - 2*15 - 12;
CGFloat height = 15 + bannerH + 24 + (170*.3*width/104.0);
_headerView = [[HomeHeaderView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, height)];
_headerView.dk_backgroundColorPicker = DKColorPickerWithKey(VCViewBG);
}
......
......@@ -7,11 +7,12 @@
#import "DsMiddleView.h"
#import "HeaderDataModel.h"
#import "ThreeMinuteController.h"
#import "UnityGameController.h"
#import "BreatheController.h"
@interface DsMiddleView ()
@property (nonatomic, strong) UIImageView *unityIV;
@property (nonatomic, strong) UIImageView *coaxIV;
@property (nonatomic, strong) UIImageView *mbsrIV;
@property (nonatomic, strong) UIImageView *balanceIV;
@property (nonatomic, strong) UIImageView *comfortableIV;
@property (nonatomic, strong) NSArray *middleImgs;
......@@ -22,26 +23,32 @@
- (void)layoutSubviews {
[super layoutSubviews];
CGFloat width = (kScreenWidth - 2*15 - 14)/2;
[self.unityIV mas_makeConstraints:^(MASConstraintMaker *make) {
CGFloat width = kScreenWidth - 2*15 - 12;
[self.coaxIV mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self);
make.leftMargin.equalTo(self).offset(15);
make.width.equalTo(@(width));
make.height.equalTo(@(133*width/165.0));
make.width.equalTo(@(.3*width));
make.height.equalTo(@(170*.3*width/104.0));
}];
[self.mbsrIV mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.coaxIV);
make.left.equalTo(self.coaxIV.mas_right).offset(12);
make.right.equalTo(self).offset(-15);
make.height.equalTo(@(79*.7*width/229.0));
}];
[self.balanceIV mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.unityIV);
make.rightMargin.equalTo(self).offset(-15);
make.width.equalTo(self.unityIV);
make.height.equalTo(@(62*width/166.0));
make.top.equalTo(self.mbsrIV.mas_bottom).offset(12);
make.left.equalTo(self.mbsrIV);
make.bottom.equalTo(self.coaxIV);
}];
[self.comfortableIV mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.equalTo(self.balanceIV);
make.height.equalTo(self.balanceIV);
make.rightMargin.equalTo(self.balanceIV);
make.bottom.equalTo(self.unityIV);
make.rightMargin.equalTo(self.mbsrIV);
make.top.bottom.equalTo(self.balanceIV);
make.left.equalTo(self.balanceIV.mas_right).offset(13);
}];
self.height = self.unityIV.height;
self.height = self.coaxIV.height;
}
- (instancetype)initWithFrame:(CGRect)frame {
......@@ -52,16 +59,19 @@
UIImageView *iv = [[UIImageView alloc] initWithImage:[UIImage imageNamed:self.middleImgs[i]]];
[iv dk_setAlphaPicker:DKAlphaPickerWithAlphas(1.0, .5, .5)];
iv.tag = i;
[iv debugViewShowBorder];
iv.userInteractionEnabled = YES;
UITapGestureRecognizer *tapGR = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapAction:)];
[iv addGestureRecognizer:tapGR];
[self addSubview:iv];
if (i == 0) {
self.unityIV = iv;
self.coaxIV = iv;
} else if (i == 1) {
self.balanceIV = iv;
} else {
} else if (i == 2) {
self.comfortableIV = iv;
} else {
self.mbsrIV = iv;
}
}
}
......@@ -72,10 +82,11 @@
UIView *sender = tapper.view;
// 判断是否登录成功
if ([LoginUtils getUserLoginData]) {
if (sender.tag == 0) {
if (sender.tag == 0 || sender.tag == 3) {
// 进入三分钟即刻入睡页面
ThreeMinuteController *threeVC = [[ThreeMinuteController alloc] init];
[self.ds_viewController.navigationController pushViewController:threeVC animated:YES];
UnityGameController *gameVC = [[UnityGameController alloc] init];
gameVC.gameType = sender.tag == 0 ? GameTypeCoax : GameTypeBall;
[self.ds_viewController.navigationController pushViewController:gameVC animated:YES];
} else {
BreatheController *breatheVC = [[BreatheController alloc] init];
breatheVC.style = sender.tag == 1 ? LottieStyleBalance : LottieStyleComfortable;
......
......@@ -11,7 +11,7 @@
#import "CWPageControl.h"
#import "HeaderDataModel.h"
#import "DsMiddleView.h"
#import "ThreeMinuteController.h"
#import "UnityGameController.h"
@interface HomeHeaderView () <CWCarouselDatasource, CWCarouselDelegate>
// 轮播图
......@@ -92,8 +92,10 @@
self.ds_viewController.tabBarController.selectedIndex = 1;
}
break;
case 10: { // 进入三分钟即刻入睡页面
[self.ds_viewController.navigationController pushViewController:[ThreeMinuteController new] animated:YES];
case 10: { // 进入哄睡页面
UnityGameController *gameVC = [UnityGameController new];
gameVC.gameType = GameTypeCoax;
[self.ds_viewController.navigationController pushViewController:gameVC animated:YES];
}
break;
case 8: { // 进入睡眠评测页面
......
//
// ThreeMinuteController.h
// UnityGameController.h
// DreamSleep
//
// Created by peter on 2022/4/11.
......@@ -7,6 +7,13 @@
#import <UIKit/UIKit.h>
/// 三分钟即刻入睡VC(哄睡界面、Unity界面)
@interface ThreeMinuteController : UIViewController
// 游戏类型
typedef NS_ENUM(NSInteger, GameType) {
GameTypeCoax, // 哄睡
GameTypeBall // 小球
};
/// Unity游戏页面:(哄睡界面、小球页面)
@interface UnityGameController : UIViewController
@property (nonatomic, assign) GameType gameType;
@end
//
// ThreeMinuteController.m
// UnityGameController.m
// DreamSleep
//
// Created by peter on 2022/4/11.
//
#import "ThreeMinuteController.h"
#import "UnityGameController.h"
#import <UnityFramework/UnityFramework.h>
@interface ThreeMinuteController () <UnityFrameworkListener>
@interface UnityGameController () <UnityFrameworkListener>
@property (nonatomic, strong) UnityFramework* ufw;
@end
@implementation ThreeMinuteController
@implementation UnityGameController
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = DSBlack;
[self showUnityView];
[self showUnityView:self.gameType];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(exitCoaxSleep) name:ExitCoaxSleep object:nil];
}
......@@ -72,10 +72,11 @@ extern char** gArgv;
[[self ufw] runEmbeddedWithArgc:gArgc argv:gArgv appLaunchOpts:nil];
}
- (void)showUnityView {
- (void)showUnityView:(GameType)gameType {
char * message = gameType == GameTypeCoax ? "1" : "2";
[self initUnity];
// message:1表示哄睡,2表示小球
[self.ufw sendMessageToGOWithName:"Main Camera" functionName:"LoadGame" message:"1"];
[self.ufw sendMessageToGOWithName:"Main Camera" functionName:"LoadGame" message:message];
[self.ufw showUnityWindow];
}
......
{
"images" : [
{
"filename" : "btn_home_xiaoqiu_normal.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "btn_home_xiaoqiu_normal@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "btn_home_xiaoqiu_normal@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!