Example #1
0
    void SortHeroWithQuailty(ref List <HerorecruitTemplate> heroList)
    {
        for (int i = 0; i < heroList.Count - 1; ++i)
        {
            HerorecruitTemplate item = heroList[i];
            for (int j = i; j < heroList.Count; ++j)
            {
                HeroTemplate hero1    = (HeroTemplate)DataTemplate.GetInstance().m_HeroTable.getTableData(heroList[i].GetID());
                int          quality1 = hero1.getQuality();

                HeroTemplate hero2    = (HeroTemplate)DataTemplate.GetInstance().m_HeroTable.getTableData(heroList[j].GetID());
                int          quality2 = hero2.getQuality();

                if (quality2 > quality1)
                {
                    item        = heroList[j];
                    heroList[j] = heroList[i];
                    heroList[i] = item;
                }
                else if (quality2 == quality1)
                {
                    if (hero2.GetID() > hero1.GetID())
                    {
                        item        = heroList[j];
                        heroList[j] = heroList[i];
                        heroList[i] = item;
                    }
                }
            }
        }
    }
Example #2
0
    // 成功刷新英雄
    public void SuccessRefresh(int dream)
    {
        HeroTemplate        temp   = ( HeroTemplate )DataTemplate.GetInstance().m_HeroTable.getTableData(dream);
        HerorecruitTemplate retemp = ( HerorecruitTemplate )DataTemplate.GetInstance().m_HeroRecruitTable.getTableData(dream);

        HeroInfoPop.inst.SetShowData(temp, retemp.getHerolevel());
        HeroInfoPop.inst.SetExchangeHero();

        string number = string.Format(GameUtils.getString("recruit_bubble2"), 1);

        InterfaceControler.GetInst().AddMsgBox(number, HeroInfoPop.inst.selfTransform.transform.parent);
    }
Example #3
0
    // 成功买到一个
    public void SuccessBuyOne(LinkedList <int> herolist)
    {
        foreach (var item in herolist)
        {
            UI_HomeControler.Inst.AddUI(HeroInfoPop.UI_ResPath);
            HeroTemplate        temp   = (HeroTemplate)DataTemplate.GetInstance().m_HeroTable.getTableData(item);
            HerorecruitTemplate retemp = (HerorecruitTemplate)DataTemplate.GetInstance().m_HeroRecruitTable.getTableData(item);
            HeroInfoPop.inst.SetShowData(temp, retemp.getHerolevel());
            HeroInfoPop.inst.SetSingGainHero();

            RefreshDreamValue();
            break;
        }
    }
Example #4
0
    /// <summary>
    /// 显示英雄数据 根据不同的打开方式加载不同的数据
    /// </summary>
    /// <param name="type"></param>
    public void ShowHeroData(int type)
    {
        m_HeroTemp.Clear();

        Dictionary <int, IExcelBean> _data = DataTemplate.GetInstance().m_HeroRecruitTable.getData();

        // 单抽
        if (type == 1)
        {
            foreach (var _item in _data)
            {
                HerorecruitTemplate _temp = (HerorecruitTemplate)DataTemplate.GetInstance().m_HeroRecruitTable.getTableData(_item.Key);
                if (_temp.getInitialweight1() != 0)
                {
                    m_HeroTemp.Add(_temp);
                }
            }
        }
        else if (type == 2)           // 十连抽
        {
            foreach (var _item in _data)
            {
                HerorecruitTemplate _temp = (HerorecruitTemplate)DataTemplate.GetInstance().m_HeroRecruitTable.getTableData(_item.Key);
                if (_temp.getInitialweight2() != 0)
                {
                    m_HeroTemp.Add(_temp);
                }
            }
        }
        else if (type == 3)            // 梦想兑换
        {
            foreach (var _item in _data)
            {
                HerorecruitTemplate _temp = (HerorecruitTemplate)DataTemplate.GetInstance().m_HeroRecruitTable.getTableData(_item.Key);
                if (_temp.getInitialweight4() != 0)
                {
                    m_HeroTemp.Add(_temp);
                }
            }
        }

        SortHeroWithQuailty(ref m_HeroTemp);
        m_HeroLayout.cellCount       = m_HeroTemp.Count;
        m_HeroLayout.updateCellEvent = UpdateHeroItem;
        m_HeroLayout.Reload();
    }
Example #5
0
    //// 加载英雄
    //GameObject LoadHero(int index)
    //{
    //    GameObject cell = null;

    //    if (index < m_HeroTemp.Count)
    //    {
    //        cell = Instantiate(m_HeroItem) as GameObject;
    //        cell.transform.FindChild("Parent").localPosition = Vector3.zero;
    //        cell.AddComponent<Button>();

    //        ObjectCard objHero = GetObjectCard(m_HeroTemp[index]);
    //        UI_HeroListItem uiIt = cell.AddComponent<UI_HeroListItem>();

    //        uiIt.m_id = index;
    //        uiIt.tableId = objHero.GetHeroData().TableID;
    //        uiIt.Initialize(objHero);

    //        uiIt.SetSelectClick();
    //    }

    //    return cell;
    //}

    ObjectCard GetObjectCard(HerorecruitTemplate _temp)
    {
        HeroTemplate heroT = (HeroTemplate)DataTemplate.GetInstance().m_HeroTable.getTableData(_temp.GetID());

        ObjectCard obj  = new ObjectCard();
        Hero       hero = new Hero();

        hero.skill1     = heroT.getSkill1ID();
        hero.skill2     = heroT.getSkill2ID();
        hero.skill3     = heroT.getSkill3ID();
        hero.heroid     = heroT.getId();
        hero.herolevel  = 1;
        hero.heroviewid = heroT.getArtresources();
        obj.GetHeroData().Init(hero);

        return(obj);
    }
Example #6
0
    public override void InitUIView()
    {
        base.InitUIView();

        m_BuyOneText.text    = GameUtils.getString("hero_recruit_content5");
        m_BuyTenText.text    = GameUtils.getString("hero_recruit_content6");
        m_LeftPreText.text   = GameUtils.getString("hero_recruit_content16");
        m_CenterPreText.text = GameUtils.getString("hero_recruit_content16");
        m_RightPreText.text  = GameUtils.getString("hero_recruit_content16");

        //m_BottomTipsText.ShowRichText(GameUtils.getString("hero_recruit_content9"));
        m_CenterTipsText.ShowRichText((GameUtils.getString("hero_recruit_content17")));

        InitTipsText();

        try
        {
            m_RecruitScene = GameObject.Find("Recruit_Scene");
            m_CimeliaScene = GameObject.Find("Cimelia_Scene");

            m_RecruitScene.SetActive(true);
            m_CimeliaScene.SetActive(false);
        }
        catch (System.Exception ex)
        {
        }

        // 是否进入兑换英雄界面
        if (ObjectSelf.GetInstance().dream != 0)
        {
            UI_HomeControler.Inst.AddUI(HeroInfoPop.UI_ResPath);
            HeroTemplate        temp   = (HeroTemplate)DataTemplate.GetInstance().m_HeroTable.getTableData(ObjectSelf.GetInstance().dream);
            HerorecruitTemplate retemp = (HerorecruitTemplate)DataTemplate.GetInstance().m_HeroRecruitTable.getTableData(ObjectSelf.GetInstance().dream);
            HeroInfoPop.inst.SetShowData(temp, retemp.getHerolevel());
            HeroInfoPop.inst.SetExchangeHero();
            return;
        }

        // 引导购买一次
        if (GuideManager.GetInstance().isGuideUser&& GuideManager.GetInstance().IsContentGuideID(100202) == false)
        {
            GuideManager.GetInstance().ShowGuideWithIndex(100202);
        }
    }