public override void OnException(ExceptionContext context) { context.ExceptionHandled = true; var error = new HandledResult <Exception>(context.Exception).HandleException(); context.HttpContext.Response.Clear(); context.HttpContext.Response.ContentType = new MediaTypeHeaderValue("application/json").ToString(); context.HttpContext.Response.StatusCode = error.StatusCode; context.HttpContext.Response.WriteAsync(JsonConvert.SerializeObject(error), Encoding.UTF8); }
public IResult Search() { var value = SearchText.Value; if (string.IsNullOrEmpty(value) || value.Length < 3) { return(HandledResult.Skip()); } //мы должны обнулить а затем записать что бы избежать срабатывания таймера SearchText.Value = ""; ActiveSearchTerm.Value = value; return(HandledResult.Handled()); }
void CompleteJob(HandledResult handle) { scheduledJobs.Remove(handle); handle.jobHandle.Complete(); handle.contactpoints.Dispose(); handle.initialVerts.Dispose(); handle.modifiedVerts.CopyTo(modifiedVertices); handle.modifiedVerts.Dispose(); mesh.vertices = modifiedVertices; vertices = mesh.vertices; mesh.RecalculateNormals(); }
void OnCollisionEnter(Collision other) { if (other.contacts.Length > 0) { Vector3[] contactPoints = new Vector3[other.contacts.Length]; for (int i = 0; i < other.contacts.Length; i++) { Vector3 currentContactpoint = other.contacts[i].point; currentContactpoint = transform.InverseTransformPoint(currentContactpoint); contactPoints[i] = currentContactpoint; } HandledResult newHandledResult = new HandledResult(); IndentSnow(force, contactPoints, ref newHandledResult); } }
public IResult ClearSearch() { if (!String.IsNullOrEmpty(SearchText)) { SearchText.Value = ""; return(HandledResult.Handled()); } if (String.IsNullOrEmpty(ActiveSearchTerm)) { return(HandledResult.Skip()); } ActiveSearchTerm.Value = ""; SearchText.Value = ""; return(HandledResult.Handled()); }
void IndentSnow(float force, Vector3[] worldPositions, ref HandledResult newHandledResult) { newHandledResult.contactpoints = new NativeArray <Vector3> (worldPositions, Allocator.TempJob); newHandledResult.initialVerts = new NativeArray <Vector3> (vertices, Allocator.TempJob); newHandledResult.modifiedVerts = new NativeArray <Vector3> (modifiedVertices, Allocator.TempJob); IndentationJob meshIndentationJob = new IndentationJob { contactPoints = newHandledResult.contactpoints, initialVertices = newHandledResult.initialVerts, modifiedVertices = newHandledResult.modifiedVerts, force = force, radius = radius }; JobHandle indentationJobhandle = meshIndentationJob.Schedule(newHandledResult.initialVerts.Length, newHandledResult.initialVerts.Length); newHandledResult.jobHandle = indentationJobhandle; scheduledJobs.Add(newHandledResult); }