コード例 #1
0
    /// <summary>
    /// 设置未获取界面数据
    /// </summary>
    public void SetUnOwnBelleInfo()
    {
        if (BelleInfoWindow.Instance() != null)
        {
            Tab_Belle belleTab = BelleInfoWindow.Instance().CurSellectedBelleData;

            if (null == belleTab)
            {
                LogModule.ErrorLog("BelleInfoWindow.Instance().CurSellectedBelleData is null!");
                return;
            }
            //名字
            m_belleName.text = belleTab.Name;

            //背景半身像
            UnityEngine.Object belleTextureObj = ResourceManager.LoadResource(BelleData.GetBelleBigTextureName(belleTab), typeof(Texture)) as Texture;
            if (null != belleTextureObj)
            {
                m_belleTextTure.mainTexture = belleTextureObj as Texture;
                m_belleTextTure.color       = m_disAbleBelleTextTure;
            }

            //描述信息
            m_belleDesc.text = belleTab.Introduction;

            //美人小图标
            Tab_CommonItem commItem = TableManager.GetCommonItemByID(belleTab.BelleItemID, 0);
            if (commItem != null)
            {
                m_belleIcon.spriteName = commItem.Icon;
            }

            //美人合成需要的碎片个数
            int belleSubItemId     = belleTab.BelleItemID;
            int belleTotalSubCount = belleTab.BelleItemCount;
            int belleSubItemCount  = GameManager.gameManager.PlayerDataPool.BackPack.GetItemCountByDataId(belleSubItemId);

            m_belleCurCount.text = belleSubItemCount.ToString() + "/" + belleTotalSubCount.ToString();
            /*  m_belleTotalCount.text = belleTotalSubCount.ToString();*/

            belleTotalSubCount      = belleTotalSubCount <= 0 ? 1 : belleTotalSubCount;
            m_processBar.fillAmount = (float)(belleSubItemCount * 1.0 / belleTotalSubCount);

            //按钮文字
            string itemStr = "#{10259}";

            m_redGetBelle.SetActive(false);
            //可合成的提示
            if (belleTotalSubCount > 0 && belleTotalSubCount <= belleSubItemCount)
            {
                itemStr = "#{10260}";
                m_redGetBelle.SetActive(true);
            }
            m_getBelleItemBtn.text = StrDictionary.GetClientDictionaryString(itemStr);

            //属性信息
            for (int i = 0; i < belleTab.getAttrTypeCount(); i++)
            {
                // labelNextAttrValue.text = StrDictionary.GetClientDictionaryString("#{3084}", nextValueAdd, Utils.GetAttrTypeString(curTabBelle.GetAttrTypebyIndex(i)));
                m_AttrTypes[i].text   = Utils.GetAttrTypeString(belleTab.GetAttrTypebyIndex(i));
                m_AttrValues[i].text  = "+" + belleTab.GetAttrValuebyIndex(i);
                m_AttrTypes[i].color  = m_ColorDisable;
                m_AttrValues[i].color = m_ColorDisable;
            }

            if (m_getBelleItemWin != null)
            {
                m_getBelleItemWin.SetActive(false);
            }
        }
    }
コード例 #2
0
    /// <summary>
    /// 设置基本属性界面
    /// </summary>
    public void SetBelleAttrData()
    {
        if (null == BelleInfoWindow.Instance())
        {
            return;
        }

        Tab_Belle belleTab = BelleInfoWindow.Instance().CurSellectedBelleData;

        if (null == belleTab)
        {
            return;
        }

        Belle curBelleData = null;
        bool  bOwned       = false;

        if (BelleData.OwnedBelleMap.ContainsKey(belleTab.Id))
        {
            curBelleData = BelleData.OwnedBelleMap[belleTab.Id];
            bOwned       = true;
        }
        if (null == curBelleData)
        {
            return;
        }

//         Tab_CommonItem commItem = TableManager.GetCommonItemByID(belleTab.BelleItemID, 0);
//         if (commItem != null)
//             m_bellePic.spriteName = commItem.Icon;
//         //美人等级
//         m_belleLevel.text = StrDictionary.GetClientDictionaryString("#{1308}", BelleData.GetBelleDescByColorLevel(curBelleData.colorLevel), curBelleData.subLevel);
//         m_belleLevel.color = BelleData.GetBelleColorByColorLevel(curBelleData.colorLevel);

        //  UpdateEvalutionInfo();
        curBelleData.UpdateAttrMap();
        int nextAttrTypeIndex      = curBelleData.GetNextLevelAttrType(curBelleData.orgLevel + 1);
        int nextAttrValue          = curBelleData.GetNextLevelAttrValue(curBelleData.orgLevel + 1);
        Tab_BelleLevelup belleLevL = TableManager.GetBelleLevelupByID(curBelleData.id * Belle.ID_FACTOR + curBelleData.orgLevel, 0);

        if (null == belleLevL)
        {
            return;
        }
        //美人属性值
        for (int i = 0; i < belleTab.getAttrTypeCount(); i++)
        {
            m_shrapPic[i].gameObject.SetActive(false);
            m_defaultText[i].gameObject.SetActive(true);
            m_nextValues[i].text    = "";
            m_attrTypeNames[i].text = Utils.GetAttrTypeString(belleTab.GetAttrTypebyIndex(i));

            int closeValue = 0;
            //亲密值
            if (belleTab.GetAttrTypebyIndex(i) == belleTab.CloseAddAttrType)
            {
                closeValue = curBelleData.closeAddValue;
            }
            //非第六条属性,受颜色等级控制
            if (i != belleTab.getAttrTypeCount() - 1)
            {
                if (i < curBelleData.colorLevel)
                {
                    m_attrValues[i].text = "+" + (belleLevL.GetAttrValuebyIndex(i) /*+ closeValue*/);
                }
                else
                {
                    m_attrValues[i].text = "+" + (belleTab.GetAttrValuebyIndex(i) /*+ closeValue*/);
                }
            }
            else //第六条属性,不受颜色等级控制
            {
                m_attrValues[i].text = "+" + ((curBelleData.IsMaxLevel()? belleLevL.GetAttrValuebyIndex(i):belleTab.GetAttrValuebyIndex(i)) /*+ closeValue*/);
                m_attrTypeNames[i].gameObject.SetActive(false);
            }

            //亲密值
            if (i == 0)
            {
                m_closeValueText.text = StrDictionary.GetClientDictionaryString("#{10817}", closeValue);
                m_closeValueText.gameObject.SetActive(closeValue > 0);
            }

            if (belleTab.getAttrTypeCount() - 1 != i && nextAttrTypeIndex == i)
            {
                //  LogModule.DebugLog("nextAttrType ===    " + nextAttrType + "   BelleTab.getAttrTypeByIndex " + i + "  " + belleTab.GetAttrTypebyIndex(i));
                if (i < curBelleData.colorLevel && nextAttrValue > 0)
                {
                    m_nextValues[i].text = "+" + nextAttrValue.ToString();
                    m_shrapPic[i].gameObject.SetActive(true);
                }
                else
                {
                    m_nextValues[i].text = "";
                }
            }
            else
            {
                m_shrapPic[i].gameObject.SetActive(false);
                m_nextValues[i].text = "";
            }

            if (null != curBelleData && bOwned)
            {
                if (i != belleTab.getAttrTypeCount() - 1)
                {
                    m_attrTypeNames[i].color = i < curBelleData.colorLevel ? m_ColorHighlight : m_ColorDisable;
                    m_attrValues[i].color    = i < curBelleData.colorLevel ? m_ColorHighlight : m_ColorDisable;
//                     m_nextValues[i].color = i < curBelleData.colorLevel ? m_ColorHighlight : m_ColorDisable;

                    m_defaultText[i].gameObject.SetActive(i >= curBelleData.colorLevel);
                }
                else
                {
                    m_attrTypeNames[i].color = curBelleData.IsMaxLevel() ? m_ColorHighlight : m_ColorDisable;
                    m_attrValues[i].color    = curBelleData.IsMaxLevel() ? m_ColorHighlight : m_ColorDisable;
//                     m_nextValues[i].color = curBelleData.IsMaxLevel() ? m_ColorHighlight : m_ColorDisable;
                    m_defaultText[i].gameObject.SetActive(!curBelleData.IsMaxLevel());
                }
            }
            else
            {
                m_attrTypeNames[i].color = m_ColorDisable;
                m_attrValues[i].color    = m_ColorDisable;
//                 m_nextValues[i].color = m_ColorDisable;
                m_shrapPic[i].gameObject.SetActive(false);
                m_defaultText[i].gameObject.SetActive(true);
                m_nextValues[i].text = "";
            }
        }
        //回调的时候等级变化,需要设置战力值
        //   SetCombatValue();
        //触发更新Item数量
        //据策划说,没有第六条属性
        m_attrTypeNames[5].gameObject.SetActive(false);
        m_attrValues[5].gameObject.SetActive(false);
        m_nextValues[5].gameObject.SetActive(false);
        m_shrapPic[5].gameObject.SetActive(false);
        m_defaultText[5].gameObject.SetActive(false);
        //
    }