void Execute(Tile inTargetTile) { inTargetTile.mech?.healthComponent.ModifyHealth(-weaponInUse.data.damage); OnCompleteCallback?.Invoke(); Cancel(); }
void Update() { if (m_Disabled) { return; } if (m_DisplayTimeCounter < m_HideAfter) { m_DisplayTimeCounter += Time.deltaTime; } else { StartHideAnim(); if (m_CompleteTimeCounter < m_CompleteAfter) { m_CompleteTimeCounter += Time.deltaTime; } else { OnCompleteCallback.Invoke(); m_Disabled = true; } } }
public UseCaseHandler (OnCompleteCallback <TOutput> onComplete = null, OnStartCallback onStart = null, OnErrorCallback onError = null) { OnStart = onStart; OnError = onError; OnComplete = onComplete; }
public UseCaseHandler <M> FromResult <M>( NextAction <M> action, OnCompleteCallback <M> onComplete = null, OnStartCallback onStart = null, OnErrorCallback onError = null) { M result = default; var nextHandler = new UseCaseHandler <M>(); nextHandler.ExecutingTask = ExecutingTask?.ContinueWith(t => { onStart?.Invoke(); try { result = action.Invoke(Result); onComplete?.Invoke(result); } catch (Exception e) { onError?.Invoke(e); } nextHandler.Result = result; }); return(nextHandler); }
void Execute(Tile inTargetTile) { new Command.MoveMech(_mechActor, inTargetTile.worldPosition).ExecuteAndSend(); OnCompleteCallback?.Invoke(); Cancel(); }
private static void ResetPendingCompilationInfo() { string reasonForFailure; VSUtils.VCUtils.SetCompilerSetting_ShowIncludes(documentBeingCompiled.ProjectItem?.ContainingProject, showIncludeSettingBefore, out reasonForFailure); onCompleted = null; documentBeingCompiled = null; graphBeingExtended = null; VSUtils.GetDTE().Events.BuildEvents.OnBuildDone -= OnBuildConfigFinished; }
public void StartAnimation(Xform startState, Xform endState, float duration, OnCompleteCallback OnComplete = null, TimeScaleFunction RescaleTime = null) { m_start = startState; m_end = endState; current = startState; m_duration = duration; m_startTime = Time.time; m_timeElapsed = 0; m_t = 0; m_animate = true; m_OnComplete = OnComplete; m_RescaleTime = RescaleTime; }
public void StartRotation(float toDegZ, float duration, OnCompleteCallback OnComplete = null, TimeScaleFunction RescaleTime = null) { m_start = current; m_end = current; m_duration = duration; m_startTime = Time.time; m_timeElapsed = 0; m_t = 0; m_animate = true; m_OnComplete = OnComplete; m_RescaleTime = RescaleTime; m_end.rotation = Quaternion.Euler(0, 0, toDegZ); }
private static async Task ResetPendingCompilationInfo() { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); try { VSUtils.VCUtils.SetCompilerSetting_ShowIncludes(documentBeingCompiled.ProjectItem?.ContainingProject, showIncludeSettingBefore); } catch (VCQueryFailure) { } onCompleted = null; documentBeingCompiled = null; graphBeingExtended = null; VSUtils.GetDTE().Events.BuildEvents.OnBuildDone -= OnBuildConfigFinished; }
private void LoadAssets(AsyncOperation operation) { var request = operation as AssetBundleRequest; isAssetLoaded = true; AllAssets = new T[request.allAssets.Length]; for (var i = 0; i < request.allAssets.Length; i++) { var asset = request.allAssets[i]; AllAssets[i] = asset as T; } if (OnCompleteCallback != null) { var loadedAsset = Asset as T; OnCompleteCallback.Invoke(loadedAsset); } }
public static int Run(string arguments, OnCompleteCallback onCompleteCallback) { // Create StartInfo. var atomicParsleyProcessStartInfo = new ProcessStartInfo(); atomicParsleyProcessStartInfo.FileName = _atomicParsleyFile.FullName; atomicParsleyProcessStartInfo.Arguments = arguments; atomicParsleyProcessStartInfo.UseShellExecute = false; atomicParsleyProcessStartInfo.RedirectStandardOutput = true; atomicParsleyProcessStartInfo.RedirectStandardError = true; // Run. using(var atomicParsleyProcess = Process.Start(atomicParsleyProcessStartInfo)) { // Write StdOut. var localOutput = ""; atomicParsleyProcess.OutputDataReceived += (Sender, E) => { localOutput += E.Data; Logger.Log("AtomicParsley").StdOut.Write(E.Data); }; // Write StdErr. atomicParsleyProcess.ErrorDataReceived += (Sender, E) => { Logger.Log("AtomicParsley").StdErr.Write(E.Data); }; // Wait for process to exit and then assign Output to LocalOuput. atomicParsleyProcess.WaitForExit(); // Trigger onComplete if(onCompleteCallback!=null) { onCompleteCallback(atomicParsleyProcess.ExitCode, localOutput); } // Return exit code. return atomicParsleyProcess.ExitCode; } }
/// <summary> /// Parses a given source file using cl.exe with the /showIncludes option and adds the output to the original graph. /// </summary> /// <remarks> /// If this is the first file, the graph is necessarily a tree after this operation. /// </remarks> /// <returns>true if successful, false otherwise.</returns> public static async Task <bool> AddIncludesRecursively_ShowIncludesCompilation(this IncludeGraph graph, Document document, OnCompleteCallback onCompleted) { var canPerformShowIncludeCompilation = await CanPerformShowIncludeCompilation(document); if (!canPerformShowIncludeCompilation.Result) { await Output.Instance.ErrorMsg(canPerformShowIncludeCompilation.Reason); return(false); } try { var dte = VSUtils.GetDTE(); if (dte == null) { await Output.Instance.ErrorMsg("Failed to acquire dte object."); return(false); } try { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); showIncludeSettingBefore = VSUtils.VCUtils.GetCompilerSetting_ShowIncludes(document.ProjectItem?.ContainingProject); VSUtils.VCUtils.SetCompilerSetting_ShowIncludes(document.ProjectItem?.ContainingProject, true); } catch (VCQueryFailure queryFailure) { await Output.Instance.ErrorMsg("Can't compile with show includes: {0}.", queryFailure.Message); return(false); } // Only after we're through all early out error cases, set static compilation infos. dte.Events.BuildEvents.OnBuildDone += OnBuildConfigFinished; CompilationBasedGraphParser.onCompleted = onCompleted; CompilationBasedGraphParser.documentBeingCompiled = document; CompilationBasedGraphParser.graphBeingExtended = graph; // Even with having the config changed and having compile force==true, we still need to make a dummy change in order to enforce recompilation of this file. { document.Activate(); var documentTextView = VSUtils.GetCurrentTextViewHost(); var textBuffer = documentTextView.TextView.TextBuffer; using (var edit = textBuffer.CreateEdit()) { edit.Insert(0, " "); edit.Apply(); } using (var edit = textBuffer.CreateEdit()) { edit.Replace(new Microsoft.VisualStudio.Text.Span(0, 1), ""); edit.Apply(); } } await VSUtils.VCUtils.CompileSingleFile(document); } catch (Exception e) { await ResetPendingCompilationInfo(); await Output.Instance.ErrorMsg("Compilation of file '{0}' with /showIncludes failed: {1}.", document.FullName, e); return(false); } return(true); }
public FlowmapPathfinder(GridManager gridManager, UnitController unitController, OnCompleteCallback onCompleteCallback = null) { this.gridManager = gridManager; this.unitController = unitController; this.onCompleteCallback = onCompleteCallback; }
public void OnDisplayAnimationEnded() { OnCompleteCallback.Invoke(); }
private static extern void Sge_Att_requestTrackingAuthorization(OnCompleteCallback callback);
// public async Task AsyncUploadProject(string fileName, string projectId, IProgress<double> progress) // { // AsyncFunction(fileName, projectId, progress); // } // private Task AsyncFunction(string fileName, string projectId, IProgress<double> progress) // { // return Task.Run(() => // { // UploadProject(fileName, projectId, progress); // return; // }); // } public void AsyncUploadProject(string fileName, string projectId, IProgress <double> progress, OnCompleteCallback onComplete) { Func <string, string, IProgress <double>, Exception> fun = t_UploadProject; fun.BeginInvoke(fileName, projectId, progress, (ar => { Debug.Log("Async FTP Upload Ended."); if (ar == null) { throw new ArgumentNullException("ar"); } Func <string, string, IProgress <double>, Exception> dl = (Func <string, string, IProgress <double>, Exception>)ar.AsyncState; Exception result = dl.EndInvoke(ar); onComplete(result); }), fun); Debug.Log("Async FTP Upload Start."); }
/// <summary> /// Parses a given source file using cl.exe with the /showIncludes option and adds the output to the original graph. /// </summary> /// <remarks> /// If this is the first file, the graph is necessarily a tree after this operation. /// </remarks> /// <returns>true if successful, false otherwise.</returns> public static bool AddIncludesRecursively_ShowIncludesCompilation(this IncludeGraph graph, Document document, OnCompleteCallback onCompleted) { if (!CanPerformShowIncludeCompilation(document, out string reasonForFailure)) { Output.Instance.ErrorMsg(reasonForFailure); return(false); } try { var dte = VSUtils.GetDTE(); if (dte == null) { Output.Instance.ErrorMsg("Failed to acquire dte object."); return(false); } { bool?setting = VSUtils.VCUtils.GetCompilerSetting_ShowIncludes(document.ProjectItem?.ContainingProject, out reasonForFailure); if (!setting.HasValue) { Output.Instance.ErrorMsg("Can't compile with show includes: {0}.", reasonForFailure); return(false); } else { showIncludeSettingBefore = setting.Value; } VSUtils.VCUtils.SetCompilerSetting_ShowIncludes(document.ProjectItem?.ContainingProject, true, out reasonForFailure); if (!string.IsNullOrEmpty(reasonForFailure)) { Output.Instance.ErrorMsg("Can't compile with show includes: {0}.", reasonForFailure); return(false); } } // Only after we're through all early out error cases, set static compilation infos. dte.Events.BuildEvents.OnBuildDone += OnBuildConfigFinished; CompilationBasedGraphParser.onCompleted = onCompleted; CompilationBasedGraphParser.documentBeingCompiled = document; CompilationBasedGraphParser.graphBeingExtended = graph; // Even with having the config changed and having compile force==true, we still need to make a dummy change in order to enforce recompilation of this file. { document.Activate(); var documentTextView = VSUtils.GetCurrentTextViewHost(); var textBuffer = documentTextView.TextView.TextBuffer; using (var edit = textBuffer.CreateEdit()) { edit.Insert(0, " "); edit.Apply(); } using (var edit = textBuffer.CreateEdit()) { edit.Replace(new Microsoft.VisualStudio.Text.Span(0, 1), ""); edit.Apply(); } } VSUtils.VCUtils.CompileSingleFile(document); } catch (Exception e) { ResetPendingCompilationInfo(); Output.Instance.ErrorMsg("Compilation of file '{0}' with /showIncludes failed: {1}.", document.FullName, e); return(false); } return(true); }