コード例 #1
0
        /// <summary>
        /// 获取boss角色id列表
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        static public List <uint> GetBossMonsterList(Neptune.Data data = null)
        {
            if (data == null)
            {
                data = Neptune.DataManager.Instance.Data;
            }
            Dictionary <int, Neptune.BaseGenericNode> monsters = data.GetData <Neptune.MonsterBase>().Data;

            List <uint> actorIdList = new List <uint>();

            actorIdList.Clear();
            if (monsters != null)
            {
                foreach (var monsterBase in monsters.Values)
                {
                    if (monsterBase is Neptune.Monster)
                    {
                        Neptune.Monster monster = (Neptune.Monster)monsterBase;
                        if (ActorHelper.IsBoss(monster.ExcelId) == true)
                        {
                            actorIdList.Add(monster.ExcelId);
                        }
                    }
                }
            }

            return(actorIdList);
        }
コード例 #2
0
        /// <summary>
        /// 根据角色id获取怪物的位置
        /// </summary>
        static public List <Vector3> GetMonsterPositionsByActorId(uint actorId, Neptune.Data data = null)
        {
            if (data == null)
            {
                data = Neptune.DataManager.Instance.Data;
            }
            Dictionary <int, Neptune.BaseGenericNode> monsters = data.GetData <Neptune.MonsterBase>().Data;
            List <Vector3> retPositions = new List <Vector3>();

            retPositions.Clear();

            if (monsters != null)
            {
                foreach (var monsterBase in monsters.Values)
                {
                    if (monsterBase is Neptune.Monster)
                    {
                        Neptune.Monster monster = (Neptune.Monster)monsterBase;
                        if (monster != null && monster.ExcelId == actorId)
                        {
                            retPositions.Add(monster.Position);
                        }
                    }
                    else if (monsterBase is Neptune.MonsterGroup)
                    {
                        Neptune.MonsterGroup monsterGroup = (Neptune.MonsterGroup)monsterBase;
                        if (monsterGroup != null)
                        {
                            List <string> strs = DBManager.Instance.QuerySqliteField <string>(GlobalConfig.DBFile, "data_monster", "id", monsterGroup.ExcelId.ToString(), "actor");
                            foreach (string str in strs)
                            {
                                uint ret = 0;
                                uint.TryParse(str, out ret);
                                if (ret == actorId)
                                {
                                    retPositions.Add(monsterGroup.Position);
                                    break;
                                }
                            }
                        }
                    }
                }
            }

            return(retPositions);
        }
コード例 #3
0
ファイル: NeptuneDataWrap.cs プロジェクト: wuhuolong/MaxBooks
        static int _m_GetData(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


            Neptune.Data __cl_gen_to_be_invoked = (Neptune.Data)translator.FastGetCSObj(L, 1);


            try {
                {
                    System.Type node_type = (System.Type)translator.GetObject(L, 2, typeof(System.Type));

                    Neptune.Data.Container __cl_gen_ret = __cl_gen_to_be_invoked.GetData(node_type);
                    translator.Push(L, __cl_gen_ret);



                    return(1);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
        }
コード例 #4
0
            uint CalcTargetNum(uint instanceId, string targetStr)
            {
                uint targetNum = 0;

                Neptune.Data levelData = xc.Dungeon.LevelManager.Instance.LoadLevelFileTemporary(SceneHelp.GetFirstStageId(instanceId));
                if (levelData == null)
                {
                    return(targetNum);
                }
                if (targetStr == "kill_all")
                {
                    Dictionary <int, Neptune.BaseGenericNode> monsters = levelData.GetData <Neptune.MonsterBase>().Data;
                    foreach (var monsterBase in monsters.Values)
                    {
                        if (monsterBase is Neptune.Monster)
                        {
                            ++targetNum;
                        }
                        else if (monsterBase is Neptune.MonsterGroup)
                        {
                            Neptune.MonsterGroup  monsterGroup = (Neptune.MonsterGroup)monsterBase;
                            DBMonster             dbMonster    = DBManager.Instance.GetDB <DBMonster>();
                            DBMonster.MonsterInfo monsterInfo  = dbMonster.GetMonsterInfo(monsterGroup.ExcelId);
                            if (monsterInfo != null)
                            {
                                targetNum += monsterInfo.Num;
                            }
                        }
                    }
                }
                else
                {
                    var matchs = System.Text.RegularExpressions.Regex.Matches(targetStr, @"\{kill,(\S+)\}");
                    foreach (System.Text.RegularExpressions.Match match in matchs)
                    {
                        if (match.Success)
                        {
                            List <uint> ids = DBTextResource.ParseArrayUint(match.Groups[1].Value, ",");
                            foreach (uint id in ids)
                            {
                                Dictionary <int, Neptune.BaseGenericNode> monsters = levelData.GetData <Neptune.MonsterBase>().Data;
                                foreach (var monsterBase in monsters.Values)
                                {
                                    if (monsterBase.Id == id)
                                    {
                                        if (monsterBase is Neptune.Monster)
                                        {
                                            ++targetNum;
                                        }
                                        else if (monsterBase is Neptune.MonsterGroup)
                                        {
                                            Neptune.MonsterGroup  monsterGroup = (Neptune.MonsterGroup)monsterBase;
                                            DBMonster             dbMonster    = DBManager.Instance.GetDB <DBMonster>();
                                            DBMonster.MonsterInfo monsterInfo  = dbMonster.GetMonsterInfo(monsterGroup.ExcelId);
                                            if (monsterInfo != null)
                                            {
                                                targetNum += monsterInfo.Num;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }

                return(targetNum);
            }
コード例 #5
0
        /// <summary>
        /// 获取指定id和type的tag的位置
        /// </summary>
        /// <param name="idAndType">id和type的字符串组合,例如boss_pos_2</param>
        /// <param name="data"></param>
        /// <returns></returns>
        static public Vector3 GetTagPosition(string idAndType, Neptune.Data data = null)
        {
            if (data == null)
            {
                data = Neptune.DataManager.Instance.Data;
            }

            var tag_data = data.GetData <Neptune.Tag>().Data;

            // 解析idAndType中的id
            int id          = -1;
            int digit_place = 1;
            int type_length = -1;
            int num_0       = (int)'0';

            for (int i = idAndType.Length - 1; i >= 0; --i)
            {
                char c = idAndType[i];
                if (c >= '0' && c <= '9')
                {
                    if (id == -1)
                    {
                        id = digit_place * ((int)c - num_0);
                    }
                    else
                    {
                        id += digit_place * ((int)c - num_0);
                    }

                    digit_place *= 10;
                }
                else if (c == '_')
                {
                    type_length = i;
                    break;
                }
            }

            Neptune.BaseGenericNode node_info = null;
            if (!tag_data.TryGetValue(id, out node_info))
            {
                return(Vector3.zero);
            }

            Neptune.Tag tag_info = node_info as Neptune.Tag;
            if (tag_info != null)
            {
                // 判断类型是否相同
                string type = tag_info.Type;
                for (int i = 0; i < type.Length && i < type_length; ++i)
                {
                    char c1 = type[i];
                    char c2 = idAndType[i];
                    if (c1 != c2)
                    {
                        return(Vector3.zero);
                    }
                }

                return(tag_info.Position);
            }
            else
            {
                return(Vector3.zero);
            }
        }