Пример #1
0
    IEnumerator PickUpEffect(string key, MineDropComponent mineDropComponent)
    {
        mineDropComponent.AddEffect();

        MineDropItemInfo gatherDropItemInfo = m_GatherDropItemInfos[key];

        if (gatherDropItemInfo.obj != null)
        {
            gatherDropItemInfo.obj.SetActive(false);
        }

        yield return(new WaitForSeconds(3.0f));

        DestoryDropInfo(key);
    }
Пример #2
0
 public void NotifyDropResult(string key)
 {
     if (m_GatherDropItemInfos.ContainsKey(key))
     {
         GameObject obj = m_GatherDropItemInfos[key].obj;
         if (obj)
         {
             MineDropComponent mineDropComponent = obj.GetComponent <MineDropComponent>();
             if (mineDropComponent)
             {
                 UIManager.Instance.StartCoroutine(PickUpEffect(key, mineDropComponent));
             }
         }
         else
         {
             DestoryDropInfo(key);
         }
     }
 }
Пример #3
0
    private void CreateDropItem(string key, MineDropItemInfo mineDropItemInfo, bool needFly = false)
    {
        NpcCombat?nc = m_CfgEternityProxy.GetNpcCombatByKey(mineDropItemInfo.tid);

        if (!nc.HasValue)
        {
            return;
        }

        PackageBoxAttr?pb = m_CfgEternityProxy.GetPackageBoxAttrByModelIdAndGrade((uint)nc.Value.BoxModel, mineDropItemInfo.ship_tlv);

        if (!pb.HasValue)
        {
            return;
        }

        int   modelid = pb.Value.BoxModel;
        Model?mdata   = m_CfgEternityProxy.GetModel(modelid);

        if (mdata.Value.AssetName.Equals(string.Empty))
        {
            return;
        }

        Vector3          curPos = Vector3.zero;
        SpacecraftEntity spe    = m_GameplayProxy.GetEntityById <SpacecraftEntity>((uint)mineDropItemInfo.parentid) as SpacecraftEntity;

        if (spe)
        {
            curPos = spe.GetRootTransform().position;
        }

        AssetUtil.InstanceAssetAsync(mdata.Value.AssetName, (address, uObj, userData) =>
        {
            mineDropItemInfo.obj = uObj as GameObject;
            MineDropComponent mineDropComponent = mineDropItemInfo.obj.GetComponent <MineDropComponent>();
            if (!mineDropComponent)
            {
                mineDropComponent = mineDropItemInfo.obj.AddComponent <MineDropComponent>();
            }

            SpacecraftEntity mainPlayer = m_GameplayProxy.GetMainPlayer();
            mineDropComponent.Initialize(mainPlayer, mineDropItemInfo.uid, mineDropItemInfo.tid, mineDropItemInfo.item_tid, pb);
            if (needFly)
            {
                mineDropItemInfo.obj.transform.position = curPos;
                mineDropComponent.AddFlyEffect(mineDropItemInfo.positon_x, mineDropItemInfo.positon_y, mineDropItemInfo.positon_z);
            }
            else
            {
                Vector3 endPos         = new Vector3(mineDropItemInfo.positon_x, mineDropItemInfo.positon_y, mineDropItemInfo.positon_z);
                Vector3 clientPosition = m_GameplayProxy.ServerAreaOffsetToClientPosition(endPos);
                mineDropItemInfo.obj.transform.position = clientPosition;
                mineDropComponent.SetDropItemState(DropItemState.Stay);
                mineDropComponent.AddEffect(true);
            }

            /// 跃迁客户端不清数据
            if (m_GatherDropItemInfos.ContainsKey(key))
            {
                m_GatherDropItemInfos.Remove(key);
            }
            m_GatherDropItemInfos.Add(key, mineDropItemInfo);
        });
    }