public void FishingEnd(bool success) { foreach (Fish f in Fishes) { f.FishingEnd(); } areaCollider.enabled = true; FishingControls?.Disable(); FishingControls?.Dispose(); FishingControls = null; Debug.Log("Stopped fishing."); if (_fishingBehaviourScript == null) { return; } if (success) { ActiveFish.ForceStopAI(); Debug.Log("Fish Caught!"); } else { OnFail?.Invoke(); Debug.Log("Fish Got Away..."); } Destroy(_fishingBehaviourScript.gameObject); }
public void Disconnect(LoginClient client) { lock (Clients) Clients.Remove(client); OnFail?.Invoke(client); }
private void RemoteCallHandler(PatcherIpcEnvelope envelope) { switch (envelope.OpCode) { case PatcherIpcOpCode.Hello: //_client.Initialize(_clientPort); Log.Information("[PATCHERIPC] GOT HELLO"); State = InstallerState.Ready; break; case PatcherIpcOpCode.InstallOk: Log.Information("[PATCHERIPC] INSTALL OK"); State = InstallerState.Ready; break; case PatcherIpcOpCode.InstallFailed: State = InstallerState.Failed; OnFail?.Invoke(); Stop(); Environment.Exit(0); break; default: throw new ArgumentOutOfRangeException(); } }
IEnumerator WaitForReload(float time) { yield return(new WaitForSeconds(time)); _audioSource.clip = AudioList.Instance.puzzleerror; _audioSource.Play(); OnFail.Invoke(); }
public async Task Start(Stream stream) { try { using (var parser = new Parser(this.stream = stream)) { if (!storage.Recycle(out var buffer, true)) { throw new Exception("Unable to recycle buffer"); } for (int endMember; (endMember = await parser.Find("/members/member")) != -1 && !storage.IsClosed;) { try { if (SkipEvery < 1) { ++Records; } else if ((Records++ + StartAt) % (SkipEvery + 1) != 0) { continue; } Position = parser.Current; var p = new Member(); await p.Load(parser, endMember, maxDataSize); ++Processed; p.Validate(); buffer.Add(p); if (buffer.IsFull) { storage.Store(buffer); OnProgress?.Invoke(this, (double)stream.Position / stream.Length); if (!storage.Recycle(out buffer, true)) { throw new Exception("Unable to recycle buffer"); } } } catch (Exception e) when(e is EPersonInvalid || e is Parser.EMaxLengthExceeded) { ++Invalid; OnInvalidItem?.Invoke(this, e); } } if (buffer.Count > 0) { storage.Store(buffer); } } OnProgress?.Invoke(this, 1); } catch (Exception e) { OnFail?.Invoke(this, e); throw; } }
public void HandleFail(Exception ex, int retryCount, long elapsedMilliseconds) { var eventType = string.Format("{0}_Failed", eventName); var message = string.Format("Event {0} failed, Retries {1}, Exception {2}", ex.GetType().Name, eventName, ex); if (OnFail != null) { OnFail.Invoke(ex); } TraceEvent(eventType, message, retryCount, elapsedMilliseconds); }
public async Task Start() { try { await Setup(); using (var update = GetUpdateCommand()) { while (!storage.IsClosed || storage.StorageCount > 0) { //Nothing to consume, breaks the loop if (!storage.Take(out var buffer, true)) { break; } try { using (var transaction = db.BeginTransaction(System.Data.IsolationLevel.ReadCommitted)) { var records = buffer.Count; using (var writer = db.BeginBinaryImport("COPY synchronize__person (fname, lname, dob, phone) FROM STDIN (FORMAT BINARY)")) { for (var i = -1; ++i < buffer.Count;) { buffer[i].Save(writer); } writer.Complete(); writer.Close(); } await update.ExecuteNonQueryAsync(); await transaction.CommitAsync(); Imported += records; buffer.Clear(); //Sends the buffer back to be recycled by another Producer storage.Waste(buffer); } } catch { //Failed to save the buffer, return it to the storage storage.Store(buffer); throw; } } } } catch (Exception e) { OnFail?.Invoke(this, e); throw; } finally { await Teardown(); } }
public void Dispose() { GCHandle handle = GCHandle.Alloc(array, GCHandleType.Pinned); //no method to copy from IntPtr to IntPtr int bytes = Count * size; Copy(handle.AddrOfPinnedObject(), Ptr, bytes); handle.Free(); bool result = GL.UnmapNamedBuffer(ID); if (result) { OnFail?.Invoke(ID); callback?.Invoke(ID); } GC.SuppressFinalize(this); }
protected bool HandleReadable(byte[] source) { lock (Sync) { if (PipedTo != null) { if (!PipedTo.Write(source)) { OnFail?.Invoke(); } return(true); } if (_OnData != null) { _OnData(source); return(true); } return(Readable.Write(source)); } }
public void FinishMoving(bool isOnlyMoving) { if (isOnlyMoving) { currentMoving = null; transform.position = new Vector3(10, 10, 0); return; } var settings = currentMoving.GetComponent <PartSettings>(); if ((settings.destinationObjectTag == null || settings.destinationObjectTag.Equals("")) && _carParts.TryToSetUpDetail(currentMoving, distanceToCorrectDrop)) { generator.GenerateAllFreeSlots(); AudioPlayPutDetail(currentMoving); Vibration.Vibrate(100); OnSuccess?.Invoke(); print("Success"); if (generator.IsAllDetailsSetUp()) { FindObjectOfType <Level>().StartLevel(); } } else if ((settings.destinationObjectTag != null && !settings.destinationObjectTag.Equals("")) && TryToSetUp(GameObject.FindGameObjectsWithTag(settings.destinationObjectTag), settings.destionationObjectRangeInstall, settings.isColorMatching)) { currentMoving.GetComponent <IInteractiveAction>().Action(); OnSuccess?.Invoke(); print("Success"); } else { if (_carParts.IsInCarBase(currentMoving.transform.position)) { AudioPlayError(currentMoving); } currentMoving.GetComponent <MovableObject>().ReturnToStartPosition(); OnFail?.Invoke(); } // transform.position = new Vector3(10, 10, 0); currentMoving = null; }
void AttendBubble(GameObject bubble) { if (sequence.Peek() == bubble.GetComponent <SpriteRenderer>().sprite) { audioManager.PlayEnvironmentSound("BubbleExplosion"); Destroy(bubble); sequence.Dequeue(); OnScore.Invoke(); if (hits >= bubbleCount) { FinishGame(); } } else { OnFail.Invoke(); } }
/// <summary> /// Compile an Assembly from the given sources /// </summary> /// <param name="code"></param> /// <returns></returns> public Assembly Compile(string[] code) { var code_provider = new CSharpCodeProvider(); var code_parameters = new CompilerParameters(); code_parameters.ReferencedAssemblies.AddRange(ReferencedAssemblies.ToArray()); code_parameters.GenerateExecutable = false; code_parameters.GenerateInMemory = false; var result = code_provider.CompileAssemblyFromSource(code_parameters, code); if (result.Errors.HasErrors) { foreach (var item in result.Errors) { OnFail.Invoke(this, new Logging(item.ToString())); } return(null); } return(result.CompiledAssembly); }
/// <summary> /// Invokes the proper status event based on the execution context's result status /// </summary> /// <param name="executionContext"></param> protected void InvokeStatusEvent(ExecutionContext executionContext) { switch (executionContext.Result.Status) { case TestStatus.Pass: OnPass.Invoke(executionContext); break; case TestStatus.Fail: OnFail.Invoke(executionContext); break; case TestStatus.Error: OnError.Invoke(executionContext); break; case TestStatus.Ignore: OnIgnore.Invoke(executionContext); break; } }
// Starts a backoff operation. Accepts an optional parameter to let the listeners know why the backoff operation was started. public async Task DoBackoff(string err = null) { if (_timeoutId != null) { throw new InvalidOperationException("Backoff in progress."); } if (_backoffNumber == _maxNumberOfRetry) { OnFail?.Invoke(err); Reset(); } else { OnBackoff?.Invoke(_backoffNumber, _backoffDelay, err); _backoffDelay = _backoffStrategy.Next(); _timeoutId = new CancellationTokenSource(); await Task.Delay(_backoffDelay, _timeoutId.Token); OnBackoffInternal(); } }
public void ExecuteStep() { try { SetStart(); OnStart?.Invoke(Reference); Execute(); OnSuccess?.Invoke(Reference, this); SetEnd(); } catch (Exception e) { HasExecutionError = true; OnFail?.Invoke(Reference, e); } finally { OnFinish?.Invoke(Reference); } }
private void OnFailCaller() { OnFail?.Invoke(this); OnDoneCaller(); }
private void AuthOnError(object sender, AuthenticatorErrorEventArgs authenticatorErrorEventArgs) { OnFail?.Invoke(sender, new OnFailEventArgs { Error = authenticatorErrorEventArgs.Message }); }
void TreatFailing() { OnFail?.Invoke(this.gameObject); }
protected void FailedCommand() { OnFail?.Invoke(this, EventArgs.Empty); }
private void TaskFail() { _task.TaskUnsuccessful(); OnFail?.Invoke(); }
private void TaskFail() { OnFail?.Invoke(); Debug.Log("Wire task failed"); }
public void Reject(string error) { this.error = error; rejected = true; OnFail?.Invoke(this); }