Example #1
0
    void AddMissionItem(int missionId)
    {
        MissionSelItem_N AddItem = Instantiate(mPrefab) as MissionSelItem_N;

        AddItem.gameObject.name = "ItemName" + mSelIndex;
        mSelIndex++;
        AddItem.transform.parent        = mUITable.transform;
        AddItem.transform.localPosition = Vector3.zero;
        AddItem.transform.localRotation = Quaternion.identity;
        AddItem.transform.localScale    = Vector3.one;

        string strtitle = MissionRepository.GetMissionNpcListName(missionId, false);

        if (missionId == MissionManager.m_SpecialMissionID9)
        {
            if (EntityCreateMgr.Instance.IsRandomNpc(m_CurSelNpc))
            {
                NpcMissionData missionData = m_CurSelNpc.GetUserData() as NpcMissionData;

                if (null != missionData && (missionData.mCurComMisNum >= missionData.mCompletedMissionCount || UINPCTalk.m_QuickZM))
                {
                    strtitle = "[ffff00]" + strtitle + "[-]";
                }
            }
        }

        AddItem.SetMission(missionId, strtitle, this, m_Player);
        mMissionItemList.Add(AddItem);
    }
Example #2
0
    bool CheckAddMissionReplyID(int id)
    {
        MissionCommonData data = MissionManager.GetMissionCommonData(id);

        if (data == null)
        {
            return(false);
        }

        if (id == 9137 || id == 9138)
        {
            if (data.m_iReplyNpc != m_CurSelNpc.Id)
            {
                return(false);
            }
        }

        //如果不是谈话任务,那么未接取或已完成的不能交
        if (!data.IsTalkMission())
        {
            if (!MissionManager.Instance.HasMission(id) || MissionManager.Instance.HadCompleteMission(id))
            {
                return(false);
            }
        }

        if (MissionRepository.IsAutoReplyMission(id))
        {
            return(false);
        }

        if (MissionRepository.GetMissionNpcListName(id, true) == "")
        {
            if (PeGameMgr.IsMulti)
            {
                MissionManager.Instance.RequestCompleteMission(id);
            }
            else
            {
                MissionManager.Instance.CompleteMission(id);
                MissionCommonData mcd = MissionManager.GetMissionCommonData(id);
                if (mcd != null && mcd.m_Type != 0)
                {
                    canShow = false;
                }
            }
            return(false);
        }

        return(true);
    }
Example #3
0
    void AddMissionReplyItem(int missionId)
    {
        MissionSelItem_N AddItem = Instantiate(mPrefab) as MissionSelItem_N;

        AddItem.gameObject.name = "ItemName" + mSelIndex;
        mSelIndex++;
        AddItem.transform.parent        = mUITable.transform;
        AddItem.transform.localPosition = Vector3.zero;
        AddItem.transform.localRotation = Quaternion.identity;
        AddItem.transform.localScale    = Vector3.one;

        string strtitle = "";

        strtitle = MissionRepository.GetMissionNpcListName(missionId, true);
        AddItem.SetMission(missionId, strtitle, this, m_Player);
        mMissionItemList.Add(AddItem);
    }
    public void SetMission(int missionId, UIBaseWidget parent)
    {
        mMissionId     = missionId;
        mParentNPCTalk = parent as UINPCTalk;
//		mParentMissionMain = parent as MissionMainGui_N;
        mNPCGui = parent as UINpcWnd;
        mMissionContent.text = MissionRepository.GetMissionNpcListName(mMissionId, false);

        MissionCommonData data = MissionManager.GetMissionCommonData(missionId);

        if (data == null)
        {
            return;
        }

        if (mMissionMarke != null)
        {
            if (m_Player != null)
            {
                if (MissionManager.Instance.HasMission(missionId))
                {
                    if (data.m_Type == MissionType.MissionType_Main /* && !MissionManager.HasRandomMission(missionId)*/)
                    {
                        if (MissionManager.Instance.IsReplyMission(missionId))
                        {
                            mMissionMarke.spriteName = "MainMissionEnd";
                        }
                        else
                        {
                            mMissionMarke.spriteName = "MissionNotEnd";
                        }
                    }
                    else if (data.IsTalkMission())
                    {
                        mMissionMarke.spriteName = "SubMission";
                    }
                    else
                    {
                        if (MissionManager.Instance.IsReplyMission(missionId))
                        {
                            mMissionMarke.spriteName = "SubMissionEnd";
                        }
                        else
                        {
                            mMissionMarke.spriteName = "MissionNotEnd";
                        }
                    }
                }
                else
                {
                    if (data.m_Type == MissionType.MissionType_Main)
                    {
                        mMissionMarke.spriteName = "MainMissionGet";
                    }
                    else if (data.m_Type == MissionType.MissionType_Sub)
                    {
                        mMissionMarke.spriteName = "SubMissionGet";
                    }
                    else
                    {
                        mMissionMarke.spriteName = "SubMission";
                    }
                }
            }
            else
            {
                mMissionMarke.gameObject.SetActive(false);
            }
            mMissionMarke.MakePixelPerfect();
        }
        else
        {
            if (MissionManager.Instance.HasMission(missionId))
            {
                if (data.m_Type == MissionType.MissionType_Main &&
                    !MissionManager.HasRandomMission(missionId))
                {
                    if (MissionManager.Instance.IsReplyMission(missionId))
                    {
                        mMissionContent.color = Color.yellow;
                    }
                    else
                    {
                        mMissionContent.color = Color.white;
                    }
                }
                else if (data.IsTalkMission())
                {
                    mMissionContent.color = Color.white;
                }
                else
                {
                    if (MissionManager.Instance.IsReplyMission(missionId))
                    {
                        mMissionContent.color = Color.yellow;
                    }
                    else
                    {
                        mMissionContent.color = Color.white;
                    }
                }
            }
            else
            {
                mMissionContent.color = Color.white;
            }

            UIButton button = mMissionContent.GetComponent <UIButton>();
            if (button)
            {
                button.defaultColor = mMissionContent.color;
            }
        }
        RefreshCollider();
    }