/// <summary> /// End the Battle /// </summary> /// <returns></returns> public bool EndBattle() { BattleRunning = false; BattleScore.ScoreTotal = BattleScore.CalculateScore(); return(true); }
// 更新比分回调 public void RecvUpdateBattleScore(GameMessage message) { BattleScore battleScore = ProtoTransfer.Deserialize <BattleScore>(message.data); int scoreT1 = battleScore.scoreT1; int scoreT2 = battleScore.scoreT2; redScoreTxt.text = scoreT1.ToString(); blueScoreTxt.text = scoreT2.ToString(); }
/// <summary> /// 更新比分 /// </summary> public void UpdateScore(Player player) { if (player.tempData.team == 1) { scoreT1++; } else if (player.tempData.team == 2) { scoreT2++; } // 广播更新比分的消息 GameMessage broadMsg = new GameMessage(); broadMsg.type = BitConverter.GetBytes((int)Protocol.UpdateScore); BattleScore battleScore = new BattleScore(); battleScore.scoreT1 = scoreT1; battleScore.scoreT2 = scoreT2; broadMsg.data = ProtoTransfer.Serialize(battleScore); BroadcastTcp(broadMsg); }
public override int GetHashCode() { int hash = 1; if (UserId != 0) { hash ^= UserId.GetHashCode(); } if (PlayerId != 0L) { hash ^= PlayerId.GetHashCode(); } if (Name.Length != 0) { hash ^= Name.GetHashCode(); } if (Tili != 0) { hash ^= Tili.GetHashCode(); } if (Jingli != 0) { hash ^= Jingli.GetHashCode(); } if (BattleScore != 0L) { hash ^= BattleScore.GetHashCode(); } hash ^= ResMap.GetHashCode(); hash ^= heroList_.GetHashCode(); hash ^= equipList_.GetHashCode(); if (formation_ != null) { hash ^= Formation.GetHashCode(); } return(hash); }