Skip to content

Commit 0c07a06

Browse files
author
jeffgaogao
committed
docs(TcgSdk): update demo
1 parent 4e52c90 commit 0c07a06

File tree

1 file changed

+25
-13
lines changed

1 file changed

+25
-13
lines changed

Demo/TCRDemo/TCGDemo/TCGDemoGamePlayVC.m

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ - (void)onEnableLocalVideo:(BOOL)enable {
541541
_videoCapturer = [[TCGCameraVideoCapturer alloc] initWithTcrSession:self.session];
542542
}
543543
[_videoCapturer startCaptureWithDevice:device format:format fps:_captureFps];
544-
544+
545545
} else {
546546
[_videoCapturer stopCapture];
547547
}
@@ -604,7 +604,7 @@ - (void)logWithLevel:(TCRLogLevel)logLevel log:(NSString *)log {
604604
[formatter setDateFormat:@"yyyy-MM-dd HH:mm:ss.SSS"];
605605
[formatter setTimeZone:[NSTimeZone localTimeZone]];
606606
NSString *timestamp = [formatter stringFromDate:[NSDate date]];
607-
607+
608608
switch (logLevel) {
609609
case TCRLogLevelDebug:
610610
NSLog(@"[TCRSDK] %@ [DEBUG]: %@", timestamp, log);
@@ -618,7 +618,7 @@ - (void)logWithLevel:(TCRLogLevel)logLevel log:(NSString *)log {
618618
case TCRLogLevelError:
619619
NSLog(@"[TCRSDK] %@ [ERROR]: %@", timestamp, log);
620620
break;
621-
621+
622622
default:
623623
break;
624624
}
@@ -630,10 +630,15 @@ - (void)onEvent:(TcrEvent)event eventData:(id)eventData {
630630
NSArray *array;
631631
CGRect rect;
632632
switch (event) {
633-
case STATE_CONNECTED:
633+
case STATE_CONNECTED: {
634+
NSLog(@"ApiTest STATE_CONNECTED:%@", (NSString *)eventData);
634635
NSLog(@"requestId = %@", [_session getRequestId]);
635-
[self showToast:@"连接成功"];
636+
dispatch_async(dispatch_get_main_queue(), ^{
637+
[self showToast:@"连接成功"];
638+
self.pcTouchView.hidden = NO;
639+
});
636640
break;
641+
}
637642
case STATE_RECONNECTING:
638643
[self showToast:@"重连中"];
639644
break;
@@ -662,12 +667,6 @@ - (void)onEvent:(TcrEvent)event eventData:(id)eventData {
662667
case MULTI_USER_ROLE_APPLY:
663668
NSLog(@"ApiTest 收到坐席请求:%@", (NSString *)eventData);
664669
break;
665-
case CURSOR_IMAGE_INFO:
666-
info = (NSDictionary *)eventData;
667-
array = info[@"imageFrame"];
668-
rect = CGRectMake([array[0] floatValue], [array[1] floatValue], [array[2] floatValue], [array[3] floatValue]);
669-
[self.pcTouchView setCursorImage:info[@"image"] andRemoteFrame:rect];
670-
break;
671670
case CLIENT_STATS:
672671
info = (NSDictionary *)eventData;
673672
NSLog(@"ApiTest CLIENT_STATS: %@", info);
@@ -683,9 +682,10 @@ - (void)onEvent:(TcrEvent)event eventData:(id)eventData {
683682
[self checkKBOpen];
684683
}
685684
break;
686-
case GAME_START_COMPLETE:
685+
case GAME_START_COMPLETE: {
687686
NSLog(@"ApiTest 游戏拉起:%@", (NSString *)eventData);
688687
break;
688+
}
689689
case CAMERA_STATUS_CHANGED: {
690690
info = (NSDictionary *)eventData;
691691
NSLog(@"ApiTest 摄像头状态切换:%@", info);
@@ -712,6 +712,18 @@ - (void)onEvent:(TcrEvent)event eventData:(id)eventData {
712712
break;
713713
}
714714

715+
case CURSOR_STATE_CHANGE: {
716+
NSLog(@"ApiTest CURSOR_STATE_CHANGE:%@", (NSString *)eventData);
717+
[self.pcTouchView setCursorTouchMode:TCRMouseCursorTouchMode_RelativeTouch];
718+
[self.pcTouchView setCursorIsShow:[eventData boolValue]];
719+
break;
720+
}
721+
case CURSOR_IMAGE_INFO:
722+
info = (NSDictionary *)eventData;
723+
array = info[@"imageFrame"];
724+
rect = CGRectMake([array[0] floatValue], [array[1] floatValue], [array[2] floatValue], [array[3] floatValue]);
725+
[self.pcTouchView setCursorImage:info[@"image"] andRemoteFrame:rect];
726+
break;
715727
default:
716728
break;
717729
}
@@ -784,7 +796,7 @@ - (void)onAudioData:(TCRAudioFrame *)data {
784796
__weak typeof(self) weakSelf = self;
785797
NSData *data1 = data.data;
786798
dispatch_async(_audioPlayerQueue, ^{
787-
[weakSelf.audioPlayer playWithData:data1];
799+
[weakSelf.audioPlayer playWithData:data1];
788800
});
789801
}
790802
#pragma mark--- 多人互动 ---

0 commit comments

Comments
 (0)