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]); } }
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); } } }
public tagQuestText GetQuestText(uint questid) { tagQuestText pQuestText = null; m_QuestInfo.TryGetValue(questid, out pQuestText); if (pQuestText != null) { return(pQuestText); } return(null); }
// 对应任务的 quest_name.xml public void LoadQuestName( ) { CXmlContainer xml = new CXmlContainer(); List <string> questlist = new List <string> (); if (xml.LoadXML("data/quest_name", "id", questlist)) { for (int i = 0; i < questlist.Count; i++) { tagQuestText quest = new tagQuestText(); quest.id = xml.GetDword("id", questlist[i]); quest.name = xml.GetString("name", questlist[i]); quest.AcceptTalk = xml.GetString("AcceptTalk", questlist[i]); quest.CompleteTalk = xml.GetString("CompleteTalk", questlist[i]); m_QuestInfo.Add(quest.id, quest); } } }
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]); } }