Exemple #1
0
    void ShowQuestInfo(uint questid)
    {
        tagQuestText pQuestText = CQuestMgr.Inst.GetData().GetQuestText(questid);

        if (pQuestText == null)
        {
            return;
        }

        tagQuestProto pProto = CQuestMgr.Inst.GetData().GetQuestProto(questid);

        if (pProto == null)
        {
            return;
        }

        m_LabelExp.text       = pProto.rew_value.ToString();
        m_LabelMoney.text     = pProto.rew_value2.ToString();
        m_LabelQuestDesc.text = pQuestText.over_view;
        m_LabelQuestAccp.text = pQuestText.AcceptTalk;

        for (int i = 0; i < 3; i++)
        {
            ShowRewardItem(m_reward[i], pProto.rew_item[i], pProto.rew_item_num[i]);
        }
    }
Exemple #2
0
    void AddQuestOne(tagQuestProto pProto)
    {
        tagQuestText pQuestText = CQuestMgr.Inst.GetData().GetQuestText(pProto.id);

        if (pQuestText == null)
        {
            return;
        }

        if (m_questItem != null)
        {
            GameObject pItem = NGUITools.AddChild(m_questlist, m_questItem);
            if (pItem != null)
            {
                Transform pIcon = pItem.transform.Find("Icon");
                if (pIcon != null)
                {
                    UnityEngine.GameObject ctrl = pIcon.gameObject;
                    ctrl.GetComponent <UILabel>().text = pQuestText.name;
                }

                float   fheight = (m_questItem.transform.position.y - 32 * m_mapObj2QuestID.Count);
                Vector3 pos     = new Vector3(m_questItem.transform.position.x, fheight, m_questItem.transform.position.z);
                pItem.transform.position = pos;

                UIEventListener.Get(pItem).onClick = OnQuestCheckEvent;
                m_mapObj2QuestID.Add(pItem, pProto.id);
            }
        }
    }
Exemple #3
0
    public void LoadQuestProto( )
    {
        CXmlContainer xml       = new CXmlContainer();
        List <string> questlist = new List <string> ();

        if (xml.LoadXML("data/quest_proto", "id", questlist))
        {
            for (int i = 0; i < questlist.Count; i++)
            {
                tagQuestProto quest = new tagQuestProto();
                quest.id            = xml.GetDword("id", questlist[i]);
                quest.type          = (EQuestEvent)xml.GetInt("type", questlist[i], 0);
                quest.prev_quest_id = xml.GetDword("prev_quest", questlist[i]);
                quest.next_quest_id = xml.GetDword("next_quest", questlist[i]);
                quest.limit_time    = xml.GetDword("limit_time", questlist[i]);
                quest.limit_level   = xml.GetInt("limit_level", questlist[i], -1);
                quest.limit_class   = xml.GetInt("limit_class", questlist[i], -1);
                quest.week          = (EWeek)xml.GetInt("week", questlist[i], 0);
                int repeata = xml.GetInt("canrepeata", questlist[i], 0);
                quest.repeatable = Convert.ToBoolean(repeata);

                quest.accept_quest_npc   = xml.GetDword("accept_npc", questlist[i]);
                quest.complete_quest_npc = xml.GetDword("complete_npc", questlist[i]);

                quest.accept_req_item[0]     = xml.GetDword("accept_req_item1", questlist[i]);
                quest.accept_req_item_num[0] = xml.GetInt("accept_req_item_num1", questlist[i], 1);
                quest.accept_req_item[1]     = xml.GetDword("accept_req_item2", questlist[i]);
                quest.accept_req_item_num[1] = xml.GetInt("accept_req_item_num2", questlist[i], 1);
                quest.accept_req_item[2]     = xml.GetDword("accept_req_item3", questlist[i]);
                quest.accept_req_item_num[2] = xml.GetInt("accept_req_item_num3", questlist[i], 1);

                quest.complete_req_data[0]     = xml.GetDword("complete_req_item1", questlist[i]);
                quest.complete_req_data_num[0] = xml.GetInt("complete_req_item_num1", questlist[i], 1);
                quest.complete_req_data[1]     = xml.GetDword("complete_req_item2", questlist[i]);
                quest.complete_req_data_num[1] = xml.GetInt("complete_req_item_num2", questlist[i], 1);
                quest.complete_req_data[2]     = xml.GetDword("complete_req_item3", questlist[i]);
                quest.complete_req_data_num[2] = xml.GetInt("complete_req_item_num3", questlist[i], 1);

                quest.rew_type   = xml.GetInt("rew_type", questlist[i], 0);
                quest.rew_value  = xml.GetInt("rew_value", questlist[i], 0);
                quest.rew_type2  = xml.GetInt("rew_type1", questlist[i], 0);
                quest.rew_value2 = xml.GetInt("rew_value1", questlist[i], 0);

                quest.rew_sel_type    = xml.GetInt("rew_item_seltype", questlist[i], 0);
                quest.rew_item[0]     = xml.GetDword("rew_item1", questlist[i]);
                quest.rew_item_num[0] = xml.GetInt("rew_item_num1", questlist[i], 1);
                quest.rew_item[1]     = xml.GetDword("rew_item2", questlist[i]);
                quest.rew_item_num[1] = xml.GetInt("rew_item_num2", questlist[i], 1);
                quest.rew_item[2]     = xml.GetDword("rew_item3", questlist[i]);
                quest.rew_item_num[2] = xml.GetInt("rew_item_num3", questlist[i], 1);


                m_QuestData.Add(quest.id, quest);
            }
        }
    }
Exemple #4
0
    public tagQuestProto GetQuestProto(uint questid)
    {
        tagQuestProto pProto = null;

        m_QuestData.TryGetValue(questid, out pProto);
        if (pProto != null)
        {
            return(pProto);
        }
        return(null);
    }
Exemple #5
0
    //-----------------------------------------------------------
    // init quest
    public void Init(tagQuestProto pProto)
    {
        m_pProto = pProto;

        m_pQuestTrack.dwFlag = EQuestState.QS_DOING;
        m_pQuestTrack.fTime  = pProto.limit_time / 1000.0f;
        for (int i = 0; i < 3; i++)
        {
            m_pQuestTrack.completeInfo [i] = pProto.complete_req_data [i];
            m_pQuestTrack.nTargetnum[i]    = 0;
        }
    }
Exemple #6
0
    //-----------------------------------------------------------------
    // add quest by id
    public void     AcceptQuest(uint questid)
    {
        tagQuestProto pQuestProto = m_QuestData.GetQuestProto(questid);

        if (pQuestProto == null)
        {
            Common.ERROR_MSG(string.Format("not find quest proto ", questid));
            return;
        }

        CQuest pQuest = null;

        m_currentQuests.TryGetValue(questid, out pQuest);
        if (pQuest == null)
        {
            pQuest = new CQuest();
            pQuest.Init(pQuestProto);
            m_currentQuests.Add(questid, pQuest);
        }
    }
Exemple #7
0
    //------------------------------------------------------------------
    // quest is can accpet
    public bool IsCanAcceptQuest(uint questid)
    {
        // haved accepted quest
        bool bHave = IsHaveQuest(questid);

        if (bHave)
        {
            return(false);
        }

        tagQuestProto pQuestProto = m_QuestData.GetQuestProto(questid);

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

        if (pQuestProto.limit_class != 0)
        {
        }

        if (pQuestProto.limit_level != 0)
        {
            if (CFightTeamMgr.Instance.m_pBattleHero.m_nLevel < pQuestProto.limit_level)
            {
                return(false);
            }
        }

        if (pQuestProto.prev_quest_id != 0)
        {
            if (!IsCopletedQuest(pQuestProto.prev_quest_id))
            {
                return(false);
            }
        }

        return(true);
    }
Exemple #8
0
    private void SetQuestCaption(uint questid)
    {
        tagEntityProto pEntity = null;

        CProtoManager.inst.m_mapEntity.TryGetValue(CQuestMgr.Inst.GetTalkNPCTypeID(), out pEntity);
        if (pEntity == null)
        {
            return;
        }

        ClearTalkFrame();
        QuestTalk.SetActive(true);
        if (m_eOpType == EOptionType.EOT_AcceptQuest)
        {
            m_AcceptQuest.SetActive(true);
            m_CompleteQuest.SetActive(false);
        }


        if (m_eOpType == EOptionType.EOT_CompleteQuest)
        {
            m_AcceptQuest.SetActive(false);
            m_CompleteQuest.SetActive(true);
        }

        tagQuestText pQuestText = CQuestMgr.Inst.GetData().GetQuestText(questid);

        if (pQuestText == null)
        {
            return;
        }

        tagQuestProto pProto = CQuestMgr.Inst.GetData().GetQuestProto(questid);

        if (pProto == null)
        {
            return;
        }

        Transform pInfo = QuestTalk.transform.Find("info");

        if (pInfo != null)
        {
            if (m_eOpType == EOptionType.EOT_AcceptQuest)
            {
                pInfo.GetComponent <UILabel>().text = pQuestText.AcceptTalk;
            }
            if (m_eOpType == EOptionType.EOT_CompleteQuest)
            {
                pInfo.GetComponent <UILabel>().text = pQuestText.CompleteTalk;
            }
        }

        Transform icon = QuestTalk.transform.Find("icon");

        if (icon != null)
        {
            UnityEngine.GameObject ctrl = icon.gameObject;
            ctrl.GetComponent <UISprite>().spriteName = pEntity.szIcon;
        }

        m_LabelExp.GetComponent <UILabel> ().text   = pProto.rew_value.ToString();
        m_LabelMoney.GetComponent <UILabel> ().text = pProto.rew_value2.ToString();
        for (int i = 0; i < 3; i++)
        {
            ShowRewardItem(m_reward[i], pProto.rew_item[i], pProto.rew_item_num[i]);
        }
    }