示例#1
0
    private void UpdateEvolve(Muhon data)
    {
        if (null == data)
        {
            return;
        }
        bool isMaxStarLv = data.IsMaxStarLv;

        if (null != m_trans_EvolveInfos &&
            m_trans_EvolveInfos.gameObject.activeSelf == isMaxStarLv)
        {
            m_trans_EvolveInfos.gameObject.SetActive(!isMaxStarLv);
        }
        if (!isMaxStarLv)
        {
            if (null != m_evolveCurGrow)
            {
                m_evolveCurGrow.SetGridData(data.QWThisID);
            }
            MuhonStarData starData = null;

            UIItemShowGrid showGrid = null;
            //星级显示
            for (EquipDefine.AttrIndex i = EquipDefine.AttrIndex.None + 1; i < EquipDefine.AttrIndex.Max; i++)
            {
                if (m_dicStarData.TryGetValue(i, out starData))
                {
                    starData.SetStatus(data.StartLevel >= (int)i);
                }

                if (m_dicMuhonDeputy.TryGetValue(i, out showGrid) && null != showGrid)
                {
                    if ((int)i > data.EvolveNeedMuhonNum)
                    {
                        showGrid.SetVisible(false);
                    }
                    else
                    {
                        if (!showGrid.Visible)
                        {
                            showGrid.SetVisible(true);
                        }

                        if (IsDeputyEvolveGridFill(i))
                        {
                            showGrid.SetGridData(m_dicSelectMuhonDeputy[i], true);
                        }
                        else
                        {
                            showGrid.SetGridData(0);
                        }
                    }
                }
            }
            //辅助物品


            UpdateEvolveSelectStarAnim();
            Muhon next = data.Next;
            //预览
            //星级
            if (null != m_slider_EvolveCurStarLv)
            {
                m_slider_EvolveCurStarLv.value = data.StartLevel / 5f;
            }
            if (null != m_slider_EvolveNextStarLv)
            {
                m_slider_EvolveNextStarLv.value = next.StartLevel / 5f;
            }
            //等级
            if (null != m_label_EvolveCurLv)
            {
                m_label_EvolveCurLv.text = tmgr.GetLocalFormatText(LocalTextType.Local_Txt_Set_4, data.MaxLv);
            }
            if (null != m_label_EvolveNextLv)
            {
                m_label_EvolveNextLv.text = tmgr.GetLocalFormatText(LocalTextType.Local_Txt_Set_4, next.MaxLv);
            }
            int attrCount = data.AdditionAttrCount;
            //附加属性
            if (null != m_label_EvolveCurAttrNum)
            {
                m_label_EvolveCurAttrNum.text = tmgr.GetLocalFormatText(LocalTextType.Local_TXT_Soul_Num, data.MuhonAttrUpLimit);
            }
            if (null != m_label_EvolveNextAttrNum)
            {
                m_label_EvolveNextAttrNum.text = tmgr.GetLocalFormatText(LocalTextType.Local_TXT_Soul_Num, data.Next.MuhonAttrUpLimit);
            }
            ColorType color = ColorType.JZRY_Green;
            if (null != m_label_EvolveMuhonLv)
            {
                if (data.Level != data.MaxLv)
                {
                    color = ColorType.JZRY_Txt_NotMatchRed;
                }
                else
                {
                    color = ColorType.JZRY_Green;
                }

                m_label_EvolveMuhonLv.text = tmgr.GetLocalFormatText(LocalTextType.Local_TXT_Soul_ColorLv,
                                                                     ColorManager.GetNGUIColorOfType(ColorType.JZRY_Txt_Black)
                                                                     , ColorManager.GetNGUIColorOfType(color), data.Level, data.MaxLv);
            }

            //角色等级限制
            if (null != m_label_EvolvePlayerLvLmit)
            {
                if (DataManager.Instance.PlayerLv < data.EvolveNeedPlayerLv)
                {
                    color = ColorType.JZRY_Txt_NotMatchRed;
                }
                else
                {
                    color = ColorType.JZRY_Green;
                }
                m_label_EvolvePlayerLvLmit.text = string.Format("{0}圣魂升星需达{1}主角{2}级"
                                                                , tmgr.GetMuhonStarName(data.StartLevel)
                                                                , ColorManager.GetNGUIColorOfType(color)
                                                                , data.EvolveNeedPlayerLv);
            }

            //辅助道具
            SetEvolveAssit();
        }

        //最大星级
        if (null != m_trans_EvolveMax &&
            m_trans_EvolveMax.gameObject.activeSelf != isMaxStarLv)
        {
            m_trans_EvolveMax.gameObject.SetActive(isMaxStarLv);
        }
        if (isMaxStarLv)
        {
            //刷新圣魂升级信息
            if (null != m_evolveMaxGrow)
            {
                m_evolveMaxGrow.SetGridData(data.QWThisID);
            }
            List <EquipDefine.EquipBasePropertyData> baseProperyList = emgr.GetWeaponSoulBasePropertyData(data.BaseId, data.Level);
            int countCur = (null != baseProperyList) ? baseProperyList.Count : 0;
            if (countCur == 0)
            {
                Engine.Utility.Log.Error("进化表格数据错误");
                return;
            }
            if (null != m_sprite_EvolveAttrTitle)
            {
                m_sprite_EvolveAttrTitle.transform.Find("Value").GetComponent <UILabel>().text
                    = tmgr.GetLocalFormatText(LocalTextType.Local_TXT_Soul_Num, data.MuhonAttrUpLimit);
            }
            EquipDefine.EquipBasePropertyData temp = null;
            if (null != m_sprite_EvolveAttr1)
            {
                if (countCur >= 1)
                {
                    temp = baseProperyList[0];
                    m_sprite_EvolveAttr1.transform.Find("Name").GetComponent <UILabel>().text  = temp.Name;
                    m_sprite_EvolveAttr1.transform.Find("Value").GetComponent <UILabel>().text = temp.ToString();
                }
                else if (m_sprite_EvolveAttr1.gameObject.activeSelf)
                {
                    m_sprite_EvolveAttr1.gameObject.SetActive(false);
                }
            }
            if (null != m_sprite_EvolveAttr2)
            {
                if (countCur >= 2)
                {
                    temp = baseProperyList[1];
                    m_sprite_EvolveAttr2.transform.Find("Name").GetComponent <UILabel>().text  = temp.Name;
                    m_sprite_EvolveAttr2.transform.Find("Value").GetComponent <UILabel>().text = temp.ToString();
                }
                else if (m_sprite_EvolveAttr2.gameObject.activeSelf)
                {
                    m_sprite_EvolveAttr2.gameObject.SetActive(false);
                }
            }
            if (null != m_sprite_EvolveAttr3)
            {
                if (countCur >= 3)
                {
                    temp = baseProperyList[2];
                    m_sprite_EvolveAttr3.transform.Find("Name").GetComponent <UILabel>().text  = temp.Name;
                    m_sprite_EvolveAttr3.transform.Find("Value").GetComponent <UILabel>().text = temp.ToString();
                }
                else if (m_sprite_EvolveAttr3.gameObject.activeSelf)
                {
                    m_sprite_EvolveAttr3.gameObject.SetActive(false);
                }
            }
            if (null != m_sprite_EvolveAttr4)
            {
                if (countCur >= 4)
                {
                    temp = baseProperyList[3];
                    m_sprite_EvolveAttr4.transform.Find("Name").GetComponent <UILabel>().text  = temp.Name;
                    m_sprite_EvolveAttr4.transform.Find("Value").GetComponent <UILabel>().text = temp.ToString();
                }
                else if (m_sprite_EvolveAttr4.gameObject.activeSelf)
                {
                    m_sprite_EvolveAttr4.gameObject.SetActive(false);
                }
            }
        }
    }
    private void UpdateUI()
    {
        EquipManager emgr     = DataManager.Manager <EquipManager>();
        Muhon        curMuhon = DataManager.Manager <ItemManager>().GetBaseItemByQwThisId <Muhon>(evolveMuhonId);

        if (null == curMuhon || null == curMuhon.Pre)
        {
            TipsManager.Instance.ShowTips("进化完成数据错误!");
            return;
        }

        if (null != mShowGrid)
        {
            mShowGrid.SetGridData(evolveMuhonId);
        }
        if (null != m_label_MuhonName)
        {
            m_label_MuhonName.text = curMuhon.Name;
        }
        if (null != m_label_MuhonLv)
        {
            m_label_MuhonLv.text = DataManager.Manager <TextManager>().GetLocalFormatText(LocalTextType.Local_TXT_Soul_ColorLv
                                                                                          , "", "", curMuhon.Level, curMuhon.MaxLv);
        }

        if (null != m_label_AttrNumPre)
        {
            m_label_AttrNumPre.text = DataManager.Manager <TextManager>()
                                      .GetLocalFormatText(LocalTextType.Local_TXT_Soul_Num, curMuhon.Pre.MuhonAttrUpLimit);
        }

        if (null != m_label_AttrNumCur)
        {
            m_label_AttrNumCur.text = DataManager.Manager <TextManager>()
                                      .GetLocalFormatText(LocalTextType.Local_TXT_Soul_Num, curMuhon.MuhonAttrUpLimit);
        }
        List <EquipDefine.EquipBasePropertyData> curBaseProperyList = emgr.GetWeaponSoulBasePropertyData(curMuhon.BaseId, 1);
        List <EquipDefine.EquipBasePropertyData> preBaseProperyList = emgr.GetWeaponSoulBasePropertyData(curMuhon.Pre.BaseId, (int)curMuhon.Pre.MaxLv);

        EquipDefine.EquipBasePropertyData temp = null;
        Transform tempTrans   = null;
        Vector3   baseLastPos = gapWidget;

        if (null != m_lstBaseAttr)
        {
            for (int i = 0, max = m_lstBaseAttr.Count; i < max; i++)
            {
                tempTrans = m_lstBaseAttr[i];
                if (null == tempTrans)
                {
                    continue;
                }
                if (null != curBaseProperyList && curBaseProperyList.Count > i &&
                    null != preBaseProperyList && preBaseProperyList.Count > i)
                {
                    if (!tempTrans.gameObject.activeSelf)
                    {
                        tempTrans.gameObject.SetActive(true);
                    }
                    tempTrans.Find("Content/Name").GetComponent <UILabel>().text  = curBaseProperyList[i].Name;
                    tempTrans.Find("Content/CurV").GetComponent <UILabel>().text  = preBaseProperyList[i].ToString();
                    tempTrans.Find("Content/NextV").GetComponent <UILabel>().text = curBaseProperyList[i].ToString();
                }
                else
                {
                    if (tempTrans.gameObject.activeSelf)
                    {
                        tempTrans.gameObject.SetActive(false);
                    }
                    if (i == (max - 1))
                    {
                        Vector3 tempV = tempTrans.position;
                        tempV         = tempTrans.TransformPoint(tempV);
                        tempV         = m_scrollview_AttrContent.transform.InverseTransformPoint(tempV);
                        baseLastPos.y = tempV.y;
                    }
                }
            }
        }

        List <GameCmd.PairNumber> addtive = curMuhon.GetAdditiveAttr();

        if (null != m_lstAddtiveAttr)
        {
            for (int i = 0, max = m_lstAddtiveAttr.Count; i < max; i++)
            {
                tempTrans = m_lstAddtiveAttr[i];
                if (null == tempTrans)
                {
                    continue;
                }
                if (null != addtive && addtive.Count > i)
                {
                    if (!tempTrans.gameObject.activeSelf)
                    {
                        tempTrans.gameObject.SetActive(true);
                    }
                    tempTrans.Find("Grade").GetComponent <UILabel>().text = emgr.GetAttrGrade(addtive[i]).ToString();
                    tempTrans.Find("Des").GetComponent <UILabel>().text   = emgr.GetAttrDes(addtive[i]);
                }
                else if (tempTrans.gameObject.activeSelf)
                {
                    tempTrans.gameObject.SetActive(false);
                }
            }
        }

        bool additiveVisible = (null != addtive && addtive.Count != 0);

        if (null != m_trans_AddtiveAttrContent)
        {
            if (m_trans_AddtiveAttrContent.gameObject.activeSelf != additiveVisible)
            {
                m_trans_AddtiveAttrContent.gameObject.SetActive(additiveVisible);
            }

            if (additiveVisible)
            {
                m_trans_AddtiveAttrContent.transform.localPosition = gapWidget;
            }
        }

        if (null != m_scrollview_AttrContent)
        {
            m_scrollview_AttrContent.ResetPosition();
        }
    }
示例#3
0
    private void UpdatePromote(Muhon data)
    {
        if (null == data)
        {
            return;
        }
        if (null == data.LocalUpgradeDataBase)
        {
            Engine.Utility.Log.Error(CLASS_NAME + "->upGradeDataBase null");
            return;
        }

        //刷新圣魂升级信息
        if (null != m_promoteGrow)
        {
            m_promoteGrow.SetGridData(data.QWThisID);
        }

        //刷新等级经验信息
        if (null != m_label_Level)
        {
            //当前等级:{0}/{1}   {2}需求等级:{3}
            ColorType cTye = ColorType.Green;
            if (DataManager.Instance.PlayerLv < data.BaseData.useLevel)
            {
                cTye = ColorType.Red;
            }
            string color = ColorManager.GetNGUIColorOfType(ColorType.Gray);
            m_label_Level.text = string.Format("{0}/{1}", data.Level, data.MaxLv);
            //= DataManager.Manager<TextManager>().GetLocalFormatText(LocalTextType.Local_TXT_Soul_Level
            //, data.Level, data.MaxLv, ColorUtil.GetNGUIColorOfType(cTye), data.BaseData.useLevel);
        }
        float expPercentage = (data.IsMaxLv) ? 1f : (float)data.Exp / data.UpgradeExp;

        if (null != m_label_PromoteExpPencentage)
        {
            m_label_PromoteExpPencentage.text = string.Format("{0}%", (expPercentage * 100).ToString("f1"));
        }
        if (null != m_slider_PromoteExpProgress)
        {
            SlideAnimation slideAnim = m_slider_PromoteExpProgress.GetComponent <SlideAnimation>();
            if (null != slideAnim)
            {
                slideAnim.DoSlideAnim(slideAnim.value, expPercentage);
            }
        }
        //刷新基础属性预览
        List <EquipDefine.EquipBasePropertyData> basePropertyList = emgr.GetWeaponSoulBasePropertyData(data.BaseId, data.Level);
        int count = (null != basePropertyList) ? basePropertyList.Count : 0;

        table.WeaponSoulUpgradeDataBase          nextUpgradeDataBase = null;
        List <EquipDefine.EquipBasePropertyData> nexBasePropertyList = null;

        if (!data.IsMaxLv)
        {
            nexBasePropertyList = emgr.GetWeaponSoulBasePropertyData(data.BaseId, data.Level + 1);
        }

        if (null != m_trans_BasePropertyLevel)
        {
            m_trans_BasePropertyLevel.Find("Content/Name").GetComponent <UILabel>().text    = "等级";
            m_trans_BasePropertyLevel.Find("Content/Current").GetComponent <UILabel>().text = data.Level + "";
            m_trans_BasePropertyLevel.Find("Content/Target").GetComponent <UILabel>().text  = (data.IsMaxLv) ? "满级" : "" + (data.Level + 1);
        }
        EquipDefine.EquipBasePropertyData temp = null;
        if (null != m_trans_BaseProperty1)
        {
            if (count >= 1)
            {
                temp = basePropertyList[0];
            }

            m_trans_BaseProperty1.Find("Content/Name").GetComponent <UILabel>().text    = (null != temp) ? temp.Name : "无";
            m_trans_BaseProperty1.Find("Content/Current").GetComponent <UILabel>().text = (null != temp) ? temp.ToString() : "无";
            m_trans_BaseProperty1.Find("Content/Target").GetComponent <UILabel>().text  = (!data.IsMaxLv && null != nexBasePropertyList && nexBasePropertyList.Count >= 1) ? nexBasePropertyList[0].ToString() : "满级";
        }
        if (null != m_trans_BaseProperty2)
        {
            if (count >= 2)
            {
                temp = basePropertyList[1];
            }

            m_trans_BaseProperty2.Find("Content/Name").GetComponent <UILabel>().text    = (null != temp) ? temp.Name : "无";
            m_trans_BaseProperty2.Find("Content/Current").GetComponent <UILabel>().text = (null != temp) ? temp.ToString() : "无";
            m_trans_BaseProperty2.Find("Content/Target").GetComponent <UILabel>().text  = (!data.IsMaxLv && null != nexBasePropertyList && nexBasePropertyList.Count >= 2) ? nexBasePropertyList[1].ToString() : "满级";
        }
        if (null != m_trans_BaseProperty3)
        {
            if (count >= 3)
            {
                temp = basePropertyList[2];
            }

            m_trans_BaseProperty3.Find("Content/Name").GetComponent <UILabel>().text    = (null != temp) ? temp.Name : "无";
            m_trans_BaseProperty3.Find("Content/Current").GetComponent <UILabel>().text = (null != temp) ? temp.ToString() : "无";
            m_trans_BaseProperty3.Find("Content/Target").GetComponent <UILabel>().text  = (!data.IsMaxLv && null != nexBasePropertyList && nexBasePropertyList.Count >= 3) ? nexBasePropertyList[2].ToString() : "满级";
        }
        if (null != m_trans_BaseProperty4)
        {
            if (count >= 4)
            {
                temp = basePropertyList[3];
            }

            m_trans_BaseProperty4.Find("Content/Name").GetComponent <UILabel>().text    = (null != temp) ? temp.Name : "无";
            m_trans_BaseProperty4.Find("Content/Current").GetComponent <UILabel>().text = (null != temp) ? temp.ToString() : "无";
            m_trans_BaseProperty4.Find("Content/Target").GetComponent <UILabel>().text  = (!data.IsMaxLv && null != nexBasePropertyList && nexBasePropertyList.Count >= 4) ? nexBasePropertyList[3].ToString() : "满级";
        }
    }