Ejemplo n.º 1
0
    private void CreateCards()
    {
        Dictionary <int, int> tmpCardDic = battle.clientIsMine ? battle.mHandCards : battle.oHandCards;

        Dictionary <int, int> .Enumerator enumerator = tmpCardDic.GetEnumerator();

        int index = 0;

        while (enumerator.MoveNext())
        {
            if (battle.summon.ContainsKey(enumerator.Current.Key))
            {
                continue;
            }

            GameObject go = GameObject.Instantiate <GameObject>(Resources.Load <GameObject>("HeroCard"));

            HeroCard hero = go.GetComponent <HeroCard>();

            hero.SetFrameVisible(false);

            hero.Init(enumerator.Current.Key, enumerator.Current.Value);

            cardDic.Add(enumerator.Current.Key, hero);

            go.transform.SetParent(cardContainer, false);

            float cardWidth  = (go.transform as RectTransform).sizeDelta.x;
            float cardHeight = (go.transform as RectTransform).sizeDelta.y;

            (go.transform as RectTransform).anchoredPosition = new Vector2(-0.5f * cardContainer.rect.width + cardWidth * 0.5f + index * cardWidth, -0.5f * cardContainer.rect.height + cardHeight * 0.5f);

            index++;
        }
    }
Ejemplo n.º 2
0
    public void MapUnitUpAsButton(MapUnit _mapUnit)
    {
        if (battle.clientActionType == ActionType.SUMMON && battle.clientActionData1 == _mapUnit.index)
        {
            if (nowChooseHero == null)
            {
                nowChooseHero = summonHero;

                nowChooseHero.SetFrameVisible(true);
            }
            else
            {
                if (nowChooseHero == summonHero)
                {
                    nowChooseHero = null;

                    UnsummonHero(summonHero.cardUid);
                }
                else
                {
                    ClearNowChooseHero();

                    nowChooseHero = summonHero;

                    nowChooseHero.SetFrameVisible(true);
                }
            }
        }
        else if (battle.heroMapDic.ContainsKey(_mapUnit.index))
        {
            HeroCard nowHero = heroDic [_mapUnit.index];

            if (nowChooseHero == null)
            {
                nowChooseHero = nowHero;

                nowChooseHero.SetFrameVisible(true);
            }
            else
            {
                if (nowChooseHero != nowHero)
                {
                    ClearNowChooseHero();

                    nowChooseHero = nowHero;

                    nowChooseHero.SetFrameVisible(true);
                }
            }
        }
        else if (summonHero == null && nowChooseHero != null && nowChooseHero.cardUid != -1 && battle.mapDic [_mapUnit.index] == battle.clientIsMine && nowChooseHero.sds.cost <= GetMoney())
        {
            SummonHero(nowChooseHero.cardUid, _mapUnit.index);
        }
        else
        {
            ClearNowChooseHero();
        }
    }
Ejemplo n.º 3
0
    public void HeroClick(HeroCard _hero)
    {
        ClearNowChooseHero();

        if (nowChooseHero != _hero)
        {
            nowChooseHero = _hero;

            nowChooseHero.SetFrameVisible(true);
        }
    }
Ejemplo n.º 4
0
    private void AddHeroToMapReal(HeroCard _heroCard, int _pos)
    {
        MapUnit mapUnit = mapUnitDic [_pos];

        _heroCard.SetFrameVisible(false);

        _heroCard.transform.SetParent(heroContainer, false);

        _heroCard.transform.localPosition = mapUnit.transform.localPosition;

//		_heroCard.transform.localPosition = Vector3.zero;

        _heroCard.transform.localScale = new Vector3(heroScale, heroScale, heroScale);

        _heroCard.SetMouseEnable(false);
    }