public uint Execute(PacketDistributed ipacket)
        {
            CG_ASK_COLLECTBORNMONSTER packet = (CG_ASK_COLLECTBORNMONSTER )ipacket;

            if (null == packet)
            {
                return((uint)PACKET_EXE.PACKET_EXE_ERROR);
            }
            //enter your logic
            return((uint)PACKET_EXE.PACKET_EXE_CONTINUE);
        }
예제 #2
0
    // 开始从场景中移除物品
    public void RemoveItem(GameObject ItemObj)
    {
        if (ItemObj)
        {
            // 玩家任务检测
            List <int> nMissionIDList = GameManager.gameManager.MissionManager.GetAllMissionID();
            int        nMissionCount  = nMissionIDList.Count;
            if (nMissionCount <= 0)
            {
                return;
            }
            int nBornMonster = 0;
            // 遍历任务
            foreach (int nMissionID in nMissionIDList)
            {
                Tab_MissionBase MissionTab = TableManager.GetMissionBaseByID(nMissionID, 0);
                if (MissionTab == null)
                {
                    continue;
                }
                if (MissionTab.LogicType != (int)TableType.Table_CollectItem)
                {
                    continue;
                }

                // 任务状态 已完成
                if (2 == GameManager.gameManager.MissionManager.GetMissionState(nMissionID))
                {
                    continue;
                }

                Tab_MissionCollectItem CItem = TableManager.GetMissionCollectItemByID(MissionTab.LogicID, 0);
                if (CItem == null)
                {
                    LogModule.ErrorLog("Can not find missionCollectItem {0}", MissionTab.LogicID);
                    continue;
                }

                GameObject gItemObj = Singleton <ObjManager> .GetInstance().FindOtherGameObj(ItemObj.name);

                if (gItemObj)
                {
                    Obj_OtherGameObj otherGameObj = gItemObj.GetComponent <Obj_OtherGameObj>();
                    if (otherGameObj && otherGameObj.GetIntParamByIndex(0) == CItem.CharModelID)
                    {
                        m_MissionID  = nMissionID;
                        nBornMonster = otherGameObj.GetIntParamByIndex(3);
                    }
                    break;
                }
            }

            // 无任务
            if (m_MissionID < 0)
            {
                return;
            }

            if (nBornMonster > 0)
            {
                CG_ASK_COLLECTBORNMONSTER packet = (CG_ASK_COLLECTBORNMONSTER)PacketDistributed.CreatePacket(MessageID.PACKET_CG_ASK_COLLECTBORNMONSTER);
                if (packet != null)
                {
                    packet.Id = nBornMonster;
                    packet.SendPacket();
                }
            }

            m_ItemObjToRemove = ItemObj;
            GameManager.gameManager.SoundManager.PlaySoundEffect(9);        //collect
            // 通知采集条
            UIManager.ShowUI(UIInfo.CollectItemSlider);
        }
    }