コード例 #1
0
ファイル: LevelLoadHelper.cs プロジェクト: zzsort/monono2
        public static BrushLstLoader CreateBrushLstLoader(DirManager levelDir, string relPath)
        {
            BrushLstLoader brushlst = null;

            if (levelDir.Exists(relPath))
            {
                using (var brushLstStream = levelDir.OpenFile(relPath))
                    brushlst = new BrushLstLoader(brushLstStream);
            }
            return(brushlst);
        }
コード例 #2
0
ファイル: LevelLoadHelper.cs プロジェクト: zzsort/monono2
        public static Dictionary <int, CgfLoader> CreateBrushLstCgfLoaderMap(
            DirManager meshesDir, BrushLstLoader brushlst)
        {
            var cgfMap = new Dictionary <int, CgfLoader>();

            foreach (var brushInfo in brushlst.brushInfoList)
            {
                if (!meshesDir.Exists(brushInfo.filename))
                {
                    Log.WriteLine("**Model not found: " + brushInfo.filename);
                    continue;
                }

                using (var cgfStream = meshesDir.OpenFile(brushInfo.filename))
                {
                    var c = new CgfLoader(cgfStream);
                    cgfMap.Add(brushInfo.brushInfoIndex, c);
                }
            }
            return(cgfMap);
        }
コード例 #3
0
        // if levelFolder is empty, levelDir points to a single level directory.
        // otherwise, levelDir points to the levels\ directory, and levelFolder chooses a specific level directory.
        public static List <DoorInfo> LoadDoorInfosForLevel(DirManager levelDir, string levelFolder = "")
        {
            var result = new List <DoorInfo>();

            using (var stream = new AionXmlStreamReader(levelDir.OpenFile(Path.Combine(levelFolder, "mission_mission0.xml")), false))
            {
                var xdoc = XDocument.Load(stream);
                foreach (var e in xdoc.Root.Element("Objects").Elements("Entity"))
                {
                    if (e.Attribute("EntityClass").Value != "Door")
                    {
                        continue;
                    }

                    var doorInfo = new DoorInfo();
                    doorInfo.EntityId = int.Parse(e.Attribute("EntityId").Value);
                    doorInfo.Name     = e.Attribute("Name").Value;

                    // TODO "dir" is a value in degrees which matches "angles"...
                    // do these always represent the same rotation? check broken door models... add check...
                    // TODO are x and y in angles always zero?
                    doorInfo.Angles = e.Attribute("Angles") != null?Util.ParseVector(e.Attribute("Angles").Value) : Vector3.Zero;

                    doorInfo.Pos = Util.ParseVector(e.Attribute("Pos").Value);

                    var properties = e.Element("Properties");
                    doorInfo.object_AnimatedModel = properties.Attribute("object_AnimatedModel").Value;

                    var server = properties.Element("Server");
                    doorInfo.bClickable = server.Attribute("bClickable").Value == "1";
                    doorInfo.bCloseable = server.Attribute("bCloseable").Value == "1";
                    doorInfo.bOneWay    = server.Attribute("bOneWay").Value == "1";
                    doorInfo.bOpened    = server.Attribute("bOpened").Value == "1";

                    result.Add(doorInfo);
                }
            }
            return(result);
        }