Example #1
0
        // 用户登录成功回调函数
        void OnUserLoginAction_CallBack(int userId, string userName, int level, string addr, int userValue)
        {
            try
            {
                // 添加用户分组
                int iGroupId = 1;
                AnyChatServerSDK.BRAS_UserInfoControl(userId, AnyChatServerSDK.BRAS_USERINFO_CTRLCODE_ADDGROUP, iGroupId, 0, "我的好友");
                iGroupId = 2;
                AnyChatServerSDK.BRAS_UserInfoControl(userId, AnyChatServerSDK.BRAS_USERINFO_CTRLCODE_ADDGROUP, iGroupId, 0, "在线游客");
                // 将当前所有在线用户添加为自己的好友
                foreach (UserInfo userInfo in users)
                {
                    int iUserId = userInfo.Id;
                    AnyChatServerSDK.BRAS_UserInfoControl(userId, AnyChatServerSDK.BRAS_USERINFO_CTRLCODE_ADDFRIEND, iUserId, 0, "");
                }
                // 设置好友与分组的关系(即好友属于哪一个分组)
                iGroupId = 1;
                foreach (UserInfo userInfo in users)
                {
                    int iUserId = userInfo.Id;
                    iGroupId = (iUserId > 0) ? 1 : 2;           // 游客密码为空,userid由核心服务器分配,为负数
                    AnyChatServerSDK.BRAS_UserInfoControl(userId, AnyChatServerSDK.BRAS_USERINFO_CTRLCODE_SETGROUPRELATION, iGroupId, iUserId, "");
                }
                // 设置当前用户信息(用户资料,客户端可以通过API:BRAC_GetUserInfo来获取这些信息)
                int iInfoId = 1;                                                                          // InfoId由业务层自己定义
                AnyChatServerSDK.BRAS_SetUserInfo(userId, iInfoId, userName, 0);
                iInfoId = 2;                                                                              // InfoId由业务层自己定义
                AnyChatServerSDK.BRAS_SetUserInfo(userId, iInfoId, addr, 0);
                iInfoId = 3;                                                                              // InfoId由业务层自己定义
                AnyChatServerSDK.BRAS_SetUserInfo(userId, iInfoId, "我的签名", 0);
                iInfoId = 4;                                                                              // InfoId由业务层自己定义
                AnyChatServerSDK.BRAS_SetUserInfo(userId, iInfoId, Convert.ToString(userId % 10 + 1), 0); // 随机分配一个图像ID
                // 将本地用户添加为其它用户的好友列表中
                foreach (UserInfo userInfo in users)
                {
                    int otherUserid = userInfo.Id;
                    AnyChatServerSDK.BRAS_UserInfoControl(otherUserid, AnyChatServerSDK.BRAS_USERINFO_CTRLCODE_ADDFRIEND, userId, 0, "");
                    // 关联好友分组
                    iGroupId = (userId > 0) ? 1 : 2;
                    AnyChatServerSDK.BRAS_UserInfoControl(otherUserid, AnyChatServerSDK.BRAS_USERINFO_CTRLCODE_SETGROUPRELATION, iGroupId, userId, "");
                    // 下发同步指令,将新设置的好友同步给客户端
                    AnyChatServerSDK.BRAS_UserInfoControl(otherUserid, AnyChatServerSDK.BRAS_USERINFO_CTRLCODE_SYNCDATA, 0, 0, "");
                }
                // 下发同步指令,将前面设置的资料同步给当前客户端
                AnyChatServerSDK.BRAS_UserInfoControl(userId, AnyChatServerSDK.BRAS_USERINFO_CTRLCODE_SYNCDATA, 0, 0, "");
                //加入用户对象集合
                UserInfo mode = new UserInfo();
                mode.Id   = userId;
                mode.Name = userName;
                mode.Ip   = addr;
                users.Add(mode);

                str = new string[] { userId.ToString(), userName, "游客", addr.ToString(), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") };
                UserLoginActionReceived_main = new SystemSettingServer.OnUserLoginAction_Received(OnUserLoginAction_CallBack_main);
                rtb_message.Invoke(UserLoginActionReceived_main, userId, userName, level, addr, userValue);
            }
            catch (Exception ex)
            {
                Log.SetLog("OnUserLoginAction_CallBack             用户登录成功错误:" + ex.Message.ToString());
            }
        }
Example #2
0
 // 用户登录成功回调函数
 void OnUserLoginAction_CallBack(int userId, string userName, int level, string addr, int userValue)
 {
     UserLoginActionReceived_main = new SystemSettingServer.OnUserLoginAction_Received(OnUserLoginAction_CallBack_main);
     rtb_message.Invoke(UserLoginActionReceived_main, userId, userName, level, addr, userValue);
 }
Example #3
0
 // 用户登录成功回调函数
 void OnUserLoginAction_CallBack(int userId, string userName, int level, string addr, int userValue)
 {
     UserLoginActionReceived_main = new SystemSettingServer.OnUserLoginAction_Received(OnUserLoginAction_CallBack_main);
     rtb_message.Invoke(UserLoginActionReceived_main, userId, userName, level, addr, userValue);
 }
Example #4
0
        // 用户登录成功回调函数
        void OnUserLoginAction_CallBack(int userId, string userName, int level, string addr, int userValue)
        {
            try
            {
                 // 添加用户分组
                int iGroupId = 1;
                AnyChatServerSDK.BRAS_UserInfoControl(userId, AnyChatServerSDK.BRAS_USERINFO_CTRLCODE_ADDGROUP, iGroupId, 0, "我的好友");
                iGroupId= 2;
                AnyChatServerSDK.BRAS_UserInfoControl(userId, AnyChatServerSDK.BRAS_USERINFO_CTRLCODE_ADDGROUP, iGroupId, 0, "在线游客");
                // 将当前所有在线用户添加为自己的好友
                foreach (UserInfo userInfo in users)
                {
                    int iUserId = userInfo.Id;
                    AnyChatServerSDK.BRAS_UserInfoControl(userId, AnyChatServerSDK.BRAS_USERINFO_CTRLCODE_ADDFRIEND, iUserId, 0, "");
                }
                // 设置好友与分组的关系(即好友属于哪一个分组)
                iGroupId = 1;
                foreach (UserInfo userInfo in users)
                {
                    int iUserId = userInfo.Id;
                    iGroupId = (iUserId > 0) ? 1 : 2;		// 游客密码为空,userid由核心服务器分配,为负数
                    AnyChatServerSDK.BRAS_UserInfoControl(userId, AnyChatServerSDK.BRAS_USERINFO_CTRLCODE_SETGROUPRELATION, iGroupId, iUserId, "");
                }
                // 设置当前用户信息(用户资料,客户端可以通过API:BRAC_GetUserInfo来获取这些信息)
                int iInfoId = 1;	// InfoId由业务层自己定义
                AnyChatServerSDK.BRAS_SetUserInfo(userId, iInfoId, userName, 0);
                iInfoId = 2;	// InfoId由业务层自己定义
                AnyChatServerSDK.BRAS_SetUserInfo(userId, iInfoId, addr, 0);
                iInfoId = 3;	// InfoId由业务层自己定义
                AnyChatServerSDK.BRAS_SetUserInfo(userId, iInfoId, "我的签名", 0);
                iInfoId = 4;	// InfoId由业务层自己定义
                AnyChatServerSDK.BRAS_SetUserInfo(userId, iInfoId, Convert.ToString(userId%10 + 1), 0);// 随机分配一个图像ID
                // 将本地用户添加为其它用户的好友列表中
                foreach (UserInfo userInfo in users)
                {
                    int otherUserid = userInfo.Id;
                    AnyChatServerSDK.BRAS_UserInfoControl(otherUserid, AnyChatServerSDK.BRAS_USERINFO_CTRLCODE_ADDFRIEND, userId, 0, "");
                    // 关联好友分组
                    iGroupId = (userId > 0) ? 1 : 2;
                    AnyChatServerSDK.BRAS_UserInfoControl(otherUserid, AnyChatServerSDK.BRAS_USERINFO_CTRLCODE_SETGROUPRELATION, iGroupId, userId, "");
                    // 下发同步指令,将新设置的好友同步给客户端
                     AnyChatServerSDK.BRAS_UserInfoControl(otherUserid, AnyChatServerSDK.BRAS_USERINFO_CTRLCODE_SYNCDATA, 0, 0, "");
                }
                // 下发同步指令,将前面设置的资料同步给当前客户端
                AnyChatServerSDK.BRAS_UserInfoControl(userId, AnyChatServerSDK.BRAS_USERINFO_CTRLCODE_SYNCDATA, 0, 0, "");
                //加入用户对象集合
                UserInfo mode = new UserInfo();
                mode.Id = userId;
                mode.Name = userName;
                mode.Ip = addr;
                users.Add(mode);

                str = new string[] { userId.ToString(), userName, "游客", addr.ToString(), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") };
                UserLoginActionReceived_main = new SystemSettingServer.OnUserLoginAction_Received(OnUserLoginAction_CallBack_main);
                rtb_message.Invoke(UserLoginActionReceived_main, userId, userName, level, addr, userValue);
            }
            catch (Exception ex)
            {
                Log.SetLog("OnUserLoginAction_CallBack             用户登录成功错误:" + ex.Message.ToString());
            }
        }