예제 #1
0
    public void readyForBattle()
    {
        _curRound   = -1;
        _actionTime = 0;
        _isWin      = false;

        _star  = 0;
        _score = 0;

        _gold  = 0;
        _paper = 0;

        SolaEngine engine = SolaEngine.getInstance();
        PartnerMgr pMgr   = (PartnerMgr)engine.getMgr(typeof(PartnerMgr));

        _partners = new Dictionary <int, BattleHeroModel> ();
        Dictionary <int, HeroModel> partner = pMgr.getPartners();

        foreach (int pos in partner.Keys)
        {
            HeroModel       model   = partner[pos];
            BattleHeroModel bhModel = new BattleHeroModel();
            bhModel.setModel(model, false, new Vector3(0, 0, 0));
            bhModel.formatModel();

            _partners.Add(pos, bhModel);
            bhModel.HERO_DIED += _onPartnerDeath;
        }

        MissionModel missionModel = _missionModel;

        _curBattleInfos = missionModel.getBattleInfos();
    }
예제 #2
0
    private void _updateHeroView()
    {
        foreach (Image image in heroImgs)
        {
            image.gameObject.SetActive(false);
        }

        PartnerMgr pMgr  = (PartnerMgr)_engine.getMgr(typeof(PartnerMgr));
        int        index = 0;

        Dictionary <int, HeroModel> partners = pMgr.getPartners();
        int heroIndex = 0;

        foreach (HeroModel model in partners.Values)
        {
            if (heroIndex > 2)
            {
                break;
            }

            heroIndex++;

            string img        = model.getBodyImg();
            Sprite bodySprite = Resources.Load <Sprite> (img);

            Image image = heroImgs [index];
            image.gameObject.SetActive(true);
            image.sprite = bodySprite;

            if (index == 0)
            {
                int start = model.getStart();
                int size  = heroStars.Length;

                for (int i = 0; i < size; i++)
                {
                    GameObject gameObject = heroStars [i].gameObject;
                    gameObject.SetActive(i < start);
                }

                heroName.text = model.getName();

                int atk = model.getAtk();
                int hp  = model.getHp();
                int spd = model.getSpd();

                heroAtkSlider.value = atk;
                heroHpSlider.value  = hp;
                heroSpdSlider.value = spd;

                heroAtkText.text  = atk.ToString();
                heroHpText.text   = hp.ToString();
                heroSpdkText.text = spd.ToString();
            }

            index++;
        }
    }
예제 #3
0
    private void _updatePartners()
    {
        SolaEngine engine = SolaEngine.getInstance();
        PartnerMgr pMgr   = (PartnerMgr)engine.getMgr(typeof(PartnerMgr));

        Dictionary <int, HeroModel> partners = pMgr.getPartners();

        for (int i = 0; i < partnerItems.Length; i++)
        {
            HeroModel partner = null;
            if (partners.ContainsKey(i))
            {
                partner = partners[i];
            }

            ToBattlePartnerItem partnerItem = partnerItems[i];
            partnerItem.setModel(partner);
            partnerItem.setPos(i);

            partnerItem.onClicked += _onSelectedPartner;
        }
    }