public async Task CallAgainProduct(int managerId, int clientId, DateTime dateTime) { var user = await _dbContext.User.FirstOrDefaultAsync(u => u.Id == managerId); var clientProducts = await _dbContext.ClientProduct .Where(c => c.Client.Id == clientId) .ToArrayAsync(); if (user != null && clientProducts.Any()) { foreach (var cp in clientProducts) { var managerAction = new ManagerAction { User = user, ClientProduct = cp, Result = ManagerActionResult.Refused, DateTime = DateTime.Now, CallAgainDateTime = dateTime }; await _dbContext.ManagerAction.AddAsync(managerAction); } await _dbContext.SaveChangesAsync(); } }
public void OnTriggerEnter(Collider in_hit) { if (in_hit.CompareTag("Enemy")) { Enemy hitEnemy = in_hit.gameObject.GetComponent <Enemy>() as Enemy; if (hitEnemy) { // 死亡中かチェック Player enemy = hitEnemy as Player; if (ManagerAction.isDie(ref enemy)) { } // 相手にダメージを与えた else if (ManagerAction.isDamage(ref enemy)) { } else { m_normalDmgActionParam.moveVec = charBase.dir; if (m_normalDmgActionParam.moveVec == Vector3.zero) { m_normalDmgActionParam.moveVec = Vector3.forward; } m_normalDmgActionParam.moveVec = -m_normalDmgActionParam.moveVec; action.runFromPrority(ActionId.eNORMAL_DAMAGE, m_normalDmgActionParam); } } } }
public virtual void Awake() { m_charCtrl = GetComponent <CharCtrl>() as CharCtrl; DebugUtils.Asseert(m_charCtrl); Player play = this; m_managerAction = new ManagerAction(ref play, ref actionList); DebugUtils.Asseert(m_managerAction != null); }
public async Task AcceptProduct(int managerId, int[] clientProductIds) { var user = await _dbContext.User.FirstOrDefaultAsync(u => u.Id == managerId); var acceptedClientProducts = await _dbContext.ClientProduct .Include(c => c.Client) .Where(c => clientProductIds.Contains(c.Id)) .ToArrayAsync(); if (user != null && acceptedClientProducts.Any()) { var allClientProducts = await _dbContext.ClientProduct .Where(c => c.Client.Id == acceptedClientProducts[0].Client.Id) .ToArrayAsync(); foreach (var cp in allClientProducts) { var managerAction = new ManagerAction { User = user, ClientProduct = cp, DateTime = DateTime.Now }; if (acceptedClientProducts.Contains(cp)) { managerAction.Result = ManagerActionResult.Accept; cp.Accepted = true; _dbContext.Update(cp); } else { managerAction.Result = ManagerActionResult.Refused; } await _dbContext.ManagerAction.AddAsync(managerAction); } await _dbContext.SaveChangesAsync(); } }
/// <summary> /// Frees this instance. /// </summary> public void Free() { autoEvent = null; action = null; response = null; }
/// <summary> /// Creates a new <see cref="ResponseHandler"/>. /// </summary> /// <param name="action"><see cref="ManagerAction"/></param> /// <param name="autoEvent"><see cref="AutoResetEvent"/></param> public ResponseHandler(ManagerAction action, AutoResetEvent autoEvent) { response = null; this.action = action; this.autoEvent = autoEvent; }
public TaskResponseHandler(ManagerAction action) { TaskCompletionSource = new TaskCompletionSource <ManagerResponse>(TaskCreationOptions.RunContinuationsAsynchronously); Action = action; }
public TaskResponseHandler(ManagerAction action) { TaskCompletionSource = new TaskCompletionSource <ManagerResponse>(); Action = action; }