chore: 更新 .gitignore 文件,移除不必要的包文件类型;新增邮箱验证码登录流程和 OAuth/Ticket 认证系统 API 文档;更新勋章相关逻辑,优化用户信息获取失败处理;调整勋章展示逻辑,支持多等级高亮功能。
This commit is contained in:
@@ -353,4 +353,16 @@
|
||||
return _goButton;
|
||||
}
|
||||
|
||||
// 在主实现体内添加事件穿透逻辑
|
||||
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
|
||||
if (!self.userInteractionEnabled || self.hidden || self.alpha <= 0.01) {
|
||||
return nil;
|
||||
}
|
||||
CGPoint goButtonPoint = [self.goButton convertPoint:point fromView:self];
|
||||
if ([self.goButton pointInside:goButtonPoint withEvent:event]) {
|
||||
return self.goButton;
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
@end
|
||||
|
@@ -401,4 +401,16 @@
|
||||
return _goButton;
|
||||
}
|
||||
|
||||
// ========== 事件穿透实现 ==========
|
||||
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
|
||||
if (!self.userInteractionEnabled || self.hidden || self.alpha <= 0.01) {
|
||||
return nil;
|
||||
}
|
||||
CGPoint goButtonPoint = [self.goButton convertPoint:point fromView:self];
|
||||
if ([self.goButton pointInside:goButtonPoint withEvent:event]) {
|
||||
return self.goButton;
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
@end
|
||||
|
@@ -52,11 +52,13 @@ static const NSInteger kItemsPerRow = 5;
|
||||
[self.blurEffectView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.leading.trailing.equalTo(self).inset(0);
|
||||
make.bottom.equalTo(self).offset(12);
|
||||
make.height.mas_equalTo(self.collectionView.mas_height).multipliedBy(1.05);
|
||||
make.height.mas_equalTo(KScreenHeight*2/3);
|
||||
}];
|
||||
[self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.bottom.leading.trailing.equalTo(self).inset(kGetScaleWidth(0));
|
||||
make.height.mas_equalTo(kGetScaleWidth(246));
|
||||
make.bottom.equalTo(self);
|
||||
make.leading.trailing.equalTo(self).inset(16);
|
||||
// make.height.mas_equalTo(kGetScaleWidth(246));
|
||||
make.height.mas_equalTo(KScreenHeight*2/3 - 30);
|
||||
}];
|
||||
}
|
||||
|
||||
@@ -69,7 +71,6 @@ static const NSInteger kItemsPerRow = 5;
|
||||
-(void)setPlayList:(NSMutableArray *)playList {
|
||||
_playList = playList;
|
||||
[self.dataSource addObjectsFromArray:playList];
|
||||
[self updateViewHeightWithItemCount:self.dataSource.count];
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
[self.collectionView reloadData];
|
||||
});
|
||||
@@ -78,7 +79,6 @@ static const NSInteger kItemsPerRow = 5;
|
||||
- (void)setLittleGameList:(NSMutableArray<LittleGameInfoModel *> *)littleGameList {
|
||||
_littleGameList = littleGameList;
|
||||
[self.dataSource addObjectsFromArray:littleGameList];
|
||||
[self updateViewHeightWithItemCount:self.dataSource.count];
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
[self.collectionView reloadData];
|
||||
});
|
||||
@@ -90,39 +90,18 @@ static const NSInteger kItemsPerRow = 5;
|
||||
self.dataSource = [NSMutableArray array];
|
||||
[self.dataSource addObjectsFromArray:playList];
|
||||
[self.dataSource addObjectsFromArray:littleGameList];
|
||||
[self updateViewHeightWithItemCount:self.dataSource.count];
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
[self.collectionView reloadData];
|
||||
});
|
||||
}
|
||||
|
||||
- (void)updateViewHeightWithItemCount:(NSInteger)count {
|
||||
if (count == 0) {
|
||||
return;
|
||||
}
|
||||
NSInteger lineNum = (count + kItemsPerRow - 1)/kItemsPerRow;// MIN(3, (count + kItemsPerRow - 1)/kItemsPerRow);
|
||||
|
||||
CGFloat calHeight = self.itemHeight;
|
||||
CGFloat height = 20 + 56 * lineNum + 44 * (lineNum - 1) + 70;
|
||||
height = calHeight * lineNum;
|
||||
// [self.ms_bgView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
// make.height.mas_equalTo(kGetScaleWidth(height + 12));
|
||||
// }];
|
||||
if (height > KScreenHeight*2/3) {
|
||||
height = KScreenHeight*2/3;
|
||||
}
|
||||
[self.collectionView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(kGetScaleWidth(height));
|
||||
}];
|
||||
}
|
||||
|
||||
- (NSInteger)countOfCurrentType {
|
||||
return self.dataSource.count;// self.littleGameList.count > 0 ? self.littleGameList.count : self.playList.count;
|
||||
}
|
||||
|
||||
#pragma mark- UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout
|
||||
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath{
|
||||
CGFloat width = (KScreenWidth-kGetScaleWidth(6))/4;
|
||||
CGFloat width = (KScreenWidth - 64)/4;
|
||||
return [self countOfCurrentType] > 0 ? CGSizeMake(width, self.itemHeight) : CGSizeMake(KScreenWidth, self.emptyHeight);
|
||||
}
|
||||
- (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout insetForSectionAtIndex:(NSInteger)section{
|
||||
@@ -183,16 +162,16 @@ static const NSInteger kItemsPerRow = 5;
|
||||
if (!_collectionView) {
|
||||
MSBaseRTLFlowLayout *layout = [[MSBaseRTLFlowLayout alloc] init];
|
||||
|
||||
layout.minimumLineSpacing = 10;
|
||||
layout.minimumInteritemSpacing = 0;
|
||||
layout.minimumLineSpacing = 0;
|
||||
layout.minimumInteritemSpacing = 8;
|
||||
_collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
|
||||
_collectionView.showsHorizontalScrollIndicator = NO;
|
||||
_collectionView.showsVerticalScrollIndicator = NO;
|
||||
_collectionView.dataSource = self;
|
||||
_collectionView.delegate = self;
|
||||
_collectionView.backgroundColor = [UIColor clearColor];
|
||||
[_collectionView registerClass:[MSRoomMenuGameCell class] forCellWithReuseIdentifier:NSStringFromClass([MSRoomMenuGameCell class])];
|
||||
[_collectionView registerClass:[MSRoomMenuGameEmptyCell class] forCellWithReuseIdentifier:NSStringFromClass([MSRoomMenuGameEmptyCell class])];
|
||||
|
||||
}
|
||||
return _collectionView;
|
||||
}
|
||||
|
@@ -70,7 +70,7 @@
|
||||
}
|
||||
|
||||
- (void)gameSetUp {
|
||||
// nslog(@"小游戏的版本号是:%@", [SudMGP getVersion]);
|
||||
NSLog(@"小游戏的版本号是:%@", [SudMGP getVersion]);
|
||||
BOOL isTestEnv = NO;
|
||||
#ifdef DEBUG
|
||||
isTestEnv = YES;
|
||||
@@ -90,7 +90,7 @@
|
||||
}
|
||||
NSString * userId = [AccountInfoStorage instance].getUid;
|
||||
NSString * roomId = self.gameModel.roomId;
|
||||
// nslog(@"用户ID:%@,房间ID:%@, 游戏ID:%lld, code:%@", userId, roomId, self.currentmgId, self.code);
|
||||
NSLog(@"用户ID:%@,房间ID:%@, 游戏ID:%lld, code:%@", userId, roomId, self.currentmgId, self.code);
|
||||
|
||||
NSString *language = [NSBundle getLanguageText];
|
||||
if ([language hasPrefix:@"zh"]) {
|
||||
@@ -105,7 +105,7 @@
|
||||
self.fsmAPP2MG = [SudMGP loadMG:userId roomId:roomId code:self.code mgId:self.currentmgId language:language fsmMG:self rootView:self];
|
||||
} else {
|
||||
/// 初始化失败, 可根据业务重试
|
||||
// nslog(@"ISudFSMMG:initGameSDKWithAppID:初始化sdk失败 :%@",retMsg);
|
||||
NSLog(@"ISudFSMMG:initGameSDKWithAppID:初始化sdk失败 :%@",retMsg);
|
||||
}
|
||||
}];
|
||||
}
|
||||
@@ -157,7 +157,7 @@
|
||||
* 游戏日志
|
||||
*/
|
||||
-(void)onGameLog:(NSString*)dataJson {
|
||||
// nslog(@"ISudFSMMG:onGameLog:%@", dataJson);
|
||||
NSLog(@"ISudFSMMG:onGameLog:%@", dataJson);
|
||||
NSDictionary * dic = [SudCommon turnStringToDictionary:dataJson];
|
||||
NSString * msg_string = [dic objectForKey:@"msg"];
|
||||
if (!msg_string) {
|
||||
@@ -169,7 +169,7 @@
|
||||
* 游戏开始
|
||||
*/
|
||||
-(void)onGameStarted {
|
||||
// nslog(@"ISudFSMMG:onGameStarted:游戏开始");
|
||||
NSLog(@"ISudFSMMG:onGameStarted:游戏开始");
|
||||
[self notifySelfInState:YES seatIndex:-1];///加入房间
|
||||
[self handleSelfReadyEvent];///准备游戏
|
||||
}
|
||||
@@ -178,7 +178,7 @@
|
||||
* 游戏销毁
|
||||
*/
|
||||
-(void)onGameDestroyed {
|
||||
// nslog(@"ISudFSMMG:onGameDestroyed:游戏销毁");
|
||||
NSLog(@"ISudFSMMG:onGameDestroyed:游戏销毁");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -186,14 +186,14 @@
|
||||
* @param dataJson {"code":"value"}
|
||||
*/
|
||||
-(void)onExpireCode:(id<ISudFSMStateHandle>)handle dataJson:(NSString*)dataJson {
|
||||
// nslog(@"ISudFSMMG:onExpireCode:Code过期");
|
||||
NSLog(@"ISudFSMMG:onExpireCode:Code过期");
|
||||
// 请求业务服务器刷新令牌
|
||||
[Api getSudGameCode:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
if (code == 200) {
|
||||
NSString * gameCode = data.data[@"code"];
|
||||
self.code = gameCode;
|
||||
[self.fsmAPP2MG updateCode:gameCode listener:^(int retCode, const NSString *retMsg, const NSString *dataJson) {
|
||||
// nslog(@"ISudFSMMG:updateGameCode retCode=%@ retMsg=%@ dataJson=%@", @(retCode), retMsg, dataJson);
|
||||
NSLog(@"ISudFSMMG:updateGameCode retCode=%@ retMsg=%@ dataJson=%@", @(retCode), retMsg, dataJson);
|
||||
}];
|
||||
// 回调结果
|
||||
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:@(0), @"ret_code", @"return form APP onExpireCode", @"ret_msg", nil];
|
||||
@@ -251,15 +251,15 @@
|
||||
|
||||
// 检查是否解析成功
|
||||
if (error) {
|
||||
// nslog(@"JSON 解析失败: %@", error.localizedDescription);
|
||||
NSLog(@"JSON 解析失败: %@", error.localizedDescription);
|
||||
} else {
|
||||
// nslog(@"解析后的字典: %@", dictionary);
|
||||
NSLog(@"解析后的字典: %@", dictionary);
|
||||
// 禁止模式选择
|
||||
NSMutableDictionary *ui = [[NSMutableDictionary alloc] initWithDictionary:dictionary[@"ui"]];
|
||||
[ui setObject: @{@"hide" : @(YES)}
|
||||
forKey:@"lobby_game_setting"];
|
||||
[dictionary setObject:ui forKey:@"ui"];
|
||||
// nslog(@"更新后的字典: %@", dictionary);
|
||||
NSLog(@"更新后的字典: %@", dictionary);
|
||||
}
|
||||
|
||||
// dict[@"ui"] = @{
|
||||
@@ -290,11 +290,11 @@
|
||||
* @param dataJson 回调json
|
||||
*/
|
||||
-(void)onGameStateChange:(id<ISudFSMStateHandle>) handle state:(NSString*) state dataJson:(NSString*) dataJson {
|
||||
// nslog(@"onGameStateChange 回调: %@ \n%@", state, dataJson);
|
||||
NSLog(@"onGameStateChange 回调: %@ \n%@", state, dataJson);
|
||||
if ([state isEqualToString:MG_COMMON_SELF_CLICK_READY_BTN]) {
|
||||
// [self addAI];
|
||||
} else if ([state isEqualToString:@"mg_common_game_add_ai_players"]) {
|
||||
// nslog(@" ????????????????????????????????????????????? ");
|
||||
NSLog(@" ????????????????????????????????????????????? ");
|
||||
} else if([state isEqualToString:MG_COMMON_GAME_SETTLE]){
|
||||
NSDictionary *data = @{@"value0":self.gameModel.data.matchRoundId ?: @""};
|
||||
NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys:[data mj_JSONString] , @"reportGameInfoExtras",@"value0" , @"reportGameInfoKey" ,nil];
|
||||
@@ -308,7 +308,7 @@
|
||||
[self.delegate getGameRsultsWithList:list];
|
||||
}
|
||||
}else if ([state isEqualToString:MG_COMMON_PUBLIC_MESSAGE]) {
|
||||
// nslog(@"ISudFSMMG:onGameStateChange:游戏->APP:公屏消息");
|
||||
NSLog(@"ISudFSMMG:onGameStateChange:游戏->APP:公屏消息");
|
||||
} else if ([state isEqualToString:MG_COMMON_KEY_WORD_TO_HIT]) {
|
||||
|
||||
}else if ([state isEqualToString:MG_COMMON_SELF_CLICK_JOIN_BTN]) {//加入游戏按钮点击
|
||||
@@ -318,9 +318,9 @@
|
||||
seatIndex = [[dic objectForKey:@"seatIndex"] intValue];
|
||||
}
|
||||
if (seatIndex == -1) {
|
||||
// nslog(@"来自加入按钮%d",seatIndex);
|
||||
NSLog(@"来自加入按钮%d",seatIndex);
|
||||
}else {
|
||||
// nslog(@"来自麦位+入%d",seatIndex);
|
||||
NSLog(@"来自麦位+入%d",seatIndex);
|
||||
}
|
||||
[self notifySelfInState:YES seatIndex:-1];
|
||||
} else if([state isEqualToString:MG_COMMON_SELF_CLICK_START_BTN]) {//开始游戏按钮点击
|
||||
@@ -330,7 +330,7 @@
|
||||
[self handleSelfInExitEvent];
|
||||
} else {
|
||||
/// 其他状态
|
||||
// nslog(@"ISudFSMMG:onGameStateChange:游戏->APP:state:%@",MG_COMMON_PUBLIC_MESSAGE);
|
||||
NSLog(@"ISudFSMMG:onGameStateChange:游戏->APP:state:%@",MG_COMMON_PUBLIC_MESSAGE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -342,7 +342,7 @@
|
||||
* @param dataJson 回调JSON
|
||||
*/
|
||||
-(void)onPlayerStateChange:(nullable id<ISudFSMStateHandle>) handle userId:(NSString*) userId state:(NSString*) state dataJson:(NSString*) dataJson {
|
||||
// nslog(@"ISudFSMMG:onPlayerStateChange:游戏->APP:游戏玩家状态变化:userId: %@ --state: %@ --dataJson: %@", userId, state, dataJson);
|
||||
NSLog(@"ISudFSMMG:onPlayerStateChange:游戏->APP:游戏玩家状态变化:userId: %@ --state: %@ --dataJson: %@", userId, state, dataJson);
|
||||
/// 状态解析
|
||||
NSString *dataStr = @"";
|
||||
if ([state isEqualToString:MG_COMMON_PLAYER_IN]) {
|
||||
@@ -382,9 +382,9 @@
|
||||
dataStr = YMLocalizedString(@"XPRoomLittleGameContainerView8");
|
||||
[self handleState_MG_DG_SCORE_WithUserId:userId dataJson:dataJson];
|
||||
}else {
|
||||
// nslog(@"ISudFSMMG:onPlayerStateChange:未做解析状态:%@", MG_DG_SCORE);
|
||||
NSLog(@"ISudFSMMG:onPlayerStateChange:未做解析状态:%@", MG_DG_SCORE);
|
||||
}
|
||||
// nslog(@"ISudFSMMG:onPlayerStateChange:dataStr:%@", dataStr);
|
||||
NSLog(@"ISudFSMMG:onPlayerStateChange:dataStr:%@", dataStr);
|
||||
/// 回调
|
||||
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:@(0), @"ret_code", @"return form APP onPlayerStateChange", @"ret_msg", nil];
|
||||
[handle success:[SudCommon dictionaryToJson:dict]];
|
||||
@@ -443,9 +443,9 @@
|
||||
/// @param state 状态名称
|
||||
/// @param dataJson 需传递的json
|
||||
- (void)notifyStateChange:(NSString *) state dataJson:(NSString*) dataJson {
|
||||
// nslog(@"ISudFSMMG: START notifyStateChange:state=%@ \ndataJson=%@", state, dataJson);
|
||||
NSLog(@"ISudFSMMG: START notifyStateChange:state=%@ \ndataJson=%@", state, dataJson);
|
||||
[self.fsmAPP2MG notifyStateChange:state dataJson:dataJson listener:^(int retCode, const NSString *retMsg, const NSString *dataJson) {
|
||||
// nslog(@"ISudFSMMG:notifyStateChange:retCode=%@ retMsg=%@ dataJson=%@", @(retCode), retMsg, dataJson);
|
||||
NSLog(@"ISudFSMMG:notifyStateChange:retCode=%@ retMsg=%@ dataJson=%@", @(retCode), retMsg, dataJson);
|
||||
|
||||
if (retCode == 0 && [state isEqualToString:APP_COMMON_SELF_PLAYING]) {//开始游戏
|
||||
//上报游戏开始
|
||||
@@ -606,11 +606,11 @@
|
||||
}
|
||||
|
||||
- (void)handleState_MG_DG_SELECTING_WithUserId:(NSString *)userId dataJson:(NSString *)dataJson {
|
||||
// nslog(@"handleState_MG_DG_SELECTING_WithUserId%@",dataJson);
|
||||
NSLog(@"handleState_MG_DG_SELECTING_WithUserId%@",dataJson);
|
||||
}
|
||||
|
||||
- (void)handleState_MG_DG_PAINTING_WithUserId:(NSString *)userId dataJson:(NSString *)dataJson {
|
||||
// nslog(@"handleState_MG_DG_PAINTING_WithUserId%@",dataJson);
|
||||
NSLog(@"handleState_MG_DG_PAINTING_WithUserId%@",dataJson);
|
||||
/// 设置麦位状态为作画中
|
||||
NSDictionary * dic = [SudCommon turnStringToDictionary:dataJson];
|
||||
bool isPainting = NO;
|
||||
@@ -621,18 +621,18 @@
|
||||
|
||||
- (void)handleState_MG_DG_ERRORANSWER_WithUserId:(NSString *)userId dataJson:(NSString *)dataJson {
|
||||
/// 错误答案
|
||||
// nslog(@"handleState_MG_DG_ERRORANSWER_WithUserId%@",dataJson);
|
||||
NSLog(@"handleState_MG_DG_ERRORANSWER_WithUserId%@",dataJson);
|
||||
|
||||
}
|
||||
|
||||
- (void)handleState_MG_DG_TOTALSCORE_WithUserId:(NSString *)userId dataJson:(NSString *)dataJson {
|
||||
/// 总积分
|
||||
// nslog(@"handleState_MG_DG_TOTALSCORE_WithUserId%@",dataJson);
|
||||
NSLog(@"handleState_MG_DG_TOTALSCORE_WithUserId%@",dataJson);
|
||||
}
|
||||
|
||||
- (void)handleState_MG_DG_SCORE_WithUserId:(NSString *)userId dataJson:(NSString *)dataJson {
|
||||
/// 本次积分
|
||||
// nslog(@"handleState_MG_DG_SCORE_WithUserId%@",dataJson);
|
||||
NSLog(@"handleState_MG_DG_SCORE_WithUserId%@",dataJson);
|
||||
}
|
||||
|
||||
/// 销毁MG
|
||||
|
@@ -1447,13 +1447,13 @@ XPCandyTreeInsufficientBalanceViewDelegate>
|
||||
self.userInfo = userInfo;
|
||||
|
||||
[self requestBoomData];
|
||||
[self getOnlineCount];
|
||||
|
||||
@kWeakify(self);
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_global_queue(0, 0), ^{
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_global_queue(0, 0), ^{
|
||||
@kStrongify(self);
|
||||
//获取一下红包信息
|
||||
[self.presenter getRedPacket:[NSString stringWithFormat:@"%ld", self.roomInfo.uid]];
|
||||
[self getOnlineCount];
|
||||
});
|
||||
|
||||
switch (roomInfo.type) {
|
||||
@@ -1842,7 +1842,7 @@ XPCandyTreeInsufficientBalanceViewDelegate>
|
||||
continue;
|
||||
}
|
||||
|
||||
NSLog(@" --- Message Raw Attach Content: %@, %@, %ld", @(message.senderClientType), message.rawAttachContent, (long)message.messageType);
|
||||
// NSLog(@" --- Message Raw Attach Content: %@, %@, %ld", @(message.senderClientType), message.rawAttachContent, (long)message.messageType);
|
||||
|
||||
if (message.messageType == NIMMessageTypeNotification) {
|
||||
NIMNotificationObject *notiMsg = (NIMNotificationObject *)message.messageObject;
|
||||
|
Reference in New Issue
Block a user