Example #1
0
    void OnCardClick(CardVisual card)
    {
        // Select the clicked card
        m_castCard = card;
        m_visualManager.MakeAllUnclickable();

        // Move the card to the targetting zone
        CGBasicZone   targettingZone = m_visualManager.GetPlayerTargettingZone();
        CGChannelZone channelZero    = m_visualManager.GetPlayerChannel(0);

        targettingZone.MoveCardToZone(card);

        // Close the card selection menu
        m_menu.Close(channelZero);

        // Highlight possible targets and wait for one to be picked
        List <int> targets = GetTargets(card);

        if (targets.Count == 0)
        {
            // No valid targets found, one of three possibilities:
            // - There may be no legal targets
            // - The spell may not target anything
            // - An error is causing no targets to be found
            // Tell the server to cast the spell with no targets and await a response
            SGC_CastSpellFromChannel0 command = new SGC_CastSpellFromChannel0(card.m_cardID, -1);
            m_visualManager.TransmitStream(command.PackCommand());
            FinishCommand();
            return;
        }
        else
        {
            m_visualManager.MakeClickable(targets, OnTargetClick);
        }
    }
Example #2
0
 void MoveCardToGraveyardWithCallback(CGBasicZone graveyard, CardVisual card)
 {
     DOTween.Sequence()
     .Append(graveyard.MoveCardToZone(card))
     .AppendCallback(FinishCommand);
 }