상속: MegaMan.IO.Xml.GameXmlReader
예제 #1
0
        public void TryLoad(StageLinkInfo info)
        {
            var stageReader = new StageXmlReader();
            StageInfo map = stageReader.LoadStageXml(info.StagePath);

            var handler = new StageHandler(map);

            var joins = new Dictionary<ScreenInfo, Dictionary<Join, JoinHandler>>();

            foreach (var screen in map.Screens.Values)
            {
                joins[screen] = new Dictionary<Join, JoinHandler>();
            }

            foreach (Join join in map.Joins)
            {
                var screenOne = map.Screens[join.screenOne];
                var screenTwo = map.Screens[join.screenTwo];

                JoinHandler handlerOne = CreateJoin(join, handler, screenOne);

                joins[screenOne].Add(join, handlerOne);

                JoinHandler handlerTwo = CreateJoin(join, handler, screenTwo);

                joins[screenTwo].Add(join, handlerTwo);
            }

            var screens = new Dictionary<string, ScreenHandler>();
            foreach (var screen in map.Screens.Values)
            {
                screens[screen.Name] = CreateScreen(handler, screen, joins[screen].Values.ToList());
            }

            handler.InitScreens(screens);

            handler.WinHandler = info.WinHandler;

            if (info.LoseHandler == null)
            {
                // repeat this stage
                handler.LoseHandler = new HandlerTransfer { Fade = true, Type = HandlerType.Stage, Name = info.Name };
            }
            else
            {
                handler.LoseHandler = info.LoseHandler;
            }

            _loadedStages[info.Name] = handler;
        }
예제 #2
0
        public StageDocument(ProjectDocument project, StageLinkInfo linkInfo)
        {
            Project = project;
            History = new History();
            var stageReader = new StageXmlReader();
            map = stageReader.LoadStageXml(linkInfo.StagePath);
            Tileset = new TilesetDocument(map.Tileset);
            LinkName = linkInfo.Name;

            // wrap all map screens in screendocuments
            // this should be the only time MegaMan.Screen's are touched directly
            foreach (var pair in map.Screens)
            {
                WrapScreen(pair.Value);
            }
        }
예제 #3
0
 public IStageReader GetStageReader(FilePath path)
 {
     var reader = new StageXmlReader(this, new EntityPlacementXmlReader(), new HandlerCommandXmlReader());
     reader.Init(_dataSource);
     return reader;
 }