|
8#
楼主 |
发表于 2014-7-14 11:39:28
|
只看该作者
- (void)viewDidLoad
{
[super viewDidLoad];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(AnyChatNotifyHandler:) name:@"ANYCHATNOTIFY" object:nil];
anychat = [[AnyChatPlatform alloc] init];
anychat.notifyMsgDelegate = self;
[AnyChatPlatform InitSDK:0];
[self loginAnyChatWithUserName:@"aa" password:@""];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
-(void) viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
_videoChatViewController.view.frame = self.view.frame;
}
- (void)AnyChatNotifyHandler:(NSNotification*)notify
{
NSDictionary*dict =notify.userInfo;
[anychat OnRecvAnyChatNotify:dict];
}
-(void) loginAnyChatWithUserName:(NSString*)userName password:(NSString*)password
{
[AnyChatPlatform Connect:@"st.padbot.cn": 8906];
[AnyChatPlatform Login:userName : password];
[AnyChatPlatform EnterRoom:*(_chatRoomId) :@""];
}
// 连接服务器消息
- (void) OnAnyChatConnect:(BOOL) bSuccess
{
}
// 用户登陆消息
- (void) OnAnyChatLogin:(int) dwUserId : (int) dwErrorCode
{
if(dwErrorCode == GV_ERR_SUCCESS) {
[self updateLocalSettings];
} else {
}
}
// 用户进入房间消息
- (void) OnAnyChatEnterRoom:(int) dwRoomId : (int) dwErrorCode
{
NSMutableArray *onlineUserList = [[NSMutableArray alloc] initWithArray:[AnyChatPlatform GetOnlineUser]];
NSLog(@"0000000000 %d onlineUser count %d",dwRoomId,onlineUserList.count);
}
// 房间在线用户消息
- (void) OnAnyChatOnlineUser:(int) dwUserNum : (int) dwRoomId
{
NSMutableArray *onlineUserList = [[NSMutableArray alloc] initWithArray:[AnyChatPlatform GetOnlineUser]];
NSLog(@"1111111111 %d , onLineUser count %d",dwUserNum,onlineUserList.count);
}
// 用户进入房间消息
- (void) OnAnyChatUserEnterRoom:(int) dwUserId
{
NSMutableArray *onlineUserList = [[NSMutableArray alloc] initWithArray:[AnyChatPlatform GetOnlineUser]];
NSLog(@"22222222 %d onlineUser count %d",onlineUserList.count);
}
// 用户退出房间消息
- (void) OnAnyChatUserLeaveRoom:(int) dwUserId
{
NSLog(@"2222222222");
}
|
|