示例#1
0
文件: GameScreen.cs 项目: ndech/Alpha
        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;
        }
示例#2
0
文件: Water.cs 项目: ndech/Alpha
 public void Render(DeviceContext deviceContext, Matrix worldMatrix, Matrix viewMatrix, Matrix projectionMatrix, Sun sun)
 {
     deviceContext.InputAssembler.SetVertexBuffers(0, new VertexBufferBinding(_vertexBuffer, Utilities.SizeOf<VertexDefinition.WaterVertex>(), 0));
     deviceContext.InputAssembler.SetIndexBuffer(_indexBuffer, Format.R32_UInt, 0);
     deviceContext.InputAssembler.PrimitiveTopology = PrimitiveTopology.TriangleList;
     _shader.Render(deviceContext, _indexCount, worldMatrix, viewMatrix, projectionMatrix, _bumpMapTexture, _borderTexture, _waveTranslation, sun);
 }
示例#3
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"));
 }
示例#4
0
 public void Render(DeviceContext deviceContext, Matrix worldMatrix, Matrix viewMatrix, Matrix projectionMatrix, Sun sun)
 {
     deviceContext.InputAssembler.SetVertexBuffers(0, new VertexBufferBinding(_vertexBuffer, Utilities.SizeOf <VertexDefinition.WaterVertex>(), 0));
     deviceContext.InputAssembler.SetIndexBuffer(_indexBuffer, Format.R32_UInt, 0);
     deviceContext.InputAssembler.PrimitiveTopology = PrimitiveTopology.TriangleList;
     _shader.Render(deviceContext, _indexCount, worldMatrix, viewMatrix, projectionMatrix, _bumpMapTexture, _borderTexture, _waveTranslation, sun);
 }