Пример #1
0
        public MainInterface()
        {
            DependencyManager.Connect(Game.city, this);
            DependencyManager.Connect(Game.UIKey, this);

            textBar    = new HBox();
            numbersBar = new HBox();
            VBox topBars = new VBox(false, 2)
            {
                BorderWidth = 5
            };

            topBars.PackStart(textBar);
            topBars.PackStart(numbersBar);
            PackStart(new HSeparator(), false, false, 0);
            PackStart(topBars, false, false, 0);
            PackStart(new HSeparator(), false, false, 0);

            HBox mainHBox = new HBox();

            PackStart(mainHBox, true, true, 0);

            //Set up the containers
            VBox leftVBox = new VBox();

            mainNotebook = new Notebook();
            leftVBox.PackStart(mainNotebook, true, true, 0);
            mainHBox.PackStart(leftVBox, true, true, 0);

            ////Notebook
            ///
            //Map tab
            map = new Map();             //Profiler called inside Map constructor
            mainNotebook.AppendPage(map, new Label("Map"));
            Profiler.Log();
            //Search tab
            Search search = new Search(null, (obj) => Inspector.InspectInNearestInspector(obj, this));

            mainNotebook.AppendPage(search, new Label("Search"));
            //My domain
            Search domain = new Search((obj) => (obj is Territory || obj is Structure) && ((IAffiliated)obj).affiliation == Game.player,
                                       (obj) => Inspector.InspectInNearestInspector(obj, this));

            domain.typesButton.State        = StateType.Insensitive;
            domain.toplevelOnlyButton.State = StateType.Insensitive;
            mainNotebook.AppendPage(domain, new Label("Domain"));
            //Event log tab
            eventLogLabel = new ClickableEventBox {
                Child = new Label("Logs"), prelight = false, depress = false
            };
            eventLogLabel.DoubleClicked += (o, a) => WindowizeEventLog();
            eventLogLabel.ShowAll();
            eventLogsScroller = new ScrolledWindow();
            eventLogsScroller.SetSizeRequest(200, -1);
            eventLogsDisplay = new VBox {
                BorderWidth = 10
            };
            eventLogsScroller.AddWithViewport(eventLogsDisplay);
            mainNotebook.AppendPage(eventLogsScroller, eventLogLabel);

            //Agents bottom bar
            assetsBar = new AssetsBottomBar {
                BorderWidth = 10
            };
            leftVBox.PackStart(assetsBar, false, false, 0);

            //Inspector
            Inspector inspector = new Inspector()
            {
                BorderWidth = 10
            };

            mainHBox.PackStart(inspector, false, false, 0);

            Profiler.Log(ref Profiler.searchCreateTime);

            MainWindow.main.inspector = inspector;

            Destroyed += (o, a) => DependencyManager.Destroy(this);

            Reload();

            mainNotebook.CurrentPage = 0;
        }