本文整理汇总了C#中ZyGames.Doudizhu.Model.TableData.Init方法的典型用法代码示例。如果您正苦于以下问题:C# TableData.Init方法的具体用法?C# TableData.Init怎么用?C# TableData.Init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZyGames.Doudizhu.Model.TableData
的用法示例。
在下文中一共展示了TableData.Init方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoComplatedSettlement
/// <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);
}
示例2: CheckStart
/// <summary>
/// 检查是否开始
/// </summary>
/// <param name="tableData"></param>
public void CheckStart(TableData tableData)
{
bool started = !Array.Exists(tableData.Positions, pos => !pos.IsAI && pos.UserId == 0);
if (started)
{
TraceLog.WriteComplement("房间:{0},桌:{1}开始发牌...", tableData.RoomId, tableData.TableId);
foreach (var p in tableData.Positions)
{
p.ReSendCard();
}
tableData.Init();
//随机第一个开始叫地主
int index = RandomUtils.GetRandom(0, tableData.Positions.Length);
var pos = tableData.Positions[index];
tableData.CallLandlordPos = pos.Id;
tableData.CallLandlordId = pos.UserId;
tableData.CallLandlordName = pos.NickName;
TraceLog.WriteComplement("房间:{0},桌:{1}第一个开始叫地主{2}", tableData.RoomId, tableData.TableId, pos.Id + pos.NickName);
SendCard(tableData, TableData.CardBackNum);
SyncNotifyAction(ActionIDDefine.Cst_Action2004, tableData, null,
t =>
{
TraceLog.WriteComplement("桌子:{0}底牌:{1}", tableData.TableId, string.Join(",", tableData.BackCardData));
foreach (var p in tableData.Positions)
{
_cardRole.SortCard(p.CardData);
TraceLog.WriteComplement("桌子:{0}玩家{1}-{2}牌:{3}",
tableData.TableId, p.UserId, p.NickName, string.Join(",", p.CardData));
}
TraceLog.WriteComplement("房间:{0},桌:{1}发牌结束", tableData.RoomId, tableData.TableId);
});
}
}