public override void Init(ChatInfoSelectLinkLogic.Data data, int index) { base.Init(data, index); this.name = index.ToString(); FellowContainer container = GameManager.gameManager.PlayerDataPool.FellowContainer; if (container == null) { return; } Fellow fellow = container.GetFellowByGuid(data.guid); if (null == fellow) { return; } m_fellowIcon.spriteName = fellow.GetIcon(); m_fellowName.text = fellow.Name; m_level.text = fellow.Level.ToString(); m_combatValue.text = fellow.GetCombatValue().ToString(); m_fellowQuality.spriteName = FellowTool.GetFellowQualityFrame(fellow.Quality); this.m_fellowGuid = data.guid; }
/// <summary> /// 点击添加宝宝 /// </summary> void OnChoosePartnerClick() { NewPlayerGuidLogic.CloseWindow(); FellowContainer container = GameManager.gameManager.PlayerDataPool.FellowContainer; if (container == null) { return; } List <Fellow> babylist = FellowTool.FellowCanBreedingFilter(container); //List<Fellow> babylist = FellowTool.FellowBabyFilter(container); if (babylist.Count <= 0) { GUIData.AddNotifyData("#{10330}"); return; } m_FellowIndexBuffer = m_FellowIndex; m_PartnerChooseWindow.SetActive(true); ShowChooseBabyFellow(babylist); }
public uint Execute(PacketDistributed ipacket) { GC_CALL_FELLOW_RET packet = (GC_CALL_FELLOW_RET)ipacket; if (null == packet) { return((uint)PACKET_EXE.PACKET_EXE_ERROR); } UInt64 fellowGuid = packet.Guid; int fellowObjId = packet.Objid; if (fellowGuid == GlobeVar.INVALID_GUID) { return((uint)PACKET_EXE.PACKET_EXE_ERROR); } FellowContainer container = GameManager.gameManager.PlayerDataPool.FellowContainer; if (container != null) { Fellow fellow = container.GetFellowByGuid(fellowGuid); if (fellow != null) { //设置为召出 fellow.Called = true; if (PartnerFrameLogic.Instance() != null) { if (PartnerFrameLogic_Info.Instance() != null) { PartnerFrameLogic_Info.Instance().UpdateFellowInfo(fellow, false); } if (PartnerFrameLogic.Instance().NewPlayerGuideFlag_Step == 1) { if (MenuBarLogic.Instance()) { //MenuBarLogic.Instance().NewPlayerGuide(101); } //PartnerFrameLogic.Instance().NewPlayerGuideFlag_Step = -1; } //UIManager.CloseUI(UIInfo.PartnerFrameRoot); } } } Singleton <ObjManager> .GetInstance().MainPlayer.CurFellowObjId = fellowObjId; Singleton <ObjManager> .GetInstance().MainPlayer.CurFellowObjGuid = fellowGuid; //播放召出特效 GameManager.gameManager.PlayerDataPool.FellowPlayerEffect = true; //enter your logic return((uint)PACKET_EXE.PACKET_EXE_CONTINUE); }
void InitMaterialPartnerGrid() { Utils.CleanGrid(m_MaterialPartnerGrid); // 先加载个加宠物按钮 靠前显示 if (false == CreateAddMaterialBtn()) { return; } //m_MaterialPartnerLabel.SetActive(m_ChoosePartnerGuid.Count <= 0); FellowContainer container = GameManager.gameManager.PlayerDataPool.FellowContainer; if (container == null) { return; } for (int i = 0; i < m_ChoosePartnerGuid.Count; i++) { if (m_ChoosePartnerGuid[i] == GlobeVar.INVALID_GUID) { break; } Fellow fellow = container.GetFellowByGuid(m_ChoosePartnerGuid[i]); if (fellow == null || false == fellow.IsValid() || fellow.Guid == m_Fellow.Guid || fellow.Locked) { break; } string objectName = i + 1 < 10 ? "0" + (i + 1).ToString() : (i + 1).ToString(); GameObject fellowobject = Utils.BindObjToParent(m_MaterialPartnerItem, m_MaterialPartnerGrid, objectName); if (fellowobject == null || fellowobject.GetComponent <MaterialPartnerItemLogic>() == null) { break; } fellowobject.GetComponent <MaterialPartnerItemLogic>().Init(fellow); } if (m_MaterialPartnerGrid.GetComponent <UIGrid>() != null) { m_MaterialPartnerGrid.GetComponent <UIGrid>().Reposition(); } //UpdateFellowInfo_NextStar(m_Fellow, m_ChoosePartnerExp); }
int GetCurBattleFellowExp() { int nFexp = 0; FellowContainer container = GameManager.gameManager.PlayerDataPool.FellowContainer; if (container != null) { Fellow fellow = container.GetFellowByGuid(Singleton <ObjManager> .GetInstance().MainPlayer.CurFellowObjGuid); if (fellow != null) { nFexp = fellow.Exp; } } return(nFexp); }
void UpdateSweepAwardFellowExp() { m_nFellowExpCurStep = 0; int nCurLevel = -1; FellowContainer container = GameManager.gameManager.PlayerDataPool.FellowContainer; if (container != null) { Fellow fellow = container.GetFellowByGuid(Singleton <ObjManager> .GetInstance().MainPlayer.CurFellowObjGuid); if (fellow != null) { nCurLevel = fellow.Level; } } if (m_nFellowLevelBeforeSweep == nCurLevel) { MyTweenNum tw = new MyTweenNum(); tw.From = m_FellowExpSlider.value; tw.To = CalFellowExpSliderValue(); m_FellowExpTweenNumList.Add(tw); } else if (m_nFellowLevelBeforeSweep < nCurLevel) { for (int i = m_nFellowLevelBeforeSweep; i <= nCurLevel; ++i) { MyTweenNum tw = new MyTweenNum(); if (i == m_nFellowLevelBeforeSweep) { tw.From = m_FellowExpSlider.value; tw.To = 1f; m_FellowExpTweenNumList.Add(tw); } else if (i > m_nFellowLevelBeforeSweep && i < nCurLevel) { tw.From = 0f; tw.To = 1f; m_FellowExpTweenNumList.Add(tw); } else if (i == nCurLevel) { tw.From = 0; tw.To = CalFellowExpSliderValue(); m_FellowExpTweenNumList.Add(tw); } } } }
int GetCurLevelBattleFellowTotalExp() { int nCurLevelTotalFexp = 0; FellowContainer container = GameManager.gameManager.PlayerDataPool.FellowContainer; if (container != null) { Fellow fellow = container.GetFellowByGuid(Singleton <ObjManager> .GetInstance().MainPlayer.CurFellowObjGuid); if (fellow != null) { Tab_LevelUp curTabLevelup = TableManager.GetLevelUpByID(fellow.Level, 0); nCurLevelTotalFexp = curTabLevelup.FellowExpNeed; } } return(nCurLevelTotalFexp); }
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 uint Execute(PacketDistributed ipacket) { GC_UNCALL_FELLOW_RET packet = (GC_UNCALL_FELLOW_RET)ipacket; if (null == packet) { return((uint)PACKET_EXE.PACKET_EXE_ERROR); } UInt64 fellowGuid = packet.Guid; if (fellowGuid == GlobeVar.INVALID_GUID) { return((uint)PACKET_EXE.PACKET_EXE_ERROR); } FellowContainer container = GameManager.gameManager.PlayerDataPool.FellowContainer; if (container != null) { Fellow fellow = container.GetFellowByGuid(fellowGuid); if (fellow != null) { //ÉèÖÃΪÕÙ»Ø fellow.Called = false; if (PartnerFrameLogic_Info.Instance() != null) { PartnerFrameLogic_Info.Instance().UpdateFellowInfo(fellow, false); } } } Singleton <ObjManager> .GetInstance().MainPlayer.CurFellowObjId = -1; Singleton <ObjManager> .GetInstance().MainPlayer.CurFellowObjGuid = GlobeVar.INVALID_GUID; //enter your logic return((uint)PACKET_EXE.PACKET_EXE_CONTINUE); }
private void Sweep(int nCount) { ClearSweepAwardInfo(); // 扫荡前人物等级 Obj_MainPlayer mainPlayer = Singleton <ObjManager> .Instance.MainPlayer; if (null != mainPlayer) { m_nLevelBeforeSweep = mainPlayer.BaseAttr.Level; } // 扫荡前宠物等级 FellowContainer container = GameManager.gameManager.PlayerDataPool.FellowContainer; if (container != null) { Fellow fellow = container.GetFellowByGuid(Singleton <ObjManager> .GetInstance().MainPlayer.CurFellowObjGuid); if (fellow != null) { m_nFellowLevelBeforeSweep = fellow.Level; } } // 扫荡前经验条 m_ExpSlider.value = (float)CalExpSliderValue(); // 扫荡前宠物经验条 m_FellowExpSlider.value = (float)CalFellowExpSliderValue(); // 请求扫荡 if (null != GameManager.gameManager.PlayerDataPool.JuQingCopySceneData) { GameManager.gameManager.PlayerDataPool.JuQingCopySceneData.ReqSweepStoryCopyScene(m_nStoryCopySceneID, nCount); } }
public uint Execute(PacketDistributed ipacket) { GC_UPDATE_FELLOW packet = (GC_UPDATE_FELLOW)ipacket; if (null == packet) { return((uint)PACKET_EXE.PACKET_EXE_ERROR); } //取得伙伴在容器中的索引 int index = packet.Packindex; FellowContainer container = GameManager.gameManager.PlayerDataPool.FellowContainer; if (container != null) { Fellow fellow = container.GetFellowByIndex(index); if (fellow != null) { //GUID fellow.Guid = packet.Guid; //ID fellow.DataId = packet.Dataid; //昵称 fellow.Name = packet.Name; //品质 if (packet.HasQuality) { fellow.Quality = packet.Quality; } //经验 if (packet.HasExp) { fellow.Exp = packet.Exp; } //级别 if (packet.HasLevel) { fellow.Level = packet.Level; } //打星等级 if (packet.HasStarexp) { fellow.StarExp = packet.Starexp; } //打星等级 if (packet.HasStarlevel) { fellow.StarLevel = packet.Starlevel; } //成长率 //if (packet.HasGrowup) //{ // fellow.GrowUp = (float)packet.Growup / 100.0f; //} //幸运值 if (packet.HasLucky) { fellow.Lucky = packet.Lucky; } //当前可用繁殖次数 if (packet.HasProcreatecount) { fellow.ProcreateCount = packet.Procreatecount; } //元素属性 if (packet.HasElementattr) { fellow.ElementAttr = packet.Elementattr; } //上锁 if (packet.HasIslock) { fellow.Locked = (packet.Islock == 1) ? true : false; } //初始五围属性 if (packet.HasBaseattack) { fellow.BaseAttack = packet.Baseattack; } if (packet.HasBasehit) { fellow.BaseHit = packet.Basehit; } if (packet.HasBasecritical) { fellow.BaseCritical = packet.Basecritical; } if (packet.HasBaseguard) { fellow.BaseGuard = packet.Baseguard; } if (packet.HasBasebless) { fellow.BaseBless = packet.Basebless; } if (packet.tallentskillidCount > 0 && packet.tallentskilllevelCount > 0) { fellow.TallentSkill.Clear(); for (int i = 0; i < packet.tallentskillidCount && i < packet.tallentskilllevelCount; i++) { if (false == fellow.TallentSkill.ContainsKey(packet.tallentskillidList[i])) { fellow.TallentSkill.Add(packet.tallentskillidList[i], packet.tallentskilllevelList[i]); } } } for (int i = 0; i < packet.elementskillidCount; i++) { if (false == fellow.IsHaveSkillId(packet.elementskillidList[i])) { fellow.SetElementSkillId(packet.elementskillidList[i], i); } } if (PartnerFrameLogic.Instance() != null) { PartnerFrameLogic.Instance().UpdateFellowInfo_Refresh(); if (PartnerFrameLogic.Instance().rebirthFellowGuid != GlobeVar.INVALID_GUID) { PartnerFrameLogic.Instance().InitPartnerList(PartnerFrameLogic.Instance().rebirthFellowGuid); PartnerFrameLogic.Instance().rebirthFellowGuid = Games.GlobeDefine.GlobeVar.INVALID_GUID; } } if (Singleton <ObjManager> .GetInstance().MainPlayer != null && fellow.Guid == Singleton <ObjManager> .GetInstance().MainPlayer.CurFellowObjGuid) { Obj_Fellow curFellow = Singleton <ObjManager> .GetInstance().FindObjInScene(Singleton <ObjManager> .GetInstance().MainPlayer.CurFellowObjId) as Obj_Fellow; if (curFellow != null) { curFellow.SetBordName(fellow.Name); } } } } if (MenuBarLogic.Instance() != null) { MenuBarLogic.Instance().UpdateFellowRedTip(); } if (PartnerFrameLogic.Instance() != null) { PartnerFrameLogic.Instance().UpdateFellowTip(); } return((uint)PACKET_EXE.PACKET_EXE_CONTINUE); }
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); }
void UpdateChooseFellowInfo(bool forward) { FellowContainer container = GameManager.gameManager.PlayerDataPool.FellowContainer; if (container == null) { return; } List <Fellow> babylist = FellowTool.FellowCanBreedingFilter(container); if (babylist.Count <= 0) { return; } Fellow updatefellow = null; if (forward) { for (int i = (m_FellowIndexBuffer + 1) % babylist.Count; i < babylist.Count; i++) { Fellow fellow = babylist[i]; if (false == fellow.IsValid()) { continue; } if (m_BabyFellowBuffer == null) { updatefellow = fellow; m_FellowIndexBuffer = i; break; } else { if (fellow.Guid != m_BabyFellowBuffer.Guid) { updatefellow = fellow; m_FellowIndexBuffer = i; break; } } } } else { for (int i = (m_FellowIndexBuffer + babylist.Count - 1) % babylist.Count; i >= 0; i--) { Fellow fellow = babylist[i]; if (false == fellow.IsValid()) { continue; } if (m_BabyFellowBuffer == null) { updatefellow = fellow; m_FellowIndexBuffer = i; break; } else { if (fellow.Guid != m_BabyFellowBuffer.Guid) { updatefellow = fellow; m_FellowIndexBuffer = i; break; } } } } if (updatefellow == null || false == updatefellow.IsValid() || false == updatefellow.IsBabyFellow()) { return; } // m_PartnerChooseIcon.spriteName = updatefellow.GetIcon(); // m_PartnerChooseNameLabel.text = updatefellow.Name; // m_PartnerChooseLevelLabel.text = "LV" + updatefellow.Level.ToString(); // m_PartnerChooseCombatValueLabel.text = updatefellow.GetCombatValue().ToString(); // m_PartnerChooseProcreateLabel.text = updatefellow.ProcreateCount.ToString(); // m_PartnerChooseLuckyLabel.text = updatefellow.Lucky.ToString(); m_BabyFellowBuffer = updatefellow; }
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); } }