Exemple #1
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();
                    }
                }
            }
        }
    }