Exemplo n.º 1
0
        /// <summary>
        /// 完成结算
        /// </summary>
        /// <param name="tableData"></param>
        private void DoComplatedSettlement(TableData tableData)
        {
            //放入空桌池中RoomData roomData;
            RoomData roomData = GetRoomData(tableData.RoomId);

            if (roomData != null)
            {
                foreach (PositionData position in tableData.Positions)
                {
                    var user = GetUser(position.UserId);
                    if (user != null)
                    {
                        user.Property.InitTablePos();
                    }
                    position.Init();
                }
                tableData.Init();
                if (roomData.Tables.Remove(tableData.TableId))
                {
                    //Console.WriteLine("Table:{0} is init", tableData.TableId);
                    int minTableCount = ConfigEnvSet.GetInt("Game.Table.MinTableCount", 10);
                    if (roomData.TablePool.Count < minTableCount)
                    {
                        roomData.TablePool.Enqueue(tableData);
                    }
                    else
                    {
                        tableData.Dispose();
                    }
                    return;
                }
            }
            TraceLog.WriteError("TableData object {1} in {0} room has be disposed error.", tableData.RoomId, tableData.TableId);
        }