/// <summary> /// Create the game instance /// </summary> public MainGame(string level) { currentBomb_ = new CurrentElement(); this.graphics_ = new GraphicsDeviceManager(this) { IsFullScreen = true, SupportedOrientations = DisplayOrientation.LandscapeLeft, PreferMultiSampling = true }; this.level_ = level; ended_ = false; lose_ = false; this.em_ = new Event(); this.ladder_ = new Ladder(); this.selecterAnimation_ = new SelecterAnimation(); #region mapNameInit mapName_ = new List<string> { "NumbaWan", "DidUCheckTuto", "It's Something", "Versus", "CombisTheG", "InTheRedCorner", "TheBreach", "OppositeForces", "XFactor", "ChooseYourSide", "DynamiteWarehouse", "FaceToFace", "OneStepAway", "FindYourWayOut", "Corporate", "Unreachable", "Tetris", "Life", "Invasion", "A-Maze-Me" }; tutoName_ = new List<string> { "TutoNormalBomb", "TutoLineBomb", "TutoConeBomb", "TutoXBomb", "TutoCheckpointBS", "TutoHBomb", "TutoUltimateBomb", "TutoBonusTNT" }; #endregion isTuto_ = tutoName_.Contains(this.level_); Content.RootDirectory = "Content"; }
public override void Execute() { // Verify all [Required] and [Import]ed properties have valid values. this.ValidateObject(); var application = CurrentElement.Root.As <IApplication>(); var command = CurrentElement.As <ICommand>(); var handlerLinks = application.Design.Services.Service .SelectMany(s => s.Components.Component.SelectMany(c => c.Subscribes.ProcessedCommandLinks.Where(l => l.CommandReference.Value == command))) .ToList(); var senderLinks = application.Design.Services.Service .SelectMany(s => s.Components.Component.SelectMany(c => c.Publishes.CommandLinks.Where(l => l.CommandReference.Value == command))) .ToList(); var relatedComponents = handlerLinks.Select(l => l.Parent.Parent) .Concat(senderLinks.Select(l => l.Parent.Parent)) .Where(c => c != null) .Distinct() .ToList(); tracer.Verbose( "Prompting for confirmation of deletion for command '{0}' with related components {1}", command.InstanceName, string.Join(", ", relatedComponents.Select(c => "'" + c.InstanceName + "'"))); var viewModel = new RelatedComponentsPickerViewModel(relatedComponents, command) { Title = "Delete the component?" }; var picker = WindowFactory.CreateDialog <RelatedComponentsPicker>(viewModel); using (new MouseCursor(Cursors.Arrow)) { if (picker.ShowDialog().GetValueOrDefault()) { var selectedComponents = viewModel.SelectedComponents.ToList(); tracer.Info( "Deleting command '{0}' and related components {1}", command.InstanceName, string.Join(", ", selectedComponents.Select(c => "'" + c.InstanceName + "'"))); foreach (var component in selectedComponents) { component.Delete(); } foreach (var link in handlerLinks) { link.Delete(); } foreach (var link in senderLinks) { link.Delete(); } command.Delete(); } else { tracer.Verbose("Deletion for command '{0}' cancelled", command.InstanceName); } } }
private void InsertNode(Node node) { CurrentElement.AppendChild(node); }
public void QueueDraw() { CurrentElement.InvalidateVisual(); }
public IEnumerable <XElement> PropertyElements() => CurrentElement.Elements(CompositeDefinitionHelper.Property);
//------------------------------------------------------------------------------------------------ /// <summary> /// Gives a string representation of the current state of the enumerator. /// </summary> /// <returns>Returns a string representation of the enumerator.</returns> public override string ToString() { return("DiscreteElementEnumerator: " + CurrentElement.ToString()); }
public string AttributeValue(string attributeName) => CurrentElement.AttributeValue(attributeName);
public void QueueResize() { CurrentElement.InvalidateVisual(); }
/// <summary> ///Matches the current state of the component's signalr integration with that of the provided value /// </summary> /// <returns>true if values match, false otherwise</returns> public override bool Evaluate() { var component = CurrentElement.As <NServiceBusStudio.IComponent>(); return(component.IsBroadcastingViaSignalR == IsBroadcastingViaSignalR); }
public override void Execute() { // Verify all [Required] and [Import]ed properties have valid values. this.ValidateObject(); var endpoint = CurrentElement.As <IAbstractEndpoint>(); var app = CurrentElement.Root.As <IApplication>(); var viewModel = new ServiceAndCommandPickerViewModel(app, endpoint); var picker = WindowFactory.CreateDialog <ServiceAndCommandPicker>(viewModel); using (new MouseCursor(Cursors.Arrow)) { if (picker.ShowDialog().GetValueOrDefault()) { var selectedService = viewModel.SelectedService; var selectedCommand = viewModel.SelectedCommand; var service = app.Design.Services.Service.FirstOrDefault(x => x.InstanceName == selectedService) ?? app.Design.Services.CreateService(selectedService); var newCommand = false; var command = service.Contract.Commands.Command.FirstOrDefault(x => x.InstanceName == selectedCommand); if (command == null) { newCommand = true; command = service.Contract.Commands.CreateCommand(selectedCommand); } // create and deploy new publisher command var publisherComponent = service.Components.CreateComponent(command.InstanceName + "Sender", x => x.Publishes.CreateLink(command)); var deployToEndpoint = default(EventHandler); deployToEndpoint = (s, e) => { var c = s as IComponent; if (c != null && c == publisherComponent) { c.DeployTo(endpoint); app.OnInstantiatedComponent -= deployToEndpoint; } }; app.OnInstantiatedComponent += deployToEndpoint; if (newCommand) { if (viewModel.SelectedHandlerComponent == null) { service.Components.CreateComponent(command.InstanceName + "Handler", x => x.Subscribes.CreateLink(command)); } else { var handlerComponent = viewModel.SelectedHandlerComponent; handlerComponent.Subscribes.CreateLink(command); SagaHelper.CheckAndPromptForSagaUpdate(handlerComponent, MessageBoxService, WindowFactory); } } } } }
public Constructor() { ElementsCollection = new ElementsCollection(); CurrentElement = new CurrentElement(); ConnectionCollection = new ConnectionCollection(); }