예제 #1
0
    //-----------------------------------------------------------------------------------------------Networking
    //there exists only unselect, so unselect this card if we were selecting it wrongly
    public void ReceiveNetworkCorrection(IndividualCard myCard)
    {
        myCard.DestroySelectedEfect();
        CancelInvoke("CheckCards");
        canSelect = true;

        mem_Cards.Remove(myCard);

        /*if (mem_Cards [0] == myCard) {
         *      mem_Cards [0] = null;
         *      myCard.DestroySelectedEfect ();
         *
         *      if(activeTimer != null)
         *              StopCoroutine (activeTimer);
         *
         *      if (mem_Cards [1] != null) {
         *              mem_Cards [0] = mem_Cards [1];
         *              mem_Cards [1] = null;
         *              CancelInvoke ("CheckCards");
         *              canSelect = true;
         *
         *              activeTimer = DeselectTimer (mem_Cards [0]);
         *              StartCoroutine (activeTimer);
         *      } else {
         *      }
         * }*/
    }
예제 #2
0
 public void ReceiveNetworkCorrection(IndividualCard myCard)
 {
     if (mem_Cards.Remove(myCard))
     {
         myCard.DestroySelectedEfect();
     }
 }
예제 #3
0
 //there exists only unselect, so unselect this card if we were selecting it wrongly
 public void ReceiveNetworkCorrection(IndividualCard myCard)
 {
     for (int i = 0; i < 4; i++)
     {
         if (mem_Cards [i] == myCard)
         {
             mem_Cards [i] = null;
             myCard.DestroySelectedEfect();
         }
     }
 }
예제 #4
0
    public void ReceiveNetworkCorrection(byte[] data)
    {
        int        x;
        int        y;
        int        type;
        int        selectEffectID;
        cardStates state;

        x              = System.BitConverter.ToInt16(data, 2);
        y              = System.BitConverter.ToInt16(data, 2 + 2);
        type           = System.BitConverter.ToInt16(data, 2 + 2 + 2);
        selectEffectID = System.BitConverter.ToInt16(data, 2 + 2 + 2 + 2);

        char cState = (char)data [2 + 2 + 2 + 2 + 2];

        switch (cState)
        {
        case cs_open:
            state = cardStates.open;
            break;

        case cs_close:
            state = cardStates.close;
            break;

        case cs_match:
            state = cardStates.matched;
            break;

        default:
            state = cardStates.close;
            break;
        }

        IndividualCard myCard = null;

        try{
            myCard = CardHandler.s.allCards [x, y];

            //these will unselect the card from respective places
            LocalPlayerController.s.ReceiveNetworkCorrection(myCard);
            PowerUpManager.s.ReceiveNetworkCorrection(myCard);
            NPCManager.s.ReceiveNetworkCorrection(myCard);
        } catch (Exception e) {
            DataLogger.LogMessage(e.Message + " - " + e.StackTrace);
        }

        if (myCard != null)
        {
            //after unselection is done, we will update the card type to be correct
            CardHandler.s.UpdateCardType(x, y, type);

            switch (state)
            {
            case cardStates.open:
                myCard.SelectCard(-1);
                if (selectEffectID > 0)
                {
                    myCard.DestroySelectedEfect();
                    myCard.selectedEffect = (GameObject)Instantiate(GS.a.gfxs.selectEffects[selectEffectID].gameObject, myCard.transform.position, Quaternion.identity);
                }
                break;

            case cardStates.close:
                myCard.UnSelectCard();
                break;

            case cardStates.matched:
                myCard.NetworkCorrectMatch();
                break;

            default:
                myCard.UnSelectCard();
                break;
            }
        }
    }