//rNum号房间让某人选英雄 private static void SendPickHero(DataCenter dataCenter, int rNum) { if (dataCenter.RoomDataDic[rNum].FinishCount == 0) { //如果有人达到了第一个八个建筑 int winSeatNum = dataCenter.RoomDataDic[rNum].PlayerDataList.FindIndex(p => p.IsFirst); if (winSeatNum >= 0) { string s = "3|4|3|"; foreach (var item in dataCenter.RoomDataDic[rNum].PlayerDataList) { s += (item.SNum + "|"); s += (item.Score + "|"); s += (item.Exp + "|"); } SendToRoom(dataCenter, rNum, s); return; } dataCenter.RoomDataDic[rNum].BackH = CardRes.RandOrderHList(dataCenter.CardRes.OrderHeros); dataCenter.RoomDataDic[rNum].BackH.RemoveAt(0); } //当玩家数量为2时,直到finishCount为4时才停止,不是2时直到finishCount为count时候就停止开始游戏。 if (dataCenter.RoomDataDic[rNum].PlayerDataList.Count == 2) { SendPickHeroCase1(dataCenter, rNum); return; } else { SendPickHeroCase2(dataCenter, rNum); return; } }
public RoomData() { BackB = new List <Building>(); BackH = new List <Hero>(); CardRes cardRes = new CardRes(); BackB = cardRes.Buildings; cardRes.Heros.ForEach(i => BackH.Add(i)); TableB = new List <Building>(); TableH = new List <Hero>(); Hero2PlayerDic = new Dictionary <int, int>(); PlayerDataList = new List <PlayerData>(); Status = "未开始"; FinishCount = 0; KilledNum = -1; }
public void InitBaseData(CardRes cardRes) { _cardRes = cardRes; _cardBaseDataDict = new Dictionary <int, CardPB>(); _openBaseCardDict = new Dictionary <int, CardPB>(); foreach (var pb in _cardRes.Cards) { _cardBaseDataDict[pb.CardId] = pb; if (pb.Used == 0) //0是开放,1是不开放 { _openBaseCardDict[pb.CardId] = pb; } } _signatureRuleList = cardRes.SignatureRules.ToList(); }