public static MenuItem CreateInspectButton(IGUIComplete obj, Widget referenceWidget) { MenuItem inspectButton = new MenuItem("Inspect"); inspectButton.Activated += (o, a) => Inspector.InspectInNearestInspector(obj, referenceWidget); return(inspectButton); }
public Territory(TerritoryData data) { name = data.name; ID = data.ID; position = data.position; size = data.size; reputation = data.reputation; structures = data.structures.ConvertAll((structure) => Game.city.Get <Structure>(structure)); foreach (Structure structure in structures) { DependencyManager.Connect(structure, this); structure.parent = this; } traits = data.mechanics.ConvertAll((input) => Trait.Load(input)); foreach (Trait mechanic in traits) { DependencyManager.Connect(mechanic, this); mechanic.parent = this; } attack = new GameAction { name = "Attack", description = "Launch an attack on " + name, action = delegate(Context context) { attackers = new Attack(this); Game.city.activeBattlegrounds.Add(this); DependencyManager.Connect(this, attackers); DependencyManager.Flag(this); DependencyManager.TriggerAllFlags(); Inspector.InspectInNearestInspector(attackers, MainWindow.main); }, condition = (context) => attackers == null && UIFactory.EditAuthorized(this, "attack") }; defend = new GameAction { name = "Defend", description = "Mount a defense of " + name, action = delegate(Context context) { defenders = new Defense(this); DependencyManager.Connect(this, defenders); DependencyManager.Flag(this); DependencyManager.TriggerAllFlags(); Inspector.InspectInNearestInspector(defenders, MainWindow.main); }, condition = (context) => attackers != null && defenders == null && UIFactory.EditAuthorized(this, "defend") }; }
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; }