public void SendAllItemToPlayer() { if (GameConfig.IsMultiMode) { if (null != mNetWork) { mNetWork.GetAllItem(); } } else { foreach (int itemObjID in mItemList) { ItemObject itemObj = ItemMgr.Instance.Get(itemObjID); //if(PlayerFactory.mMainPlayer.AddItem(itemObj)) // mItemList.Remove(itemObj.instanceId); //else //{ // ResetUI(); // break; //} if (null != Pathea.MainPlayerCmpt.gMainPlayer) { Pathea.PlayerPackageCmpt pPC = Pathea.MainPlayerCmpt.gMainPlayer.GetComponent <Pathea.PlayerPackageCmpt>(); pPC.Add(itemObj); } } mItemList.Clear(); CheckDestroy(); } }
public virtual void FetchAll() { if (!CanFetchAll()) { return; } if (_net != null) { _net.GetAllItem(); } else { foreach (ItemSample item in _itemList) { playerPkg.Add(item.protoId, item.stackCount); } _itemList.Clear(); if (fetchItem != null) { fetchItem.Invoke(); } } }