예제 #1
0
    private void InitEvolveWidgets()
    {
        if (IsInitStatus(TabMode.JinHua))
        {
            return;
        }
        SetInitStatus(TabMode.JinHua, true);

        if (null != m_widget_PreviewCollider)
        {
            UIEventListener.Get(m_widget_PreviewCollider.gameObject).onClick = (preViewObj) =>
            {
                SetEvolvePre(false);
            };
        }

        Transform clone = null;

        if (null != m_trans_EvolveGrowRoot && null == m_evolveCurGrow)
        {
            clone = UIManager.AddGridTransform(GridID.Uiitemshowgrid, m_trans_EvolveGrowRoot);
            if (null != clone)
            {
                m_evolveCurGrow = clone.GetComponent <UIItemShowGrid>();
                if (null == m_evolveCurGrow)
                {
                    m_evolveCurGrow = clone.gameObject.AddComponent <UIItemShowGrid>();
                }
            }
        }

        m_dicStarData    = new Dictionary <EquipDefine.AttrIndex, MuhonStarData>();
        m_dicMuhonDeputy = new Dictionary <EquipDefine.AttrIndex, UIItemShowGrid>();

        Transform      tempTrans    = null;
        UIToggle       tempToggle   = null;
        string         indexStr     = "";
        UIItemShowGrid tempShowGrid = null;

        UIEventDelegate deputyAction = (eventType, data, param) =>
        {
            if (eventType == UIEventType.Click && data is UIItemShowGrid)
            {
                UIItemShowGrid        showGrid = data as UIItemShowGrid;
                EquipDefine.AttrIndex index    = EquipDefine.AttrIndex.None;
                if (TryGetEvolveGridAttrIndex(showGrid.CacheTransform.gameObject, out index))
                {
                    if (null != param && param is bool)
                    {
                        OnUnloadEvolveMuhon(index);
                    }
                    else if (!IsDeputyEvolveGridFill(index))
                    {
                        OnSelectEvolveMuhon(index);
                    }
                }
            }
        };

        m_dicParticleWidgets = new Dictionary <EquipDefine.AttrIndex, UIParticleWidget>();
        UIParticleWidget tempParticleWidget = null;
        Transform        tempParticleTran   = null;

        //星星爆点组件初始化
        if (null == m_evolveStarBoomParticleWidget && null != m_trans_EvolveStarLightParticle)
        {
            m_evolveStarBoomParticleWidget = m_trans_EvolveStarLightParticle.GetComponent <UIParticleWidget>();
            if (null == m_evolveStarBoomParticleWidget)
            {
                m_evolveStarBoomParticleWidget = m_trans_EvolveStarLightParticle.gameObject.AddComponent <UIParticleWidget>();
            }
            if (null != m_evolveStarBoomParticleWidget && null != m_label_EvolveEffetDepthLimitMask)
            {
                m_evolveStarBoomParticleWidget.depth = m_label_EvolveEffetDepthLimitMask.depth - 1;
            }
        }

        //进化目标组件爆点初始化
        if (null == m_evolveTargetParticleWidget && null != m_trans_EvolveTargeParticle)
        {
            m_evolveTargetParticleWidget = m_trans_EvolveTargeParticle.GetComponent <UIParticleWidget>();
            if (null == m_evolveTargetParticleWidget)
            {
                m_evolveTargetParticleWidget = m_trans_EvolveTargeParticle.gameObject.AddComponent <UIParticleWidget>();
            }
            if (null != m_evolveTargetParticleWidget && null != m_label_EvolveEffetDepthLimitMask)
            {
                m_evolveTargetParticleWidget.depth = m_label_EvolveEffetDepthLimitMask.depth - 1;
            }
        }

        for (EquipDefine.AttrIndex i = EquipDefine.AttrIndex.None + 1; i < EquipDefine.AttrIndex.Max; i++)
        {
            if (!Enum.IsDefined(typeof(EquipDefine.AttrIndex), i)) //|| i == EquipDefine.AttrIndex.Fifth)
            {
                continue;
            }
            indexStr = ((int)i).ToString();
            if (null != m_trans_CostEvolveStar)
            {
                tempTrans = m_trans_CostEvolveStar.Find(indexStr);
                if (null != tempTrans)
                {
                    tempToggle = tempTrans.GetComponent <UIToggle>();
                    if (null != tempToggle)
                    {
                        m_dicStarData.Add(i, MuhonStarData.Create(tempToggle, i));
                    }
                }
            }

            if (null != m_trans_CostEvolveMuhon)
            {
                if (null != tempTrans)
                {
                    tempTrans        = m_trans_CostEvolveMuhon.Find(indexStr);
                    tempParticleTran = tempTrans.Find(indexStr);
                    if (null != tempParticleTran)
                    {
                        tempParticleWidget = tempParticleTran.GetComponent <UIParticleWidget>();
                        if (null == tempParticleWidget)
                        {
                            tempParticleWidget = tempParticleTran.gameObject.AddComponent <UIParticleWidget>();
                        }
                        if (null != tempParticleWidget)
                        {
                            if (null != m_label_EvolveEffetDepthLimitMask)
                            {
                                tempParticleWidget.depth = m_label_EvolveEffetDepthLimitMask.depth - 1;
                            }
                            if (!m_dicParticleWidgets.ContainsKey(i))
                            {
                                m_dicParticleWidgets.Add(i, tempParticleWidget);
                            }
                        }
                    }


                    clone        = UIManager.AddGridTransform(GridID.Uiitemshowgrid, tempTrans);
                    tempShowGrid = clone.GetComponent <UIItemShowGrid>();
                    if (null == tempShowGrid)
                    {
                        tempShowGrid = clone.gameObject.AddComponent <UIItemShowGrid>();
                    }
                    if (null != tempShowGrid)
                    {
                        tempShowGrid.RegisterUIEventDelegate(deputyAction);
                        m_dicMuhonDeputy.Add(i, tempShowGrid);
                    }
                }
            }
        }

        if (null != m_trans_EvolveMaxGrowRoot && null == m_evolveMaxGrow)
        {
            clone = UIManager.AddGridTransform(GridID.Uiitemgrowshowgrid, m_trans_EvolveMaxGrowRoot);
            if (null != clone)
            {
                m_evolveMaxGrow = clone.GetComponent <UIItemGrowShowGrid>();
                if (null == m_evolveMaxGrow)
                {
                    m_evolveMaxGrow = clone.gameObject.AddComponent <UIItemGrowShowGrid>();
                }
            }
        }

        m_dicSelectMuhonDeputy = new Dictionary <EquipDefine.AttrIndex, uint>();
    }
예제 #2
0
    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;
        }
    }
예제 #3
0
    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();
        }
    }