Ejemplo n.º 1
0
    internal static void PlayCardCallback(object[] data)
    {
        string who = (string)data[0];
        PlayerObjectBehaviour forPlayer = LocalPlayer;

        if (who.Equals(EnemyPlayer.PlayerName))
        {
            forPlayer = EnemyPlayer;
        }
        int guid = (int)data[1];
        int mana = (int)data[2];
        CardObjectBehaviour cob = CardObjectBehaviour.GetCOB(guid);

        forPlayer.Hob.RemoveCard(cob.gameObject);
        forPlayer.UpdateMana(mana);
        cob.gameObject.GetComponent <DragHandCard>().CanDrag = false;

        cob.AddDoTweens(() =>
        {
            // Move card to neutral position and play effects
            Vector3 spellEffectPos = NeutralBattlePoint.transform.position;
            cob.AddEffectParticle();
            cob.SetTweening(true);
            Sequence s = DOTween.Sequence();
            s.Insert(0f, cob.gameObject.transform.DOMove(new Vector3(spellEffectPos.x, spellEffectPos.y, -3f), GameConfig.F("SPELL_CARD_FLY_TIME")));
            s.Insert(0f, cob.gameObject.transform.DOScale(GameConfig.F("SPELL_CARD_SCALE"), GameConfig.F("SPELL_CARD_FLY_TIME")));
            s.AppendInterval(GameConfig.F("SPELL_CARD_FLY_TIME") + GameConfig.F("SPELL_CARD_DISPLAY_TIME"));
            s.OnComplete(() =>
            {
                cob.SetTweening(false);
            });
        });
    }
Ejemplo n.º 2
0
    internal static void UpdatePlayerMana(object[] data)
    {
        string who  = (string)data[0];
        int    mana = (int)data[1];
        PlayerObjectBehaviour forPlayer = LocalPlayer;

        if (who.Equals(EnemyPlayer.PlayerName))
        {
            forPlayer = EnemyPlayer;
        }
        forPlayer.UpdateMana(mana);
    }
Ejemplo n.º 3
0
    internal static void FirstLoadDataCallback(object[] data)
    {
        JSONObject firstLoadData = (JSONObject)data[0];

        JSONObject p1     = firstLoadData.GetField("players").GetField("p1");
        string     p1Name = p1.GetField("name").str;
        int        p1Hp   = (int)p1.GetField("hp").n;
        int        p1Mp   = (int)p1.GetField("mp").n;

        JSONObject p2     = firstLoadData.GetField("players").GetField("p2");
        string     p2Name = p2.GetField("name").str;
        int        p2Hp   = (int)p2.GetField("hp").n;
        int        p2Mp   = (int)p2.GetField("mp").n;

        if (p1Name.Equals(LocalPlayerName))
        {
            LocalPlayer.PlayerName = p1Name;
            LocalPlayer.UpdateHealth(p1Hp);
            LocalPlayer.UpdateMana(p1Mp);

            EnemyPlayer.PlayerName = p2Name;
            EnemyPlayer.UpdateHealth(p2Hp);
            EnemyPlayer.UpdateMana(p2Mp);
        }
        else if (p2Name.Equals(LocalPlayerName))
        {
            EnemyPlayer.PlayerName = p1Name;
            EnemyPlayer.UpdateHealth(p1Hp);
            EnemyPlayer.UpdateMana(p1Mp);

            LocalPlayer.PlayerName = p2Name;
            LocalPlayer.UpdateHealth(p2Hp);
            LocalPlayer.UpdateMana(p2Mp);
        }
        else
        {
            throw new Exception("[UpdateStartUI]Neither player name match local names");
        }
    }