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; }
public override void Initialize() { _ratioX = Size.X; _ratioY = Size.Y; _screenX = ConfigurationManager.Config.ScreenSize.X; _screenY = ConfigurationManager.Config.ScreenSize.Y; _texture = new RenderTexture(Context.DirectX.Device, Size); _rectangle = new TexturedRectangle(Context, _texture.ShaderResourceView, Size); _camera = new Camera(new Vector3(0,200,0), new Vector3(0, MathUtil.PiOverTwo, 0)); _terrain = new Terrain(Context, Context.World.ProvinceManager.LandProvinces.ToList()); _orthoProjectionMatrix = Matrix.OrthoLH(2*_ratioX, 2*_ratioY, ConfigurationManager.Config.NearLimit, ConfigurationManager.Config.FarLimit); _water = new TexturedRectangle(Context, Context.TextureManager.Create("dark_paper.png", "Data/UI/"), ConfigurationManager.Config.WorldSize * Scaling); _water.TextureRepeat(new Vector2I(4,2)); IconButton centerButton = new IconButton(Context, "province_map_center") { Coordinates = new UniRectangle(new UniScalar(1.0f, -35), 5, 30, 30) }; centerButton.Clicked += () => MoveCamera((Vector3) _selectedProvince.Center); Register(centerButton); }
public MinimapPanel(IContext context, Terrain terrain) : base(context, "minimap_panel", new UniRectangle(), SharpDX.Color.Black) { _terrain = terrain; }