Exemple #1
0
        protected override void onSuccess(AddChatRoomMemberRequest request, AddChatRoomMemberResponse response)
        {
            Log.i("NetSceneAddChatRoomMember", "doscene respone sucess");
            RetConst ret = (RetConst)response.BaseResponse.Ret;
            NetSceneAddChatRoomMemberResult result = new NetSceneAddChatRoomMemberResult {
                retCode = (RetConst)response.BaseResponse.Ret,
                sceneAddChatRoomMember = this
            };

            if (result.retCode == RetConst.MM_ERR_MEMBER_TOOMUCH)
            {
                Log.d("NetSceneAddChatRoomMember", "send AddChatRoomMemberRequest failed ret =" + ret);
                string str = response.BaseResponse.ErrMsg.String;
                try
                {
                    string[] strArray = str.Split(new char[] { ',' });
                    if (strArray.Length == 3)
                    {
                        result.requestMemberCount = Convert.ToUInt32(strArray[1]);
                        result.maxMemberCount     = Convert.ToUInt32(strArray[2]);
                    }
                    else
                    {
                        Log.e("NetSceneAddChatRoomMember", "get maxMemberCount from errmsg failed, maxMemberCount not exist in errmsg");
                    }
                }
                catch (Exception exception)
                {
                    Log.e("NetSceneAddChatRoomMember", "get maxMemberCount from errmsg failed" + exception);
                }
                EventCenter.postEvent(EventConst.ON_NETSCENE_ADD_CHATROOM_MEMBER_ERR, result, null);
            }
            else if (result.retCode != RetConst.MM_OK)
            {
                Log.e("NetSceneAddChatRoomMember", "send AddChatRoomMemberRequest failed ret =" + ret);
                EventCenter.postEvent(EventConst.ON_NETSCENE_ADD_CHATROOM_MEMBER_ERR, result, null);
            }
            else
            {
                result.retCode = ChatRoomMgr.checkMemberStatusFromMemberList(this.invalidUsernameList, this.memeberBlackList, this.notExistUserList, this.verifyUserList, response.MemberListList);
                if (result.retCode != RetConst.MM_OK)
                {
                    Log.e("NetSceneAddChatRoomMember", "send checkMemberStatusFromMemberList failed ret =" + result.retCode);
                    EventCenter.postEvent(EventConst.ON_NETSCENE_ADD_CHATROOM_MEMBER_ERR, result, null);
                }
                else if (!ChatRoomMgr.addChatroomMember(request.ChatRoomName.String, response, this.verifyUserList))
                {
                    Log.e("NetSceneAddChatRoomMember", "addChatroomMember : fail");
                    EventCenter.postEvent(EventConst.ON_NETSCENE_ADD_CHATROOM_MEMBER_ERR, result, null);
                }
                else
                {
                    Log.i("NetSceneAddChatRoomMember", "doscene post sucess");
                    EventCenter.postEvent(EventConst.ON_NETSCENE_ADD_CHATROOM_MEMBER_SUCCESS, result, null);
                }
            }
        }
Exemple #2
0
        protected override void onSuccess(CreateChatRoomRequest request, CreateChatRoomResponse response)
        {
            Log.i("NetSceneCreateChatRoom", "doscene respone sucess");
            NetSceneCreateChatRoomResult result = new NetSceneCreateChatRoomResult();
            RetConst ret = (RetConst)response.BaseResponse.Ret;

            result.retCode             = ret;
            result.sceneCreateChatRoom = this;
            if (result.retCode == RetConst.MM_ERR_MEMBER_TOOMUCH)
            {
                Log.d("NetSceneCreateChatRoom", "send NetSceneCreateChatRoom failed ret =" + ret);
                string str = response.BaseResponse.ErrMsg.String;
                try
                {
                    string[] strArray = str.Split(new char[] { ',' });
                    if (strArray.Length == 3)
                    {
                        result.requestMemberCount = Convert.ToUInt32(strArray[1]);
                        result.maxMemberCount     = Convert.ToUInt32(strArray[2]);
                    }
                    else
                    {
                        Log.e("NetSceneCreateChatRoom", "get maxMemberCount from errmsg failed, maxMemberCount not exist in errmsg");
                    }
                }
                catch (Exception exception)
                {
                    Log.e("NetSceneCreateChatRoom", "get maxMemberCount from errmsg failed" + exception);
                }
                EventCenter.postEvent(EventConst.ON_NETSCENE_CREATE_CHATROOM_ERR, result, null);
            }
            else if (ret != RetConst.MM_OK)
            {
                Log.e("NetSceneCreateChatRoom", "send NetSceneCreateChatRoom failed ret =" + ret);
                EventCenter.postEvent(EventConst.ON_NETSCENE_CREATE_CHATROOM_ERR, result, null);
            }
            else
            {
                this.chatRoomName = response.ChatRoomName.String;
                result.retCode    = ChatRoomMgr.checkMemberStatusFromMemberList(this.invalidUsernameList, this.memeberBlackList, this.notExistUserList, this.verifyUserList, response.MemberListList);
                if (result.retCode != RetConst.MM_OK)
                {
                    Log.e("NetSceneCreateChatRoom", "send checkMemberStatusFromMemberList failed ret =" + result.retCode);
                    EventCenter.postEvent(EventConst.ON_NETSCENE_CREATE_CHATROOM_ERR, result, null);
                }
                else if (string.IsNullOrWhiteSpace(this.chatRoomName) || (response.MemberListList.Count == this.verifyUserList.Count))
                {
                    Log.e("NetSceneCreateChatRoom", string.Concat(new object[] { "createChatroom failed ret =", result.retCode, " verifyUserList.Count = ", this.verifyUserList.Count }));
                    EventCenter.postEvent(EventConst.ON_NETSCENE_CREATE_CHATROOM_ERR, result, null);
                }
                else if (!ChatRoomMgr.createChatroom(response, this.verifyUserList))
                {
                    Log.e("NetSceneCreateChatRoom", "createChatroom : fail");
                    EventCenter.postEvent(EventConst.ON_NETSCENE_CREATE_CHATROOM_ERR, result, null);
                }
                else
                {
                    Log.i("NetSceneCreateChatRoom", "doscene post sucess");
                    EventCenter.postEvent(EventConst.ON_NETSCENE_CREATE_CHATROOM_SUCCESS, result, null);
                }
            }
        }