public async Task <bool> StartMinecraftAsync(IWin32Window fromWindow) { if (this.instanceMetadata == null) { return(false); } var session = await SessionUtil.GetSessionAsync(fromWindow); if (session == null) { return(false); } var launchOptions = CreateLaunchOptions(session); var launchVersion = this.instanceMetadata.CurrentLaunchVersion; if (this.packMetadata.SupportsVr) { if (this.isVrEnabled) { launchVersion = this.instanceMetadata.VrLaunchVersion; } else if (this.packMetadata.EnableVivecraftForNonVrPlayers != false) { launchVersion = this.instanceMetadata.NonVrLaunchVersion; } } launchOptions.StartVersion = await GetVersionMetadataAsync(launchVersion); var launch = new MLaunch(launchOptions); var process = launch.GetProcess(); process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardError = true; process.StartInfo.RedirectStandardOutput = true; process.EnableRaisingEvents = true; process.Exited += (_, _) => CurrentProcess = null; process.Start(); CurrentProcess = process; Launched?.Invoke(this, EventArgs.Empty); return(true); }
/// <summary> /// Fires the paragon.app.runtime.onLaunched event to JavaScript. /// </summary> private void OnEventPageBrowserLoad(object sender, LoadEndEventArgs e) { if (_eventPageBrowser != null) { _eventPageBrowser.LoadEnd -= OnEventPageBrowserLoad; } if (e != null && e.Frame.IsMain) { if (Metadata.UpdateLaunchStatus != null) { Metadata.UpdateLaunchStatus("Waiting for window creations ..."); } _eventPageLaunchTimer = new Timer(OnLaunchTimerExpired, null, _eventPageLaunchTimeout, TimeSpan.FromMilliseconds(-1)); Launched.Raise(this, EventArgs.Empty); } }
public bool Raycast(Vector3 position, Vector3 direction, out HitscanInfo scanInfo, float maxDistance, Vector3 muzzle) { scanInfo = default; scanInfo.origin = position; scanInfo.direction = direction; scanInfo.maxDistance = maxDistance; scanInfo.muzzle = muzzle; bool success = Physics.Raycast(position, direction, out scanInfo.hitInfo, maxDistance, layerMask); scanInfo.success = success; // Events processing HitscanEventArgs args = new HitscanEventArgs(scanInfo); Launched?.Invoke(this, args); if (success) { Impacted?.Invoke(this, args); } return(success); }
private void ApplicationOnLaunched(object sender, EventArgs e) { Launched.Raise(); }