예제 #1
0
        private void OnEnable()
        {
            m_Target       = target as Creature;
            m_IsAutoCreate = m_Target.m_AutoCreation;
            List <NpcVO> allNpcs = ConfigVO <NpcVO> .Instance.GetList();

            if (allNpcs != null && allNpcs.Count > 0)
            {
                m_NpcListTemplateList = new List <NpcVO>();
                KMapPathType mapPathType = m_Target.m_Root.GetGamingMapPathType();
                for (int iAllNpc = 0; iAllNpc < allNpcs.Count; iAllNpc++)
                {
                    NpcVO vo = allNpcs[iAllNpc];
                    if ((mapPathType == KMapPathType.KMapPath_Groud && vo.motionType == (int)MotionType.Human) ||
                        (mapPathType == KMapPathType.KMapPath_Space && vo.motionType == (int)MotionType.Ship))
                    {
                        m_NpcListTemplateList.Add(vo);
                    }
                }
            }

            if (m_NpcListTemplateList != null)
            {
                for (int iNpc = 0; iNpc < m_NpcListTemplateList.Count; iNpc++)
                {
                    if (m_NpcListTemplateList[iNpc].ID == m_Target.m_NpcId)
                    {
                        m_Target.m_SelectNpcIndex = iNpc;
                        break;
                    }
                }
            }


            if (m_Target.m_NpcIdArray == null || m_Target.m_NpcIdArray.Length <= 0)
            {
                if (m_NpcListTemplateList != null && m_NpcListTemplateList.Count > 0)
                {
                    m_Target.m_NpcIdArray = new string[m_NpcListTemplateList.Count];
                    for (int iNpc = 0; iNpc < m_NpcListTemplateList.Count; iNpc++)
                    {
                        NpcVO vo = m_NpcListTemplateList[iNpc];
                        m_Target.m_NpcIdArray[iNpc] = string.Format("{0}_{1}", vo.ID, vo.Name);
                    }
                }
            }
            m_LastNpcId = m_Target.m_NpcId;
        }
예제 #2
0
        private void OnSelect()
        {
            List <NpcVO> npcListTemplateList = null;

            ConfigInfoWindow.OpenWindow(() =>
            {
                List <NpcVO> allNpcs = ConfigVO <NpcVO> .Instance.GetList();
                if (allNpcs != null && allNpcs.Count > 0)
                {
                    npcListTemplateList      = new List <NpcVO>();
                    KMapPathType mapPathType = m_Target.m_Root.GetGamingMapPathType();
                    for (int iAllNpc = 0; iAllNpc < allNpcs.Count; iAllNpc++)
                    {
                        NpcVO vo = allNpcs[iAllNpc];
                        if ((mapPathType == KMapPathType.KMapPath_Groud && vo.motionType == (int)MotionType.Human) ||
                            (mapPathType == KMapPathType.KMapPath_Space && vo.motionType == (int)MotionType.Ship))
                        {
                            npcListTemplateList.Add(vo);
                        }
                    }
                }
                return(npcListTemplateList != null ? npcListTemplateList.Count : 0);
            }, (index) =>
            {
                string str = "";
                if (npcListTemplateList != null && npcListTemplateList.Count > index)
                {
                    str = $"{npcListTemplateList[index].ID}_{npcListTemplateList[index].Name}";
                }
                return(str);
            }, (index) =>
            {
                m_Target.m_SelectNpcIndex = index;
            });
            //NpcInfoWindow.OpenWindow(m_Target);
        }