public async Task <int> Join(ChatUser_Data user) { var iret = 1; var cu = this.GetChatUser(user.Id); if (cu == null) { cu = await CreateIChatUser(user); } IChatRoom cr = null; if (user.ChatRoomId == string.Empty) { cr = await CreateIChatRoom(); } else { cr = GetChatRoom(user.ChatRoomId); if (cr != null) { iret = -2;//已经在房间中 return(iret); } else { cr = await CreateIChatRoom(); } } iret = await cr.Join(user); return(iret); }
public async Task <IChatUser> CreateIChatUser(ChatUser_Data user) { var cu = this.GrainFactory.GetGrain <IChatUser>(user.Id); m_Dict_ChatUser.TryAdd(user.Id, cu); await cu.SetChatUser_Data(user); return(cu); }
public Task <int> Join(ChatUser_Data user) { var iret = 1; return(Task.FromResult(iret)); }
public Task SetChatUser_Data(ChatUser_Data cu) { this.m_ChatUser_Data = cu; return(Task.CompletedTask); }