public static IEnumerable <ActionMap> GetActionsMapsFromTargetObject(object target, bool onlyWithAttribute = false, bool usePrefixInAllMethods = false, string prefix = null) { var argumentMapper = new ArgumentMapper(); var actionMapper = new ActionMapper(argumentMapper); return(actionMapper.Map(target, onlyWithAttribute, usePrefixInAllMethods, prefix)); }
public ExecuteCommandHandler(DbContextAccesor contextAccessor, ActionMapper actionMapper, IServiceProvider serviceProvider, ILogger <ExecuteCommandHandler> logger) : base(contextAccessor) { this.actionMapper = actionMapper; this.serviceProvider = serviceProvider; this.logger = logger; }
private void StandingUpdate() { if (ActionMapper.IsPressed(UserAction.Jump)) { Jump(); } }
public void Add(ActionBusiness action) { var entity = ActionMapper.Map(action); databaseContext.Action.Add(entity); databaseContext.SaveChanges(); }
private void Awake() { _characterController = GetComponent <CharacterController>(); _audioSource = GetComponent <AudioSource>(); _animator = GetComponent <Animator>(); _serveSpeedManager = GetComponent <ServeSpeedManager>(); _actionMapper = new ActionMapper(wasd, hitBall); }
private void JumpingUpdate() { Body.ApplyLinearImpulse(new Vector2(0, -JUMP_IMPULSE)); if (--jumpFramesRemaining <= 0 || !ActionMapper.IsPressed(UserAction.Jump)) { state = States.Falling; } }
public void Update(ActionBusiness action) { var entity = databaseContext.Action.Find(action.Id); if (entity != null) { entity = ActionMapper.Map(action); databaseContext.SaveChanges(); } }
// Update is called once per frame void Update() { if (ActionMapper.IsButtonPressed(pauseKeys)) { if (_isPaused) { ResumeGame(); } else { PauseGame(); } } }
public static SapphireDatabaseBuilder AddSapphireDb(this IServiceCollection services, SapphireDatabaseOptions options = null) { if (options == null) { options = new SapphireDatabaseOptions(); } services.AddSingleton(options); CommandExecutor commandExecutor = new CommandExecutor(options); services.AddSingleton(commandExecutor); foreach (KeyValuePair <string, Type> handler in commandExecutor.commandHandlerTypes) { services.AddTransient(handler.Value); } services.AddSingleton(new DbContextTypeContainer()); services.AddSingleton <SubscriptionManager>(); services.AddSingleton <MessageSubscriptionManager>(); services.AddScoped <SapphireDatabaseNotifier>(); services.AddTransient <DbContextAccesor>(); services.AddSingleton <ConnectionManager>(); services.AddTransient <SapphireChangeNotifier>(); services.AddSingleton <SapphireMessageSender>(); services.AddSingleton <SapphireStreamHelper>(); ActionMapper actionMapper = new ActionMapper(); services.AddSingleton(actionMapper); services.AddSingleton <SyncManager>(); foreach (KeyValuePair <string, Type> handler in actionMapper.actionHandlerTypes) { services.AddTransient(handler.Value); } return(new SapphireDatabaseBuilder(services)); }
public override void Update(IScene scene, GameTime gameTime) { switch (state) { case States.Standing: StandingUpdate(); break; case States.Jumping: JumpingUpdate(); break; case States.Falling: FallingUpdate(); break; case States.Walking: WalkingUpdate(); break; } float xVel = 0; if (ActionMapper.IsPressed(UserAction.MoveLeft)) { xVel -= WALK_IMPULSE; } if (ActionMapper.IsPressed(UserAction.MoveRight)) { xVel += WALK_IMPULSE; } Body.ApplyLinearImpulse(new Vector2(xVel, 0)); if (Body.LinearVelocity.X > MAX_HORIZONTAL_SPEED) { Body.LinearVelocity = new Vector2(MAX_HORIZONTAL_SPEED, Body.LinearVelocity.Y); } else if (Body.LinearVelocity.X < -MAX_HORIZONTAL_SPEED) { Body.LinearVelocity = new Vector2(-MAX_HORIZONTAL_SPEED, Body.LinearVelocity.Y); } lastVelocity = Body.LinearVelocity; }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { resizer = new WindowResizer(graphics, this); // Render target is used to separate internal resolution from display resolution. renderTarget = new RenderTarget2D(GraphicsDevice, InternalResolution.Width, InternalResolution.Height); ActionMapper.Initialize(); // Output some diagnostics before returning. Console.WriteLine("BackbufferWidth: {0}", graphics.PreferredBackBufferWidth); Console.WriteLine("BackbufferHeight: {0}", graphics.PreferredBackBufferHeight); Console.WriteLine("IsFixedTimeStep: {0}", IsFixedTimeStep); base.Initialize(); }
private void InsertAction(ActionRecord actionInstance, string activityInstanceId, DbContext dbContext) { var actionRecordMapper = new ActionMapper(dbContext); var actionEntity = new ActionEntity { ACTION_ID = actionInstance.ActionId ?? Guid.NewGuid().ToString(), ACTIVITY_INSTANCE_ID = activityInstanceId, APPROVER_REQUIRED = "PLACEHOLDER", CREATED_ON = DateTime.Now, LAST_UPDATED_ON = DateTime.Now, OPERATION_CODE = "UNSET", REQUIRED_OPERATOR_TYPE = 1, REQUIRED_ROLE = actionInstance.RequiredRole }; actionRecordMapper.Insert(actionEntity); }
public static SapphireDatabaseBuilder AddSapphireDb(this IServiceCollection services, SapphireDatabaseOptions options = null) { if (options == null) { options = new SapphireDatabaseOptions(); } services.AddSingleton(options); CommandExecutor commandExecutor = new CommandExecutor(options); services.AddSingleton(commandExecutor); foreach (KeyValuePair <string, Type> handler in commandExecutor.commandHandlerTypes) { services.AddTransient(handler.Value); } services.AddSingleton(new DbContextTypeContainer()); services.AddScoped <SapphireDatabaseNotifier>(); services.AddTransient <DbContextAccesor>(); services.AddSingleton <ConnectionManager>(); services.AddTransient <SapphireChangeNotifier>(); services.AddSingleton <SapphireMessageSender>(); ActionMapper actionMapper = new ActionMapper(); services.AddSingleton(actionMapper); services.AddHttpClient <HttpClient>((client) => { client.Timeout = TimeSpan.FromSeconds(10); }); services.AddTransient <NlbManager>(); foreach (KeyValuePair <string, Type> handler in actionMapper.actionHandlerTypes) { services.AddTransient(handler.Value); } return(new SapphireDatabaseBuilder(services)); }
public PlayerInfo(int aPlayerIndex, EInputType aInputType, string aPlayerName = null) { myPlayerIndex = aPlayerIndex; myInputType = aInputType; myMappedActions = new ActionMapper(); if (aPlayerName == null) { GenerateName(); GenerateDefaultActions(); } else { myName = aPlayerName; GenerateDefaultActions(); // json read mapped actions, if new player, generate default anyways } }
public static SapphireDatabaseBuilder AddSapphireDb(this IServiceCollection services, SapphireDatabaseOptions options = null) { if (options == null) { options = new SapphireDatabaseOptions(); } services.AddSingleton(options); CommandExecutor commandExecutor = new CommandExecutor(options); services.AddSingleton(commandExecutor); foreach (KeyValuePair <string, Type> handler in commandExecutor.commandHandlerTypes) { services.AddTransient(handler.Value); } services.AddSingleton(new DbContextTypeContainer()); services.AddSingleton <SubscriptionManager>(); services.AddSingleton <MessageSubscriptionManager>(); services.AddScoped <SapphireDatabaseNotifier>(); services.AddScoped <ISapphireDatabaseNotifier, SapphireDatabaseNotifier>(); services.AddTransient <DbContextAccesor>(); services.AddSingleton <ConnectionManager>(); services.AddTransient <SapphireChangeNotifier>(); services.AddSingleton <SapphireMessageSender>(); services.AddSingleton <SapphireStreamHelper>(); ActionMapper actionMapper = new ActionMapper(); services.AddSingleton(actionMapper); services.AddSingleton <SyncContext>(); services.AddSingleton <SyncManager>(); foreach (KeyValuePair <string, Type> handler in actionMapper.actionHandlerTypes) { services.AddTransient(handler.Value); } IEnumerable <Type> modelConfigurationTypes = Assembly.GetCallingAssembly().GetTypes() .Where(t => typeof(ISapphireModelConfiguration).IsAssignableFrom(t)); foreach (Type modelConfigurationType in modelConfigurationTypes) { services.AddTransient(typeof(ISapphireModelConfiguration), modelConfigurationType); } IEnumerable <Type> actionHandlerConfigurationTypes = Assembly.GetCallingAssembly().GetTypes() .Where(t => typeof(ISapphireActionConfiguration).IsAssignableFrom(t)); foreach (Type actionHandlerConfigurationType in actionHandlerConfigurationTypes) { services.AddTransient(typeof(ISapphireActionConfiguration), actionHandlerConfigurationType); } return(new SapphireDatabaseBuilder(services)); }
public List <ActionBusiness> GetAll() { return((from a in databaseContext.Action.Include(i => i.Person) select ActionMapper.Map(a)).ToList()); }
public void Test1() { ActionMapper am = new ActionMapper(new MockController()); am.DispatchAction("play"); }
public ActionBusiness GetById(int id) { return((from s in databaseContext.Action where s.Id == id select ActionMapper.Map(s)).FirstOrDefault()); }
/// <summary> /// Show more information about an action /// Routing create to be able to access as: /Action/Id /// </summary> /// <param name="id"></param> /// <returns></returns> public async Task <ActionResult> Details(int?PublishModeFilter, int?id, bool computeReadNext = false, bool partial = false) { if (!id.HasValue) { return(HttpNotFound()); } var action = await _prepareService.GetPublishedAction(id.Value); if (action == null) { return(HttpNotFound()); } var publication = await _prepareService.GetLightPublication(action.Publication.PublicationId); ViewBag.ComputeReadNext = computeReadNext; ViewBag.publishModeFilter = PublishModeFilter.Value; // TODO : Faire le calcul du chemin critique en incluant les tâches des sous-process // Change to normal WBS order (alphanumeric) //if (computeReadNext) //{ // var tempCriticalPath = publication.PublishedActions.CriticalPath(p => p.Successors, p => p.BuildFinish - p.BuildStart); // var criticalPath = new List<PublishedAction>(); // for (int i = tempCriticalPath.Count(); i > 0; i--) // criticalPath.Add(tempCriticalPath.ElementAt(i - 1)); // var nextActionIndex = criticalPath.IndexOf(criticalPath.First(u => u.PublishedActionId == id)) + 1; // ViewBag.NextAction = nextActionIndex >= criticalPath.Count ? 0 : criticalPath[nextActionIndex].PublishedActionId; //} var actionIndex = action.Publication.PublishedActions.OrderBy(a => a, new WBSComparer()).Select(p => p.PublishedActionId).ToList().IndexOf(action.PublishedActionId); var previousId = actionIndex - 1 >= 0 ? action.Publication.PublishedActions.OrderBy(a => a, new WBSComparer()).Select(p => p.PublishedActionId).ToList().ElementAtOrDefault(actionIndex - 1) : 0; var nextId = action.Publication.PublishedActions.OrderBy(a => a, new WBSComparer()).Select(p => p.PublishedActionId).ToList().ElementAtOrDefault(actionIndex + 1); var localizations = action.Publication.Localizations.ToDictionary(k => k.ResourceKey, v => v.Value); var documentationReferentials = await _referentialsService.GetDocumentationReferentials(action.Publication.ProcessId); localizations = ActionMapper.UpdateLocalizationLabelForDetail(localizations, documentationReferentials); var visibleColumns = ActionMapper.GetDetailDispositions(action.Publication, (PublishModeEnum)PublishModeFilter.Value); var values = new Dictionary <string, ActionColumnViewModel>(); var actionHeaders = ActionMapper.GetDetailColumnHeader(visibleColumns, localizations); if (computeReadNext) { ViewBag.NextAction = nextId; } foreach (var setting in visibleColumns) { (List <RefsCollection> refs, List <CustomLabel> customLabel) = ActionMapper.BuildReferenceAndCustomLabel(action, localizations); var attribute = ReflectionHelper.GetPropertyValue(action, setting); values.Add(setting, ActionMapper.GetPublishedActionAttributes(action, attribute, setting, setting, localizations, refs, customLabel)); } //Populate Action detail dispositions var detailsDisposition = new List <string>(); if ((PublishModeEnum)PublishModeFilter.Value == PublishModeEnum.Formation) { if (publication.Formation_ActionDisposition.IsNotNullNorEmpty()) { detailsDisposition = publication.Formation_ActionDisposition.Split(',').ToList(); } } else if ((PublishModeEnum)PublishModeFilter.Value == PublishModeEnum.Inspection) { if (publication.Inspection_ActionDisposition.IsNotNullNorEmpty()) { detailsDisposition = publication.Inspection_ActionDisposition.Split(',').ToList(); } } var model = new GenericActionViewModel { ActionHeaders = actionHeaders, ActionId = action.PublishedActionId, Label = action.Label, ColumnValues = values, VideoExtension = action.CutVideo != null?MimeMapping.GetMimeMapping(action.CutVideo.Extension) : null, VideoHash = action.CutVideo?.Hash, VideoExt = action.CutVideo?.Extension, ProcessId = action.Publication.ProcessId, ProcessLabel = action.Publication.Process.Label, PublicationVersion = action.Publication.Version, PublicationVersionIsMajor = action.Publication.IsMajor, PreviousActionId = previousId, NextActionId = nextId, IsKeyTask = action.IsKeyTask, PublishModeFilter = PublishModeFilter.Value, DetailActionDispositions = detailsDisposition }; if (partial) { return(PartialView(model)); } return(View(model)); }
private void ReadInput() { moveLeftRightValue = 0; moveForwardBackwardValue = 0; _finishHitting = false; BallLogic ball = BallLogic.Instance; if (ActionMapper.GetMoveLeft(leftButton, horizontalAxis)) { moveLeftRightValue += -1; } if (ActionMapper.GetMoveRight(rightButton, horizontalAxis)) { moveLeftRightValue += 1; } if (ActionMapper.GetMoveForward(forwardButton, verticalAxis)) { moveForwardBackwardValue += 1; } if (ActionMapper.GetMoveBackward(backwardButton, verticalAxis)) { moveForwardBackwardValue += -1; } if (ActionMapper.GetHitPressed(hitButton, hitJoystickButton) && ball.GetHittingPlayer() != _id) { if (!_isCharging && _isServing) { _currentHitForce = minHitForce; _isCharging = true; } else if (!_isCharging && ball.GetHittingPlayer() != 0) { _currentHitForce = minHitForce; if (!_isServing) { aimTarget.position = _aimStartPosition; _ballSide = BallLogic.Instance.GetSide(transform.position); _playerAnimation.StartHittingAnimation(_ballSide); } _isCharging = true; } else if (_isCharging) { _currentHitForce += deltaHitForce * Time.deltaTime; _currentHitForce = Math.Min(_currentHitForce, maxHitForce); } } if (ActionMapper.GetHitReleased(hitButton, hitJoystickButton)) { if (_isServing && ball.GetHittingPlayer() == 0) { _isCharging = false; _playerAnimation.StartServeAnimation(); _animatedServingBall = Instantiate(animatableServeBallPrefab, transform.position + Vector3.up * animatableServeBallPrefab.GetComponent <BallServeAnimation>().verticalAppearOffset, Quaternion.identity); } } }
public SmartStart(ActionMapper actions) { InitializeComponent(); PreviewKeyDown += new KeyEventHandler(SmartStart_PreviewKeyDown); }