Пример #1
0
    public void Pass()
    {
        HideAll();
        PlayCardsReq req = new PlayCardsReq();
        var          reqTypeWithPoints = new TypeWithPoints();

        reqTypeWithPoints.cardsType = CardsType.Pass;
        req.typeWithPoints          = reqTypeWithPoints;
        req.handPoints = new List <int>(PlayManager.GetInstance().AllPointsInHand());

        SendPlayCards(req);
    }
Пример #2
0
    public void SendPlayCards(PlayCardsReq req)
    {
        HideAll();
        SocketRequest sr = new SocketRequest();

        sr.p1  = GUIDHelper.generate();
        sr.p2  = "playCards";
        sr.p3  = LocalToken();
        sr.p4  = SystemInfo.deviceUniqueIdentifier;
        sr.p5  = AppContext.GetInstance().Watch.gameId.ToString();
        sr.p6  = AppContext.GetInstance().Watch.seatId.ToString();
        sr.p7  = AppContext.GetInstance().Watch.seqInGame.ToString();
        sr.p8  = req.typeWithPoints.cardsType.ToString();
        sr.p9  = req.Keys();
        sr.p10 = CardHelper.GetInstance().Join(req.points);
        sr.p11 = CardHelper.GetInstance().Join(req.handPoints);
        SendBytes(ProtoHelper.Proto2Bytes(sr));

        GetComponent <GameUIRender>().SendMessage("LetItGo");
    }
Пример #3
0
    public void PlayCards()
    {
        List <int> allReady2GoPoints = PlayManager.GetInstance().AllReady2GoPoints();

        Debug.Log("out before play:" + CardHelper.GetInstance().Join(PlayManager.GetInstance().AllPointsOutside()));

        if (allReady2GoPoints.Count == 0)
        {
            Debug.Log("no card selected.");
            ShowMessage(ErrorCode.PLAY_NO_CARD_SELECTED);
        }
        else
        {
            Debug.Log("ready2GoPoints:" + CardHelper.GetInstance().Join(allReady2GoPoints));

            TypeWithPoints typeWithPoints = CardHelper.GetInstance().JudgeType(allReady2GoPoints);
            Debug.Log(string.Format("type:{0},p:{1},ps{2}", typeWithPoints.cardsType, typeWithPoints.p, Join(typeWithPoints.ps)));
            if (typeWithPoints.cardsType.Equals(CardsType.Invalid))
            {
                ShowMessage(ErrorCode.PLAY_INVALID_CARDS_TYPE);
            }
            else if (!CardHelper.GetInstance().CanPlay(typeWithPoints))
            {
                ShowMessage(ErrorCode.PLAY_NOT_BIG_ENOUGH);
            }
            else
            {
                List <int> goPoints   = new List <int>(allReady2GoPoints);
                List <int> handPoints = new List <int>(PlayManager.GetInstance().AllPointsInHand());

                PlayCardsReq req = new PlayCardsReq();
                req.typeWithPoints = typeWithPoints;
                req.handPoints     = handPoints;
                req.points         = goPoints;

                GameObject.FindGameObjectWithTag("MainCamera").GetComponent <GameController>().SendMessage("SendPlayCards", req);
            }
        }
    }