Пример #1
0
    public void ForeordinationClickPress(GameObject go)
    {
        int index;

        if (go != null && int.TryParse(go.name, out index) && ForeordinationTips != null)
        {
            Tab_Belle belleTab = BelleInfoWindow.Instance().CurSellectedBelleData;
            if (null != belleTab)
            {
                --index;
                if (index > -1 && index < belleTab.getAffectionConditonValueCount())
                {
                    int id = belleTab.GetAffectionConditonValuebyIndex(index);

                    bool      isHas          = BelleData.OwnedBelleMap.ContainsKey(id);
                    Tab_Belle affectionbelle = TableManager.GetBelleByID(id, 0);
                    if (affectionbelle != null)
                    {
                        Tab_CommonItem cItem = TableManager.GetCommonItemByID(affectionbelle.BelleItemID, 0);
                        if (cItem != null)
                        {
                            Transform tf = ForeordinationTips.transform.Find("Item");
                            if (tf != null)
                            {
                                UISprite us = tf.GetComponent <UISprite>();
                                if (us != null)
                                {
                                    us.spriteName = Games.GlobeDefine.GlobeVar.QualityColorGrid[cItem.Quality - 1];
                                    if (isHas)
                                    {
                                        us.color = Games.GlobeDefine.GlobeVar.BUTTONCOLER;
                                    }
                                    else
                                    {
                                        us.color = Games.GlobeDefine.GlobeVar.BUTTONGRAY;
                                    }
                                }
                            }
                            tf = ForeordinationTips.transform.Find("Item/Head");
                            if (tf != null)
                            {
                                UISprite usc = tf.GetComponent <UISprite>();
                                if (usc != null)
                                {
                                    usc.spriteName = cItem.Icon;
                                    if (isHas)
                                    {
                                        usc.color = Games.GlobeDefine.GlobeVar.BUTTONCOLER;
                                    }
                                    else
                                    {
                                        usc.color = Games.GlobeDefine.GlobeVar.BUTTONGRAY;
                                    }
                                }
                            }
                            tf = ForeordinationTips.transform.Find("belleName");
                            if (tf != null)
                            {
                                UILabel ul = tf.GetComponent <UILabel>();
                                if (ul != null)
                                {
                                    ul.text = affectionbelle.Name;
                                }
                            }
                            tf = ForeordinationTips.transform.Find("ForeordinationName");
                            if (tf != null)
                            {
                                UILabel ul = tf.GetComponent <UILabel>();
                                if (ul != null)
                                {
                                    ul.text = belleTab.GetAffectionNamebyIndex(index);
                                }
                            }
                            tf = ForeordinationTips.transform.Find("Property");
                            if (tf != null)
                            {
                                UILabel ul = tf.GetComponent <UILabel>();
                                if (ul != null)
                                {
                                    ul.text = belleTab.GetAffectionDescbyIndex(index);
                                }
                            }
                        }
                    }
                }
            }
        }
        if (ForeordinationTips != null)
        {
            ForeordinationTips.SetActive(true);
        }
    }
    public void SetRelationshipInfo()
    {
        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;
        }

        for (int i = 0; i < m_belleNames.Length; i++)
        {
            if (i < belleTab.getAffectionGainsTypeCount())
            {
                Tab_Belle targetBelle = TableManager.GetBelleByID(belleTab.GetAffectionConditonValuebyIndex(i), 0);
                if (null == targetBelle)
                {
                    continue;
                }

                UnityEngine.Object belleTextureObj = ResourceManager.LoadResource(BelleData.GetBelleBigTextureName(targetBelle), typeof(Texture)) as Texture;
                if (null != belleTextureObj)
                {
                    m_bellePics[i].mainTexture = belleTextureObj as Texture;
                    // m_bellePics[i].color = m_ColorDisable;
                }
                //目标美人图片
                //  Tab_CommonItem commItem = TableManager.GetCommonItemByID(targetBelle.BelleItemID, 0);
                // if (commItem != null)
                //     m_bellePics[i].spriteName = commItem.Icon;
                //目标美人名字
                m_belleNames[i].text  = targetBelle.Name;
                m_belleNames[i].color = m_ColorDisable;

                //当前美人情缘名称
                m_relationNames[i].text  = belleTab.GetAffectionNamebyIndex(i);
                m_relationNames[i].color = m_ColorDisable;

                //当前美人加成属性描述
                m_attrDescs[i].text  = belleTab.GetAffectionDescbyIndex(i);
                m_attrDescs[i].color = m_ColorDisable;

                if (null != curBelleData && bOwned)
                {
                    int curBelleMatrixID = curBelleData.matrixID;
                    if (curBelleMatrixID < 0)
                    {
                        continue;
                    }

                    if (!BelleData.OwnedMatrixMap.ContainsKey(curBelleMatrixID))
                    {
                        continue;
                    }

                    if (!BelleData.OwnedMatrixMap[curBelleMatrixID].isActive)
                    {
                        continue;
                    }

                    bool bActive = false;

                    // 同上阵
                    int targetBelleID = belleTab.GetAffectionConditonValuebyIndex(i);
                    if (BelleData.OwnedBelleMap.ContainsKey(targetBelleID))
                    {
                        if (BelleData.OwnedBelleMap[targetBelleID].matrixID == curBelleData.matrixID)
                        {
                            bActive = true;
                        }
                    }

                    m_belleNames[i].color    = bActive ? m_belleNameHighlight : m_ColorDisable;
                    m_relationNames[i].color = bActive ? m_relationNameHightlight : m_ColorDisable;
                    m_attrDescs[i].color     = bActive ? m_attrDescHightlight : m_ColorDisable;
                }
            }
        }
    }