Ejemplo n.º 1
0
        public GameScreen(IContext context)
            : base(context, "game_screen", false)
        {
            _sun = new Sun();
            _water = new Water(context, context.World.ProvinceManager.SeaProvinces);
            _terrain = new Terrain(context, context.World.ProvinceManager.LandProvinces.ToList());
            _sky = new Sky(context);
            _fleetRenderer = new FleetRenderer(context);
            _fleetMoveOrderRenderer = new FleetMoveOrderRenderer(context);
            _counter = new FpsCounter();

            Button saveButton = new Button(context, "save_button", new UniRectangle(0, 0, 100, 100), "save");
            Register(saveButton);
            saveButton.Clicked += (b) => context.World.Save("test.xml");
            Register(new DynamicLabel(context, "calendar", new UniRectangle(new UniScalar(1.0f, -300), 0, 300, 50),
                () => context.World.Calendar.CurrentDate + " (" + context.World.Calendar.CurrentSeason + ")"));
            Register(new DynamicLabel(context, "fps", new UniRectangle(100, 0, 100, 50),
                () => _counter.Value + "FPS"));
            new PositionLayout(this, 200, 100, HorizontalAlignment.Center, VerticalAlignment.Top)
                .Create(new DynamicLabel(Context, "money", new UniRectangle(),
                    () => Context.Realm.Economy.Treasury.ToString(CultureInfo.InvariantCulture)));
            MinimapPanel minimapPanel = new MinimapPanel(context, _terrain);
            new PositionLayout(this, 300, 200, HorizontalAlignment.Right, VerticalAlignment.Bottom).Create(minimapPanel);
            ExtraMinimapButtonPanel extraMinimapButtonPanel = new ExtraMinimapButtonPanel(context, () => minimapPanel.ExtraPanelVisible);
            new PositionLayout(this, 300, 200, HorizontalAlignment.Center, VerticalAlignment.Bottom).Create(extraMinimapButtonPanel);
            _settlementDetailPanel = new SettlementDetailPanel(context);
            new PositionLayout(this, 800, 600, HorizontalAlignment.Left, VerticalAlignment.Bottom)
                .Create(_provinceDetailPanel = new ProvinceDetailPanel(context, _settlementDetailPanel));
            new PositionLayout(this, 500, 600, HorizontalAlignment.Center, VerticalAlignment.Middle)
                .Create(_settlementDetailPanel);
            Register(new MapTooltip(context, this));
            new PositionLayout(this, 100, 25, HorizontalAlignment.Left, VerticalAlignment.Top).Create(new RealmInfo(context));
            Register(_statisticsWindow = new StatisticsWindow(context, new UniRectangle(200, 200, 400, 200)));
            _statisticsWindow.Visible = false;
        }
Ejemplo n.º 2
0
 public SphericalWorldScreen(IContext context)
     : base(context, "spherical_world")
 {
     _sphere = new Sphere(Context, 255, 5000);
     _sky = new Sky(Context);
     _sun = new Sun();
     _camera = new SphericalWorldCamera();
     _counter = new FpsCounter();
     Register(new DynamicLabel(context, "fps_counter", new UniRectangle(5, 5, 100, 50),
         () => _counter.Value + "FPS"));
 }