protected override void OnLoading()
 {
     base.OnLoading();
     if (null == m_infoGrid && null != m_trans_InfoGridRoot)
     {
         GameObject preObj = UIManager.GetResGameObj(GridID.Uiitemshowgrid) as GameObject;
         if (null != preObj)
         {
             GameObject cloneObj = NGUITools.AddChild(m_trans_InfoGridRoot.gameObject, preObj);
             if (null != cloneObj)
             {
                 m_infoGrid = cloneObj.GetComponent <UIItemShowGrid>();
                 if (null == m_infoGrid)
                 {
                     m_infoGrid = cloneObj.AddComponent <UIItemShowGrid>();
                 }
                 if (null != m_infoGrid && !m_infoGrid.Visible)
                 {
                     m_infoGrid.SetVisible(true);
                 }
             }
         }
     }
 }
    protected override void OnLoading()
    {
        base.OnLoading();
        GameObject      preObj   = UIManager.GetResGameObj(GridID.Uiitemshowgrid);
        GameObject      cloneObj = null;
        UIEventDelegate dlg      = (eventType, data, param) =>
        {
            if (eventType == UIEventType.Click)
            {
                TipsManager.Instance.ShowItemTips(evolveMuhonId);
            }
        };

        if (null != preObj)
        {
            if (null == mShowGrid && null != m_trans_InfoGridRoot)
            {
                cloneObj = NGUITools.AddChild(m_trans_InfoGridRoot.gameObject, preObj);
                if (null != cloneObj)
                {
                    mShowGrid = cloneObj.GetComponent <UIItemShowGrid>();
                    if (null == mShowGrid)
                    {
                        mShowGrid = cloneObj.AddComponent <UIItemShowGrid>();
                    }
                    if (null != mShowGrid && !mShowGrid.Visible)
                    {
                        mShowGrid.SetVisible(true);
                        mShowGrid.RegisterUIEventDelegate(dlg);
                    }
                }
            }
        }
        Transform tempTrans = null;

        if (null != m_trans_BaseAttr)
        {
            m_lstBaseAttr = new List <Transform>();
            for (int i = 1; i <= 4; i++)
            {
                tempTrans = m_trans_BaseAttr.Find(i.ToString());
                if (null != tempTrans)
                {
                    m_lstBaseAttr.Add(tempTrans);
                }
            }
        }

        if (null != m_trans_AdditiveAttr)
        {
            m_lstAddtiveAttr = new List <Transform>();
            for (int i = 1; i <= 5; i++)
            {
                tempTrans = m_trans_AdditiveAttr.Find(i.ToString());
                if (null != tempTrans)
                {
                    m_lstAddtiveAttr.Add(tempTrans);
                }
            }
        }

        if (null != m_widget_GapWidget)
        {
            gapWidget = m_widget_GapWidget.gameObject.transform.localPosition;
        }
    }
    /// <summary>
    /// 刷新
    /// </summary>
    private void UpdateStrengthen()
    {
        if (m_emSelectInlayPos == GameCmd.EquipPos.EquipPos_None)
        {
            return;
        }
        bool isMax = emgr.IsGridStrengthenMax(m_emSelectInlayPos);

        if (null != m_label_ActiveSuitLvTxt)
        {
            m_label_ActiveSuitLvTxt.text = emgr.ActiveStrengthenSuitLv.ToString();
        }
        if (null != m_strengthen)
        {
            bool equipGrid = false;
            uint equipId   = 0;

            if (emgr.IsEquipPos(m_emSelectInlayPos, out equipId))
            {
                equipGrid = true;
            }
            equipGrid = equipGrid && !isMax;
            if (m_strengthen.gameObject.active != equipGrid)
            {
                m_strengthen.SetVisible(equipGrid);
            }

            if (equipGrid)
            {
                m_strengthen.SetGridData(equipId);
            }
        }

        if (null != m_label_StrengthenPosName)
        {
            m_label_StrengthenPosName.text = string.Format("{0}.部位", EquipDefine.GetEquipPosName(m_emSelectInlayPos));
        }

        if (null != m_sprite_StrengthenPosIcon)
        {
            m_sprite_StrengthenPosIcon.spriteName = EquipDefine.GetEquipPartIcon(m_emSelectInlayPos);
            m_sprite_StrengthenPosIcon.MakePixelPerfect();
        }

        //强化属性提升
        bool enable = !isMax;

        EquipDefine.LocalGridStrengthenData next = (enable)? emgr.GetNextStrengthDataByPos(m_emSelectInlayPos) : null;
        if (null != m_label_StrengthenCurLv)
        {
            if (m_label_StrengthenCurLv.gameObject.activeSelf != enable)
            {
                m_label_StrengthenCurLv.gameObject.SetActive(enable);
            }
            if (enable)
            {
                m_label_StrengthenCurLv.text = string.Format("强化 {0}级", emgr.GetGridStrengthenLvByPos(m_emSelectInlayPos));
            }
        }

        if (null != m_label_StrengthenTargetLv)
        {
            if (m_label_StrengthenTargetLv.gameObject.activeSelf != enable)
            {
                m_label_StrengthenTargetLv.gameObject.SetActive(enable);
            }
            if (enable)
            {
                m_label_StrengthenTargetLv.text = string.Format("强化 {0}级", emgr.GetGridStrengthenLvByPos(m_emSelectInlayPos) + 1);
            }
        }


        if (null != m_label_StrengthenMaxLv)
        {
            if (m_label_StrengthenMaxLv.gameObject.activeSelf != isMax)
            {
                m_label_StrengthenMaxLv.gameObject.SetActive(isMax);
            }
            if (isMax)
            {
                m_label_RefineMaxLv.text = string.Format("强化 {0}级", emgr.GetGridStrengthenLvByPos(m_emSelectInlayPos));;
            }
        }

        List <EquipDefine.EquipBasePropertyData> curBaseProData  = (null != StrengthenData) ? StrengthenData.BaseProp : null;
        List <EquipDefine.EquipBasePropertyData> nextBaseProData = (enable) ?
                                                                   emgr.GetNextStrengthDataByPos(m_emSelectInlayPos).BaseProp : null;

        Transform content        = null;
        Transform max            = null;
        bool      propertyenable = false;

        if (null != m_trans_StrengthenEquipProperty1)
        {
            propertyenable = (null != curBaseProData) && (curBaseProData.Count > 0) ||
                             (null != nextBaseProData) && (nextBaseProData.Count > 0);
            if (m_trans_StrengthenEquipProperty1.gameObject.activeSelf != propertyenable)
            {
                m_trans_StrengthenEquipProperty1.gameObject.SetActive(propertyenable);
            }

            if (propertyenable)
            {
                content = m_trans_StrengthenEquipProperty1.Find("Content");
                max     = m_trans_StrengthenEquipProperty1.Find("Max");

                if (content.gameObject.activeSelf != enable)
                {
                    content.gameObject.SetActive(enable);
                }
                if (enable)
                {
                    content.Find("Name").GetComponent <UILabel>().text
                        = ((null != curBaseProData && curBaseProData.Count > 0) ? curBaseProData[0].Name : nextBaseProData[0].Name);
                    content.Find("CurValue").GetComponent <UILabel>().text
                        = "+" + ((null != curBaseProData && curBaseProData.Count > 0) ? curBaseProData[0].ToString() : "0");
                    content.Find("TargetValue").GetComponent <UILabel>().text = "+" + nextBaseProData[0].ToString();
                }
                if (max.gameObject.activeSelf == enable)
                {
                    max.gameObject.SetActive(!enable);
                }

                if (!enable)
                {
                    max.Find("AttrTxt").GetComponent <UILabel>().text = string.Format("{0} +{1}"
                                                                                      , curBaseProData[0].Name
                                                                                      , curBaseProData[0]);
                }
            }
        }

        if (null != m_trans_StrengthenEquipProperty2)
        {
            propertyenable = (null != curBaseProData) && (curBaseProData.Count > 1) ||
                             (null != nextBaseProData) && (nextBaseProData.Count > 1);
            if (m_trans_StrengthenEquipProperty2.gameObject.activeSelf != propertyenable)
            {
                m_trans_StrengthenEquipProperty2.gameObject.SetActive(propertyenable);
            }

            if (propertyenable)
            {
                content = m_trans_StrengthenEquipProperty2.Find("Content");
                max     = m_trans_StrengthenEquipProperty2.Find("Max");

                if (content.gameObject.activeSelf != enable)
                {
                    content.gameObject.SetActive(enable);
                }
                if (enable)
                {
                    content.Find("Name").GetComponent <UILabel>().text
                        = ((null != curBaseProData && curBaseProData.Count > 1) ? curBaseProData[1].Name : nextBaseProData[1].Name);
                    content.Find("CurValue").GetComponent <UILabel>().text
                        = "+" + ((null != curBaseProData && curBaseProData.Count > 1) ? curBaseProData[1].ToString() : "0");
                    content.Find("TargetValue").GetComponent <UILabel>().text = "+" + nextBaseProData[1].ToString();
                }
                if (max.gameObject.activeSelf == enable)
                {
                    max.gameObject.SetActive(!enable);
                }

                if (!enable)
                {
                    max.Find("AttrTxt").GetComponent <UILabel>().text = string.Format("{0} +{1}"
                                                                                      , curBaseProData[1].Name
                                                                                      , curBaseProData[1]);
                }
            }
        }

        if (null != m_trans_StrengthenMax)
        {
            if (m_trans_StrengthenMax.gameObject.activeSelf != isMax)
            {
                m_trans_StrengthenMax.gameObject.SetActive(isMax);
            }
        }

        //设置消耗材料
        SetStrengthenCostMaterial();
        //设置消耗钱币
        SetStrengthenCost();
        RefreshBtnState();
    }
Exemple #4
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);
                }
            }
        }
    }
    protected override void OnLoading()
    {
        base.OnLoading();
        GameObject preObj = null;

        if (null == m_showGrid && null != m_trans_InfoGridRoot)
        {
            preObj = UIManager.GetResGameObj(GridID.Uiitemshowgrid);
            if (null != preObj)
            {
                GameObject cloneObj = NGUITools.AddChild(m_trans_InfoGridRoot.gameObject, preObj);
                if (null != cloneObj)
                {
                    m_showGrid = cloneObj.GetComponent <UIItemShowGrid>();
                    if (null == m_showGrid)
                    {
                        m_showGrid = cloneObj.AddComponent <UIItemShowGrid>();
                    }
                    if (null != m_showGrid && !m_showGrid.Visible)
                    {
                        m_showGrid.SetVisible(true);
                        m_showGrid.RegisterUIEventDelegate((eventType, data, param) =>
                        {
                            if (eventType == UIEventType.Click)
                            {
                                Muhon muhon = DataManager.Manager <ItemManager>().GetBaseItemByQwThisId <Muhon>(blendMuhonId);
                                if (null != muhon)
                                {
                                    TipsManager.Instance.ShowItemTips(muhon);
                                }
                            }
                        });
                    }
                }
            }
        }

        mlstGrids = new List <UIProperyGradeGrid>();
        preObj    = UIManager.GetResGameObj(GridID.Uiproperygradegrid) as GameObject;
        if (null != m_grid_AdditiveContent)
        {
            UIProperyGradeGrid mGrid = null;
            GameObject         obj   = null;
            for (EquipDefine.AttrIndex i = EquipDefine.AttrIndex.First
                 ; i <= EquipDefine.AttrIndex.Fifth; i++)
            {
                obj = NGUITools.AddChild(m_grid_AdditiveContent.gameObject, preObj);
                if (null != obj)
                {
                    obj.name = ((int)i).ToString();
                    mGrid    = obj.GetComponent <UIProperyGradeGrid>();
                    if (null == mGrid)
                    {
                        mGrid = obj.gameObject.AddComponent <UIProperyGradeGrid>();
                    }
                    mlstGrids.Add(mGrid);
                }
            }
            m_grid_AdditiveContent.Reposition();
        }
    }