protected override void OnAwake()
    {
        base.OnAwake();
        m_lab_name = CacheTransform.Find("Content/Infos/Name").GetComponent <UILabel>();
        if (null != m_lab_name)
        {
            m_lab_name.color = ColorManager.GetColor32OfType(ColorType.White);
        }
        m_ts_infos  = CacheTransform.Find("Content/Infos");
        m_ts_none   = CacheTransform.Find("Content/None");
        m_ts_unload = CacheTransform.Find("Content/Infos/Unload");
        InitItemInfoGrid(CacheTransform.Find("Content/Infos/InfoGridRoot/InfoGrid"));
        mtsInfoRoot = CacheTransform.Find("Content/Infos/InfoGridRoot");
        if (null != m_ts_unload)
        {
            UIEventListener.Get(m_ts_unload.gameObject).onClick = (obj) =>
            {
                InvokeUIDlg(UIEventType.Click, this, true);
            };
        }
        m_ts_AttrRoot = CacheTransform.Find("Content/Infos/AttrRoot");
        if (null != m_ts_AttrRoot)
        {
            int size = 5;
            m_TransDatas = new AttrTransData[size];
            Transform     tempTs   = null;
            StringBuilder builder  = new StringBuilder();
            AttrTransData tempData = null;
            for (int i = 0; i < size; i++)
            {
                tempData = new AttrTransData();
                builder.Remove(0, builder.Length);
                builder.Append(i + 1);
                tempData.Root = m_ts_AttrRoot.Find(builder.ToString());

                builder.Remove(0, builder.Length);
                builder.Append(i + 1);
                builder.Append("/Content/Grade/Grade");
                tempTs = m_ts_AttrRoot.Find(builder.ToString());

                if (null != tempTs)
                {
                    tempData.Grade = tempTs.GetComponent <UILabel>();
                }

                builder.Remove(0, builder.Length);
                builder.Append(i + 1);
                builder.Append("/Content/Des");
                tempTs = m_ts_AttrRoot.Find(builder.ToString());
                if (null != tempTs)
                {
                    tempData.Des = tempTs.GetComponent <UILabel>();
                }
                m_TransDatas[i] = tempData;
            }
        }
    }
Beispiel #2
0
    private void SetOpenData()
    {
        if (null == compoundSelectData)
        {
            return;
        }
        SetTransformState(true);
        ResetInfoGrid();
        BaseItem baseItem = DataManager.Manager <ItemManager>().GetTempBaseItemByBaseID <BaseItem>(compoundSelectData.BaseID);
        int      attrNum  = (null != compoundSelectData.Attrs) ? compoundSelectData.Attrs.Count : 0;

        SetIcon(true, baseItem.Icon);
        SetBorder(true, ItemDefine.GetItemBorderIcon((uint)attrNum));
        if (compoundSelectData.IsBind)
        {
            SetBindMask(true);
        }
        if (null != m_TransDatas)
        {
            AttrTransData      temData = null;
            GameCmd.PairNumber pair    = null;
            EquipManager       emgr    = DataManager.Manager <EquipManager>();

            for (int i = 0, max = m_TransDatas.Length; i < max; i++)
            {
                temData = m_TransDatas[i];
                if (temData.Root == null)
                {
                    continue;
                }
                if (null != compoundSelectData.Attrs && compoundSelectData.Attrs.Count > i)
                {
                    if (!temData.Root.gameObject.activeSelf)
                    {
                        temData.Root.gameObject.SetActive(true);
                    }
                    pair = compoundSelectData.Attrs[i];
                    if (null != temData.Grade)
                    {
                        temData.Grade.text = emgr.GetAttrGrade(compoundSelectData.Attrs[i]).ToString();
                    }

                    if (null != temData.Des)
                    {
                        temData.Des.text = emgr.GetAttrDes(compoundSelectData.Attrs[i]);
                    }
                }
                else if (temData.Root.gameObject.activeSelf)
                {
                    temData.Root.gameObject.SetActive(false);
                }
            }
        }
        SetSelect(m_bSelect);
    }
Beispiel #3
0
    void UpdateMainEquipAttr(bool canCompound)
    {
        Equip equip = Data;

        if (null != m_trans_CompoundMainAttrRoot)
        {
            if (m_trans_CompoundMainAttrRoot.gameObject.activeSelf != canCompound)
            {
                m_trans_CompoundMainAttrRoot.gameObject.SetActive(canCompound);
            }

            if (canCompound)
            {
                List <GameCmd.PairNumber> pairs         = equip.GetAdditiveAttr();
                AttrTransData             tempTransData = null;
                GameCmd.PairNumber        pair          = null;
                for (int i = 0, max = m_compoundAttrTransData.Length; i < max; i++)
                {
                    tempTransData = m_compoundAttrTransData[i];
                    if (null == tempTransData.Root)
                    {
                        continue;
                    }

                    if (null != pairs && pairs.Count > i)
                    {
                        if (!tempTransData.Root.gameObject.activeSelf)
                        {
                            tempTransData.Root.gameObject.SetActive(true);
                        }

                        pair = pairs[i];
                        if (null != tempTransData.Grade)
                        {
                            tempTransData.Grade.text = emgr.GetAttrGrade(pair).ToString();
                        }

                        if (null != tempTransData.Des)
                        {
                            tempTransData.Des.text = emgr.GetAttrDes(pair);
                        }
                    }
                    else if (tempTransData.Root.gameObject.activeSelf)
                    {
                        tempTransData.Root.gameObject.SetActive(false);
                    }
                }
            }
        }
    }
    /// <summary>
    ///
    /// </summary>
    /// <param name="none"></param>
    /// <param name="qwThisId"></param>
    /// <param name="index"></param>
    public void SetGridViewData(bool none, uint qwThisId = 0)
    {
        ResetInfoGrid();
        this.m_uint_qwThisId = qwThisId;
        if (null != m_ts_none && m_ts_none.gameObject.activeSelf != none)
        {
            m_ts_none.gameObject.SetActive(none);
        }

        if (null != m_ts_infos && m_ts_infos.gameObject.activeSelf == none)
        {
            m_ts_infos.gameObject.SetActive(!none);
        }
        if (!none)
        {
            ResetInfoGrid();
            Equip equip = DataManager.Manager <ItemManager>().GetBaseItemByQwThisId <Equip>(qwThisId);
            if (null != equip)
            {
                SetBorder(true, equip.BorderIcon);
                SetIcon(true, equip.Icon);
                SetBindMask(equip.IsBind);
            }
            if (null != m_lab_name)
            {
                m_lab_name.text = equip.Name;
            }
            if (null != m_TransDatas)
            {
                EquipManager              emgr          = DataManager.Manager <EquipManager>();
                GameCmd.PairNumber        pair          = null;
                AttrTransData             tempTransData = null;
                List <GameCmd.PairNumber> pairs         = equip.GetAdditiveAttr();
                for (int i = 0, max = m_TransDatas.Length; i < max; i++)
                {
                    tempTransData = m_TransDatas[i];
                    if (null == tempTransData.Root)
                    {
                        continue;
                    }

                    if (null != pairs && pairs.Count > i)
                    {
                        if (!tempTransData.Root.gameObject.activeSelf)
                        {
                            tempTransData.Root.gameObject.SetActive(true);
                        }
                        pair = pairs[i];
                        if (null != tempTransData.Grade)
                        {
                            tempTransData.Grade.text = emgr.GetAttrGrade(pair).ToString();
                        }

                        if (null != tempTransData.Des)
                        {
                            tempTransData.Des.text = emgr.GetAttrDes(pair);
                        }
                    }
                    else if (tempTransData.Root.gameObject.activeSelf)
                    {
                        tempTransData.Root.gameObject.SetActive(false);
                    }
                }
            }
        }
    }
Beispiel #5
0
    /// <summary>
    /// 初始化合成组件
    /// </summary>
    void InitCompoundWidgets()
    {
        if (IsInitStatus(ForgingPanelMode.Compound))
        {
            return;
        }
        SetInitStatus(ForgingPanelMode.Compound, true);
        Transform  tempTs   = null;
        GameObject cloneObj = null;

        //組件
        if (null != m_trans_CompoundGrowShowRoot && null == m_compoundGrowShow)
        {
            tempTs = UIManager.GetObj(GridID.Uiitemgrowshowgrid);
            if (null != tempTs)
            {
                Util.AddChildToTarget(m_trans_CompoundGrowShowRoot, tempTs);
                cloneObj = tempTs.gameObject;
                if (null != cloneObj)
                {
                    m_compoundGrowShow = cloneObj.GetComponent <UIItemGrowShowGrid>();
                    if (null == m_compoundGrowShow)
                    {
                        m_compoundGrowShow = cloneObj.AddComponent <UIItemGrowShowGrid>();
                    }
                    m_compoundGrowShow.RegisterUIEventDelegate(OnUIEventCallback);
                }
            }
        }

        if (null != m_trans_CompoundMainAttrRoot)
        {
            m_compoundAttrTransData = new AttrTransData[5];
            AttrTransData tempAttrData = null;
            StringBuilder strBuilder   = new StringBuilder();
            for (int i = 0, max = m_compoundAttrTransData.Length; i < max; i++)
            {
                tempAttrData = new AttrTransData();
                strBuilder.Remove(0, strBuilder.Length);
                strBuilder.Append(i + 1);
                tempAttrData.Root = m_trans_CompoundMainAttrRoot.Find(strBuilder.ToString());
                if (null == tempAttrData.Root)
                {
                    continue;
                }
                strBuilder.Append("/Content/Grade/Grade");
                tempTs = m_trans_CompoundMainAttrRoot.Find(strBuilder.ToString());
                if (null != tempTs)
                {
                    tempAttrData.Grade = tempTs.GetComponent <UILabel>();
                }
                strBuilder.Remove(0, strBuilder.Length);
                strBuilder.Append(i + 1);
                strBuilder.Append("/Content/Des");
                tempTs = m_trans_CompoundMainAttrRoot.Find(strBuilder.ToString());
                if (null != tempTs)
                {
                    tempAttrData.Des = tempTs.GetComponent <UILabel>();
                }
                m_compoundAttrTransData[i] = tempAttrData;
            }
        }

        //祝福
        if (null != m_trans_ZFRoot && null == m_zfGrowShow)
        {
            tempTs   = m_trans_UIZFGrid;
            cloneObj = tempTs.gameObject;
            if (null != tempTs)
            {
                Util.AddChildToTarget(m_trans_ZFRoot, tempTs);
                if (null != cloneObj)
                {
                    m_zfGrowShow = cloneObj.GetComponent <UIZFGrid>();
                    if (null == m_zfGrowShow)
                    {
                        m_zfGrowShow = cloneObj.AddComponent <UIZFGrid>();
                    }
                }
                m_zfGrowShow.RegisterUIEventDelegate(OnUIEventCallback);
            }
        }


        //副武器初始化
        if (null != m_trans_CompoundDeputyContent)
        {
            m_lst_equipSelects = new List <UIEquipDeputySelectGrid>();

            UIEventDelegate dpdAction = (eventType, obj, param) =>
            {
                if (eventType == UIEventType.Click)
                {
                    UIEquipDeputySelectGrid esg = obj as UIEquipDeputySelectGrid;
                    if (null != param && param is bool)
                    {
                        UnloadCompoundDeputyEquipFill(esg.Index);
                    }
                    else
                    {
                        if (!IsCompoundDeputyEquipFill(esg.Index))
                        {
                            OnSelectCompoundDeputy(esg.Index);
                        }
                    }
                }
            };
            UIEquipDeputySelectGrid dps = null;
            string tempStr = "";
            for (int i = 0; i < 3; i++)
            {
                tempStr = string.Format("EDSG{0}", i + 1);
                tempTs  = m_trans_CompoundDeputyContent.Find(tempStr);
                if (null == tempTs)
                {
                    continue;
                }

                cloneObj = tempTs.gameObject;
                if (null != cloneObj)
                {
                    dps = cloneObj.GetComponent <UIEquipDeputySelectGrid>();
                    if (null == dps)
                    {
                        dps = cloneObj.AddComponent <UIEquipDeputySelectGrid>();
                    }
                    dps.SetIndex(i);
                    dps.RegisterUIEventDelegate(dpdAction);
                    m_lst_equipSelects.Add(dps);
                }
            }
        }

        ResetCompound();
    }
Beispiel #6
0
    protected override void OnAwake()
    {
        base.OnAwake();
        Transform tempTrans = null;

        m_toggle   = CacheTransform.Find("Content/OpenContent/Toggle").GetComponent <UIToggle>();
        selectMask = CacheTransform.Find("Content/OpenContent/SelectMask");
        if (null != m_toggle)
        {
            m_toggle.onChange.Add(new EventDelegate(() =>
            {
                if (IsSelect && !callEvent)
                {
                    callEvent = true;
                }
                InvokeCallBack();
                if (null != selectMask && selectMask.gameObject.activeSelf != IsSelect)
                {
                    selectMask.gameObject.SetActive(IsSelect);
                }
            }));
        }

        m_tsOpen  = CacheTransform.Find("Content/OpenContent");
        m_tsClose = CacheTransform.Find("Content/CloseContent");
        if (null != m_tsClose)
        {
            m_openAnim = m_tsClose.GetComponent <TweenRotation>();
            if (null != m_openAnim)
            {
                m_openAnim.AddOnFinished(() =>
                {
                    OnAnimFinish();
                });
            }
        }

        m_tsFreeGet  = CacheTransform.Find("Content/CloseContent/FreeGet");
        m_tsCostRoot = CacheTransform.Find("Content/CloseContent/CostRoot");

        m_tsCostMoney = CacheTransform.Find("Content/CloseContent/CostRoot/Money");
        tempTrans     = CacheTransform.Find("Content/CloseContent/CostRoot/Money/Icon");
        if (null != tempTrans)
        {
            m_moneyIcon = tempTrans.GetComponent <UISprite>();
        }

        m_tsCostProp = CacheTransform.Find("Content/CloseContent/CostRoot/Prop");
        tempTrans    = CacheTransform.Find("Content/CloseContent/CostRoot/Prop/Icon");
        if (null != tempTrans)
        {
            m_propIcon = tempTrans.GetComponent <UITexture>();
        }

        tempTrans = CacheTransform.Find("Content/CloseContent/CostRoot/Prop/Broder");
        if (null != tempTrans)
        {
            m_propBorder = tempTrans.GetComponent <UISprite>();
        }

        tempTrans = CacheTransform.Find("Content/CloseContent/CostRoot/Num");
        if (null != tempTrans)
        {
            m_costNum = tempTrans.GetComponent <UILabel>();
        }

        tempTrans = CacheTransform.Find("Content/OpenContent/AttrRoot");
        if (null != tempTrans)
        {
            int size = 5;
            m_TransDatas = new AttrTransData[size];
            Transform     tempTs   = null;
            StringBuilder builder  = new StringBuilder();
            AttrTransData tempData = null;
            for (int i = 0; i < size; i++)
            {
                tempData = new AttrTransData();
                builder.Remove(0, builder.Length);
                builder.Append(i + 1);
                tempData.Root = tempTrans.Find(builder.ToString());

                builder.Remove(0, builder.Length);
                builder.Append(i + 1);
                builder.Append("/Content/Grade/Grade");
                tempTs = tempTrans.Find(builder.ToString());

                if (null != tempTs)
                {
                    tempData.Grade = tempTs.GetComponent <UILabel>();
                }

                builder.Remove(0, builder.Length);
                builder.Append(i + 1);
                builder.Append("/Content/Des");
                tempTs = tempTrans.Find(builder.ToString());
                if (null != tempTs)
                {
                    tempData.Des = tempTs.GetComponent <UILabel>();
                }
                m_TransDatas[i] = tempData;
            }
        }

        InitItemInfoGrid(CacheTransform.Find("Content/OpenContent/InfoGridRoot/InfoGrid"), false);
    }