public pb.CardType GetExchangeTypeBySide(pb.BattleSide side) { SideInfo sideInfo = getSideInfoBySide(side); if (sideInfo != null) { return(sideInfo.GetExchangeType()); } return(pb.CardType.None); }
public int GetExchangeCardCountBySide(pb.BattleSide side) { SideInfo sideInfo = getSideInfoBySide(side); if (sideInfo != null) { return(sideInfo.GetExchangeCardCount()); } return(0); }
public pb.CardType GetLackCardTypeBySide(pb.BattleSide side) { SideInfo sideInfo = getSideInfoBySide(side); if (sideInfo != null) { return(sideInfo.LackPaiType); } return(pb.CardType.None); }
private List <Pai> getAllUsefulCardsBySide(pb.BattleSide side) { for (int i = 0; i < _playerPaiInfoList.Count; i++) { if (_playerPaiInfoList[i].Side == side) { return(_playerPaiInfoList[i].GetUsefulPaiList()); } } return(null); }
public List <int> GetCardIdListBySideAndStatus(pb.BattleSide side, PaiStatus status) { for (int i = 0; i < _playerPaiInfoList.Count; i++) { if (_playerPaiInfoList[i].Side == side) { return(_playerPaiInfoList[i].GetPaiIdListByStatus(status)); } } return(null); }
public PlayerInfo GetPlayerInfoBySide(pb.BattleSide side) { for (int i = 0; i < _playerPaiInfoList.Count; i++) { if (_playerPaiInfoList[i].Side == side) { return(_playerPaiInfoList[i].PlayerInfo); } } return(null); }
private SideInfo getSideInfoBySide(pb.BattleSide side) { for (int i = 0; i < _playerPaiInfoList.Count; i++) { if (side == _playerPaiInfoList[i].Side) { return(_playerPaiInfoList[i]); } } return(null); }
public pb.BattleSide GetPaiDrawnSideByShaiZi(pb.BattleSide dealerSide, int shaiziValue) { pb.BattleSide curSide = dealerSide; while (shaiziValue > 1) { curSide--; if (curSide < pb.BattleSide.east) { curSide = pb.BattleSide.north; } shaiziValue--; } return(curSide); }
public void UpdateGangCard(Pai pai, pb.BattleSide side, bool showFront) { _info = pai; _side = side; _pai.gameObject.SetActive(showFront); if (showFront) { _pai.spriteName = "b" + _info.Id.ToString(); _bg.spriteName = "inhand_bg2"; } else { _bg.spriteName = "inhand_bg2"; } }
public Pai GetPaiInfoByIndexAndSide(pb.BattleSide side, int index) { for (int i = 0; i < _playerPaiInfoList.Count; i++) { if (side == _playerPaiInfoList[i].Side) { List <Pai> list = _playerPaiInfoList[i].GetPaiList(); //Debug.LogError("side=" + side.ToString() + ", current pai list count=" + list.Count); if (index < list.Count) { return(list[index]); } } } return(null); }
//方位列表:从自己方位开始按照东南西北排序 public List <pb.BattleSide> GetSortSideListFromSelf() { pb.BattleSide selfSide = GetSelfSide(); pb.BattleSide curSide = selfSide; List <pb.BattleSide> sideSortList = new List <pb.BattleSide>(); do { sideSortList.Add(curSide); curSide++; if (curSide > pb.BattleSide.north) { curSide = pb.BattleSide.east; } } while (curSide != selfSide); return(sideSortList); }
public void TurnToNextPlayer(int playerOid, pb.CardInfo drawnCard, pb.TurnSwitchType type) { Debug.Log("turn to next:" + playerOid + ", type=" + type.ToString()); if (drawnCard != null) { Debug.Log("draw new card:" + drawnCard.CardOid); BattleManager.Instance.CurTurnDrawnCardOid = drawnCard.CardOid; } _curPlaySide = GetSideByPlayerOID(playerOid); for (int i = 0; i < _playerPaiInfoList.Count; i++) { if (_playerPaiInfoList[i].PlayerInfo.OID == playerOid && drawnCard != null) { _playerPaiInfoList[i].AddPai(drawnCard); } } EventDispatcher.TriggerEvent <pb.BattleSide, pb.CardInfo, pb.TurnSwitchType>(EventDefine.TurnToPlayer, _curPlaySide, drawnCard, type); }
public void PrepareGameStart(pb.GS2CBattleStart msg) { for (int i = 0; i < msg.cardList.Count; i++) { pb.CardInfo card = msg.cardList[i]; for (int j = 0; j < _playerPaiInfoList.Count; j++) { if (_playerPaiInfoList[j].PlayerInfo.OID == card.playerId) { _playerPaiInfoList[j].AddPai(card); } } } _dealerId = msg.dealerId; _curPlaySide = GetSideByPlayerOID(_dealerId); Debug.Log("_dealerId=" + _dealerId + ", side=" + _curPlaySide.ToString()); EventDispatcher.TriggerEvent(EventDefine.PlayGamePrepareAni); }
public void UpdateUI(Pai pai, pb.BattleSide side, bool isSelfPG = false) { _info = pai; _side = side; if (_info == null) { Debug.LogError("self pai info is null."); _pai.gameObject.SetActive(false); _bg.spriteName = "inhand_bg_back2"; _bg.MakePixelPerfect(); } else { //Debug.LogError("self pai id:" + _info.Id + ", status:" + _info.Status.ToString()); switch (_info.Status) { case PaiStatus.InHand: case PaiStatus.Exchange: _pai.spriteName = "b" + _info.Id.ToString(); _pai.gameObject.SetActive(true); _pai.MakePixelPerfect(); _pai.transform.localPosition = new Vector3(0, -11, 0); _bg.spriteName = "inhand_bg2"; break; case PaiStatus.Peng: _pai.spriteName = "b" + _info.Id.ToString(); _pai.gameObject.SetActive(true); _pai.MakePixelPerfect(); _pai.transform.localPosition = new Vector3(0, 11, 0); _bg.spriteName = "inhand_bg1"; break; default: break; } } _isSelected = false; }
public void SetSide(pb.BattleSide side) { _side = side; }
public void UpdateBattlePlayerInfo(pb.BattlePlayerInfo role) { _side = role.side; _isOwner = role.isOwner; _playerInfo = new PlayerInfo(role.player); }