コード例 #1
0
ファイル: Trade.cs プロジェクト: weslley17w/Yupi
 /// <summary>
 ///     Initializes a new instance of the <see cref="Trade" /> class.
 /// </summary>
 /// <param name="userOneId">The user one identifier.</param>
 /// <param name="userTwoId">The user two identifier.</param>
 /// <param name="roomId">The room identifier.</param>
 internal Trade(uint userOneId, uint userTwoId, uint roomId)
 {
     _oneId = userOneId;
     _twoId = userTwoId;
     _users = new TradeUser[2];
     _users[0] = new TradeUser(userOneId, roomId);
     _users[1] = new TradeUser(userTwoId, roomId);
     _tradeStage = 1;
     _roomId = roomId;
     TradeUser[] users = _users;
     foreach (TradeUser tradeUser in users.Where(tradeUser => !tradeUser.GetRoomUser().Statusses.ContainsKey("trd")))
     {
         tradeUser.GetRoomUser().AddStatus("trd", "");
         tradeUser.GetRoomUser().UpdateNeeded = true;
     }
     ServerMessage serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("TradeStartMessageComposer"));
     serverMessage.AppendInteger(userOneId);
     serverMessage.AppendInteger(1);
     serverMessage.AppendInteger(userTwoId);
     serverMessage.AppendInteger(1);
     SendMessageToUsers(serverMessage);
 }