示例#1
0
        public override Pod SetupState(ProgramContext ProgramContext, ProgramStateContext ProgramStateContext)
        {
            _Context = ProgramStateContext;
            var context = (ScenarioBuilderContext)_Context;

            var builder  = context.ScenarioBuilder.Armies.First(i => !i.Validate());
            var renderer =
                new UnitConfigurationRenderer(
                    GameData.UnitConfigurationLinks.Values
                    .Where(builder.Parameters.Matches)
                    .Select(i => i.UnitConfiguration),
                    GameData.UnitRenderDetails,
                    128,
                    1024,
                    ClassLibrary.Instance.GetFont("compacta"));
            var screen =
                new ArmyBuilderScreen(
                    ProgramContext.ScreenResolution,
                    GameData.UnitConfigurationLinks.Values,
                    builder.Parameters,
                    renderer);

            screen.OnMainMenuButtonClicked += HandleBack;

            _Controller             = new ArmyBuilderController(builder, screen, renderer);
            _Controller.OnFinished += HandleFinished;

            return(screen);
        }
 public ArmyBuilderController(
     ArmyBuilder ArmyBuilder, ArmyBuilderScreen Screen, UnitConfigurationRenderer Renderer)
 {
     _ArmyBuilder        = ArmyBuilder;
     _Screen             = Screen;
     _Screen.OnFinished += HandleFinished;
     _Screen.OnUnitConfigurationRightClicked += HandleUnitConfigurationRightClicked;
     _Renderer = Renderer;
 }