示例#1
0
    public void SyncCounterPlaced(Card sourceCard, CounterType counterType, int amount)
    {
        Net_SyncCountersPlaced msg = new Net_SyncCountersPlaced();

        msg.amount       = amount;
        msg.counterId    = (int)counterType;
        msg.targetCardId = cardMap.Get(sourceCard);
        RelayMessage(msg);
    }
示例#2
0
    // when ereceiving info from server
    #region OnData
    private void OnData(int cnnId, int channelId, int recHostId, NetMsg msg)
    {
        //Debug.Log("Receive event. OP: " + msg.OP);
        switch (msg.OP)
        {
        case NetOP.None:
            Debug.LogError("Unexpected NETOP");
            break;

        case NetOP.LoginRequestResponse:
            LoginRequestResponse((Net_LoginRequestResponse)msg);
            break;

        case NetOP.CreateAccountResponse:
            LoginScene.Instance.receiveCreateAccountResponse((Net_CreateAccountResponse)msg);
            break;

        case NetOP.NotifyClientOfMMPairing:
            NetInterface.Get().LocalPlayerIsP1 = ((Net_NotifyClientOfMMPairing)msg).isPlayer1;
            MMDeckSelectScene.Instance.startGame();
            break;

        case NetOP.InstantiateCard:
            NetInterface.Get().ImportNewCardFromOpponent((Net_InstantiateCard)msg);
            break;

        case NetOP.MoveCardToPile:
            Net_MoveCardToPile mctp = (Net_MoveCardToPile)msg;
            NetInterface.Get().RecieveMoveCardToPile(mctp.cardId, mctp.cpId, mctp.sourceId);
            break;

        case NetOP.SyncDeckOrder:
            Net_SyncDeckOrder sdo = (Net_SyncDeckOrder)msg;
            NetInterface.Get().RecieveDeckOrder(sdo.cardIds, sdo.deckCpId);
            break;

        case NetOP.SyncCreatureCoordinates:
            Net_SyncCreatureCoordinates scc = (Net_SyncCreatureCoordinates)msg;
            NetInterface.Get().RecieveCreatureCoordinates(scc.creatureCardId, scc.x, scc.y, scc.sourceCardId);
            break;

        case NetOP.SyncAttack:
            Net_SyncAttack sa = (Net_SyncAttack)msg;
            NetInterface.Get().ReceiveAttack(sa.attackerId, sa.defenderId, sa.damageRoll);
            break;

        case NetOP.SyncPlayerStats:
            Net_SyncPlayerResources spr = (Net_SyncPlayerResources)msg;
            NetInterface.Get().RecievePlayerStats(spr.isPlayerOne, spr.gold, spr.goldPTurn, spr.mana, spr.manaPTurn, spr.actions, spr.actionsPTurn);
            break;

        case NetOP.EndTurn:
            NetInterface.Get().RecieveEndTurn();
            break;

        case NetOP.DoneSendingCards:
            NetInterface.Get().opponentFinishedSendingCards = true;
            break;

        case NetOP.DoneWithSetup:
            NetInterface.Get().finishedWithSetup = true;
            break;

        case NetOP.SyncPermanentPlaced:
            NetInterface.Get().RecievePermanentPlaced((Net_SyncPermanentPlaced)msg);
            break;

        case NetOP.SyncCreature:
            NetInterface.Get().RecieveCreatureStats((Net_SyncCreature)msg);
            break;

        case NetOP.SyncCountersPlaced:
            Net_SyncCountersPlaced scp = (Net_SyncCountersPlaced)msg;
            NetInterface.Get().RecieveCounterPlaced(scp.amount, scp.counterId, scp.targetCardId);
            break;

        case NetOP.EndGame:
            NetInterface.Get().RecieveEndGameMessage((Net_EndGame)msg);
            break;

        case NetOP.CheckVersion:
            VersionChecker.instance.recieveMessage((Net_CheckVersion)msg);
            break;
        }
    }