private void SetNpcCaption(uint questid, int step, string strContent) { tagEntityProto pEntity = null; CProtoManager.inst.m_mapEntity.TryGetValue(CQuestMgr.Inst.GetTalkNPCTypeID(), out pEntity); if (pEntity == null) { return; } ClearTalkFrame(); NpcTalk.SetActive(true); Transform pInfo = NpcTalk.transform.Find("info"); if (pInfo != null) { pInfo.GetComponent <UILabel>().text = strContent; } Transform icon = NpcTalk.transform.Find("icon"); if (icon != null) { UnityEngine.GameObject ctrl = icon.gameObject; ctrl.GetComponent <UISprite>().spriteName = pEntity.szIcon; } Transform name = NpcTalk.transform.Find("name"); if (icon != null) { UnityEngine.GameObject ctrl = name.gameObject; ctrl.GetComponent <UILabel>().text = pEntity.szName; } }
public CAIController(CNPCEntity pNPC) { m_pOwner = pNPC; m_pProto = m_pOwner.m_pProto; m_pTarget = null; m_eCurAIState = AIStateType.AIST_Idle; m_pCurrentState = CIdleAI.Instance(); m_pTransition = new GuardTransition(); m_GameObject = m_pOwner.gameObject; m_vBornPos = m_GameObject.transform.position; }
private void LoadEntityConfig() { CXmlContainer xml = new CXmlContainer(); List <string> herolist = new List <string> (); if (xml.LoadXML("data/entity_proto", "id", herolist)) { for (int i = 0; i < herolist.Count; i++) { tagEntityProto item = new tagEntityProto(); item.nBaseAtt = new int[5]; item.dwTypeID = xml.GetDword("id", herolist[i]); item.eType = (ECreatureType)xml.GetInt("type", herolist[i], 0); item.szName = xml.GetString("name", herolist[i], ""); item.szIcon = xml.GetString("Icon", herolist[i], ""); item.szModelName = xml.GetString("model", herolist[i], ""); item.nLevel = xml.GetInt("Level", herolist[i], 1); item.bCanAttack = xml.GetInt("CanAtk", herolist[i], 1) == 1 ? true : false; item.bCanBeAttack = xml.GetInt("CanBeAtk", herolist[i], 1) == 1 ? true : false; item.nRespawnTime = xml.GetInt("spawnTime", herolist[i], 1); item.nLiveTime = xml.GetInt("LiveTime", herolist[i], 0); item.nExpGive = xml.GetInt("exp", herolist[i], 1); item.dwLootID = xml.GetDword("LootID", herolist[i]); item.dwNormalSkill = xml.GetDword("normalskill1", herolist[i]); item.dwLongDisSkill = xml.GetDword("normalskill2", herolist[i]); item.fLookdistance = xml.GetFloat("Lookdist", herolist[i], 1); item.nPatrolRadius = xml.GetFloat("Patroldist", herolist[i], 1); //----------------------------------------------------------------------- // 怪物的一级属性 item.nBaseAtt[0] = xml.GetInt("Physique", herolist[i], 0); item.nBaseAtt[1] = xml.GetInt("Strength", herolist[i], 0); item.nBaseAtt[2] = xml.GetInt("Pneuma", herolist[i], 0); item.nBaseAtt[3] = xml.GetInt("InnerForce", herolist[i], 0); item.nBaseAtt[4] = xml.GetInt("Agility", herolist[i], 0); m_mapEntity.Add(item.dwTypeID, item); } } }
public IEnumerator UpdateNPCIcon( ) { uint dwNPCID = CQuestMgr.Inst.GetQuestNPCID(); if (dwNPCID <= 0) { yield break; } tagEntityProto pEntity = null; CProtoManager.inst.m_mapEntity.TryGetValue(dwNPCID, out pEntity); if (pEntity == null) { yield break; } if (m_pNPCIcon != null) { UIAtlas tu = Resources.Load("NPC_Icon", typeof(UIAtlas)) as UIAtlas; m_pNPCIcon.GetComponent <UISprite>().atlas = tu; m_pNPCIcon.GetComponent <UISprite>().spriteName = pEntity.szIcon; } }
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]); } }