コード例 #1
0
        public override void Initialize()
        {
            base.Initialize();

            TabContainer container   = Register(new TabContainer(Context, "province_tabs", new UniRectangle(0, 150, 1.0f, new UniScalar(1, -150))));
            Tab          overiewTab  = container.RegisterTab(new Tab(Context, "province_overview_tab", "Overview"));
            Tab          economyTab  = container.RegisterTab(new Tab(Context, "province_economy_tab", "Economy"));
            Tab          politicsTab = container.RegisterTab(new Tab(Context, "province_politics_tab", "Politics"));

            container.SetOffset(256 - container.TabTitleSpacing);

            new PositionLayout(this, 250, 150 + container.TabHeight - 6, HorizontalAlignment.Left, VerticalAlignment.Top, new Padding(3))
            .Create(_provinceMap = new ProvinceMap(Context, ShowProvinceFromMap))
            .Right(40, VerticalAlignment.Top, new Padding(3))
            .Create(_provinceName = new Label(Context, "province_name"));

            _settlementScrollableContainer =
                new ScrollableContainer <SettlementScrollableItem, Settlement>(Context, "settlements", 4,
                                                                               c => new SettlementScrollableItem(c, _settlementDetailPanel));
            new PositionLayout(overiewTab, _settlementScrollableContainer.Size.X, _settlementScrollableContainer.Size.Y,
                               HorizontalAlignment.Center, VerticalAlignment.Bottom)
            .Create(_settlementScrollableContainer);

            new PositionLayout(this, 20, 20, HorizontalAlignment.Right, VerticalAlignment.Top, new Padding(3))
            .Create(new IconButton(Context, "close_button", () => Visible = false));
        }
コード例 #2
0
ファイル: StatisticsWindow.cs プロジェクト: ndech/Alpha
        public override void Initialize()
        {
            base.Initialize();
            TabContainer tabContainer;

            Register(tabContainer = new TabContainer(Context, "stats_tabs_container"));
            Tab resourcesTab = tabContainer.RegisterTab(new Tab(Context, "stats_resources_tab", "Resources"));

            resourcesTab.Register(new Label(Context, "resources_stats_label", new UniRectangle(5, 5, 190, 20), "Resources :"));
            _resourceScrollableContainer = new ResizableScrollableContainer <ResourceItem, ResourceType>(Context,
                                                                                                         "ressource_stats_container", new UniRectangle(5, 30, 200, new UniScalar(1.0f, -35)), c => new ResourceItem(c, ResourceTypeSelected), () => ResourceItem.StaticSize);
            resourcesTab.Register(_resourceScrollableContainer);
            _resourceScrollableContainer.Refresh(ResourceTypes.Types.OrderBy(t => t.Name).Times(10).ToList());
            _resourceScrollableContainer.CustomExecute = (item, type) => { if (type == _selectedResourceType)
                                                                           {
                                                                               item.Toggle();
                                                                           }
            };
            resourcesTab.Register(_outputLabel          = new Label(Context, "resources_stats_output_label", new UniRectangle(205, 5, 290, 20), "No output"));
            Context.NotificationResolver.DayUpdateDone += DayUpdate;

            _resourceRepartitionChart = resourcesTab.Register(new PieChart(Context, "resource_chart",
                                                                           new UniRectangle(210, 5, new UniScalar(1.0f, -215), new UniScalar(1.0f, -10)), 200, PieChartValues));

            Tab populationTab = tabContainer.RegisterTab(new Tab(Context, "stats_population_tab", "Population"));
        }