private List <Data> GetDataListCommonItem_2() { List <Data> res = new List <Data>(); GameItemContainer EquipPack = GameManager.gameManager.PlayerDataPool.EquipPack; for (int index = 0; index < EquipPack.ContainerSize; ++index) { GameItem equip = EquipPack.GetItem(BackPackLogic.GetEquipSlotByIndex(index)); if (equip != null && equip.IsValid()) { Data data = new Data(); data.item = equip; res.Add(data); } } GameItemContainer BackPack = GameManager.gameManager.PlayerDataPool.BackPack; List <GameItem> itemall = ItemTool.ItemFilter(BackPack, 0, 0, false); for (int nIndex = 0; nIndex < GameItemContainer.MAXSIZE_BACKPACK; ++nIndex) { if (nIndex < BackPack.ContainerSize && nIndex < itemall.Count) { Data data = new Data(); data.item = itemall[nIndex]; res.Add(data); } } //道具显示比较特殊,22组为一个Item // int itemCount = MAX_COMMONITEM_COUNT; // int pageCount = 0; // if (res.Count % itemCount == 0) // { // pageCount = res.Count / itemCount; // } // else // { // pageCount = res.Count / itemCount + 1; // } // // res.Clear(); // // //看有多少页的数据 // for (int i = 0; i < pageCount; i++) // { // Data data = new Data(); // res.Add(data); // } return(res); }
/// <summary> /// 更新装备槽部分显示 /// </summary> public void UpdateEquipPack() { m_NameLabel.text = GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.RoleName; GameItemContainer EquipPack = GameManager.gameManager.PlayerDataPool.EquipPack; for (int index = 0; index < EquipPack.ContainerSize; ++index) { GameItem equip = EquipPack.GetItem(GetEquipSlotByIndex(index)); if (equip != null && equip.IsValid()) { UISprite IconSprite = m_EquipSlotIcon[index]; if (IconSprite != null) { string icon = TableManager.GetCommonItemByID(equip.DataID, 0).Icon; IconSprite.spriteName = icon; IconSprite.MakePixelPerfect(); UISprite QualitySprite = m_EquipSlotQualityFrame[index]; if (QualitySprite != null) { QualitySprite.gameObject.SetActive(true); QualitySprite.spriteName = equip.GetQualityFrame(); } UILabel ExhanceLevel = m_EquipSlotQualityFrame[index].transform.parent.transform.FindChild("Label").GetComponent <UILabel>(); if (ExhanceLevel != null) { ExhanceLevel.text = "+" + equip.EnchanceLevel.ToString(); ExhanceLevel.gameObject.SetActive(true); ExhanceLevel.MakePixelPerfect(); } } } else { UISprite IconSprite = m_EquipSlotIcon[index]; if (IconSprite != null) { IconSprite.spriteName = "Dark"; IconSprite.MakePixelPerfect(); UISprite QualitySprite = m_EquipSlotQualityFrame[index]; if (QualitySprite != null) { QualitySprite.gameObject.SetActive(false); } UILabel ExhanceLevel = m_EquipSlotQualityFrame[index].transform.parent.transform.FindChild("Label").GetComponent <UILabel>(); if (ExhanceLevel != null) { ExhanceLevel.gameObject.SetActive(false); } } } } }
/// <summary> /// 更新装备槽部分显示 /// </summary> public void UpdateEquipPack() { if (m_NameLabel != null) { m_NameLabel.text = m_strName; } GameItemContainer EquipPack = GameManager.gameManager.OtherPlayerData.EquipPack; for (int index = 0; index < EquipPack.ContainerSize; ++index) { GameObject EquipObject = m_EquipPackGrid.transform.FindChild("Equip" + index).gameObject; if (null == EquipObject) { continue; } GameItem equip = EquipPack.GetItem(GetEquipSlotByIndex(index)); if (equip != null && equip.IsValid()) { UISprite IconSprite = m_EquipSlotIcon[index]; if (IconSprite != null) { string icon = TableManager.GetCommonItemByID(equip.DataID, 0).Icon; IconSprite.spriteName = icon; IconSprite.MakePixelPerfect(); UISprite QualitySprite = m_EquipSlotQualityFrame[index]; if (QualitySprite != null) { QualitySprite.gameObject.SetActive(true); QualitySprite.spriteName = equip.GetQualityFrame(); } } } else { UISprite IconSprite = m_EquipSlotIcon[index]; if (IconSprite != null) { IconSprite.spriteName = "Dark"; IconSprite.MakePixelPerfect(); UISprite QualitySprite = m_EquipSlotQualityFrame[index]; if (QualitySprite != null) { QualitySprite.gameObject.SetActive(false); } } } } }
public void UpdateSellItem() { if (BaseAttr.Level < GlobeVar.MAX_AUTOEQUIT_LIVE) { return; } if (IsOpenAutoCombat == false) { return; } GameItemContainer BackPack = GameManager.gameManager.PlayerDataPool.BackPack; List <ulong> selllist = new List <ulong>(); List <int> sellCountList = new List <int>(); for (int index = 0; index < BackPack.ContainerSize; ++index) { GameItem eItem = BackPack.GetItem(index); if (eItem != null) //身上有这个药 { Tab_CommonItem line = TableManager.GetCommonItemByID(eItem.DataID, 0); if (line != null) { //计算品级及拾取规则 if (line.ClassID == (int)ItemClass.EQUIP && GetAutoPickUpFlag(line.Quality) /* && eItem.EnchanceLevel <= 0 && eItem.EnchanceExp <= 0 && eItem.StarLevel <= 0*/ && EquipStrengthenLogic.IsAutoEnchanceMaterial(eItem) && AutoEquipGuid != GlobeVar.INVALID_GUID) { selllist.Add(eItem.Guid); sellCountList.Add(eItem.StackCount); } } } } //做自动强化物品 if (selllist.Count > 0) { //SysShopController.SellItem((int)GameItemContainer.Type.TYPE_BACKPACK, selllist); CG_EQUIP_ENCHANCE equipEnchance = (CG_EQUIP_ENCHANCE)PacketDistributed.CreatePacket(MessageID.PACKET_CG_EQUIP_ENCHANCE); //发送消息包 equipEnchance.SetPacktype(1); equipEnchance.SetEquipguid(AutoEquipGuid); for (int i = 0; i < selllist.Count; ++i) { equipEnchance.AddMaterialguid(selllist[i]); equipEnchance.AddMaterialcount(sellCountList[i]); } equipEnchance.SendPacket(); } }
//过滤上架物品 private List <GameItem> FilterSelShenQiStuff(GameItemContainer Container) { List <GameItem> resultlist = new List <GameItem>(); for (int nIndex = 0; nIndex < Container.ContainerSize; ++nIndex) { GameItem item = Container.GetItem(nIndex); if (null != item && item.IsValid() && item.DataID == m_nNeedItemDataId) { resultlist.Add(item); } } return(ItemTool.ItemSort(resultlist)); }
public uint Execute(PacketDistributed ipacket) { GC_UPDATE_STORAGEPACK packet = (GC_UPDATE_STORAGEPACK)ipacket; if (null == packet) { return((uint)PACKET_EXE.PACKET_EXE_ERROR); } //enter your logic int Count = packet.packindexCount; GameItemContainer Container = GameManager.gameManager.PlayerDataPool.StoragePack; for (int i = 0; i < Count; i++) { int packindex = packet.GetPackindex(i); GameItem item = Container.GetItem(packindex); if (item != null) { item.DataID = packet.GetDataid(i); item.Guid = packet.GetGuid(i); item.BindFlag = (packet.GetBindflag(i) == 1); item.EnchanceLevel = packet.GetEnchancelevel(i); item.EnchanceExp = packet.GetEnchanceexp(i); item.EnchanceTotalExp = packet.GetEnchancetotalexp(i); item.StarLevel = packet.GetStarlevel(i); item.StarTimes = packet.GetStartimes(i); item.StackCount = packet.GetStackcount(i); item.CreateTime = packet.GetCreatetime(i); item.DynamicData[0] = packet.GetDynamicdata1(i); item.DynamicData[1] = packet.GetDynamicdata2(i); item.DynamicData[2] = packet.GetDynamicdata3(i); item.DynamicData[3] = packet.GetDynamicdata4(i); item.DynamicData[4] = packet.GetDynamicdata5(i); item.DynamicData[5] = packet.GetDynamicdata6(i); item.DynamicData[6] = packet.GetDynamicdata7(i); item.DynamicData[7] = packet.GetDynamicdata8(i); } } if (CangKuLogic.Instance() != null) { CangKuLogic.Instance().UpdateCangKu(); } return((uint)PACKET_EXE.PACKET_EXE_CONTINUE); }
//过滤上架物品 private List <GameItem> FilterConsignSale(GameItemContainer Container, int nClass, int nSubClass = 0) { List <GameItem> resultlist = new List <GameItem>(); for (int nIndex = 0; nIndex < Container.ContainerSize; ++nIndex) { GameItem item = Container.GetItem(nIndex); if (null != item && item.IsValid()) { int itemclass = TableManager.GetCommonItemByID(item.DataID, 0).ClassID; int itemsubclass = TableManager.GetCommonItemByID(item.DataID, 0).SubClassID; if ((itemclass == nClass || nClass == 0) && (itemsubclass == nSubClass || nSubClass == 0) && isCanConsignSale(item)) { resultlist.Add(item); } } } return(ItemTool.ItemSort(resultlist)); }
// 更新回购槽 public void UpdateBuyBackItems() { if (null == GameManager.gameManager) { return; } // 根据回购背包数据更新回购槽 m_recycleGUIDList.Clear(); GameItemContainer buyBackPack = GameManager.gameManager.PlayerDataPool.BuyBackPack; int index = 0; if (buyBackPack == null) { return; } int count = buyBackPack.GetItemCount(); for (int i = 0; i < count; i++) { GameItem curItem = buyBackPack.GetItem(i); if (null != curItem && index < recycleItems.Length) { //sprRecycleSlots[index].gameObject.SetActive(true); m_recycleGUIDList.Add(curItem.Guid); int itemID = curItem.DataID; Tab_CommonItem curTabItem = TableManager.GetCommonItemByID(itemID, 0); if (null != curTabItem) { recycleItems[index].SetData(itemID, curItem.StackCount, true); index++; } } } for (int i = index; i < recycleItems.Length; i++) { recycleItems[i].SetData(-1, 0, true); } }
public void UpdateSelectEquip() { if (AutoEquipGuid == GlobeVar.INVALID_GUID) { GameItemContainer EquipPack = GameManager.gameManager.PlayerDataPool.EquipPack; if (EquipPack != null) { for (int index = 0; index < EquipPack.ContainerSize; index++) { GameItem equip = EquipPack.GetItem(index); if (equip != null && equip.IsValid() && equip.IsBelt() == false) { AutoEquipGuid = equip.Guid; SetAutoPickUpFlag((int)Games.GlobeDefine.GameDefine_Globe.AUTOCOMBAT_PICKUP_TYPE.PICKUP_EQUIP1, true); SetAutoPickUpFlag((int)Games.GlobeDefine.GameDefine_Globe.AUTOCOMBAT_PICKUP_TYPE.PICKUP_EQUIP2, true); ServerAutoInfo(); UpdateSellItem(); return; } } } } }
public uint Execute(PacketDistributed ipacket) { GC_RET_OTHERROLE_DATA packet = (GC_RET_OTHERROLE_DATA )ipacket; if (null == packet) { return((uint)PACKET_EXE.PACKET_EXE_ERROR); } //enter your logic GameManager.gameManager.OtherPlayerData.CleanUpData(); GameManager.gameManager.OtherPlayerData.Name = packet.Rolename; GameManager.gameManager.OtherPlayerData.CombatValue = packet.Combatvalue; GameManager.gameManager.OtherPlayerData.Level = packet.Leve; GameManager.gameManager.OtherPlayerData.Profession = packet.Profession; GameManager.gameManager.OtherPlayerData.RoleGUID = packet.Roleguid; GameManager.gameManager.OtherPlayerData.CurHp = packet.Curhp; GameManager.gameManager.OtherPlayerData.MaxHP = packet.Maxhp; GameManager.gameManager.OtherPlayerData.CurMp = packet.Curmp; GameManager.gameManager.OtherPlayerData.MaxMp = packet.Maxmp; GameManager.gameManager.OtherPlayerData.CurExp = packet.Curexp; GameManager.gameManager.OtherPlayerData.MaxExp = packet.Maxexp; GameManager.gameManager.OtherPlayerData.PAttck = packet.Pattack; GameManager.gameManager.OtherPlayerData.MAttack = packet.Mattack; GameManager.gameManager.OtherPlayerData.Hit = packet.Hit; GameManager.gameManager.OtherPlayerData.Critical = packet.Critical; GameManager.gameManager.OtherPlayerData.PDefense = packet.Pdefense; GameManager.gameManager.OtherPlayerData.MDefense = packet.Mdefense; GameManager.gameManager.OtherPlayerData.DeCritical = packet.Decritical; GameManager.gameManager.OtherPlayerData.Doge = packet.Doge; GameManager.gameManager.OtherPlayerData.Strike = packet.Strike; GameManager.gameManager.OtherPlayerData.CriticalAdd = packet.Criticaladd; GameManager.gameManager.OtherPlayerData.Ductical = packet.Dutical; GameManager.gameManager.OtherPlayerData.CriticalMis = packet.Criticalmis; if (packet.HasModelVisualID) { GameManager.gameManager.OtherPlayerData.ModuleVisualID = packet.ModelVisualID; } if (packet.HasWeaponDataID) { GameManager.gameManager.OtherPlayerData.CurWeaponDataID = packet.WeaponDataID; } if (packet.HasWeaponEffectGem) { GameManager.gameManager.OtherPlayerData.WeaponEffectGem = packet.WeaponEffectGem; } if (packet.HasGuildname) { GameManager.gameManager.OtherPlayerData.GuildName = packet.Guildname; } if (packet.HasViplvl) { GameManager.gameManager.OtherPlayerData.VipLvl = packet.Viplvl; } GameItemContainer EquipContainer = GameManager.gameManager.OtherPlayerData.EquipPack; if (EquipContainer != null) { for (int i = 0; i < packet.itemguidCount; i++) { int packindex = packet.GetPackindex(i); //È¡µÃÎïÆ· GameItem item = EquipContainer.GetItem(packindex); if (null == item) { continue; } item.DataID = packet.GetDataid(i); item.Guid = packet.GetItemguid(i); if (packet.GetBindflag(i) == 1) { item.BindFlag = true; } else { item.BindFlag = false; } item.StackCount = packet.GetStackcount(i); item.CreateTime = packet.GetCreatetime(i); item.EnchanceLevel = packet.GetEnchancelevel(i); item.EnchanceExp = packet.GetEnchanceexp(i); item.StarLevel = packet.GetStarlevel(i); item.DynamicData[0] = packet.GetDynamicdata1(i); item.DynamicData[1] = packet.GetDynamicdata2(i); item.DynamicData[2] = packet.GetDynamicdata3(i); item.DynamicData[3] = packet.GetDynamicdata4(i); item.DynamicData[4] = packet.GetDynamicdata5(i); item.DynamicData[5] = packet.GetDynamicdata6(i); item.DynamicData[6] = packet.GetDynamicdata7(i); item.DynamicData[7] = packet.GetDynamicdata8(i); item.EnchanceTotalExp = packet.GetEnchancetotalexp(i); item.StarTimes = packet.GetStartimes(i); } } int nGemCount = packet.gemidCount; for (int i = 0; i < (int)EquipPackSlot.Slot_NUM; i++) { for (int index = 0; index < (int)GemSlot.OPEN_NUM; index++) { int totalIndex = i * (int)GemSlot.OPEN_NUM + index; if (totalIndex >= 0 && totalIndex < nGemCount) { int nGemId = packet.GetGemid(totalIndex); GameManager.gameManager.OtherPlayerData.GemData.SetGemId(i, index, nGemId); } } } UIManager.ShowUI(UIInfo.OtherRoleView, OtherRoleViewLogic.OnShowOtherRoleVirew); return((uint)PACKET_EXE.PACKET_EXE_CONTINUE); }
public void UpdateDrug() { m_AutoFightInfoHpIndex.spriteName = ""; m_AutoFightInfoMpIndex.spriteName = ""; m_NilAutoFightInfoHp.gameObject.SetActive(false); m_NilAutoFightInfoMp.gameObject.SetActive(false); m_AutoFightInfoEquipIndex.spriteName = ""; m_NilAutoFightInfoEquip.gameObject.SetActive(false); GameItemContainer BackPack = GameManager.gameManager.PlayerDataPool.BackPack; Obj_MainPlayer User = Singleton <ObjManager> .Instance.MainPlayer; if (User) //更新信息 { if (User.AutoHpID != -1) { Tab_CommonItem curItem = TableManager.GetCommonItemByID(User.AutoHpID, 0); if (curItem != null) { m_AutoFightInfoHpIndex.spriteName = curItem.Icon; if (BackPack.GetItemCountByDataId(User.AutoHpID) <= 0) { m_NilAutoFightInfoHp.gameObject.SetActive(true); } } } if (User.AutoMpID != -1) { Tab_CommonItem curItem = TableManager.GetCommonItemByID(User.AutoMpID, 0); if (curItem != null) { m_AutoFightInfoMpIndex.spriteName = curItem.Icon; if (BackPack.GetItemCountByDataId(User.AutoMpID) <= 0) { m_NilAutoFightInfoMp.gameObject.SetActive(true); } } } m_AutoFightInfoEquipIndex.transform.parent.FindChild("Label").GetComponent <UILabel>().text = ""; if (User.AutoEquipGuid != GlobeVar.INVALID_GUID) { GameItemContainer EquipPack = GameManager.gameManager.PlayerDataPool.EquipPack; if (EquipPack != null) { for (int index = 0; index < EquipPack.ContainerSize; index++) { GameItem equip = EquipPack.GetItem(index); if (equip != null && equip.IsValid() && equip.Guid == User.AutoEquipGuid) { Tab_CommonItem curItem = TableManager.GetCommonItemByID(equip.DataID, 0); if (null != curItem) { m_AutoFightInfoEquipIndex.spriteName = curItem.Icon; //m_NilAutoFightInfoEquip.gameObject.SetActive(true); m_AutoFightInfoEquipQuality.spriteName = equip.GetQualityFrame(); m_AutoFightInfoEquipIndex.transform.parent.GetComponent <UISprite>().spriteName = equip.GetQualityFrame(); m_AutoFightInfoEquipIndex.transform.parent.FindChild("Label").GetComponent <UILabel>().text = "+" + equip.EnchanceLevel.ToString(); } } } } } } if (PlayerFrameLogic.Instance()) { PlayerFrameLogic.Instance().InitAutoFight(); } }
//====================================================== private void CreateItem(int curType) { Utils.CleanGrid(m_ItemGrid); GameItemContainer BackPack = GameManager.gameManager.PlayerDataPool.BackPack; if (Singleton <ObjManager> .Instance.MainPlayer) { if (curType == 1) { for (int i = (int)Games.GlobeDefine.GameDefine_Globe.AUTOCOMBAT_DRUG_ID.AUTO_DRUG_START_HP; i <= (int)Games.GlobeDefine.GameDefine_Globe.AUTOCOMBAT_DRUG_ID.AUTO_DRUG_END_HP; i++) { if (BackPack.GetItemCountByDataId(i) <= 0 && Singleton <ObjManager> .Instance.MainPlayer.AutoHpID != i && Singleton <ObjManager> .Instance.MainPlayer.AutoMpID != i) { continue; } Tab_CommonItem curItem = TableManager.GetCommonItemByID(i, 0); if (null != curItem) { AutoitemLogicEx.CreateItem(m_ItemGrid, m_ResItem, curType, curItem); } } for (int i = (int)Games.GlobeDefine.GameDefine_Globe.AUTOCOMBAT_DRUG_ID.AUTO_DRUG_START_DYHP; i <= (int)Games.GlobeDefine.GameDefine_Globe.AUTOCOMBAT_DRUG_ID.AUTO_DRUG_END_DYHP; i++) { if (BackPack.GetItemCountByDataId(i) <= 0 && Singleton <ObjManager> .Instance.MainPlayer.AutoHpID != i && Singleton <ObjManager> .Instance.MainPlayer.AutoMpID != i) { continue; } Tab_CommonItem curItem = TableManager.GetCommonItemByID(i, 0); if (null != curItem) { AutoitemLogicEx.CreateItem(m_ItemGrid, m_ResItem, curType, curItem); } } } else if (curType == 2) { for (int i = (int)Games.GlobeDefine.GameDefine_Globe.AUTOCOMBAT_DRUG_ID.AUTO_DRUG_START_MP; i <= (int)Games.GlobeDefine.GameDefine_Globe.AUTOCOMBAT_DRUG_ID.AUTO_DRUG_END_MP; i++) { if (BackPack.GetItemCountByDataId(i) <= 0 && Singleton <ObjManager> .Instance.MainPlayer.AutoHpID != i && Singleton <ObjManager> .Instance.MainPlayer.AutoMpID != i) { continue; } Tab_CommonItem curItem = TableManager.GetCommonItemByID(i, 0); if (null != curItem) { AutoitemLogicEx.CreateItem(m_ItemGrid, m_ResItem, curType, curItem); } } for (int i = (int)Games.GlobeDefine.GameDefine_Globe.AUTOCOMBAT_DRUG_ID.AUTO_DRUG_START_DYMP; i <= (int)Games.GlobeDefine.GameDefine_Globe.AUTOCOMBAT_DRUG_ID.AUTO_DRUG_END_DYMP; i++) { if (BackPack.GetItemCountByDataId(i) <= 0 && Singleton <ObjManager> .Instance.MainPlayer.AutoHpID != i && Singleton <ObjManager> .Instance.MainPlayer.AutoMpID != i) { continue; } Tab_CommonItem curItem = TableManager.GetCommonItemByID(i, 0); if (null != curItem) { AutoitemLogicEx.CreateItem(m_ItemGrid, m_ResItem, curType, curItem); } } } else if (curType == 3) { GameItemContainer EquipPack = GameManager.gameManager.PlayerDataPool.EquipPack; if (EquipPack != null) { for (int index = 0; index < EquipPack.ContainerSize; index++) { GameItem equip = EquipPack.GetItem(index); if (equip != null && equip.IsValid() && equip.IsBelt() == false) { AutoitemLogicEx.CreateEquip(m_ItemGrid, m_ResItem, curType, equip); } } } } } }
// 自动吃药 public bool AutoPercent(int nType) { bool bSucceed = false; if (nType != (int)MedicSubClass.HP && nType != (int)MedicSubClass.MP) { return(false); } GameItemContainer BackPack = GameManager.gameManager.PlayerDataPool.BackPack; GameItem eItem = null; int nType2 = nType; if (nType == (int)MedicSubClass.HP) { eItem = BackPack.GetItemByGuid(HpDrugGUID); nType2 = (int)MedicSubClass.HP_DY; } else if (nType == (int)MedicSubClass.MP) { eItem = BackPack.GetItemByGuid(MpDrugGUID); nType2 = (int)MedicSubClass.MP_DY; } if (eItem != null && eItem.IsValid()) { Tab_CommonItem line = TableManager.GetCommonItemByID(eItem.DataID, 0); if (null != line) { if (line.ClassID == (int)ItemClass.MEDIC && (line.SubClassID == nType || line.SubClassID == nType2) && (AutoHpID == line.Id || AutoMpID == line.Id)) { bSucceed = true; AutoUseDrug(eItem); } } } if (bSucceed == false) { for (int index = 0; index < BackPack.ContainerSize; ++index) { GameItem eItemEx = BackPack.GetItem(index); if (eItemEx != null && eItemEx.IsValid()) { Tab_CommonItem line = TableManager.GetCommonItemByID(eItemEx.DataID, 0); if (null != line) { if (line.ClassID == (int)ItemClass.MEDIC && (line.SubClassID == nType || line.SubClassID == nType2) && (AutoHpID == line.Id || AutoMpID == line.Id)) { bSucceed = true; if (AutoUseDrug(eItemEx)) { //BackPackItemLogic.Instance().UseItem(eItemEx); if (nType == (int)MedicSubClass.HP) { HpDrugGUID = eItemEx.Guid; } else { MpDrugGUID = eItemEx.Guid; } break; } } } } } } return(bSucceed); }
public void UpdateSelectDrug() { GameItemContainer BackPack = GameManager.gameManager.PlayerDataPool.BackPack; GameItem eItem = BackPack.GetItemByGuid(HpDrugGUID); //if (AutoIsSelectDrug == false) 永远可以自动选择药 { //做自动选药处理 bool isFind = false; if (eItem == null || (eItem != null && eItem.IsValid() == false) || AutoIsSelectDrug == false) { //优先选择选择过的药品类型 if (AutoIsSelectDrug == true) { if (AutoIsSelectDrug == true) { if (BackPack.GetItemCountByDataId(AutoHpID) > 0) { HpDrugGUID = BackPack.GetItemGuidByDataID(AutoHpID); isFind = true; } } } if (!isFind) { for (int i = (int)Games.GlobeDefine.GameDefine_Globe.AUTOCOMBAT_DRUG_ID.AUTO_DRUG_END_DYHP; i >= (int)Games.GlobeDefine.GameDefine_Globe.AUTOCOMBAT_DRUG_ID.AUTO_DRUG_START_DYHP; --i) { Tab_CommonItem commonItem = TableManager.GetCommonItemByID(i, 0); if (commonItem != null) { if (BaseAttr.Level >= commonItem.MinLevelRequire) { for (int index = 0; index < BackPack.ContainerSize; ++index) { GameItem eItemEx = BackPack.GetItem(index); if (eItemEx != null && eItemEx.DataID == i) //身上有这个药 { AutoHpID = i; HpDrugGUID = BackPack.GetItemGuidByDataID(AutoHpID); isFind = true; break; } } if (isFind) { break; } } } } } if (!isFind) { for (int i = (int)Games.GlobeDefine.GameDefine_Globe.AUTOCOMBAT_DRUG_ID.AUTO_DRUG_END_HP; i >= (int)Games.GlobeDefine.GameDefine_Globe.AUTOCOMBAT_DRUG_ID.AUTO_DRUG_START_HP; --i) { Tab_CommonItem commonItem = TableManager.GetCommonItemByID(i, 0); if (commonItem != null) { if (BaseAttr.Level >= commonItem.MinLevelRequire) { for (int index = 0; index < BackPack.ContainerSize; ++index) { GameItem eItemEx = BackPack.GetItem(index); if (eItemEx != null && eItemEx.DataID == i) //身上有这个药 { AutoHpID = i; HpDrugGUID = BackPack.GetItemGuidByDataID(AutoHpID); isFind = true; break; } } if (isFind) { break; } } } } } } eItem = BackPack.GetItemByGuid(MpDrugGUID); if (eItem == null || (eItem != null && eItem.IsValid() == false) || AutoIsSelectDrug == false) { isFind = false; //优先选择选择过的药品类型 if (AutoIsSelectDrug == true) { if (BackPack.GetItemCountByDataId(AutoMpID) > 0) { MpDrugGUID = BackPack.GetItemGuidByDataID(AutoMpID); isFind = true; } } if (!isFind) { for (int i = (int)Games.GlobeDefine.GameDefine_Globe.AUTOCOMBAT_DRUG_ID.AUTO_DRUG_END_DYMP; i >= (int)Games.GlobeDefine.GameDefine_Globe.AUTOCOMBAT_DRUG_ID.AUTO_DRUG_START_DYMP; --i) { Tab_CommonItem commonItem = TableManager.GetCommonItemByID(i, 0); if (commonItem != null) { if (BaseAttr.Level >= commonItem.MinLevelRequire) { for (int index = 0; index < BackPack.ContainerSize; ++index) { GameItem eItemEx = BackPack.GetItem(index); if (eItemEx != null && eItemEx.DataID == i) //身上有这个药 { AutoMpID = i; MpDrugGUID = BackPack.GetItemGuidByDataID(AutoMpID); isFind = true; break; } } if (isFind) { break; } } } } } if (!isFind) { for (int i = (int)Games.GlobeDefine.GameDefine_Globe.AUTOCOMBAT_DRUG_ID.AUTO_DRUG_END_MP; i >= (int)Games.GlobeDefine.GameDefine_Globe.AUTOCOMBAT_DRUG_ID.AUTO_DRUG_START_MP; --i) { Tab_CommonItem commonItem = TableManager.GetCommonItemByID(i, 0); if (commonItem != null) { if (BaseAttr.Level >= commonItem.MinLevelRequire) { for (int index = 0; index < BackPack.ContainerSize; ++index) { GameItem eItemEx = BackPack.GetItem(index); if (eItemEx != null && eItemEx.DataID == i) //身上有这个药 { AutoMpID = i; MpDrugGUID = BackPack.GetItemGuidByDataID(AutoMpID); isFind = true; break; } } if (isFind) { break; } } } } } } } }
public uint Execute(PacketDistributed ipacket) { GC_UPDATEITEM packet = (GC_UPDATEITEM)ipacket; if (null == packet) { return((uint)PACKET_EXE.PACKET_EXE_ERROR); } int packtype = packet.Packtype; int packindex = packet.Packindex; GameItemContainer.Type containertype = (GameItemContainer.Type)packtype; //取得物品容器 GameItemContainer Container = GameManager.gameManager.PlayerDataPool.GetItemContainer(containertype); if (Container != null) { //取得物品 GameItem item = Container.GetItem(packindex); if (item != null) { int nRawId = item.DataID; UInt64 RawGuidID = item.Guid; //ID item.DataID = packet.Dataid; //GUID item.Guid = packet.Guid; //绑定 if (packet.HasBindflag) { if (packet.Bindflag == 1) { item.BindFlag = true; } else { item.BindFlag = false; } } else { item.BindFlag = false; } //叠加数量 if (packet.HasStackcount) { item.StackCount = packet.Stackcount; } else { item.StackCount = 1; } //创建时间 item.CreateTime = packet.Createtime; //强化等级 if (packet.HasEnchancelevel) { item.EnchanceLevel = packet.Enchancelevel; } else { item.EnchanceLevel = 0; } //强化经验 if (packet.HasEnchanceexp) { item.EnchanceExp = packet.Enchanceexp; } else { item.EnchanceExp = 0; } //强化总经验 if (packet.HasEnctotaltexp) { item.EnchanceTotalExp = packet.Enctotaltexp; } else { item.EnchanceTotalExp = 0; } //打星等级 if (packet.HasStarlevel) { item.StarLevel = packet.Starlevel; } else { item.StarLevel = 0; } //打星次数 if (packet.HasStartimes) { item.StarTimes = packet.Startimes; } else { item.StarTimes = 0; } //动态参数 if (packet.HasDynamicdata1) { item.DynamicData[0] = packet.Dynamicdata1; } else { item.DynamicData[0] = 0; } if (packet.HasDynamicdata2) { item.DynamicData[1] = packet.Dynamicdata2; } else { item.DynamicData[1] = 0; } if (packet.HasDynamicdata3) { item.DynamicData[2] = packet.Dynamicdata3; } else { item.DynamicData[2] = 0; } if (packet.HasDynamicdata4) { item.DynamicData[3] = packet.Dynamicdata4; } else { item.DynamicData[3] = 0; } if (packet.HasDynamicdata5) { item.DynamicData[4] = packet.Dynamicdata5; } else { item.DynamicData[4] = 0; } if (packet.HasDynamicdata6) { item.DynamicData[5] = packet.Dynamicdata6; } else { item.DynamicData[5] = 0; } if (packet.HasDynamicdata7) { item.DynamicData[6] = packet.Dynamicdata7; } else { item.DynamicData[6] = 0; } if (packet.HasDynamicdata8) { item.DynamicData[7] = packet.Dynamicdata8; } else { item.DynamicData[7] = 0; } //装备属性浮动参数 if (packet.HasAttrfactor) { item.AttrFactor = packet.Attrfactor; } else { item.AttrFactor = GlobeVar.INVALID_ID; } //更新界面 switch (containertype) { //物品背包 case GameItemContainer.Type.TYPE_BACKPACK: { if (BackPackLogic.Instance() != null) { BackPackLogic.Instance().UpdateBackPack(); } //美人提示 BelleData.UpdateBelleItemTip(item.DataID, item.StackCount); BelleData.UpdateBelleEvoCountTip(item.DataID, item.StackCount); //宝石界面 if (GemLogic.Instance() != null) { GemLogic.Instance().UpdateGemItemList(); } //自动选择药 if (Singleton <ObjManager> .GetInstance().MainPlayer) { Singleton <ObjManager> .GetInstance().MainPlayer.UpdateSelectDrug(); //更新头顶图标信息 if (PlayerFrameLogic.Instance()) { PlayerFrameLogic.Instance().InitAutoFight(); } //自动出售 if (item.DataID != -1) { Singleton <ObjManager> .GetInstance().MainPlayer.UpdateSellItem(packindex); } } // 乾坤袋 if (QianKunDaiLogic.Instance() != null && QianKunDaiLogic.Instance().gameObject.activeSelf) { QianKunDaiLogic.Instance().HandleUpdateItemPacket(); } // 生活技能 if (LivingSkillLogic.Instance() != null) { LivingSkillLogic.Instance().HandleUpdateItem(); } //仓库界面 if (CangKuLogic.Instance() != null) { CangKuLogic.Instance().UpdateBackPack(); } //情人节收到的花 // if (FriendChooseLogic.RoseDataId0 == item.DataID) // { // if (null != Singleton<ObjManager>.Instance.MainPlayer && // Singleton<ObjManager>.Instance.MainPlayer.CheckUseItem(item)) // { // Singleton<ObjManager>.Instance.MainPlayer.UseItem(item); // } // // } //魅力道具 // if (FlowerEggWindow.CHARM_ITEM_ID == item.DataID) // { // if (null != Singleton<ObjManager>.Instance.MainPlayer && // Singleton<ObjManager>.Instance.MainPlayer.CheckUseItem(item)) // { // Singleton<ObjManager>.Instance.MainPlayer.UseItem(item); // } // // } // if (FlowerEggWindow.Instance() != null) // { // FlowerEggWindow.Instance().UpdateItemNum(); // } if (GongZhanTianXiaWindow.Instance() != null && GlobeVar.ZHANKUANGPAI_DATAID == item.DataID) { GongZhanTianXiaWindow.Instance().UpdateZhanKuangPaiCount(); } if (GongJiShopLogic.Instance() != null && GongJiShopLogic.ConsumItem_DataID == item.DataID) { GongJiShopLogic.Instance().UpDateGongJi(); } } break; //装备槽位 case GameItemContainer.Type.TYPE_EQUIPPACK: { if (BackPackLogic.Instance() != null) { BackPackLogic.Instance().UpdateEquipPack(); } if (RoleViewLogic.Instance() != null) { RoleViewLogic.Instance().UpdateEquipPack(); } //自动强化装备选择 if (Singleton <ObjManager> .GetInstance().MainPlayer && VipData.GetVipLv() >= GlobeVar.USE_AUTOFIGHT_VIPLEVEL && Singleton <ObjManager> .GetInstance().MainPlayer.BaseAttr.Level >= GlobeVar.MAX_AUTOEQUIT_LIVE) { if (RawGuidID == Singleton <ObjManager> .GetInstance().MainPlayer.AutoEquipGuid) { if (item.IsValid()) { Singleton <ObjManager> .GetInstance().MainPlayer.AutoEquipGuid = item.Guid; } else { Singleton <ObjManager> .GetInstance().MainPlayer.AutoEquipGuid = GlobeVar.INVALID_GUID; Singleton <ObjManager> .GetInstance().MainPlayer.UpdateSelectEquip(); } } } //神器强化界面 if (EquipShenQiStrength.Instance() != null) { EquipShenQiStrength.Instance().UpdateShenQiViewInfo(); } } break; case GameItemContainer.Type.TYPE_BUYBACKPACK: { SysShopController sysShop = UIControllerBase <SysShopController> .Instance(); if (sysShop != null) { sysShop.UpdateBuyBackItems(); } } break; } ; } } //enter your logic return((uint)PACKET_EXE.PACKET_EXE_CONTINUE); }
void OnLoadDrugItem(GameObject resItem, object param) { if (null == resItem) { LogModule.ErrorLog("OnLoadDrugItem resItem is null"); return; } GameItemContainer BackPack = GameManager.gameManager.PlayerDataPool.BackPack; if (Singleton <ObjManager> .Instance.MainPlayer) { if (m_curType == 1) { for (int i = (int)Games.GlobeDefine.GameDefine_Globe.AUTOCOMBAT_DRUG_ID.AUTO_DRUG_START_HP; i <= (int)Games.GlobeDefine.GameDefine_Globe.AUTOCOMBAT_DRUG_ID.AUTO_DRUG_END_HP; i++) { if (BackPack.GetItemCountByDataId(i) <= 0 && Singleton <ObjManager> .Instance.MainPlayer.AutoHpID != i && Singleton <ObjManager> .Instance.MainPlayer.AutoMpID != i) { continue; } Tab_CommonItem curItem = TableManager.GetCommonItemByID(i, 0); if (null != curItem) { AutoDrugItem.CreateItem(ItemParent, resItem, this, curItem); } } for (int i = (int)Games.GlobeDefine.GameDefine_Globe.AUTOCOMBAT_DRUG_ID.AUTO_DRUG_START_DYHP; i <= (int)Games.GlobeDefine.GameDefine_Globe.AUTOCOMBAT_DRUG_ID.AUTO_DRUG_END_DYHP; i++) { if (BackPack.GetItemCountByDataId(i) <= 0 && Singleton <ObjManager> .Instance.MainPlayer.AutoHpID != i && Singleton <ObjManager> .Instance.MainPlayer.AutoMpID != i) { continue; } Tab_CommonItem curItem = TableManager.GetCommonItemByID(i, 0); if (null != curItem) { AutoDrugItem.CreateItem(ItemParent, resItem, this, curItem); } } } else if (m_curType == 2) { for (int i = (int)Games.GlobeDefine.GameDefine_Globe.AUTOCOMBAT_DRUG_ID.AUTO_DRUG_START_MP; i <= (int)Games.GlobeDefine.GameDefine_Globe.AUTOCOMBAT_DRUG_ID.AUTO_DRUG_END_MP; i++) { if (BackPack.GetItemCountByDataId(i) <= 0 && Singleton <ObjManager> .Instance.MainPlayer.AutoHpID != i && Singleton <ObjManager> .Instance.MainPlayer.AutoMpID != i) { continue; } Tab_CommonItem curItem = TableManager.GetCommonItemByID(i, 0); if (null != curItem) { AutoDrugItem.CreateItem(ItemParent, resItem, this, curItem); } } for (int i = (int)Games.GlobeDefine.GameDefine_Globe.AUTOCOMBAT_DRUG_ID.AUTO_DRUG_START_DYMP; i <= (int)Games.GlobeDefine.GameDefine_Globe.AUTOCOMBAT_DRUG_ID.AUTO_DRUG_END_DYMP; i++) { if (BackPack.GetItemCountByDataId(i) <= 0 && Singleton <ObjManager> .Instance.MainPlayer.AutoHpID != i && Singleton <ObjManager> .Instance.MainPlayer.AutoMpID != i) { continue; } Tab_CommonItem curItem = TableManager.GetCommonItemByID(i, 0); if (null != curItem) { AutoDrugItem.CreateItem(ItemParent, resItem, this, curItem); } } } else if (m_curType == 3) { GameItemContainer EquipPack = GameManager.gameManager.PlayerDataPool.EquipPack; if (EquipPack != null) { for (int index = 0; index < EquipPack.ContainerSize; index++) { GameItem equip = EquipPack.GetItem(index); if (equip != null && equip.IsValid() && equip.IsBelt() == false) { AutoDrugItem.CreateEquip(ItemParent, resItem, this, equip); } } } } } // foreach (List<Tab_CommonItem> curList in TableManager.GetCommonItem().Values) // { // Tab_CommonItem curItem = curList[0]; // if (null != curItem) // { // if (curItem.ClassID == (int)ItemClass.MEDIC) // { // if ((m_curType == 1 && curItem.SubClassID == (int)MedicSubClass.HP) // || (m_curType == 2 && curItem.SubClassID == (int)MedicSubClass.MP)) // { // // bool IsShow = false; // int ShopId = 3; // Tab_SystemShop curShop = TableManager.GetSystemShopByID(ShopId.ToString(), 0); // if (curShop != null) // { // for (int i = 0; i < curShop.Pnum; i++) // { // if (curItem.Id == curShop.GetPidbyIndex(i)) // { // IsShow = true; // break; // } // // } // if (IsShow) // { // AutoDrugItem.CreateItem(ItemParent,resItem, curItem.Id, curItem.Icon, curItem.Name, this); // } // } // // } // } // // } // } ItemParent.GetComponent <UIGrid>().Reposition(); ItemParent.GetComponent <UITopGrid>().Recenter(true); }
/// <summary> /// 更新装备槽部分显示 /// </summary> public void UpdateEquipPack() { GameItemContainer EquipPack = GameManager.gameManager.PlayerDataPool.EquipPack; for (int index = 0; index < EquipPack.ContainerSize; ++index) { GameItem equip = EquipPack.GetItem(GetEquipSlotByIndex(index)); if (equip != null && equip.IsValid()) { UISprite IconSprite = m_EquipSlotIcon[index]; if (IconSprite != null) { IconSprite.gameObject.SetActive(true); IconSprite.spriteName = equip.GetIcon(); IconSprite.MakePixelPerfect(); //显示品质边框 UISprite QualitySprite = m_EquipSlotQualityFrame[index]; if (QualitySprite != null) { QualitySprite.gameObject.SetActive(true); QualitySprite.spriteName = equip.GetQualityFrame(); QualitySprite.MakePixelPerfect(); } //显示强化等级 UILabel ExhanceLevel = m_EquipSlotEnhanceLevel[index]; if (ExhanceLevel != null) { //if (equip.EnchanceLevel > 0) //{ ExhanceLevel.text = "+" + equip.EnchanceLevel.ToString(); ExhanceLevel.gameObject.SetActive(true); ExhanceLevel.MakePixelPerfect(); //} //else //{ // ExhanceLevel.gameObject.SetActive(false); //} } } } else { UISprite IconSprite = m_EquipSlotIcon[index]; if (IconSprite != null) { IconSprite.gameObject.SetActive(false); } UISprite QualitySprite = m_EquipSlotQualityFrame[index]; if (QualitySprite != null) { QualitySprite.gameObject.SetActive(false); } UILabel ExhanceLevel = m_EquipSlotEnhanceLevel[index]; if (ExhanceLevel != null) { ExhanceLevel.gameObject.SetActive(false); } } } }