/// <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 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); }