예제 #1
0
    // 得到所有的英雄经验
    /// <summary>
    ///
    /// </summary>
    /// <param name="card"></param>
    /// <returns></returns>
    public int GetHeroAllExp(ObjectCard card)
    {
        foreach (var item in m_Heroupgradexp.getDataList())
        {
            HeroupgradexpTemplate temp = ( HeroupgradexpTemplate )item;
            if (temp.getBorn() == card.GetHeroRow().getBorn() && temp.getLevel() == card.GetHeroData().Level)
            {
                return(temp.getExp());
            }
        }

        return(-1);
    }
예제 #2
0
    // 重写显示英雄信息方法
    public override void ShowHeroInfo(ObjectCard heroCard)
    {
        base.ShowHeroInfo(heroCard);
        m_HeroData  = heroCard.GetHeroData();
        m_HeroDataT = heroCard.GetHeroRow();
        HeroupgradexpTemplate tempT = DataTemplate.GetInstance().GetHeroupgradexpTemplate(heroCard.GetHeroRow().getBorn(), heroCard.GetHeroData().Level);

        // 英雄等级
        m_Value.text = heroCard.GetHeroData().Level.ToString();              // +"/" + heroCard.GetHeroRow().getMaxLevel().ToString();
        // 进度条
        m_Slider.value = heroCard.GetHeroData().Exp * 1.0f / tempT.getExp(); //DataTemplate.GetInstance ().GetHeroAllExp ( heroCard );

        m_ExpTxt.text = heroCard.GetHeroData().Exp + "/" + tempT.getExp();   //DataTemplate.GetInstance ().GetHeroAllExp ( heroCard );

        int id1     = DataTemplate.GetInstance().m_GameConfig.getItem_exp_1();
        int number1 = 0;

        ObjectSelf.GetInstance().TryGetItemCountById(EM_BAG_HASHTABLE_TYPE.EM_BAG_HASHTABLE_TYPE_COMMON, id1, ref number1);
        ItemTemplate item1 = (ItemTemplate)DataTemplate.GetInstance().m_ItemTable.getTableData(id1);

        m_ItemLayout.transform.GetChild(0).GetComponent <PotionItem>().ShowInfo(number1, item1);
        m_ItemLayout.transform.GetChild(0).Find("Image1").GetComponent <Image>().sprite = GameUtils.GetItemQualitySprite(id1);

        int id2     = DataTemplate.GetInstance().m_GameConfig.getItem_exp_2();
        int number2 = 0;

        ObjectSelf.GetInstance().TryGetItemCountById(EM_BAG_HASHTABLE_TYPE.EM_BAG_HASHTABLE_TYPE_COMMON, id2, ref number2);
        ItemTemplate item2 = (ItemTemplate)DataTemplate.GetInstance().m_ItemTable.getTableData(id2);

        m_ItemLayout.transform.GetChild(1).GetComponent <PotionItem>().ShowInfo(number2, item2);
        m_ItemLayout.transform.GetChild(1).Find("Image1").GetComponent <Image>().sprite = GameUtils.GetItemQualitySprite(id2);

        int id3     = DataTemplate.GetInstance().m_GameConfig.getItem_exp_3();
        int number3 = 0;

        ObjectSelf.GetInstance().TryGetItemCountById(EM_BAG_HASHTABLE_TYPE.EM_BAG_HASHTABLE_TYPE_COMMON, id3, ref number3);
        ItemTemplate item3 = (ItemTemplate)DataTemplate.GetInstance().m_ItemTable.getTableData(id3);

        m_ItemLayout.transform.GetChild(2).GetComponent <PotionItem>().ShowInfo(number3, item3);
        m_ItemLayout.transform.GetChild(2).Find("Image1").GetComponent <Image>().sprite = GameUtils.GetItemQualitySprite(id3);

        int id4     = DataTemplate.GetInstance().m_GameConfig.getItem_exp_4();
        int number4 = 0;

        ObjectSelf.GetInstance().TryGetItemCountById(EM_BAG_HASHTABLE_TYPE.EM_BAG_HASHTABLE_TYPE_COMMON, id4, ref number4);
        ItemTemplate item4 = (ItemTemplate)DataTemplate.GetInstance().m_ItemTable.getTableData(id4);

        m_ItemLayout.transform.GetChild(3).GetComponent <PotionItem>().ShowInfo(number4, item4);
        m_ItemLayout.transform.GetChild(3).Find("Image1").GetComponent <Image>().sprite = GameUtils.GetItemQualitySprite(id4);

        //int id5 = DataTemplate.GetInstance().m_GameConfig.getItem_exp_5();
        //int number5 = 0;
        //ObjectSelf.GetInstance().TryGetItemCountById(EM_BAG_HASHTABLE_TYPE.EM_BAG_HASHTABLE_TYPE_COMMON, id5, ref number5);
        //ItemTemplate item5 = (ItemTemplate)DataTemplate.GetInstance().m_ItemTable.getTableData(id5);
        //m_ItemLayout.transform.GetChild(4).GetComponent<PotionItem>().ShowInfo(number5, item5);
        //m_ItemLayout.transform.GetChild(4).Find("Image1").GetComponent<Image>().sprite = GameUtils.GetItemQualitySprite(id5);

        //int id6 = DataTemplate.GetInstance().m_GameConfig.getItem_exp_6();
        //int number6 = 0;
        //ObjectSelf.GetInstance().TryGetItemCountById(EM_BAG_HASHTABLE_TYPE.EM_BAG_HASHTABLE_TYPE_COMMON, id6, ref number6);
        //ItemTemplate item6 = (ItemTemplate)DataTemplate.GetInstance().m_ItemTable.getTableData(id6);
        //m_ItemLayout.transform.GetChild(5).GetComponent<PotionItem>().ShowInfo(number6, item6);
        //m_ItemLayout.transform.GetChild(5).Find("Image1").GetComponent<Image>().sprite = GameUtils.GetItemQualitySprite(id6);

        if (heroCard.GetHeroData().Level == 60)
        {
            m_Number.text = "";
            m_ExpTxt.text = "";
        }
        else
        {
            HeroupgradexpTemplate temp  = DataTemplate.GetInstance().GetHeroupgradexpTemplate(heroCard.GetHeroRow().getBorn(), heroCard.GetHeroData().Level);
            HeroupgradexpTemplate _temp = DataTemplate.GetInstance().GetHeroupgradexpTemplate(heroCard.GetHeroRow().getBorn(), heroCard.GetHeroData().Level + 1);
            m_Number.text = (_temp.getConsumermoney() - temp.getConsumermoney()).ToString();
        }

        if (heroCard.GetHeroData().Level + 5 > 59)
        {
            HeroupgradexpTemplate temp  = DataTemplate.GetInstance().GetHeroupgradexpTemplate(heroCard.GetHeroRow().getBorn(), 59);
            HeroupgradexpTemplate _temp = DataTemplate.GetInstance().GetHeroupgradexpTemplate(heroCard.GetHeroRow().getBorn(), heroCard.GetHeroData().Level);
            m_5Number.text = (temp.getConsumermoney() - _temp.getConsumermoney()).ToString();
        }
        else
        {
            HeroupgradexpTemplate _temp = DataTemplate.GetInstance().GetHeroupgradexpTemplate(heroCard.GetHeroRow().getBorn(), heroCard.GetHeroData().Level);
            HeroupgradexpTemplate temp  = DataTemplate.GetInstance().GetHeroupgradexpTemplate(heroCard.GetHeroRow().getBorn(), heroCard.GetHeroData().Level + 5);
            m_5Number.text = (temp.getConsumermoney() - _temp.getConsumermoney()).ToString();
        }

        for (int i = 0; i < 4; i++)
        {
            if (i == 0)
            {
                string     type   = "战斗力";//GameUtils.GetAttriName(1);
                float      num    = 0;
                GameConfig _cofig = (GameConfig)DataTemplate.GetInstance().m_GameConfig;
                for (int j = 0; j < 3; j++)
                {
                    if (j == 0)
                    {
                        num += _cofig.getCombat_attack_factor() * m_HeroDataT.getHPGrowth();
                    }
                    if (j == 1)
                    {
                        num += _cofig.getCombat_defense_factor() * m_HeroDataT.getPhysicalAttackGrowth();
                    }
                    if (j == 2)
                    {
                        num += _cofig.getCombat_blood_factor() * m_HeroDataT.getPhysicalDefenceGrowth();
                    }
                }
                m_AtrributesLayout.transform.GetChild(i).GetComponent <AttriItems>().SetInfo(m_AtrributesLayout.transform.GetChild(i).transform, type, Math.Floor(num).ToString());
            }
            if (i == 1)
            {
                string type = GameUtils.GetAttriName(1);
                m_AtrributesLayout.transform.GetChild(i).GetComponent <AttriItems>().SetInfo(m_AtrributesLayout.transform.GetChild(i).transform, type, m_HeroDataT.getHPGrowth().ToString());
            }
            if (i == 2)
            {
                string type = GameUtils.GetAttriName(3);
                m_AtrributesLayout.transform.GetChild(i).GetComponent <AttriItems>().SetInfo(m_AtrributesLayout.transform.GetChild(i).transform, type, m_HeroDataT.getPhysicalAttackGrowth().ToString());
            }
            if (i == 3)
            {
                string type = GameUtils.GetAttriName(5);
                m_AtrributesLayout.transform.GetChild(i).GetComponent <AttriItems>().SetInfo(m_AtrributesLayout.transform.GetChild(i).transform, type, m_HeroDataT.getPhysicalDefenceGrowth().ToString());
            }
        }
    }