private List <Data> GetDataListFellow_3() { List <Data> res = new List <Data>(); FellowContainer container = GameManager.gameManager.PlayerDataPool.FellowContainer; if (container == null) { return(res); } List <Fellow> babylist = new List <Fellow>(); // int nFellowCount = container.GetFellowCount(); List <Fellow> fellowList = FellowTool.FellowSort(container); if (M_OPEN_TYPE == OPEN_TYPE.NORMAL) { for (int i = 0; i < fellowList.Count; ++i) { //有效槽位 Fellow fellow = fellowList[i]; if (fellow.IsValid()) { babylist.Add(fellow); } } } else if (M_OPEN_TYPE == OPEN_TYPE.PROPAGATE) { babylist = FellowTool.FellowCanBreedingFilter(container); } if (babylist.Count <= 0) { return(res); } for (int i = 0; i < babylist.Count; i++) { Data data = new Data(); data.guid = babylist[i].Guid; res.Add(data); } return(res); }
public void RefreshPartnerList(Predicate <Fellow> filter = null) { if (m_PartnerListGrid != null) { //先清空 Utils.CleanGrid(m_PartnerListGrid); m_PartnerList.SetActive(true); FellowContainer container = GameManager.gameManager.PlayerDataPool.FellowContainer; if (container == null) { return; } //遍历伙伴容器 List <Fellow> fellowList = FellowTool.FellowSort(container); for (int i = 0; i < fellowList.Count; ++i) { //有效槽位 Fellow fellow = fellowList[i]; if (fellow.IsValid()) { if (filter != null && !filter(fellow)) { continue; } string objectName = ""; if (i < 10) { objectName += "0"; } objectName += i.ToString(); GameObject fellowobject = Utils.BindObjToParent(m_PartnerListItem, m_PartnerListGrid, objectName); if (fellowobject != null && fellowobject.GetComponent <PartnerFrameItemLogic>() != null) { fellowobject.GetComponent <PartnerFrameItemLogic>().UpdateFellowInfo(fellow); } } } m_PartnerListGrid.GetComponent <UIGrid>().Reposition(); ShowSelectFun(); //升星后列表的选中 } }
public int GetPartnerSkillCanLevelUpCount() { //遍历伙伴容器 FellowContainer container = GameManager.gameManager.PlayerDataPool.FellowContainer; if (container == null) { return(0); } List <Fellow> fellowlist = FellowTool.FellowSort(container); for (int i = 0; i < fellowlist.Count; ++i) { Fellow fellow = fellowlist[i]; if (fellow.IsValid()) { //天赋技能 foreach (KeyValuePair <int, int> pair in fellow.TallentSkill) { if (pair.Key != GlobeVar.INVALID_ID) { int talentSkillId = pair.Key; Tab_CabalFellowTallentSkill tabTalentSkill = TableManager.GetCabalFellowTallentSkillByID(talentSkillId, 0); if (tabTalentSkill == null) { return(0); } int needTalentBookId = tabTalentSkill.SkillBook; if (tabTalentSkill.NextSkillId != GlobeVar.INVALID_ID) { if (GameManager.gameManager.PlayerDataPool.BackPack.GetItemCountByDataId(needTalentBookId) > 0) { return(1); } } else { return(0); } } } //培养技能 for (int j = 0; j < Fellow.FELLOW_ELEMENTSKILL_COUNT; j++) { int fellowElementSkillId = fellow.GetElementSkillId(i); int fellowLevel = fellow.Level; int index = j; if (fellowElementSkillId == GlobeVar.INVALID_ID)//空位还没有开启的话 { if (index < 0 || index >= Fellow.FELLOW_ELEMENTSKILL_LEVELNEED.Length) { return(0); } if (fellowLevel == Fellow.FELLOW_ELEMENTSKILL_LEVELNEED[index]) { return(0); } } else //开启了 { Tab_CabalFellowElementSkill tabSkill = TableManager.GetCabalFellowElementSkillByID(fellowElementSkillId, 0); if (tabSkill == null) { return(0); } Tab_CabalFellowElementSkill tabNextSkill = TableManager.GetCabalFellowElementSkillByID(tabSkill.NextSkillId, 0); { if (tabNextSkill == null) { return(0); } else { int packHaveBookNum = GameManager.gameManager.PlayerDataPool.BackPack.GetItemCountByDataId(tabNextSkill.NeedBookId); int nextSkillNeedBookNum = tabNextSkill.NeedBookCount; if (packHaveBookNum >= nextSkillNeedBookNum) { return(1); } } } } } } } return(0); }
public void InitPartnerList(UInt64 defaultGuid = GlobeVar.INVALID_GUID, Predicate <Fellow> filter = null) { if (m_PartnerListGrid != null) { //先清空 Utils.CleanGrid(m_PartnerListGrid); m_PartnerList.SetActive(true); FellowContainer container = GameManager.gameManager.PlayerDataPool.FellowContainer; if (container == null) { return; } //遍历伙伴容器 bool bFirst = true; List <Fellow> fellowList = FellowTool.FellowSort(container); PartnerFrameItemLogic firstOneCache = null; bool needReSelect = false; bool needToTopReset = false; int firstOneCacheIndex = 0; for (int i = 0; i < fellowList.Count; ++i) { //有效槽位 Fellow fellow = fellowList[i]; if (fellow.IsValid()) { if (filter != null && !filter(fellow)) { if (firstOneCache == null) { firstOneCacheIndex += 1; } if (fellow.Guid == defaultGuid) { needReSelect = true; } continue; } string objectName = ""; if (i < 10) { objectName += "0"; } objectName += i.ToString(); GameObject fellowobject = Utils.BindObjToParent(m_PartnerListItem, m_PartnerListGrid, objectName); if (fellowobject != null && fellowobject.GetComponent <PartnerFrameItemLogic>() != null) { fellowobject.GetComponent <PartnerFrameItemLogic>().UpdateFellowInfo(fellow); if (i == firstOneCacheIndex) { firstOneCache = fellowobject.GetComponent <PartnerFrameItemLogic>(); } if (defaultGuid == GlobeVar.INVALID_GUID) { if (bFirst) { fellowobject.GetComponent <PartnerFrameItemLogic>().OnFellowClick(); bFirst = false; needToTopReset = true; } } else { if (fellow.Guid == defaultGuid) { fellowobject.GetComponent <PartnerFrameItemLogic>().OnFellowClick(); } } } } } if (needReSelect && firstOneCache != null) { needToTopReset = true; firstOneCache.OnFellowClick(); } // add cloning fellow in info view if (filter == null && GameManager.gameManager.PlayerDataPool.IsProcreateGoing()) { GameObject fellowobject = Utils.BindObjToParent(m_PartnerListItem, m_PartnerListGrid, "z00"); if (fellowobject != null && fellowobject.GetComponent <PartnerFrameItemLogic>() != null) { fellowobject.GetComponent <PartnerFrameItemLogic>().ShowCloningInfo(); if (fellowList.Count == 0) { fellowobject.GetComponent <PartnerFrameItemLogic>().OnFellowClick(); } } } m_PartnerListGrid.GetComponent <UIGrid>().Reposition(); if (needToTopReset) { m_PartnerListGrid.GetComponent <UITopGrid>().Recenter(true); } m_PartnerCapacity.text = container.GetCapacityStr(); } UpdateFellowTip(); }
/// <summary> /// 自动筛选宠物 /// </summary> /// <param name="quality"></param> void InitMaterialPartnerGrid_Auto(int quality) { Utils.CleanGrid(m_ChooseMaterialGrid); m_ChoosePartnerGuid.Clear(); m_ChoosePartnerExp = 0; FellowContainer container = GameManager.gameManager.PlayerDataPool.FellowContainer; if (container == null) { return; } //遍历伙伴容器 List <Fellow> fellowList = FellowTool.FellowSort(container); bool gotFTEFellow = false; for (int i = 0; i < fellowList.Count; ++i) { //有效槽位 Fellow fellow = fellowList[i]; if (false == fellow.IsValid() || fellow.Guid == m_Fellow.Guid || fellow.Locked) { continue; } string objectName = string.Empty; if (!gotFTEFellow && PartnerFrameLogic.Instance().NewPlayerGuideFlag_Step == 16 && fellow.DataId == 41)// 宠物升星引导狗粮宠 { gotFTEFellow = true; objectName = "a" + fellow.DataId; } else { objectName = "b" + i; } GameObject fellowobject = Utils.BindObjToParent(m_MaterialPartnerItem, m_ChooseMaterialGrid, objectName); var logic = fellowobject.GetComponent <MaterialPartnerItemLogic>(); if (fellowobject == null || logic == null) { continue; } logic.Init(fellow); if (fellow.Quality < quality) { logic.Choose = true; m_ChoosePartnerGuid.Add(fellow.Guid); m_ChoosePartnerExp += logic.StarExp; } } if (fellowList.Count < FELLOW_PACK_DEFAULT_NUM) { for (int i = fellowList.Count; i <= FELLOW_PACK_DEFAULT_NUM; i++) { string objectName = "c" + i; Utils.BindObjToParent(m_MaterialPartnerItem, m_ChooseMaterialGrid, objectName); } } UIHexagonGrid grid = m_ChooseMaterialGrid.GetComponent <UIHexagonGrid>(); if (grid != null) { grid.sorted = true; grid.Reposition(); } int nTotalStarExp = m_ChoosePartnerExp + m_Fellow.StarExp; m_ChooseMaterialExpSprite.fillAmount = (float)nTotalStarExp / (float)m_Fellow.GetCurStarExpMax(); int addLevel = FellowTool.GetFellowAddStarLevel(m_Fellow.StarLevel, nTotalStarExp); if (addLevel > 0) { m_ChooseMaterialExpCount.gameObject.SetActive(true); m_ChooseMaterialExpCount.text = "x" + addLevel.ToString(); } else { m_ChooseMaterialExpCount.gameObject.SetActive(false); } }