Ejemplo n.º 1
0
    //点击 加为好友
    void OnClickFriend()
    {
        //如果非玩家,则不显示
        if (m_CurSelectMemberGuid == GlobeVar.INVALID_GUID || m_CurSelectMemberGuid == 0)
        {
            return;
        }

        Games.LogicObj.Obj_MainPlayer mainPlayer = Singleton <ObjManager> .GetInstance().MainPlayer;

        if (null == mainPlayer)
        {
            return;
        }
        //如果目标是自己也不发送加好友
        if (m_CurSelectMemberGuid == mainPlayer.GUID)
        {
            return;
        }

        if (GameManager.gameManager.PlayerDataPool.FriendList.IsExist(m_CurSelectMemberGuid))
        {
            mainPlayer.SendNoticMsg(false, "#{2394}");
            return;
        }

        /* if (GameManager.gameManager.PlayerDataPool.BlackList.IsExist(m_CurSelectMemberGuid))
         * {
         *   mainPlayer.SendNoticMsg(false, "#{4723}");
         *   return;
         * }  */

        CG_ADDFRIEND msg = (CG_ADDFRIEND)PacketDistributed.CreatePacket(MessageID.PACKET_CG_ADDFRIEND);

        msg.Guid = m_CurSelectMemberGuid;
        msg.SendPacket();

        mainPlayer.SendNoticMsg(false, "#{2906}");
    }
Ejemplo n.º 2
0
        //更新Obj_DropItem逻辑数据
        void FixedUpdate()
        {
            //不要频繁发包,5秒发一次
            if (bIsDrop == false)
            {
                if (Time.realtimeSinceStartup - m_fDropTimeSecond > 5)
                {
                    m_fDropTimeSecond = Time.realtimeSinceStartup;
                    bIsDrop           = true;
                }
                else
                {
                    return;
                }
            }

            //延迟发送
            if (bIsSendDrop == false)
            {
                if (Time.realtimeSinceStartup - m_fSendDropTimeSecond > m_fMoveSecond)
                {
                    SendDropItem();
                    m_fSendDropTimeSecond = Time.realtimeSinceStartup;
                    bIsSendDrop           = true;
                    gameObject.SetActive(false);
                    // UpdateMove(100);
                }
                else
                {
                    UpdateMove(m_fSpeed);
                }

                return;
            }

            if (Time.realtimeSinceStartup - m_fUpdateTimeSecond > m_fStop)
            {
                m_fUpdateTimeSecond = Time.realtimeSinceStartup;
                //更新拾取
                Obj_MainPlayer OwnerUser = Singleton <ObjManager> .Instance.MainPlayer;
                if (null != OwnerUser && OwnerUser.GUID == OwnerGuid && OwnerUser.IsDie() == false)
                {
                    if (OwnerUser.GetAutoCombatState() == true)// 挂机中自动拾取
                    {
                        if (DropType == (int)Games.GlobeDefine.GameDefine_Globe.DROP_TYPE.DROP_ITEM)
                        {
                            Tab_CommonItem line = TableManager.GetCommonItemByID(m_nItemId, 0);
                            if (line != null)
                            {
                                //计算品级及拾取规则
//                                 if ((line.ClassID == (int)ItemClass.EQUIP && OwnerUser.GetAutoPickUpFlag(line.Quality))
//                                    || (line.ClassID == (int)ItemClass.STRENGTHEN && OwnerUser.GetAutoPickUpFlag((int)Games.GlobeDefine.GameDefine_Globe.AUTOCOMBAT_PICKUP_TYPE.PICKUP_STUFF))
//                                    || (line.ClassID != (int)ItemClass.EQUIP && line.ClassID != (int)ItemClass.STRENGTHEN && OwnerUser.GetAutoPickUpFlag((int)Games.GlobeDefine.GameDefine_Globe.AUTOCOMBAT_PICKUP_TYPE.PICKUP_OTHER)))
                                {
                                    GameItemContainer BackPack = GameManager.gameManager.PlayerDataPool.BackPack;
                                    if (BackPack.GetCanContainerSize() <= 0)
                                    {
                                        OwnerUser.SendNoticMsg(true, "#{1039}");
                                        bIsDrop = false;
                                        return;
                                    }
                                    //SendDropItem();
                                    bIsSendDrop           = false;
                                    m_fSendDropTimeSecond = Time.realtimeSinceStartup;
                                }
                            }
                        }
                        else if (DropType == (int)Games.GlobeDefine.GameDefine_Globe.DROP_TYPE.DROP_COIN)
                        {
                            //SendDropItem();
                            bIsSendDrop           = false;
                            m_fSendDropTimeSecond = Time.realtimeSinceStartup;
                            StopEffect(175, true);
                            PlayEffect(176);
                        }
                    }
                    else if (Vector3.Distance(OwnerUser.transform.position, this.gameObject.transform.position) <= fActiveRadius)
                    {
                        GameItemContainer BackPack = GameManager.gameManager.PlayerDataPool.BackPack;
                        if (BackPack.GetCanContainerSize() <= 0 && DropType == (int)Games.GlobeDefine.GameDefine_Globe.DROP_TYPE.DROP_ITEM)
                        {
                            OwnerUser.SendNoticMsg(true, "#{1039}");
                            bIsDrop = false;
                            return;
                        }
                        //SendDropItem();
                        bIsSendDrop           = false;
                        m_fSendDropTimeSecond = Time.realtimeSinceStartup;
                        if (DropType == (int)Games.GlobeDefine.GameDefine_Globe.DROP_TYPE.DROP_COIN)
                        {
                            StopEffect(175, true);
                            PlayEffect(176);
                        }
                    }
                }
            }
        }