예제 #1
0
    public pb.CardType GetExchangeTypeBySide(pb.BattleSide side)
    {
        SideInfo sideInfo = getSideInfoBySide(side);

        if (sideInfo != null)
        {
            return(sideInfo.GetExchangeType());
        }
        return(pb.CardType.None);
    }
예제 #2
0
    public int GetExchangeCardCountBySide(pb.BattleSide side)
    {
        SideInfo sideInfo = getSideInfoBySide(side);

        if (sideInfo != null)
        {
            return(sideInfo.GetExchangeCardCount());
        }
        return(0);
    }
예제 #3
0
    public pb.CardType GetLackCardTypeBySide(pb.BattleSide side)
    {
        SideInfo sideInfo = getSideInfoBySide(side);

        if (sideInfo != null)
        {
            return(sideInfo.LackPaiType);
        }
        return(pb.CardType.None);
    }
예제 #4
0
 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);
 }
예제 #5
0
 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);
 }
예제 #6
0
 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);
 }
예제 #7
0
 private SideInfo getSideInfoBySide(pb.BattleSide side)
 {
     for (int i = 0; i < _playerPaiInfoList.Count; i++)
     {
         if (side == _playerPaiInfoList[i].Side)
         {
             return(_playerPaiInfoList[i]);
         }
     }
     return(null);
 }
예제 #8
0
 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);
 }
예제 #9
0
 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";
     }
 }
예제 #10
0
 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);
 }
예제 #11
0
    //方位列表:从自己方位开始按照东南西北排序
    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);
    }
예제 #12
0
 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);
 }
예제 #13
0
 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);
 }
예제 #14
0
    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;
    }
예제 #15
0
 public void SetSide(pb.BattleSide side)
 {
     _side = side;
 }
예제 #16
0
파일: SideInfo.cs 프로젝트: JudyPhy/mahjon
 public void UpdateBattlePlayerInfo(pb.BattlePlayerInfo role)
 {
     _side       = role.side;
     _isOwner    = role.isOwner;
     _playerInfo = new PlayerInfo(role.player);
 }