本文整理匯總了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);
});
}
}