本文整理匯總了C#中ZyGames.Doudizhu.Model.TableData.StopTimer方法的典型用法代碼示例。如果您正苦於以下問題:C# TableData.StopTimer方法的具體用法?C# TableData.StopTimer怎麽用?C# TableData.StopTimer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ZyGames.Doudizhu.Model.TableData
的用法示例。
在下文中一共展示了TableData.StopTimer方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: DoOutCard
/// <summary>
/// 出牌
/// </summary>
/// <param name="userId"></param>
/// <param name="positionId"></param>
/// <param name="tableData"></param>
/// <param name="cardsStr"></param>
/// <param name="errorCode">0:正常,1:不合規則,2:不存在牌,3:離開桌位</param>
public bool DoOutCard(int userId, int positionId, TableData tableData, string cardsStr, out int errorCode)
{
errorCode = 0;
int[] cards = new int[0];
if (!string.IsNullOrEmpty(cardsStr.Trim()))
{
string[] tempArray = cardsStr.Split(new char[] { ',' });
List<int> tempList = new List<int>();
for (int i = 0; i < tempArray.Length; i++)
{
if (!string.IsNullOrEmpty(tempArray[i]))
{
tempList.Add(tempArray[i].ToInt());
}
}
cards = tempList.ToArray();
}
var pos = GetUserPosition(positionId, tableData);
if (pos == null)
{
errorCode = 3;
return false;
}
if (!CheckCardEffective(pos.CardData, cards))
{
errorCode = 2;
TraceLog.WriteComplement("桌子:{0}玩家{0}出牌{1}不在手中的牌內", tableData.TableId, userId, cardsStr);
return false;
}
int cardSize;
var cardType = _cardRole.GetCardType(cards, out cardSize);
if (cardType == DeckType.Error)
{
errorCode = 1;
TraceLog.WriteComplement("桌子:{0}玩家{0}出牌{1}不合規則", tableData.TableId, userId, cardsStr);
return false;
}
if (cardType == DeckType.None && CheckOutCardNoneType(tableData))
{
//多次循環不出牌,則結束
tableData.StopTimer();
var param = new Parameters();
param.Add("FleeUserId", 0);
SyncNotifyAction(ActionIDDefine.Cst_Action2013, tableData, param,
c =>
{
//Console.WriteLine("Table:{0} is stop", tableData.TableId);
DoComplatedSettlement(tableData);
TraceLog.WriteError("桌子{0}多次連續不出牌並強製退出桌位", tableData.TableId);
});
errorCode = 3;
return true;
}
CardData cardData = new CardData(userId, positionId);
cardData.Cards = cards;
cardData.Type = cardType;
cardData.CardSize = cardSize;
if (tableData.PreCardData != null)
{
//壓牌
CardData tempData = tableData.PreCardData;
if (cardData.Type != DeckType.None &&
tempData.Type != DeckType.None &&
tempData.UserId != cardData.UserId &&
!_cardRole.EqualsCard(cardData, tempData))
{
errorCode = 1;
return false;
}
}
foreach (var card in cardData.Cards)
{
pos.CardData.Remove(card);
}
tableData.OutCardList.Add(cardData);
if (cardData.Type != DeckType.None)
{
tableData.PreCardData = cardData;
}
if (cardData.Type == DeckType.Bomb ||
cardData.Type == DeckType.WangBomb)
{
tableData.DoDouble();
}
if (pos.CardData.Count > 0)
{
int index = (pos.Id + 1) % tableData.PlayerNum;
var nextPos = tableData.Positions[index];
tableData.OutCardPos = nextPos.Id;
//.........這裏部分代碼省略.........