Ejemplo n.º 1
0
 public override bool Uninit(bool bBack)
 {
     heroItemPrefabManager.Clear();
     EnchantMaterialPrefabManager.Clear();
     EnchantHeroPrefabManager.Clear();
     DungeonHeroPrefabmanager.Clear();
     return(true);
 }
Ejemplo n.º 2
0
    void OverEnchantInit()
    {
        if (m_Hero == null)
        {
            m_Hero = EnchantHeroPrefabManager.GetNewObject <EnchantHero>(m_EnchantHeroIndicator.transform, Vector3.zero);
        }
        m_Hero.Init(m_Creature, null, null);

        EnchantHeroPrefabManager.Clear();
        DungeonHeroPrefabmanager.Clear();

        m_OverEnchantBase = EnchantHeroPrefabManager.GetNewObject <EnchantHero>(m_OverEnchanteHeroIndicator.transform, Vector3.zero);
        m_OverEnchantBase.Init(m_Creature);

        m_OverEnchantMaterial = EnchantHeroPrefabManager.GetNewObject <EnchantHero>(m_OverEnchantMaterialIndicator.transform, Vector3.zero);
        m_OverEnchantMaterial.InitDummy(null, m_Creature.Grade, 1, m_Creature.Enchant);

        m_OverEnchantResult = DungeonHeroPrefabmanager.GetNewObject <DungeonHero>(m_OverEnchantResultIndicator.transform, Vector3.zero);

        m_OverEnchantPrice.text = "0";

        heroItemPrefabManager.Clear();

        if (IsPossibleOverEnchant() == true && m_Creature.Enchant < 10)
        {
            m_Heroes = new List <EnchantHero>();
            var materials = m_SortInfo.GetFilteredCreatures(c => c.Idx != m_Creature.Idx).Where(c => c.Grade >= 6 && c.Enchant >= m_Creature.Enchant);

            if (materials.Count() > 0)
            {
                foreach (Creature creature in materials)
                {
                    if (creature.Grade == 0)
                    {
                        continue;
                    }

                    EnchantHero item = heroItemPrefabManager.GetNewObject <EnchantHero>(m_HeroGrid.transform, Vector3.zero);
                    item.Init(creature, OnToggleOverEnchantMaterials, null);

                    m_Heroes.Add(item);
                }

                for (int i = 0; i < 5; ++i)
                {
                    EnchantHero item = heroItemPrefabManager.GetNewObject <EnchantHero>(m_HeroGrid.transform, Vector3.zero);
                    item.Init(null);
                }

                m_HeroGrid.Reposition();
                m_HeroScroll.ResetPosition();

                RefreshInfo();

                m_HelpTitle.gameObject.SetActive(false);
                m_HelpDesc.gameObject.SetActive(false);
                m_OverEnchantResult.InitDummy(m_Creature.Info, m_Creature.Grade, m_Creature.Level, (short)(m_Creature.Enchant + 1), m_Creature.Info.ShowAttackType);

                return;
            }
            else
            {
                m_HelpTitle.gameObject.SetActive(true);
                m_HelpDesc.gameObject.SetActive(true);
                m_HelpTitle.text = Localization.Get("OverEnchant_NoMatarials");
                m_HelpDesc.text  = Localization.Get("Help_OverEnchant");
            }
        }
        else
        {
            m_HelpTitle.gameObject.SetActive(true);
            m_HelpDesc.gameObject.SetActive(true);
            m_HelpTitle.text = Localization.Get("OverEnchant_NotPrepare");
            m_HelpDesc.text  = Localization.Get("Help_OverEnchant");
        }
        if (m_Creature.Enchant >= 10)
        {
            m_OverEnchantResult.InitDummy(m_Creature.Info, m_Creature.Grade, m_Creature.Level, 10, m_Creature.Info.ShowAttackType);
        }
        else
        {
            m_OverEnchantResult.InitDummy(m_Creature.Info, m_Creature.Grade, m_Creature.Level, (short)(m_Creature.Enchant + 1), m_Creature.Info.ShowAttackType);
        }
    }