Example #1
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="helpItem"></param>
    /// <param name="nRecommendIndex"></param>
    public void SetCardInfo(Tab_HelpItem helpItem, int nRecommendIndex)
    {
        if (helpItem == null)
        {
            return;
        }
        if (nRecommendIndex >= HELP_RECOMMEND_MAX || nRecommendIndex < 0)
        {
            return;
        }
        m_helpItem        = helpItem;
        m_nRecommendIndex = nRecommendIndex;

        if (m_IconSprite != null)
        {
            m_IconSprite.spriteName = helpItem.GetRecomIconbyIndex(nRecommendIndex);
        }
        if (m_DescLable != null)
        {
            m_DescLable.text = helpItem.GetRecomDescbyIndex(nRecommendIndex);
        }
        if (m_TitleLable != null)
        {
            m_TitleLable.text = helpItem.GetRecomTitlebyIndex(nRecommendIndex);
        }
        int nStar = helpItem.GetRecomStarbyIndex(nRecommendIndex);

        for (int i = 0; i < m_StarIconSprite.Length; i++)
        {
            if (nStar - 1 >= i)
            {
                m_StarIconSprite[i].spriteName = "partner-star1";
            }
            else
            {
                m_StarIconSprite[i].spriteName = "partner-star2";
            }
        }
    }
Example #2
0
 private void SetCards(Tab_HelpItem helpItem)
 {
     if (m_HelpGrid_Card == null)
     {
         LogModule.ErrorLog("SetCards::m_HelpGrid_Card = null");
         return;
     }
     Utils.CleanGrid(m_HelpGrid_Card.gameObject);
     if (helpItem == null)
     {
         LogModule.ErrorLog("SetCards::helpItem = null");
         return;
     }
     if (m_HelpCardHeadTitle != null)
     {
         m_HelpCardHeadTitle.text = helpItem.HelpName;
     }
     AddCard(helpItem, 0);
     AddCard(helpItem, 1);
     AddCard(helpItem, 2);
     AddCard(helpItem, 3);
     AddCard(helpItem, 4);
     m_HelpGrid_Card.GetComponent <UIGrid>().repositionNow = true;
 }
Example #3
0
    private void AddCard(Tab_HelpItem helpItem, int nIndex)
    {
        if (null == m_HelpGrid_Card)
        {
            LogModule.ErrorLog("AddCard::m_HelpGrid_Card is null");
            return;
        }
        GameObject card = (GameObject)Instantiate(prefCard) as GameObject;

        if (null == card)
        {
            LogModule.ErrorLog("card is null, instantiate failed");
            return;
        }
        card.transform.parent        = m_HelpGrid_Card;
        card.transform.localPosition = Vector3.one;
        card.transform.localScale    = Vector3.one;
        HelpCardItem item = card.GetComponent <HelpCardItem>();

        if (null != item)
        {
            item.SetCardInfo(helpItem, nIndex);
        }
    }