示例#1
0
    void RPC_S2C_PersonalStorageDelete(uLink.BitStream stream, uLink.NetworkMessageInfo info)
    {
        int        objID = stream.Read <int>();
        ItemObject item  = ItemMgr.Instance.Get(objID);

        if (null == item)
        {
            return;
        }

        NpcStorage storage = NpcStorageMgr.GetStorage(Id);

        if (null == storage)
        {
            return;
        }

        storage.Package.RemoveItem(item);
        storage.Reset();
    }
示例#2
0
    void RPC_S2C_PersonalStorageSort(uLink.BitStream stream, uLink.NetworkMessageInfo info)
    {
        int tabIndex = stream.Read <int>();

        int[] ids = stream.Read <int[]>();

        NpcStorage storage = NpcStorageMgr.GetStorage(Id);

        if (null == storage)
        {
            return;
        }

        storage.Package.Clear((ItemPackage.ESlotType)tabIndex);
        SlotList itemList = storage.Package.GetSlotList((ItemPackage.ESlotType)tabIndex);

        for (int i = 0; i < ids.Length; i++)
        {
            ItemObject item = ItemMgr.Instance.Get(ids[i]);
            itemList[i] = item;
        }

        storage.Reset();
    }
示例#3
0
    void RPC_S2C_PersonalStorageExchange(uLink.BitStream stream, uLink.NetworkMessageInfo info)
    {
        int objID    = stream.Read <int>();
        int dstIndex = stream.Read <int>();
        int dstObjID = stream.Read <int>();
        int srcIndex = stream.Read <int>();

        ItemObject item = ItemMgr.Instance.Get(objID);

        if (null == item)
        {
            return;
        }

        NpcStorage storage = NpcStorageMgr.GetStorage(Id);

        if (null == storage)
        {
            return;
        }

        ItemObject dstObj = ItemMgr.Instance.Get(dstObjID);

        if (null != dstObj)
        {
            storage.Package.PutItem(dstObj, srcIndex);
        }
        else
        {
            storage.Package.RemoveItem(item);
        }

        storage.Package.PutItem(item, dstIndex);

        storage.Reset();
    }
示例#4
0
    public void OnMutexBtnClick(int missionId)
    {
        ActiveWnd();

        if (missionId == -3)//npcstorage
        {
            if (null == m_CurSelNpc)
            {
                Debug.LogError("open storage, but npc is null");
            }

            NpcStorage storage = null;
            if (GameConfig.IsMultiMode)
            {
                storage = NpcStorageMgr.GetStorage(m_Player.Id);
            }
            else
            {
                storage = NpcStorageMgr.GetSinglePlayerStorage();
            }

            if (null == storage)
            {
                Debug.LogError(m_CurSelNpc + " is has no storage.");
            }

            //storage.Open(m_CurSelNpc);
            Hide();
        }

        if (missionId == -1) // shop
        {
            NpcMissionData userdata = m_CurSelNpc.GetUserData() as NpcMissionData;
            if (userdata == null)
            {
                return;
            }

            int npcid = 0;
            if (PeGameMgr.IsStory)
            {
                npcid = m_CurSelNpc.Id;
            }
            else
            {
                if (userdata.m_bRandomNpc)
                {
                    npcid = userdata.m_Rnpc_ID;
                }
                else
                {
                    npcid = m_CurSelNpc.Id;
                }
            }
            if (!GameConfig.IsMultiMode)
            {
                if (GameUI.Instance.mShopWnd.UpdataShop(StoreRepository.GetNpcStoreData(npcid)))
                {
                    GameUI.Instance.mShopWnd.Show();
                }
            }
            else
            {
                // to do-- send msg to server
                //m_CurSelNpc.mNpcId for npc, npcid for store
//                if (!userdata.m_bRandomNpc)
//                {
//                    Debug.Log("nr==null");
//                    return;
//                }
                //m_Player.GetShop(m_CurSelNpc.Id, userdata.m_Rnpc_ID);

                if (null != PlayerNetwork.mainPlayer)
                {
                    PlayerNetwork.mainPlayer.RequestShopData(m_CurSelNpc.Id);
                }
            }
        }
        else if (missionId == -2)
        {
            OnClose();
        }
        else
        {
            if (m_MissionList.Contains(missionId))
            {
                if (!MissionManager.Instance.CheckCSCreatorMis(missionId))
                {
                    return;
                }

                if (!MissionManager.Instance.CheckHeroMis())
                {
                    return;
                }

                if (MissionManager.Instance.IsTempLimit(missionId))
                {
                    if (GameUI.Instance.mNPCTalk.isPlayingTalk == false)
                    {
                        GameUI.Instance.mNPCTalk.UpdateNpcTalkInfo(new List <int> {
                            4080
                        });
                        GameUI.Instance.mNPCTalk.PreShow();
                    }
                    else
                    {
                        GameUI.Instance.mNPCTalk.UpdateNpcTalkInfo(new List <int> {
                            4080
                        }, null, false);
                    }
                    Hide();
                    return;
                }

                BtnClickMission = missionId;
                if (MissionRepository.HaveTalkOP(missionId))
                {
                    Hide();
                    GameUI.Instance.mNPCTalk.UpdateNpcTalkInfo(missionId, 1);
                    GameUI.Instance.mNPCTalk.NormalOrSP(0);
                    GameUI.Instance.mNPCTalk.PreShow();
                }
                else
                {
                    MissionManager.Instance.SetGetTakeMission(missionId, m_CurSelNpc, MissionManager.TakeMissionType.TakeMissionType_Get);
                    Hide();
                }
                BtnClickMission = 0;
            }
            else if (m_MissionListReply.Contains(missionId))
            {
                if (MissionManager.Instance.IsReplyMission(missionId))
                {
                    if (PeGameMgr.IsMulti)
                    {
                        MissionManager.Instance.RequestCompleteMission(missionId);
                    }
                    else
                    {
                        MissionManager.Instance.CompleteMission(missionId);
                        UpdateMission();
                    }
                }
                else
                {
                    if (MissionRepository.HaveTalkIN(missionId))
                    {
                        Hide();
                        GameUI.Instance.mNPCTalk.UpdateNpcTalkInfo(missionId, 2);
                        GameUI.Instance.mNPCTalk.PreShow();
                    }
                }
            }
        }
    }