示例#1
0
    protected DropItemInfo GetClosestDropItem(List <DropItemInfo> _targetList)
    {
        Vector3      curPos    = GameCenter.curMainPlayer.transform.position;
        Vector3      targetPos = Vector3.zero;
        float        distance  = 0;
        DropItemInfo dropInfo  = null;

        for (int i = 0, length = _targetList.Count; i < length; i++)
        {
            targetPos = ActorMoveFSM.LineCast(new Vector2(targetList[i].ServerPos.x, targetList[i].ServerPos.y), true);
            Vector3[] path = GameStageUtility.StartPath(targetPos, curPos);
            if (path != null)
            {
                float tempDistance = path.Length == 2 ? Vector3.Distance(targetPos, curPos) : path.CountPathDistance();
                if (distance == 0)
                {
                    distance = tempDistance;
                    dropInfo = _targetList[i];
                }
                else
                {
                    if (tempDistance < distance)
                    {
                        distance = tempDistance;
                        dropInfo = _targetList[i];
                    }
                }
            }
        }
        if (dropInfo != null)
        {
            return(dropInfo);
        }
        return(_targetList.Count > 0 ? _targetList[0] : null);
    }
示例#2
0
    /// <summary>
    /// 保存掉落信息
    /// </summary>
    /// <param name="hero_uid">怪物唯一id</param>
    /// <param name="drop_list">所有玩家的掉落list 注意是所有玩家的 --我觉得是隐患</param>
    internal void OnSaveDropItemInfo(uint hero_uid, List <DropInfo> drop_list, int type)
    {
        int length = drop_list.Count;

        if (length <= 0)
        {
            return;
        }

        ServerListProxy serverListProxy = GameFacade.Instance.RetrieveProxy(ProxyName.ServerListProxy) as ServerListProxy;
        ulong           MainPlayerId    = serverListProxy.GetCurrentCharacterVO().UId;

        for (int i = 0; i < length; ++i)
        {
            if (drop_list[i].PlayerUid == MainPlayerId)
            {
                DropItemInfo dropItemInfo = new DropItemInfo();
                dropItemInfo.uid       = hero_uid;
                dropItemInfo.tid       = drop_list[i].ChestTid;
                dropItemInfo.qualityid = drop_list[i].Quality;
                dropItemInfo.shipgrade = drop_list[i].ShipTlv;
                m_ChestInfoDic.Add(hero_uid, dropItemInfo);
                break;
            }
        }
    }
示例#3
0
    public void Despawner(ResourceType t, DropItemInfo dropItem)
    {
        if (null == dropItem)
        {
            return;
        }

        //int itemId = dropItem.ItemId;
        ItemDespawnerInfo despawnItem = new ItemDespawnerInfo(dropItem.ItemId, dropItem.InfoId);
        MapArea           area        = dropItem.Area;

        if (EntityMgr.Instance.BackItemMapDic.ContainsKey(area))
        {
            EntityMgr.Instance.BackItemMapDic[area].Add(despawnItem);
        }
        else
        {
            List <ItemDespawnerInfo> itemIds = new List <ItemDespawnerInfo>();
            itemIds.Add(despawnItem);
            EntityMgr.Instance.BackItemMapDic[area] = itemIds;
        }

        if (EntityMgr.Instance.DropItemDic.ContainsKey(dropItem.ItemId))
        {
            EntityMgr.Instance.DropItemDic.Remove(dropItem.ItemId);
        }
        Despawner(t, dropItem.Cache);
    }
示例#4
0
        void Update()
        {
            //if (Time.time - lastPickTime > pickTimeInterval)
            //{
            if (m_DropItemList.Count > 0)
            {
                m_PickItems.Clear();
                for (int i = 0; i < m_DropItemList.Count; i++)
                {
                    DropItemInfo item = m_DropItemList[i];
                    if (!hasAddedItems.Contains(item.serverID))
                    {
                        if (CanPick(item))
                        {
                            m_PickItems.Add(item.serverID);
                            hasAddedItems.Add(item.serverID);
                        }
                    }
                }

                SendPickItem();
            }

            //lastPickTime = Time.time;
            //}
        }
示例#5
0
    public void RestoreState(object state)
    {
        DropItemInfo item = (DropItemInfo)state;

        transform.position = item.pos;
        itemtype           = (ItemType)item.type;
    }
示例#6
0
        private void HandleRecvDropItem(Packet parsed)
        {
            DropItemInfo d = PacketManager.RecvDropItem(parsed);

            if (ClientDropItemInfo != null)
            {
                ClientDropItemInfo(this, new ClientDropItemEventArgs(d));
            }
        }
示例#7
0
    public void InitMapDrop(int mapId)
    {
        if (!GameMgr.Instance.DicMapInfo.ContainsKey(mapId))
        {
            return;
        }
        MapInfo mapInfo = GameMgr.Instance.DicMapInfo[mapId];

        if (null != mapInfo)
        {
            List <ItemMapInfo> points = mapInfo.ItemMapInfo.FindAll(delegate(ItemMapInfo map) { return(map.IMapType == ItemMapType.POINT); });
            List <ItemMapInfo> items  = mapInfo.ItemMapInfo.FindAll(delegate(ItemMapInfo map) { return(map.IMapType == ItemMapType.ITEM); });
            HashSet <int>      set    = new HashSet <int>();
            int cout = points.Count;
            while (set.Count < 5)
            {
                int r = Random.Range(0, cout);
                if (!set.Contains(r))
                {
                    set.Add(r);
                }
            }

            int poz = 0;
            foreach (int idx in set)
            {
                if (idx < points.Count)
                {
                    Debuger.LogError("随机五个点刷新五种道具位置:" + idx);
                    poz++;
                    float        offX     = Random.Range(-points[idx].Width, points[idx].Width);
                    float        offY     = Random.Range(-points[idx].Height, points[idx].Height);
                    GameObject   go       = Spawner(poz, new Vector3(points[idx].PosX + offX, 0, points[idx].PosY + offY), ResourceType.RESOURCE_ITEM, GameMgr.Instance.ItemRoot);
                    DropItemInfo dropInfo = Util.AddComponent <DropItemInfo>(go);
                    dropInfo.ItemId = idx;
                    dropInfo.InfoId = poz;
                    dropInfo.Area   = points[idx].Area;
                    dropInfo.DropAI = DropAI.LATER;
                    EntityMgr.Instance.DropItemDic[idx] = dropInfo;
                }
            }


            for (int idx = 0; idx < items.Count; idx++)
            {
                float        offX     = Random.Range(-points[idx].Width, points[idx].Width);
                float        offY     = Random.Range(-points[idx].Height, points[idx].Height);
                GameObject   go       = Spawner((int)ItemType.ITEM_ENERGY, new Vector3(items[idx].PosX + offX, 0, items[idx].PosY + offY), ResourceType.RESOURCE_ITEM, GameMgr.Instance.ItemRoot);
                DropItemInfo dropInfo = Util.AddComponent <DropItemInfo>(go);
                dropInfo.ItemId = idx;
                dropInfo.InfoId = poz;
                dropInfo.Area   = points[idx].Area;
                dropInfo.DropAI = DropAI.LATER;
                EntityMgr.Instance.DropItemDic[idx] = dropInfo;
            }
        }
    }
示例#8
0
 private void OnTriggerEnter(Collider other)
 {
     Debuger.LogError(" 进入了" + other.transform.name);
     if (other.CompareTag("Item"))
     {
         DropItemInfo drop = other.GetComponent <DropItemInfo>();
         if (null != drop)
         {
             drop.FlyToEntity(this);
         }
     }
 }
示例#9
0
    void InistantDropItem(ItemMapInfo mapInfo, ItemType type)
    {
        float        offX     = Random.Range(-mapInfo.Width, mapInfo.Width);
        float        offY     = Random.Range(-mapInfo.Height, mapInfo.Height);
        GameObject   go       = Spawner((int)type, new Vector3(mapInfo.PosX + offX, 0, mapInfo.PosY + offY), ResourceType.RESOURCE_ITEM, GameMgr.Instance.ItemRoot);
        DropItemInfo dropInfo = Util.AddComponent <DropItemInfo>(go);

        dropInfo.ItemId = mapInfo.Index;
        dropInfo.InfoId = (int)type;
        dropInfo.Area   = mapInfo.Area;
        dropInfo.IsLock = false;
        //dropInfo.DropAI = DropAI.LATER;
        //Debug.LogError(mapInfo.Index +" "+type);
        EntityMgr.Instance.DropItemDic[dropInfo.ItemId] = dropInfo;
    }
        private void DropItem(GameItemCategory category, Vector3 pos)
        {
            var dropItem = new DropItemInfo
            {
                CatalogId = GameItemTypeExtentions.GetRandomItem(category),
                Pos       = pos,
                WorldId   = Storage.GetUniqueWorldId()
            };

            Model.AddItem(dropItem);
            var dropItemMessage = new CreateDropItemMsg {
                DropInfo = dropItem
            };

            Server.SendToAll(dropItemMessage);
        }
示例#11
0
    /// <summary>
    /// 创建净数据对象 by吴江
    /// </summary>
    /// <param name="_info"></param>
    /// <returns></returns>
    public static DropItem CreateDummy(DropItemInfo _info)
    {
        GameObject newGO = new GameObject("Dummy DropItem[" + _info.ServerInstanceID + "]");

        newGO.tag = "Monster";
        newGO.SetMaskLayer(LayerMask.NameToLayer("DropItem"));
        DropItem item = newGO.AddComponent <DropItem>();

        item.actorInfo = _info;
        item.isDummy_  = true;
        item.id        = _info.ServerInstanceID;
        GameCenter.curGameStage.PlaceGameObjectFromServer(item, _info.StartPos.x, _info.StartPos.z, 90, _info.StartPos.y);
        GameCenter.curGameStage.AddObject(item);

        return(item);
    }
示例#12
0
        /// <summary>
        /// 生成掉落
        /// </summary>
        /// <param name="dropPos"></param>
        /// <param name="dropItem"></param>
        private void GenerateDropItem(Vector3 dropPos, string dropEft, int quality, ref DropItemInfo dropItem)
        {
            GameObjectPool objPool       = null;
            GameObject     qualityEftObj = null;

            dropItem.dropEft = dropEft;
            if (m_itemEftPoolDict.ContainsKey(dropEft))
            {
                dropItem.dropType = DROP_TYPE.DROPTYPE_COMMON;
                objPool           = m_itemEftPoolDict[dropEft];

                if (QualitEftDict.ContainsKey(quality))
                {
                    qualityEftObj = CoreEntry.gGameObjPoolMgr.Instantiate(QualitEftDict[quality]);
                }
            }
            else
            {
                dropItem.dropType = DROP_TYPE.DROPTYPE_GOLD;
                objPool           = m_moneyEftObjectPool;
            }

            GameObject obj = null;

            if (objPool != null)
            {
                obj = objPool.ObtainPrefabInstance();
                if (obj == null)
                {
                    return;
                }
                dropItem.dropItemObj       = obj;
                dropItem.dropItem          = obj.GetComponent <DropItem>();
                obj.transform.position     = dropPos;
                dropItem.dropQualityEftObj = qualityEftObj;

                if (null != qualityEftObj)
                {
                    qualityEftObj.transform.SetParent(obj.transform);
                    qualityEftObj.transform.localPosition = Vector3.zero;
                    qualityEftObj.transform.localScale    = Vector3.one;
                    qualityEftObj.transform.localRotation = Quaternion.identity;
                }
            }
        }
示例#13
0
    void InistantDropItem(ItemMapInfo mapInfo, ItemType type)
    {
        //Debug.LogError("产生道具类型:" + type);
        float        offX     = Random.Range(-mapInfo.Width, mapInfo.Width);
        float        offY     = Random.Range(-mapInfo.Height, mapInfo.Height);
        GameObject   go       = Spawner((int)type, new Vector3(mapInfo.PosX + offX, 0, mapInfo.PosY + offY), ResourceType.RESOURCE_ITEM, GameMgr.Instance.ItemRoot);
        DropItemInfo dropInfo = Util.AddComponent <DropItemInfo>(go);

        dropInfo.ItemId = mapInfo.Index;
        dropInfo.InfoId = (int)type;
        dropInfo.Area   = mapInfo.Area;
        dropInfo.IsLock = false;
        if (TSCData.Instance.DropItemDic.ContainsKey(dropInfo.ItemId))
        {
            Despawner(ResourceType.RESOURCE_ITEM, TSCData.Instance.DropItemDic[dropInfo.ItemId]);
        }
        TSCData.Instance.DropItemDic[dropInfo.ItemId] = dropInfo;
    }
示例#14
0
        private void DropItem(GameItemCategory category, Vector3 pos, int itemSpawnPointIndex = -1)
        {
            var dropItem = new DropItemInfo()
            {
                CatalogId           = GameItemTypeExtensions.GetRandomItem(category),
                Pos                 = pos,
                ItemSpawnPointIndex = itemSpawnPointIndex,
                WorldId             = Storage.GetUniqueWorldId()
            };

            Model.AddItem(dropItem);
            var dropItemMessage = new CreateDropItemMsg()
            {
                DropInfo = dropItem
            };

            Server.SendToAll(dropItemMessage);
        }
示例#15
0
    protected AssetMng.DownloadID Create(DropItemInfo _info, System.Action <DropItem, EResult> _callback)
    {
        return(exResources.GetDropItem(_info.ConfigID, delegate(GameObject _asset, EResult _result)
        {
            if (GameCenter.IsDummyDestroyed(ObjectType.DropItem, _info.ServerInstanceID))
            {
                _callback(null, EResult.Failed);
                return;
            }
            if (_result != EResult.Success)
            {
                _callback(null, _result);
                return;
            }
            this.gameObject.name = "DropItem[" + _info.ServerInstanceID + "]";

            GameObject newGO = Instantiate(_asset) as GameObject;
            newGO.name = _asset.name;
            newGO.transform.parent = this.gameObject.transform;
            newGO.transform.localEulerAngles = Vector3.zero;
            newGO.transform.localPosition = Vector3.zero;
            newGO.transform.localScale = Vector3.one;
            newGO.AddComponent <FXCtrl>();
            RefreshShader(newGO);
            newGO.SetActive(false);
            newGO.SetActive(true);
            Animation anima = newGO.GetComponent <Animation>();
            if (anima != null && anima["drop"] != null)
            {
                anima["drop"].wrapMode = WrapMode.ClampForever;
                anima.Play("drop");
            }
            else
            {
                Debug.LogError("找不到 drop  动画!");
            }


            isDummy_ = false;

            Init();
            _callback(this, _result);
        }));
    }
示例#16
0
    public void AddToDropList(int packTab, int Index, Grid_N grid, Grid_N curDropItem = null)
    {
        if (curDropItem == null)
        {
            curDropItem = GetEmptyGrid();
            if (null == curDropItem)
            {
                PeTipMsg.Register(PELocalization.GetString(82209001), PeTipMsg.EMsgLevel.Warning);
                return;
            }
        }
        RemoveFromDropList(curDropItem);
        curDropItem.SetItem(grid.Item);
        DropItemInfo info = new DropItemInfo();

        info.SetInfo(packTab, Index, grid, grid.ItemObj);
        mDropInfoList.Add(info);
        ResetPackageWnd(packTab, Index);
    }
示例#17
0
        private void OnPickedItem(int unitId, PickupItem item)
        {
            if (Player.Unit.UnitID == unitId && Player.IsAlive)
            {
                var itemType = item.ItemType;
                var dropInfo = new DropItemInfo {
                    WorldId = item.WorldId, CatalogId = itemType
                };
                Client.Send(new PickUpGameItemMsg {
                    DropInfo = dropInfo
                });

                string messageText = string.Format("You picked up {0}", itemType);

                SimpleMessageForm notificationMessage = View.CreateNotificationForm();
                notificationMessage.Init(messageText);

                ApplyCommand(new ShowNotificationFormCommand(notificationMessage, 2f));
            }
        }
示例#18
0
        /// <summary>
        /// 物品是否可拾取
        /// </summary>
        /// <param name="dropItem"></param>
        /// <returns></returns>
        private bool CanPick(DropItemInfo dropItem)
        {
            if (null == dropItem.dropItemObj)
            {
                return(false);
            }

            DropItem item = dropItem.dropItemObj.GetComponent <DropItem>();

            if (null == item)
            {
                return(false);
            }

            if (false == item.CanPick)
            {
                return(false);
            }

            return(CanPickByPosition(dropItem.dropPosition));
        }
示例#19
0
    public void DropRareItem(Vector3 pos, int score, Transform parent)
    {
        if (null == m_dropItem)
        {
            m_dropItem = InfoMgr <ItemInfo> .Instance.GetInfo((int)ItemType.ITEM_RAREENERGY);
        }

        if (null == m_dropItemEffect)
        {
            m_dropItemEffect = InfoMgr <ItemEffectInfo> .Instance.GetInfo(m_dropItem.effectId);
        }

        int count = UnityEngine.Random.Range(score / 3 / m_dropItemEffect.param1, score / 2 / m_dropItemEffect.param1);

        for (int i = 0; i < count; i++)
        {
            float      dis   = Random.Range(AppConst.DropItemRangeParam1, AppConst.DropItemRangeParam2);
            float      angle = 360.0f * i / count;
            float      x     = Mathf.Cos(angle) * dis;
            float      y     = Mathf.Sin(angle) * dis;
            Vector3    v     = new Vector3(pos.x + x, 0, pos.z + y);
            GameObject go    = Spawner((int)ItemType.ITEM_RAREENERGY, pos, ResourceType.RESOURCE_ITEM, parent);
            if (null != go)
            {
                DropItemInfo dropItem = Util.AddComponent <DropItemInfo>(go);
                dropItem.IsLock = true;
                if (dropItem.ItemId == 0)
                {
                    dropItem.ItemId = Util.GetDropRareIndex();
                }
                dropItem.InfoId = (int)ItemType.ITEM_RAREENERGY;
                TSCData.Instance.RareEnergyDic[dropItem.ItemId] = dropItem;
                dropItem.Cache.DOMove(v, 0.5f).SetEase(Ease.Linear).OnComplete(() =>
                {
                    dropItem.IsLock = false;
                });
            }
        }
    }
示例#20
0
        //private static bool HandleItemMove(Client c, MoveItemInfo m, BaseItem item)
        //{

        //    if (c.MyCharacter.Bags[m.ToBag - 1].MoveItem(item, m.ToBag, m.ToSlot, out BaseItem))
        //    {
        //        item.Slot = (byte)(m.ToSlot);
        //        item.Bag = (byte)(m.ToBag);
        //        if (m.FromBag != m.ToBag && m.FromBag > 0)
        //        {
        //            c.MyCharacter.Bags[m.FromBag - 1].RemoveItem(item);
        //        }


        //        return true;
        //    }

        //    return false;
        //}


        void c_ClientDropItemInfo(object sender, ClientDropItemEventArgs e)
        {
            Client       c = (Client)sender;
            DropItemInfo d = e.Info;

            //Equipment item = channelManager.GetItemByItemID(d.ItemID);

            BaseItem item = c.MyCharacter.Bags[d.FromBag - 1].Items.Where(x => x.ItemID == d.ItemID).First();

            MapItem m = mapEngine.PlayerDropItem(item, d.ToX, d.ToY, d.ToZ, c.Map.MapID);

            c.MyCharacter.Bags[d.FromBag - 1].RemoveItem(item);


            Client[] nearbyClients = GetNearByClients(c);

            byte[] SendRemoveItem = PacketManager.SendRemoveItem(d.FromBag, d.FromSlot);
            c.Send(SendRemoveItem);

            byte[] SendItemOnGround = PacketManager.SendItemOnGround(m);
            SendSpecific(nearbyClients, SendItemOnGround);
        }
示例#21
0
    public void Despawner(ResourceType t, DropItemInfo dropItem)
    {
        if (null == dropItem)
        {
            return;
        }

        if (dropItem.InfoId == (int)ItemType.ITEM_RAREENERGY)
        {
            if (TSCData.Instance.RareEnergyDic.ContainsKey(dropItem.ItemId))
            {
                TSCData.Instance.RareEnergyDic.Remove(dropItem.ItemId);
            }
        }
        else
        {
            ItemDespawnerInfo despawnItem = new ItemDespawnerInfo(dropItem.ItemId, dropItem.InfoId);
            MapArea           area        = dropItem.Area;

            if (TSCData.Instance.BackItemMapDic.ContainsKey(area))
            {
                TSCData.Instance.BackItemMapDic[area].Add(despawnItem);
            }
            else
            {
                List <ItemDespawnerInfo> itemIds = new List <ItemDespawnerInfo>();
                itemIds.Add(despawnItem);
                TSCData.Instance.BackItemMapDic[area] = itemIds;
            }

            if (TSCData.Instance.DropItemDic.ContainsKey(dropItem.ItemId))
            {
                TSCData.Instance.DropItemDic.Remove(dropItem.ItemId);
            }
        }
        Despawner(t, dropItem.Cache);
    }
示例#22
0
        /// <summary>
        /// 回收掉落物品
        /// </summary>
        /// <param name="unusedDropItem"></param>
        private void ReleaseDropItem(DropItemInfo unusedDropItem)
        {
            EventToUI.SetArg(UIEventArg.Arg1, unusedDropItem.dropItemObj);
            EventToUI.SendEvent("EU_REMOVE_DROPITEMTEXT");

            GameObjectPool objPool = m_moneyEftObjectPool;

            if (unusedDropItem.dropType == DROP_TYPE.DROPTYPE_COMMON)
            {
                objPool = m_itemEftPoolDict[unusedDropItem.dropEft];
            }

            if (null != unusedDropItem.dropQualityEftObj)
            {
                CoreEntry.gGameObjPoolMgr.Destroy(unusedDropItem.dropQualityEftObj);
            }

            if (unusedDropItem.dropItemObj != null)
            {
                objPool.RecyclePrefabInstance(unusedDropItem.dropItemObj);
                unusedDropItem.dropItemObj = null;
            }
            m_UnusedDropItemList.Add(unusedDropItem);
        }
示例#23
0
        /// <summary>
        /// 展示掉落物品
        /// </summary>
        /// <param name="monsterID"></param>
        /// <param name="position"></param>
        private void ShowDropItem(MsgData_sSceneObjectEnterItem itemStruct)
        {
            if (itemStruct.Owner != CoreEntry.gActorMgr.MainPlayer.ServerID)
            {
                return;
            }
            Vector3 position = CommonTools.ServerPosToClient(itemStruct.PosX, itemStruct.PosY);

            position.y = CommonTools.GetTerrainHeight(position);

            LuaTable itemCfg  = null;
            LuaTable equipCfg = null;

            itemCfg = ConfigManager.Instance.BagItem.GetItemConfig(itemStruct.ConfigID);
            if (null == itemCfg)
            {
                equipCfg = ConfigManager.Instance.BagItem.GetItemConfig(itemStruct.ConfigID);
            }

            if (null == itemCfg && null == equipCfg)
            {
                LogMgr.UnityError("config error:id " + itemStruct.ConfigID + " no config data");

                return;
            }

            string dmeshid     = string.Empty;
            string itemName    = string.Empty;
            int    itemQuality = 0;

            if (null != itemCfg)
            {
                dmeshid     = itemCfg.Get <string>("dmeshid");
                itemName    = itemCfg.Get <string>("name");
                itemQuality = itemCfg.Get <int>("quality");
            }
            else
            {
                if (equipCfg != null)
                {
                    dmeshid     = equipCfg.Get <string>("dmeshid");
                    itemName    = equipCfg.Get <string>("name");
                    itemQuality = equipCfg.Get <int>("quality");
                }
            }

            DropItemInfo dropItem = null;

            if (m_UnusedDropItemList.Count > 0)
            {
                dropItem = m_UnusedDropItemList[m_UnusedDropItemList.Count - 1];
                m_UnusedDropItemList.RemoveAt(m_UnusedDropItemList.Count - 1);
            }
            else
            {
                dropItem             = new DropItemInfo();
                dropItem.dropItemObj = null;
            }

            dropItem.cfgID        = itemStruct.ConfigID;
            dropItem.serverID     = itemStruct.Guid;
            dropItem.count        = itemStruct.Count;
            dropItem.dropPosition = position;
            string[] strs = dmeshid.Split('#');
            if (strs == null || strs.Length != 2)
            {
                LogMgr.UnityError("item config error:" + itemStruct.ConfigID + ";" + dmeshid);

                return;
            }
            GenerateDropItem(dropItem.dropPosition, strs[1], itemQuality, ref dropItem);
            if (dropItem != null && dropItem.dropItem != null)
            {
                dropItem.dropItem.Init(dropItem.dropType, itemName, dropItem.count, strs[0], itemQuality);
                m_DropItemList.Add(dropItem);
            }
        }
示例#24
0
 public ClientDropItemEventArgs(DropItemInfo dii)
 {
     this.dropinfo = dii;
 }
示例#25
0
        /// <summary>
        /// 拾取特效
        /// </summary>
        /// <param name="dropItem"></param>
        private void PlayPickEffect(DropItemInfo dropItem)
        {
            if (dropItem.dropType == DROP_TYPE.DROPTYPE_GOLD)
            {
                EventToUI.SetArg(UIEventArg.Arg1, dropItem.count);
                EventToUI.SetArg(UIEventArg.Arg2, dropItem.dropPosition);
                EventToUI.SendEvent("EU_SHOW_DROPGOLDGFLY");

                CoreEntry.gAudioMgr.PlayUISound(900014);

                return;
            }

            LuaTable itemCfg  = null;
            LuaTable equipCfg = null;

            itemCfg = ConfigManager.Instance.BagItem.GetItemConfig(dropItem.cfgID);
            if (null == itemCfg)
            {
                equipCfg = ConfigManager.Instance.BagItem.GetItemConfig(dropItem.cfgID);
            }

            if (null == itemCfg && null == equipCfg)
            {
                return;
            }

            string dmeshid  = string.Empty;
            string itemName = string.Empty;
            int    quality  = -1;

            if (null != itemCfg)
            {
                dmeshid  = itemCfg.Get <string>("dmeshid");
                itemName = itemCfg.Get <string>("name");
                quality  = itemCfg.Get <int>("quality");
            }
            else
            {
                if (equipCfg != null)
                {
                    dmeshid  = equipCfg.Get <string>("dmeshid");
                    itemName = equipCfg.Get <string>("name");
                    quality  = equipCfg.Get <int>("quality");
                }
            }

            string[] strs = dmeshid.Split('#');
            if (strs == null || strs.Length != 2)
            {
                return;
            }

            EventToUI.SetArg(UIEventArg.Arg1, strs[0]);
            EventToUI.SetArg(UIEventArg.Arg2, dropItem.dropPosition);
            Transform t = PickFlyTarget;

            if (null != t)
            {
                EventToUI.SetArg(UIEventArg.Arg3, t.position);
            }
            else
            {
                EventToUI.SetArg(UIEventArg.Arg3, Vector3.zero);
            }
            EventToUI.SetArg(UIEventArg.Arg4, string.Format("{0} x{1}", itemName, dropItem.count));
            EventToUI.SetArg(UIEventArg.Arg5, quality);
            EventToUI.SendEvent("EU_SHOW_DROPFLY");

            //if (m_pickEftObjectPool != null)
            //{
            //    GameObject pickFlyObj = m_pickEftObjectPool.ObtainPrefabInstance();
            //    if (pickFlyObj != null)
            //    {
            //        pickFlyObj.SetActive(true);
            //        DropPickFly pickFly = pickFlyObj.GetComponent<DropPickFly>();
            //        ActorObj po = CoreEntry.gActorMgr.GetPlayerActorByServerID(MainRole.Instance.serverID);
            //        //pickFly.Init(dropItem.dropPosition, po.gameObject, m_pickEftObjectPool);
            //        pickFly.Init(dropItem.dropPosition, m_BagUIPos, m_pickEftObjectPool);
            //    }
            //}
        }
示例#26
0
 public List <ItemWithAmount> DoDrop()
 {
     return(DropItemInfo.Drop(products));
 }
示例#27
0
 /// <summary>
 /// 播放拾取提示
 /// </summary>
 /// <param name="item"></param>
 private void PlayPickTips(DropItemInfo item)
 {
     return;
 }
示例#28
0
 public void AddItem(DropItemInfo dropInfo)
 {
     _itemsInField.Add(dropInfo);
 }
示例#29
0
    public ItemWithAmount[] GetItems()
    {
        List <ItemWithAmount> lootItems = DropItemInfo.Drop(itemsInBox);

        return(lootItems.ToArray());
    }
示例#30
0
    public override bool Exec(Actor _actor)
    {
        targetList = FilterDropItems;
        if (targetList.Count < 1)
        {
            return(true);//所有物品都拾取完毕,结束命令
        }
        if (GameCenter.inventoryMng != null && GameCenter.inventoryMng.IsBagFull)
        {
            return(true);//背包已满结束拾取
        }
        DropItemInfo targetOne = GetClosestDropItem(targetList);

        path = GameStageUtility.StartPath(_actor.transform.position, ActorMoveFSM.LineCast(new Vector3(targetOne.ServerPos.x, 0, targetOne.ServerPos.y), true));
        if (path == null)
        {
            //掩码里的物品,加入黑名单
            if (!cannotList.Contains(targetOne))
            {
                cannotList.Add(targetOne);
            }
            if (player != null && !player.blackDropItemList.Contains(targetOne))
            {
                player.blackDropItemList.Add(targetOne);
            }
        }
        else
        {
            destPos = path[path.Length - 1];
        }
        if (!_actor.IsMoving)
        {
            if (player.isRigidity)
            {
                return(false);
            }
            Vector3 delta = destPos - _actor.transform.position;
            if (delta.sqrMagnitude <= (0.3 * 0.3))
            {
                DropItem dropItem = GameCenter.curGameStage.GetDropItem(targetOne.ServerInstanceID);
                if (dropItem != null && dropItem.HasShowName)
                {
                    //尝试拾取的物品,不管拾取是否成功,加入黑名单
                    if (!cannotList.Contains(targetOne))
                    {
                        cannotList.Add(targetOne);
                    }
                    if (player != null && !player.blackDropItemList.Contains(targetOne))
                    {
                        player.blackDropItemList.Add(targetOne);
                    }
                }
                return(false);
            }
            if (GameCenter.sceneMng.GetDropItemInfo(targetOne.ServerInstanceID) == null)
            {
                return(true);
            }
            _actor.MoveTo(path, 0.3f, false);
        }
        return(false);
    }