protected void HadleInputs() { Vertical = Input.GetAxis("Vertical"); Horizontal = Input.GetAxis("Horizontal"); HorizonalMouse = Input.GetAxis("Mouse X"); VerticalMouse = Input.GetAxis("Mouse Y"); if (Input.GetKey(KeyCode.LeftShift)) { PressShift?.Invoke(); } if (Input.GetKey(KeyCode.E)) { StartAction?.Invoke(true); } if (Input.GetMouseButton(0)) { FireMachineGun?.Invoke(); } if (Input.GetMouseButton(1)) { FireRocket?.Invoke(); } }
/// <summary> /// Runs the operation /// </summary> /// <returns>The disposable wrapper</returns> public DisposableAction Run() { // Run start action StartAction?.Invoke(); // Create the disposable action return(new DisposableAction(DisposeAction, LockOperation)); }
public void Datahandle(byte[] bytes) { BaseNetObject bno = NetBaseTool.BytesToObject(bytes) as BaseNetObject; if (bno is SystemNetObject) { SystemNetObject systemNetObject = bno as SystemNetObject; if (systemNetObject.GetType() == typeof(Msg)) { Console.WriteLine(systemNetObject); } else if (systemNetObject.GetType() == typeof(GetMyUserData)) { MyUserData = (systemNetObject as GetMyUserData).userData; } else if (systemNetObject.GetType() == typeof(CreateRoomS2C)) { transmit = (systemNetObject as CreateRoomS2C).PlayerId; wait.Set(); } else if (systemNetObject.GetType() == typeof(JoinRoomS2C)) { transmit = (systemNetObject as JoinRoomS2C); wait.Set(); } else if (systemNetObject.GetType() == typeof(GetRoomListS2C)) { transmit = (systemNetObject as GetRoomListS2C).rooms; wait.Set(); } else if (systemNetObject.GetType() == typeof(PlayerJoinS2C)) { PlayerJoin?.Invoke((systemNetObject as PlayerJoinS2C).playerId); } else if (systemNetObject.GetType() == typeof(PlayerLeaveS2C)) { PlayerLeave?.Invoke((systemNetObject as PlayerLeaveS2C).playerId); } else if (systemNetObject.GetType() == typeof(GameStart)) { StartAction?.Invoke(); } } else { GameNetObject gno = bno as GameNetObject; if (gno == null) { throw new ArgumentException(bno.GetType() + " Can't Used"); } ReceiveAction?.Invoke(gno); } //防止死锁 // wait.Set(); }
/// <summary> Start the shader. Bind the program and call Start on each sumcomponent. Then invoke StartAction</summary> public virtual void Start(GLMatrixCalc c) { GL.UseProgram(0); // ensure no active program - otherwise the stupid thing picks it GL.BindProgramPipeline(pipelineid); foreach (var x in shaders) // let any programs do any special set up { x.Value.Start(c); } StartAction?.Invoke(this, c); // any shader hooks get a chance. }
private void StartRefreshThread() { if (StartHandler != null) { StartHandler.Invoke();// StartHandler?.Invoke();//?表示可空 } //StartHandler?.Invoke();// StartHandler?.Invoke();//?表示可空 _refreshEnable = true; ThreadManager.StartThread(ThreadCluster.PlayerRefresh); }
public void Update() { if (m_IsPause) return; //计算delay 时间 if (UnityEngine.Time.realtimeSinceStartup >=m_CurRunTime + m_DelayTime+m_LastPauseTime) { if (!IsRunning) { m_CurRunTime = UnityEngine.Time.realtimeSinceStartup; m_DelayTime = 0; StartAction?.Invoke(); } IsRunning = true; } if (!IsRunning) return; //计算interval if (UnityEngine.Time.realtimeSinceStartup >= m_CurRunTime + m_Pausetime) { m_CurRunTime = UnityEngine.Time.realtimeSinceStartup + m_Interval; m_Pausetime = 0; RunAction?.Invoke(m_Loop - m_CurLoop); //Loop即使为0也执行一次 if (m_Loop != -1) { if (m_CurLoop >= m_Loop) { CompleteAction?.Invoke(); Stop(); } m_CurLoop++; } } }
public override Task StartAsync(CancellationToken cancellationToken = default) { startupService = Services.GetRequiredService <TStartup>(); if (startupService == null) { throw new NullReferenceException(nameof(startupService)); } if (StartAction != null) { StartAction.Invoke(startupService); return(Task.CompletedTask); } return(StartActionAsync?.Invoke(startupService, cancellationToken)); }
/// <summary> /// Runs the operation /// </summary> /// <returns>The disposable wrapper</returns> public async Task <IDisposable> RunAsync() { // Await the lock and get the disposable IDisposable d = await DisposableLock.LockAsync(); try { // Run start action StartAction.Invoke(); } catch { d.Dispose(); throw; } // Create the disposable action return(new DisposableAction(DisposeAction, d)); }
private void StartServer() { var url = _cfg.ServerURL; SetStatus($"Starting server at [{url}] ..."); try { StartAction?.Invoke(url); SetStatus("Server successfully started."); } catch (TargetInvocationException ex) { var msg = GetPortConflictMessage(url); MessageBox.Show(msg, "Failed to start server", MessageBoxButton.OK, MessageBoxImage.Error); ex.ShowAlert(); } catch (Exception ex) { SetStatus(ex.Info(true, true)); } }
/// <summary> Perform animation on control at this time in ms. Called internally by Control.Animate /// Animation is performed on a system tick by calling GLControlDisplay.Animate(timestamp); /// </summary> public void Animate(GLBaseControl cs, ulong timems) { if (DeltaTime) // if we were set up with delta times, then set the starttime/end time as moved on from timems { StartTime += timems; EndTime += timems; DeltaTime = false; } if (State == StateType.Waiting && timems >= StartTime) { State = StateType.Running; Start(cs); StartAction?.Invoke(this, cs, timems); } if (State == StateType.Running) { ulong elapsed = timems - StartTime; ulong timetomove = EndTime - StartTime; double deltain = (double)elapsed / (double)timetomove; // % in, 0-1 if (deltain >= 1.0) { End(cs); if (RemoveAfterEnd) { cs.Animators.Remove(this); } State = StateType.Done; FinishAction?.Invoke(this, cs, timems); } else { Middle(cs, deltain); } } }
protected override void OnStart(string[] args) { StartAction?.Invoke(); }
public void RegisterDelayStartCallback(Action <object> callback, object state) { StartCount++; StartAction?.Invoke(callback, state); }
public Task StartAsync(CancellationToken cancellationToken) { StartCount++; StartAction?.Invoke(cancellationToken); return(Task.CompletedTask); }
public override void OnStart(Activity span) => StartAction?.Invoke(span);
public override void Start() { StartAction.Invoke(); }
/// <summary> Start the shader. Bind the program and then invoke StartAction</summary> public virtual void Start(GLMatrixCalc c) { GL.UseProgram(Id); StartAction?.Invoke(this, c); }
/// <summary> Start shader - execute compute. StartAction is called </summary> public void Start(GLMatrixCalc c) { GL.UseProgram(Id); StartAction?.Invoke(this, c); GL.DispatchCompute(XWorkgroupSize, YWorkgroupSize, ZWorkgroupSize); }
private void Form1_Shown(object sender, EventArgs e) { //Run any actions queued by window manager StartAction?.Invoke(this); }
public override void Entry() { currentTime = 0; hittingTargets.Clear(); StartAction?.Invoke(); }
public void OnTransitionStart(Transition transition) { StartAction?.Invoke(); }