Exemple #1
0
    /// <summary>
    /// 选择圣魂操作
    /// </summary>
    private void OnSelectEvolveMuhon(EquipDefine.AttrIndex attrIndex)
    {
        if (DataManager.Manager <UIPanelManager>().IsShowPanel(PanelID.ItemChoosePanel))
        {
            return;
        }

        Muhon currentData = Data;

        if (null == currentData)
        {
            TipsManager.Instance.ShowTips(LocalTextType.Local_TXT_Soul_ChooseEvolveMuhonTips);
            return;
        }

        if (!currentData.IsMaxLv)
        {
            TipsManager.Instance.ShowTips(LocalTextType.Local_TXT_Soul_MuhonNeedMaxLvTips);
            return;
        }
        //筛选满足条件的圣魂
        List <uint> data        = new List <uint>();
        List <uint> filterTypes = new List <uint>();

        filterTypes.Add((uint)GameCmd.EquipType.EquipType_SoulOne);
        List <uint> muhonList = imgr.GetItemByType(GameCmd.ItemBaseType.ItemBaseType_Equip, filterTypes, GameCmd.PACKAGETYPE.PACKAGETYPE_MAIN);

        //过滤
        if (null != muhonList && muhonList.Count != 0)
        {
            for (int i = 0; i < muhonList.Count; i++)
            {
                if (currentData.IsMatchEvolve(muhonList[i], false))
                {
                    data.Add(muhonList[i]);
                }
            }
        }
        if (data.Count == 0)
        {
            TipsManager.Instance.ShowTips(tmgr.GetLocalFormatText(LocalTextType.Soul_Star_1
                                                                  , tmgr.GetMuhonStarName(currentData.StartLevel)));
            return;
        }

        data.Sort((left, right) =>
        {
            Muhon leftM  = imgr.GetBaseItemByQwThisId <Muhon>(left);
            Muhon rightM = imgr.GetBaseItemByQwThisId <Muhon>(right);
            if (currentData.IsMatchEvolve(rightM, true))
            {
                if (currentData.IsMatchEvolve(leftM, true))
                {
                    return(rightM.Level - leftM.Level);
                }
                return(1);
            }
            else if (currentData.IsMatchEvolve(leftM, true))
            {
                return(-1);
            }
            else
            {
                return(rightM.Level - leftM.Level);
            }
            return(0);
        });



        Dictionary <EquipDefine.AttrIndex, uint> curSelectDeputyMuhon   = new Dictionary <EquipDefine.AttrIndex, uint>();
        Dictionary <uint, EquipDefine.AttrIndex> curSelectDeputyMuhonRS = new Dictionary <uint, EquipDefine.AttrIndex>();
        List <uint> selectDeputyIds = new List <uint>();
        var         enumerator      = m_dicSelectMuhonDeputy.GetEnumerator();

        while (enumerator.MoveNext())
        {
            curSelectDeputyMuhon.Add(enumerator.Current.Key, enumerator.Current.Value);
            curSelectDeputyMuhonRS.Add(enumerator.Current.Value, enumerator.Current.Key);
        }

        UILabel          desLabel         = null;
        bool             needRefreshLabel = false;
        Action <UILabel> desLabAction     = (des) =>
        {
            desLabel = des;
            if (null != desLabel)
            {
                desLabel.text = tmgr.GetLocalFormatText(LocalTextType.Local_TXT_Soul_ChooseNum,
                                                        curSelectDeputyMuhon.Count, currentData.EvolveNeedMuhonNum);
            }
        };

        UIEventDelegate eventDlg = (eventTye, grid, param) =>
        {
            if (eventTye == UIEventType.Click)
            {
                UIWeaponSoulInfoSelectGrid tempGrid = grid as UIWeaponSoulInfoSelectGrid;
                if (curSelectDeputyMuhonRS.ContainsKey(tempGrid.QWThisId))
                {
                    curSelectDeputyMuhon.Remove(curSelectDeputyMuhonRS[tempGrid.QWThisId]);
                    curSelectDeputyMuhonRS.Remove(tempGrid.QWThisId);
                    tempGrid.SetHightLight(false);
                }
                else if (currentData.IsMatchEvolve(tempGrid.QWThisId))
                {
                    needRefreshLabel = true;
                    if (curSelectDeputyMuhon.Count < currentData.EvolveNeedMuhonNum)
                    {
                        if (!curSelectDeputyMuhon.ContainsKey(attrIndex))
                        {
                            curSelectDeputyMuhonRS.Add(tempGrid.QWThisId, attrIndex);
                            curSelectDeputyMuhon.Add(attrIndex, tempGrid.QWThisId);
                        }
                        else
                        {
                            for (EquipDefine.AttrIndex i = EquipDefine.AttrIndex.None + 1; i < EquipDefine.AttrIndex.Max; i++)
                            {
                                if (!Enum.IsDefined(typeof(EquipDefine.AttrIndex), i))
                                {
                                    continue;
                                }
                                if (((int)i) > currentData.EvolveNeedMuhonNum)
                                {
                                    break;
                                }
                                if (curSelectDeputyMuhon.ContainsKey(i))
                                {
                                    continue;
                                }

                                curSelectDeputyMuhonRS.Add(tempGrid.QWThisId, i);
                                curSelectDeputyMuhon.Add(i, tempGrid.QWThisId);
                                break;
                            }
                        }
                        tempGrid.SetHightLight(true);
                    }
                }
                else
                {
                    Muhon selectMuhon = imgr.GetBaseItemByQwThisId <Muhon>(tempGrid.QWThisId);
                    if (null != selectedMuhonId)
                    {
                        string txt = "";
                        if (selectMuhon.IsActive && !selectMuhon.IsMaxLv)
                        {
                            txt = tmgr.GetLocalText(LocalTextType.Local_TXT_Soul_NotMatchLvTips);
                        }
                        else if (!selectMuhon.IsActive && selectMuhon.IsMaxLv)
                        {
                            txt = tmgr.GetLocalText(LocalTextType.Local_TXT_Soul_UnactiveNotice);
                        }
                        else if (!selectMuhon.IsActive && !selectMuhon.IsMaxLv)
                        {
                            txt = tmgr.GetLocalText(LocalTextType.Local_TXT_Soul_NotMatchLvActiveTips);
                        }
                        TipsManager.Instance.ShowTips(txt);
                    }
                }

                if (null != desLabel && needRefreshLabel)
                {
                    desLabel.text = tmgr.GetLocalFormatText(LocalTextType.Local_TXT_Soul_ChooseNum,
                                                            curSelectDeputyMuhon.Count, currentData.EvolveNeedMuhonNum);
                }
            }
        };


        ItemChoosePanel.ItemChooseShowData showData = new ItemChoosePanel.ItemChooseShowData()
        {
            createNum        = data.Count,
            title            = tmgr.GetLocalText(LocalTextType.Local_TXT_Soul_ChooseMuhon),
            cloneTemp        = UIManager.GetResGameObj(GridID.Uiweaponsoulinfoselectgrid) as GameObject,
            onChooseCallback = () =>
            {
                var enumeratorSelect = curSelectDeputyMuhon.GetEnumerator();
                m_dicSelectMuhonDeputy.Clear();
                while (enumeratorSelect.MoveNext())
                {
                    m_dicSelectMuhonDeputy.Add(enumeratorSelect.Current.Key, enumeratorSelect.Current.Value);
                }
                UpdateEvolve(Data);
            },
            gridCreateCallback = (obj, index) =>
            {
                if (index >= data.Count)
                {
                    Engine.Utility.Log.Error("OnSelectInvokeEquip error,index out of range");
                }
                else
                {
                    Muhon itemData = imgr.GetBaseItemByQwThisId <Muhon>(data[index]);
                    if (null == itemData)
                    {
                        Engine.Utility.Log.Error("OnSelectInvokeEquip error,get itemData qwThisId:{0}", data[index]);
                    }
                    else
                    {
                        UIWeaponSoulInfoSelectGrid weaponsoulGrid = obj.GetComponent <UIWeaponSoulInfoSelectGrid>();
                        if (null == weaponsoulGrid)
                        {
                            weaponsoulGrid = obj.AddComponent <UIWeaponSoulInfoSelectGrid>();
                        }
                        weaponsoulGrid.RegisterUIEventDelegate(eventDlg);
                        weaponsoulGrid.SetGridViewData(itemData.QWThisID, curSelectDeputyMuhonRS.ContainsKey(data[index])
                                                       , currentData.IsMatchEvolve(data[index]), false);
                    }
                }
            },
            desPassCallback = desLabAction,
        };
        DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.ItemChoosePanel, data: showData);
    }
    /// <summary>
    /// 点击属性提升符石选择
    /// </summary>
    private void OnSelectProcessRuneStone()
    {
        if (!IsSelectEquipAttr() || DataManager.Manager <UIPanelManager>().IsShowPanel(PanelID.ItemChoosePanel))
        {
            TipsManager.Instance.ShowTips("请勾选需要提升的属性");
            return;
        }

        GameCmd.PairNumber selectAttrPair = GetEquipAttrByIndex((int)m_em_selectEquipAttrIndex);
        if (null == selectAttrPair)
        {
            Engine.Utility.Log.Error("Get AttrPair faield,promoteid:{0}", 0);
            return;
        }
        uint selectAttrGrade = emgr.GetAttrGrade(selectAttrPair);
        bool filterEqual     = IsProccessMode(ForgingProccessMode.Promote);
        //筛选满足条件符石
        List <uint> baseIdList = emgr.GetMatchProperyRunestone(selectAttrPair, filterEqual);

        UILabel          desLabel     = null;
        Action <UILabel> desLabAction = (des) =>
        {
            desLabel = des;
            if (null != desLabel)
            {
                if (filterEqual)
                {
                    desLabel.text = m_tmgr.GetLocalText(LocalTextType.Local_TXT_Rune_1);
                }
                else
                {
                    desLabel.text = m_tmgr.GetLocalText(LocalTextType.Local_TXT_Rune_2);
                }
            }
        };
        uint tempSelectGemRuneStoneId             = 0;
        UIRSInfoSelectGrid selectGemRuneStoneGrid = null;
        UIEventDelegate    eventDlg = (eventTye, grid, param) =>
        {
            if (eventTye == UIEventType.Click)
            {
                UIRSInfoSelectGrid tempGrid = grid as UIRSInfoSelectGrid;
                RuneStone          tempRs   = DataManager.Manager <ItemManager>()
                                              .GetTempBaseItemByBaseID <RuneStone>(tempGrid.BaseId, ItemDefine.ItemDataType.RuneStone);
                if (tempSelectGemRuneStoneId == tempGrid.BaseId)
                {
                    tempSelectGemRuneStoneId = 0;
                    tempGrid.SetHightLight(false);
                }
                else if (tempGrid.BaseId != 0)
                {
                    bool enable = (!filterEqual) ? (tempRs.Grade >= selectAttrGrade) : (tempRs.Grade > selectAttrGrade);
                    if (enable)
                    {
                        tempSelectGemRuneStoneId = tempGrid.BaseId;
                        if (null != selectGemRuneStoneGrid)
                        {
                            selectGemRuneStoneGrid.SetHightLight(false);
                        }
                        tempGrid.SetHightLight(true);
                        selectGemRuneStoneGrid = tempGrid;
                    }
                    else if (filterEqual)
                    {
                        TipsManager.Instance.ShowTips(LocalTextType.Rune_Promote1);
                    }
                    else
                    {
                        TipsManager.Instance.ShowTips(LocalTextType.Rune_Eliminate1);
                    }
                }
            }
        };

        ItemChoosePanel.ItemChooseShowData showData = new ItemChoosePanel.ItemChooseShowData()
        {
            createNum        = baseIdList.Count,
            title            = "选择符石",
            nullTips         = "您未拥有该类符石",
            cloneTemp        = m_trans_UIRSInfoSelectGrid.gameObject,
            onChooseCallback = () =>
            {
                if (tempSelectGemRuneStoneId != m_uint_selectRSBaseId)
                {
                    m_uint_selectRSBaseId = tempSelectGemRuneStoneId;
                    UpdateProccess(Data);
                }
            },
            gridCreateCallback = (obj, index) =>
            {
                if (index >= baseIdList.Count)
                {
                    Engine.Utility.Log.Error("OnSelectPromoteRuneStone error,index out of range");
                }
                else
                {
                    table.ItemDataBase      tempItemDataBase      = imgr.GetLocalDataBase <table.ItemDataBase>(baseIdList[index]);
                    table.RunestoneDataBase tempRuneStoneDataBase = imgr.GetLocalDataBase <table.RunestoneDataBase>(baseIdList[index]);
                    if (null == tempItemDataBase || null == tempRuneStoneDataBase)
                    {
                        Engine.Utility.Log.Error("OnSelectPromoteRuneStone error,get itemdatabase or tempItemDataBase null baseid:{0}", baseIdList[index]);
                    }
                    else
                    {
                        UIRSInfoSelectGrid gemRuneStoneGrid = obj.GetComponent <UIRSInfoSelectGrid>();
                        if (null == gemRuneStoneGrid)
                        {
                            gemRuneStoneGrid = obj.AddComponent <UIRSInfoSelectGrid>();
                        }
                        gemRuneStoneGrid.RegisterUIEventDelegate(eventDlg);
                        RuneStone rs = DataManager.Manager <ItemManager>()
                                       .GetTempBaseItemByBaseID <RuneStone>(baseIdList[index], ItemDefine.ItemDataType.RuneStone);
                        bool select = (baseIdList[index] == m_uint_selectRSBaseId);
                        bool enable = (!filterEqual) ? (rs.Grade >= selectAttrGrade) : (rs.Grade > selectAttrGrade);
                        gemRuneStoneGrid.SetGridViewData(baseIdList[index], select, enable);
                        if (select)
                        {
                            selectGemRuneStoneGrid   = gemRuneStoneGrid;
                            tempSelectGemRuneStoneId = baseIdList[index];
                        }
                    }
                }
            },
            desPassCallback = desLabAction,
        };
        DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.ItemChoosePanel, data: showData);
    }
Exemple #3
0
    /// <summary>
    /// 点击圣魂融合选择
    /// </summary>
    private void OnSelectBlendMuhon()
    {
        if (DataManager.Manager <UIPanelManager>().IsShowPanel(PanelID.ItemChoosePanel))
        {
            return;
        }
        Muhon itemData = Data;

        if (null == itemData)
        {
            TipsManager.Instance.ShowTips(LocalTextType.Local_TXT_Soul_ChooseBlendMuhonTips);
            return;
        }

        if (!emgr.IsItemHaveAdditiveAttrOrGemHole(itemData.QWThisID, false))
        {
            TipsManager.Instance.ShowTips(LocalTextType.Local_TXT_Soul_ActiveTips);
            return;
        }

        //筛选满足条件的圣魂
        List <uint> data        = new List <uint>();
        List <uint> filterTypes = new List <uint>();

        filterTypes.Add((uint)GameCmd.EquipType.EquipType_SoulOne);
        List <uint> muhonList = imgr.GetItemByType(GameCmd.ItemBaseType.ItemBaseType_Equip, filterTypes, GameCmd.PACKAGETYPE.PACKAGETYPE_MAIN);

        //过滤
        if (null != muhonList && muhonList.Count != 0)
        {
            Muhon tempData = null;

            for (int i = 0; i < muhonList.Count; i++)
            {
                if (itemData.IsMatchBlend(muhonList[i], false))
                {
                    data.Add(muhonList[i]);
                }
            }
        }
        if (data.Count == 0)
        {
            TipsManager.Instance.ShowTips(string.Format("背包中未找到消耗所需{0}{1}"
                                                        , ColorManager.GetNGUIColorOfType(ColorType.Red), itemData.Name));
            return;
        }

        data.Sort((left, right) =>
        {
            Muhon leftM  = imgr.GetBaseItemByQwThisId <Muhon>(left);
            Muhon rightM = imgr.GetBaseItemByQwThisId <Muhon>(right);
            if (rightM.IsActive)
            {
                if (leftM.IsActive)
                {
                    return(rightM.Level - leftM.Level);
                }
                return(1);
            }
            else if (leftM.IsActive)
            {
                return(-1);
            }
            else
            {
                return(rightM.Level - leftM.Level);
            }
            return(0);
        });

        UILabel          desLabel     = null;
        Action <UILabel> desLabAction = (des) =>
        {
            desLabel = des;
            if (null != desLabel)
            {
                desLabel.text = DataManager.Manager <TextManager>()
                                .GetLocalText(LocalTextType.Local_TXT_Soul_ChooseActiveMuhonNotice);
            }
        };
        uint tempSelectMuhonId = blendSelectMuhonId;
        UIWeaponSoulInfoSelectGrid tempSelectWeaponSoulGrid = null;
        UIEventDelegate            eventDlg = (eventTye, grid, param) =>
        {
            if (eventTye == UIEventType.Click)
            {
                UIWeaponSoulInfoSelectGrid tempGrid = grid as UIWeaponSoulInfoSelectGrid;
                if (tempSelectMuhonId == tempGrid.QWThisId)
                {
                    tempSelectMuhonId = 0;
                    tempGrid.SetHightLight(false);
                }
                else if (itemData.IsMatchBlend(tempGrid.QWThisId))
                {
                    tempSelectMuhonId = tempGrid.QWThisId;
                    if (null != tempSelectWeaponSoulGrid)
                    {
                        tempSelectWeaponSoulGrid.SetHightLight(false);
                    }
                    tempGrid.SetHightLight(true);
                    tempSelectWeaponSoulGrid = tempGrid;
                }
                else
                {
                    TipsManager.Instance.ShowTips(LocalTextType.Local_TXT_Soul_UnactiveNotice);
                }
            }
        };

        ItemChoosePanel.ItemChooseShowData showData = new ItemChoosePanel.ItemChooseShowData()
        {
            createNum        = data.Count,
            title            = "选择圣魂",
            cloneTemp        = UIManager.GetResGameObj(GridID.Uiweaponsoulinfoselectgrid) as GameObject,
            onChooseCallback = () =>
            {
                if (tempSelectMuhonId != blendSelectMuhonId)
                {
                    blendSelectMuhonId = tempSelectMuhonId;
                    UpdateBlend(Data);
                }
            },
            gridCreateCallback = (obj, index) =>
            {
                if (index >= data.Count)
                {
                    Engine.Utility.Log.Error("OnSelectBlendMuhon error,index out of range");
                }
                else
                {
                    Muhon tempItemData = imgr.GetBaseItemByQwThisId <Muhon>(data[index]);
                    if (null == tempItemData)
                    {
                        Engine.Utility.Log.Error("OnSelectBlendMuhon error,get itemData qwThisId:{0}", data[index]);
                    }
                    else
                    {
                        UIWeaponSoulInfoSelectGrid weaponsoulInfoGrid = obj.GetComponent <UIWeaponSoulInfoSelectGrid>();
                        if (null == weaponsoulInfoGrid)
                        {
                            weaponsoulInfoGrid = obj.AddComponent <UIWeaponSoulInfoSelectGrid>();
                        }
                        weaponsoulInfoGrid.RegisterUIEventDelegate(eventDlg);
                        if (!itemData.IsMatchBlend(tempSelectMuhonId))
                        {
                            tempSelectMuhonId = 0;
                        }
                        bool select = (data[index] == tempSelectMuhonId);
                        weaponsoulInfoGrid.SetGridViewData(tempItemData.QWThisID, select, itemData.IsMatchBlend(data[index]), true);
                        if (select)
                        {
                            tempSelectWeaponSoulGrid = weaponsoulInfoGrid;
                            tempSelectMuhonId        = data[index];
                        }
                    }
                }
            },
            desPassCallback = desLabAction,
        };
        DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.ItemChoosePanel, data: showData);
    }
Exemple #4
0
    /// <summary>
    /// 选择合成副装备
    /// </summary>
    /// <param name="gridIndex">当前点击副装备索引</param>
    private void OnSelectCompoundDeputy(int gridIndex)
    {
        if (DataManager.Manager <UIPanelManager>().IsShowPanel(PanelID.ItemChoosePanel))
        {
            return;
        }
        Equip data = Data;

        if (null == data)
        {
            TipsManager.Instance.ShowTips("没有可用的主装备");
            return;
        }
        if (!emgr.IsEquipCanCmpound(data.QWThisID))
        {
            TipsManager.Instance.ShowTips("当前装备无法进行合成操作");
            return;
        }

        //筛选满足条件的副装备
        List <uint> matchDeputyEquips = new List <uint>();

        matchDeputyEquips.AddRange(emgr.GetCompoundMatchEquip(selectEquipId));
        if (matchDeputyEquips.Count == 0)
        {
            TipsManager.Instance.ShowTips("没有找到满足合成条件的副装备");
            return;
        }

        //临时选中副装备列表
        List <uint> tempSelectdDeputyEquipList = new List <uint>();

        tempSelectdDeputyEquipList.AddRange(selectCompoundDeputyEquips);


        UILabel          desLabel     = null;
        Action <UILabel> desLabAction = (des) =>
        {
            desLabel = des;
            if (null != desLabel)
            {
                desLabel.text = m_tmgr.GetLocalFormatText(LocalTextType.Local_TXT_Soul_ChooseNum
                                                          , GetCompoundDeputyCount(tempSelectdDeputyEquipList), 3);
            }
        };
        UIEventDelegate eventDlg = (eventTye, grid, param) =>
        {
            if (eventTye == UIEventType.Click)
            {
                UIEquipInfoSelectGrid tempGrid = grid as UIEquipInfoSelectGrid;
                Equip tempEquip = imgr.GetBaseItemByQwThisId <Equip>(tempGrid.QWThisId);
                if (null != tempEquip)
                {
                    if (tempEquip.CanCompound)
                    {
                        int  selectNum    = GetCompoundDeputyCount(tempSelectdDeputyEquipList);
                        bool refreshLabel = false;
                        if (tempSelectdDeputyEquipList.Contains(tempGrid.QWThisId))
                        {
                            int clickIndex = tempSelectdDeputyEquipList.IndexOf(tempGrid.QWThisId);
                            tempSelectdDeputyEquipList[clickIndex] = 0;
                            tempGrid.SetHightLight(false);
                            refreshLabel = true;
                        }
                        else if (selectNum < 3)
                        {
                            refreshLabel = true;
                            if (tempSelectdDeputyEquipList[gridIndex] == 0)
                            {
                                tempSelectdDeputyEquipList[gridIndex] = tempGrid.QWThisId;
                            }
                            else
                            {
                                for (int i = 0; i < tempSelectdDeputyEquipList.Count; i++)
                                {
                                    if (tempSelectdDeputyEquipList[i] == 0)
                                    {
                                        tempSelectdDeputyEquipList[i] = tempGrid.QWThisId;
                                        break;
                                    }
                                }
                            }
                            tempGrid.SetHightLight(true);
                        }
                        if (null != desLabel && refreshLabel)
                        {
                            desLabel.text = desLabel.text = m_tmgr.GetLocalFormatText(LocalTextType.Local_TXT_Soul_ChooseNum
                                                                                      , GetCompoundDeputyCount(tempSelectdDeputyEquipList), 3);
                        }
                    }
                    else if (tempEquip.AdditionAttrCount == 0)
                    {
                        DataManager.Manager <EffectDisplayManager>().AddTips(m_tmgr.GetLocalText(LocalTextType.forging_compose_1));
                    }
                }
            }
        };

        ItemChoosePanel.ItemChooseShowData showData = new ItemChoosePanel.ItemChooseShowData()
        {
            createNum        = matchDeputyEquips.Count,
            title            = "选择副装备",
            cloneTemp        = UIManager.GetResGameObj(GridID.Uiequipinfoselectgrid) as GameObject,
            onChooseCallback = () =>
            {
                selectCompoundDeputyEquips = tempSelectdDeputyEquipList;
                UpdateCompound(Data);
            },
            gridCreateCallback = (obj, index) =>
            {
                UIEquipInfoSelectGrid equipInfoGrid = obj.GetComponent <UIEquipInfoSelectGrid>();
                if (null == equipInfoGrid)
                {
                    equipInfoGrid = obj.AddComponent <UIEquipInfoSelectGrid>();
                }
                Equip itemData = imgr.GetBaseItemByQwThisId <Equip>(matchDeputyEquips[index]);
                equipInfoGrid.RegisterUIEventDelegate(eventDlg);
                equipInfoGrid.SetGridViewData(itemData.QWThisID, selectCompoundDeputyEquips.Contains(itemData.QWThisID)
                                              , itemData.CompoundMaskEnable, itemData.AdditionAttrCount > 0);
            },
            desPassCallback = desLabAction,
        };
        DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.ItemChoosePanel, data: showData);
    }