Example #1
0
 private bool ValidateSeatWatch(SeatWatch watch)
 {
     if (watch.deviceType != DeviceHelper.getDeviceType() || watch.fingerPrint != SystemInfo.deviceUniqueIdentifier)
     {
         return(false);
     }
     return(true);
 }
Example #2
0
    //0.56, 0.1, 0.82
    private void RenderWatch(SeatWatch watch)
    {
        AppContext.GetInstance().Watch = watch;
        var        inHandCardIdArray   = watch.cards.Split(Constants.COMMA_SEPERATOR);
        var        inHandCapacity      = inHandCardIdArray.Length;
        List <int> pointsInHand        = new List <int>(inHandCapacity);

        for (int i = 0; i < inHandCapacity; i++)
        {
            pointsInHand.Add(int.Parse(inHandCardIdArray[i]));
        }
        RenderCardsInHand(pointsInHand);

        var proInfoArray = watch.proCardsInfo.Split(Constants.COLON_SEPERATOR);

        if (proInfoArray.Length != 4)
        {
            ShowMessage(ErrorCode.EC_GAME_INVALID_DATA);
            return;
        }
        string cardsTypeCode2Beat = proInfoArray[0];
        string cardsKeys2Beat     = proInfoArray[1];
        string cards4Show         = proInfoArray[2];
        string proPlayerAction    = proInfoArray[3]; // None, Play, Pass

        List <int> pointsOutside = new List <int>();

        if (!"-".Equals(cards4Show))
        {
            var outsideCardIdArray = cards4Show.Split(Constants.COMMA_SEPERATOR);
            var outsideCapacity    = outsideCardIdArray.Length;
            for (int i = 0; i < outsideCapacity; i++)
            {
                pointsOutside.Add(int.Parse(outsideCardIdArray[i]));
            }
        }
        RenderCardsOutside(pointsOutside);

        string     playStatus  = watch.playStatus;
        List <int> keysOutside = new List <int>();

        if (!"-".Equals(cardsKeys2Beat))
        {
            var outsideKeyArray = cardsKeys2Beat.Split(Constants.COMMA_SEPERATOR);
            foreach (string key in outsideKeyArray)
            {
                keysOutside.Add(int.Parse(key));
            }
        }
        CardHelper.GetInstance().SaveCurrentCardsType(cardsTypeCode2Beat, keysOutside);

        ShowBtns(playStatus, cardsTypeCode2Beat);
    }
Example #3
0
    void RenderResponse(SocketResponse socketResponse)
    {
        SeatWatch watch = Convert(socketResponse);

        if (!ValidateSeatWatch(watch))
        {
            ShowMessage(ErrorCode.EC_GAME_INVALID_DATA);
        }
        else
        {
            GetComponent <GameUIRender>().SendMessage("RenderWatch", watch);
        }
    }
Example #4
0
    private void MockUi()
    {
        SeatWatch watch = new SeatWatch();

        watch.cards         = "103,104,105,106,107,108,109,110,111,112,113,114,115,204,205,206,207,208,209,210";
        watch.landlordCards = "303,304,305";
        watch.playStatus    = Constants.GAME_STATUS_TURN_TO_PLAY;
        watch.proCardsInfo  = "Exist:-:303,304,305:None";

        watch.gameId    = 1L;
        watch.seatId    = 1L;
        watch.seqInGame = 1;

        RenderWatch(watch);

        TouchManager.GetInstance().OnFocus(GameObject.FindGameObjectWithTag(CardHelper.GetInstance().GetTag(103)).transform);
        TouchManager.GetInstance().OnFocus(GameObject.FindGameObjectWithTag(CardHelper.GetInstance().GetTag(104)).transform);
        TouchManager.GetInstance().OnFocus(GameObject.FindGameObjectWithTag(CardHelper.GetInstance().GetTag(105)).transform);
        TouchManager.GetInstance().OnFocus(GameObject.FindGameObjectWithTag(CardHelper.GetInstance().GetTag(106)).transform);
        TouchManager.GetInstance().OnFocus(GameObject.FindGameObjectWithTag(CardHelper.GetInstance().GetTag(107)).transform);
        TouchManager.GetInstance().TouchEnded();
    }
Example #5
0
    private SeatWatch Convert(SocketResponse socketResponse)
    {
        //    1: string code,
        //    2: string action,
        //    3: i64 gameId = 0,
        //    4: i32 gameType = 0,
        //    5: i32 deviceType = 0,
        //    6: string cards = "",
        //    7: string landlordCards = "",
        //    8: string proCardsInfo = "",
        //    9: i32 baseAmount = 0,
        //    10: i32 multiples = 0,
        //    11: string previousNickname = "",
        //    12: i32 previousCardsCount = 0,
        //    13: string nextNickname = "",
        //    14: i32 nextCardsCount = 0,
        //    15: string playStatus = "",
        //    16: bool landlord = false,
        //    17: string fingerPrint = "",
        //    18: long memberId = 0,
        //    19: long seatId = 0,
        //    20: int seqInGame = 0,

        SeatWatch watch = new SeatWatch();

        watch.gameId             = long.Parse(socketResponse.p3);
        watch.gameType           = int.Parse(socketResponse.p4);
        watch.deviceType         = int.Parse(socketResponse.p5);
        watch.cards              = socketResponse.p6;
        watch.landlordCards      = socketResponse.p7;
        watch.proCardsInfo       = socketResponse.p8;
        watch.baseAmount         = int.Parse(socketResponse.p9);
        watch.multiples          = int.Parse(socketResponse.p10);
        watch.previousNickname   = socketResponse.p11;
        watch.previousCardsCount = int.Parse(socketResponse.p12);
        watch.nextNickname       = socketResponse.p13;
        watch.nextCardsCount     = int.Parse(socketResponse.p14);
        watch.playStatus         = socketResponse.p15;
        watch.landlord           = bool.Parse(socketResponse.p16);
        watch.fingerPrint        = socketResponse.p17;
        watch.seqInGame          = int.Parse(socketResponse.p20);
        watch.seatId             = long.Parse(socketResponse.p19);

//        if ()
//        {
//            Debug.Log("p1:" + socketResponse.p1);
//            Debug.Log("p2:" + socketResponse.p2);
//            Debug.Log("p3:" + socketResponse.p3);
//            Debug.Log("p4:" + socketResponse.p4);
//            Debug.Log("p5:" + socketResponse.p5);
//            Debug.Log("p6:" + socketResponse.p6);
//            Debug.Log("p7:" + socketResponse.p7);
//            Debug.Log("p8:" + socketResponse.p8);
//            Debug.Log("p9:" + socketResponse.p9);
//            Debug.Log("p10:" + socketResponse.p10);
//            Debug.Log("p11:" + socketResponse.p11);
//            Debug.Log("p12:" + socketResponse.p12);
//            Debug.Log("p13:" + socketResponse.p13);
//            Debug.Log("p14:" + socketResponse.p14);
//            Debug.Log("p15:" + socketResponse.p15);
//            Debug.Log("p16:" + socketResponse.p16);
//            Debug.Log("p17:" + socketResponse.p17);
//            Debug.Log("p18:" + socketResponse.p18);
//            Debug.Log("p19:" + socketResponse.p19);
//            Debug.Log("p20:" + socketResponse.p20);
//            Debug.Log("p21:" + socketResponse.p21);
//            Debug.Log("p22:" + socketResponse.p22);
//        }

        return(watch);
    }