void NextStep() { if (m_firstrun) m_firstrun = false; if (m_stateidx < m_stateSeq.Count) { m_stateidx++; } var ctrl = LibSequentiaMain.instance.stepControl; if (m_stateidx == 0) { var first = m_stateSeq[0]; ctrl.StartWithOneTrack(first.curtrack, 1, false); m_prevState = first; } else if (m_stateidx >= m_stateSeq.Count) { ctrl.StepMove(m_stateSeq[m_stateSeq.Count - 1].step + 1, -1, false); } else { var cur = m_stateSeq[m_stateidx]; if (cur.newtrack != null && m_prevState.newtrack == null) { m_newTrackReverse = false; ctrl.StepMove(cur.step, cur.newtrack, cur.tscen, cur.newstep, false); } else if (m_newTrackReverse && m_prevState.newstep == 1) { // 특수 케이스 처리 : 이전에 역방향으로 다음 트랙으로 넘어가는 자연 진행을 건 경우. // 새 트랙을 다시 올려줘야한다. m_newTrackReverse = false; ctrl.StepMove(cur.step, cur.newtrack, cur.tscen, cur.newstep, false); } else if (cur.newtrack != null && m_prevState.newtrack != null) { if (m_newTrackReverse) { ctrl.StepMove(cur.newstep, cur.newtrack, cur.tscen, cur.step, false); } else { ctrl.StepMove(cur.step, cur.newtrack, cur.tscen, cur.newstep, false); } } else { ctrl.StepMove(cur.step, cur.newstep, false); } m_prevState = cur; } Debug.LogWarning("NextStep - " + m_stateidx); }
private void GotoNextState() { if (_stepState == StepState.Instructions) { ShowGoal(); _stepState = StepState.Testing; return; } else if (_stepState == StepState.Testing) { var didPass = VerifyTest(); if (!didPass) { ShowNotification(CreateTestFailNotification()); return; } ShowSummary(); _stepState = StepState.Summary; return; } else //if (_stepState == StepState.Summary) { LoadNextStep(); _stepState = StepState.Instructions; return; } }
private void RunOne(string filename, params SendToStep[] inputs) { using (var app = new PythonVisualStudioApp()) { var project = app.OpenProject(@"TestData\SendToInteractive.sln"); var program = project.ProjectItems.Item(filename); var window = program.Open(); window.Activate(); var doc = app.GetDocument(program.Document.FullName); doc.MoveCaret(new SnapshotPoint(doc.TextView.TextBuffer.CurrentSnapshot, 0)); var interactive = ReplWindowProxy.Prepare(new ReplWindowPython35Tests().Settings, false); interactive.ExecuteText("42").Wait(); interactive.ClearScreen(); WaitForText(interactive.TextView, ">>> "); var state = new StepState(interactive, app, doc, window); state.Content.Append(">>> "); foreach (var input in inputs) { input.Execute(state); } } }
protected ValGroup ScanInputsAndReturnCompositeValueGroup() { var result = ValGroup.None; var N = Count; for (int i = 0; i < N; i++) { var input = Input[i]; var group = input.Evaluate.ValGroup; if (group == ValGroup.None) { IsUnresolved = true; } else { result |= group; } // bubble-up (IsError, IsChanged, IsOverflow, IsUnresolved) var flags = input._flags2; _flags2 |= (StepState)((int)(flags & StepState.LowerMask) << 4); } return(result); }
private void RunOne(PythonVisualStudioApp app, string filename, params SendToStep[] inputs) { // SendToInteractive.pyproj uses Python 3.5 32-bit var settings = ReplWindowSettings.FindSettingsForInterpreter("Python35"); var sln = app.CopyProjectForTest(@"TestData\SendToInteractive.sln"); var project = app.OpenProject(sln); var program = project.ProjectItems.Item(filename); var window = program.Open(); window.Activate(); var doc = app.GetDocument(program.Document.FullName); doc.MoveCaret(new SnapshotPoint(doc.TextView.TextBuffer.CurrentSnapshot, 0)); var interactive = ReplWindowProxy.Prepare(app, settings, useIPython: false); interactive.ExecuteText("42").Wait(); interactive.ClearScreen(); WaitForText(interactive.TextView, ">>> "); var state = new StepState(interactive, app, doc, window); state.Content.Append(">>> "); foreach (var input in inputs) { input.Execute(state); } }
private IState CreateState(object input) { IState result; var step1 = input as IStep; if (step1 != null) { if (!_states.ContainsKey(step1)) { IStep step = step1; _states[input] = new StepState(step, _prefix + step.Name); } result = _states[input]; } else { var flow1 = input as IFlow; if (flow1 != null) { if (!_states.ContainsKey(flow1)) { IFlow flow = flow1; _states[input] = new FlowState(flow, _prefix + flow.GetName()); } result = _states[input]; } else { throw new FlowBuilderException("No state can be created for: " + input); } } _dirty = true; return(result); }
protected override void Awake () { base.Awake (); _stepStateExecutor = new StepState(this); _standStateExecutor = new StandState(this); _turningStateExecutor = new TurningState(this); }
public override void Execute(StepState state) { state.Window.Activate(); if (_submits) { // This input causes the previous input to be executed... state.Content.Append("\r\n>>> "); } state.Content.Append(_input); state.Content.Append("\r\n"); if (_output != null) { state.Content.Append(_output); state.Content.Append("\r\n"); } if (_continues) { state.Content.Append("... "); } else { state.Content.Append(">>> "); } state.App.SendToInteractive(); if (_checkOutput) { state.CheckOutput(); } }
private void Step() { if (currentInstruction != null && stepActions.ContainsKey(currentInstruction.Type)) { stepActions[currentInstruction.Type](); } currentInstruction = instructionSet.Next(); if (currentInstruction == null) { Animate(); return; } stepState = new StepState() { Position = transform.position2D(), Rotation = transform.rotation }; if (startActions.ContainsKey(currentInstruction.Type)) { startActions[currentInstruction.Type](); } Animate(); }
public async Task UpdateState(ulong id, StepState state) { using (var db = await DbConnectionFactory.OpenAsync()) { await db.UpdateStepState(id, state); } }
public override void Load(LoaderManager _loader) { mPathName = _loader.GetFullPath(mAssetName); mCreat = AssetBundle.LoadFromFileAsync(mPathName); mStep = StepState.BundleLoad; base.Load(_loader); }
private void StepQuery(ThreadQueue.TaskControl control, object state) { try { if (db != null) { StepState stState = state as StepState; if (stState.Callback != null) { while (stState.Callback(stState.Query, stState.Query.Step(), stState.State)) { } } else { stState.Step = stState.Query.Step(); } } else { throw new Exception("Database not ready!"); } } catch (Exception ex) { Debug.LogError("SQLiteAsync : Exception : " + ex.Message); } }
public void SetSequnceStepState(string name, StepState state) { if(dic.Keys.Contains<string>(name)) { dic[name].SetState(state); } }
void OnTriggerExit(Collider other) { if (Living.GetLiving(other)) { targetState = StepState.Narrow; } }
void OnTriggerEnter(Collider other) { if (Living.GetLiving(other)) { targetState = StepState.Wide; } }
//public void Back(string userId) //{ // WorkflowContent content = WorkflowInstResolver.CreateContent(WorkflowRow); // using (content) // { // Back(userId, content, null, null); // } //} public void Unlock() { ManualStepConfig manualConfig = Config as ManualStepConfig; // manualConfig. if (manualConfig.HaveUnlock) { var row = Workflow.WorkflowRow; StepState stepState = row.WI_STATUS.Value <StepState>(); if (stepState == StepState.OpenNotProcess) { //row.BeginEdit(); row.WI_STATUS = (int)StepState.NotReceive; row.WI_RECEIVE_DATE = null; row.WI_RECEIVE_ID = ""; row.WI_CURRENT_CREATE_DATE = DateTime.Now; Workflow.Source.Submit(); // row.EndEdit(); // WorkflowResolver.SetCommands(AdapterCommand.Update); // UpdateUtil.UpdateTableResolvers(null, WorkflowResolver); } else { throw new AtawException("步骤{0} 的状态不是未接收 无法解锁".AkFormat(manualConfig.DisplayName), this); } } else { throw new AtawException("步骤{0} 配置 禁止解锁".AkFormat(manualConfig.DisplayName), this); } }
public override void Execute(StepState state) { state.Window.Activate(); state.App.SendToInteractive(); state.CheckOutput(); }
public override void Execute(StepState state) { var curLine = state.Document.Caret.Position.BufferPosition.GetContainingLine(); Assert.AreEqual(_targetLine, curLine.LineNumber + 1); state.CheckOutput(); }
private void DoTransition(StepState toState, PfcExecutionContext myPfcec) { SsmData ssmData = GetSsmData(myPfcec); StepState fromState = ssmData.State; if (s_transition_Matrix[(int)fromState, (int)toState]) { ssmData.State = toState; bool timePeriodContainer = myPfcec.TimePeriod is Scheduling.TimePeriodEnvelope; if (!timePeriodContainer) { if (fromState == StepState.Running && toState == StepState.Complete) { myPfcec.TimePeriod.EndTime = myPfcec.Model.Executive.Now; } } // Get permission from Step to run. if (fromState == StepState.Idle && toState == StepState.Running) { m_myStep.GetPermissionToStart(myPfcec, this); } //Console.WriteLine("{2} from {0} to {1}", fromState, toState, this.Name); if (!timePeriodContainer) { if (fromState == StepState.Idle && toState == StepState.Running) { myPfcec.TimePeriod.StartTime = myPfcec.Model.Executive.Now; } } if (fromState == StepState.Complete && toState == StepState.Idle) { ssmData.ActiveStepInstanceEc = null; } StateChangeCompleted(myPfcec); if (fromState == StepState.Idle && toState == StepState.Running) { DoRunning(myPfcec); } StepState followOnState = s_follow_On_States[(int)toState]; if (followOnState != toState) { DoTransition(followOnState, myPfcec); } } else { string msg = string.Format("Illegal attempt to transition from {0} to {1} in step state machine for {2}.", fromState, toState, Name); throw new ApplicationException(msg); } }
public override void Execute(StepState state) { state.Editor.Invoke(() => { var view = state.Interactive.TextView; var line = view.TextSnapshot.GetLineFromLineNumber(_targetLine - 1); var span = new SnapshotSpan(line.Start, line.End); view.Selection.Select(span, false); }); }
public void ChangeGameState(StepState state) { GameState = state; if (state == StepState.Gameing) { EventBase.Instance().StepToNext(); OverTime = DateTime.Now.AddSeconds(1800); } }
void SetF2(bool val, StepState flag) { if (val) { _flags2 |= flag; } else { _flags2 &= ~flag; } }
public override void Execute(StepState state) { state.Window.Activate(); state.Editor.Invoke(() => state.Document.Selection.Clear()); state.Editor.MoveCaret( _line, _column ); }
protected override bool OnMove(float dt) { bool arrived = false; if (_StepState == StepState.Rising) { Vector3 position = _Trans.position; _Trans.position = new Vector3(position.x, position.y + 5 * Time.deltaTime, position.z); if (_Trans.position.y > _RasingDest) { _StepState = StepState.Wating; } } else if (_StepState == StepState.Wating) { if (Time.time - _StartTime > 0.5f) { _StepState = StepState.FlyToTarget; } } else if (_StepState == StepState.FlyToTarget) { _RealLeftTime -= Time.deltaTime; _RealLeftTime = Mathf.Max(0, _RealLeftTime); _LinearSpeed += _Acceleration * Time.deltaTime; _LinearSpeed = Mathf.Min(_LinearSpeed, _MaxSpeed); if (_DestTrans != null) { _DestPos = _DestTrans.position; } Vector3 vec = _DestPos - _Trans.position; _Speed = Vector3.Lerp(_StartSpeed, vec.normalized * _LinearSpeed, 1 - (_RealLeftTime / _TotalTime)); if (IsPassOverTargetPos(_Trans.position, _DestPos, _Speed, _LinearSpeed) && 1 - (_RealLeftTime / _TotalTime) > 0.5f) { _Trans.position = _DestPos; arrived = true; } else { _Trans.position += _Speed * Time.deltaTime; _SqrDistance = Util.SquareDistanceH(_Trans.position, _DestPos); if (_SqrDistance < _Tolerance * _Tolerance) { arrived = true; } } } return(!arrived); }
public void SetState(StepState state) { switch(state) { case StepState.NotStarted: stepLabel.Opacity = 0.3; break; case StepState.Started: stepLabel.Opacity = 1; break; default: break; } }
public Step( Widget title, Widget content, Widget subtitle = null, StepState state = StepState.indexed, bool isActive = false ) { D.assert(title != null); D.assert(content != null); this.title = title; this.content = content; this.subtitle = subtitle; this.state = state; this.isActive = isActive; }
/// <summary> /// Change position do step /// </summary> /// <param name="state">Change step using state</param> public void Step(StepState state) { //switch (state) //{ // case StepState.Top: // StepTop(); // break; // case StepState.Bottom: // StepBottom(); // break; // case StepState.Right: // StepRight(); // break; // case StepState.Left: // StepLeft(); // break; //} }
void Update() { if (stepState == StepState.Enable) { stepState = StepState.Over; step.BeginPCall(); step.Push(systemsName); step.PCall(); step.EndPCall(); } name = string.Format("{0} ({1} init, {2} exe, {3:0.###} ms)", systemsName, profile["initializesystemcount"], profile["executesystemcount"], profile["executecostnow"]); if (Time.frameCount % (int)avgResetInterval == 0 && (bool)profile["enable"]) { Reset(systemsName); } }
private void StepQuery(ThreadQueue.TaskControl control, object state) { try { if (db != null) { StepState stState = state as StepState; stState.Step = stState.Query.Step(); } else { throw new Exception("Database not ready!"); } } catch (Exception) { //Debug.LogError("SQLiteAsync : Exception : " + ex.Message); } }
protected override void OnStart() { base.OnStart(); _Trans = transform; _StepState = StepState.Rising; _SqrDistance = Util.SquareDistanceH(_StartPos, _DestPos); float distance = Mathf.Sqrt(_SqrDistance); var hNormalDis = (_DestPos - _StartPos).normalized; _LifeTime = Mathf.Sqrt(2 * distance / _Acceleration); _MaxSpeed = Mathf.Max(_LifeTime * _Acceleration, 20); _Speed = new Vector3(hNormalDis.x, distance * 0.4f / (_LifeTime * 0.5f), hNormalDis.z); _StartSpeed = _Speed; _LinearSpeed = _Speed.magnitude; _RealLeftTime = _LifeTime; _TotalTime = _LifeTime; _RasingDest = _StartPos.y + 2; _StartTime = Time.time; }
public override void Execute(StepState state) { state.Window.Activate(); int line = 0, column = 0; state.Editor.Invoke(() => { state.Document.Selection.Clear(); var pos = state.Editor.TextView.Caret.Position.BufferPosition; var posLine = pos.GetContainingLine(); line = posLine.LineNumber + 1; column = pos.Position - posLine.Start.Position + 1; }); state.Editor.MoveCaret( line + _lines, column + _columns ); }
public override State GetState(StepState state) { switch (state) { case StepState.NotReceive: return(MergeNRState.Instance); case StepState.ReceiveNotOpen: return(MergeRNOState.Instance); case StepState.OpenNotProcess: return(MergeONPState.Instance); case StepState.ProcessNotSend: return(MergePNSState.Instance); default: AtawDebug.ThrowImpossibleCode(this); return(null); } }
public override void Execute(StepState state) { var curSnapshot = state.Document.TextBuffer.CurrentSnapshot; var start = curSnapshot.GetLineFromLineNumber(_startLine - 1).Start + _startColumn - 1; var end = curSnapshot.GetLineFromLineNumber(_endLine - 1).Start + _endColumn - 1; state.Content.Append(_text); state.Editor.Select( _startLine, _startColumn, end - start ); state.App.SendToInteractive(); if (_checkOutput) { state.CheckOutput(); } }
private static void Run(PythonVisualStudioApp app, SendToStep[] inputs, ReplWindowProxySettings settings, EditorWindow doc, EnvDTE.Window window, string projectName = null, string workspaceName = null) { window.Activate(); doc.MoveCaret(new SnapshotPoint(doc.TextView.TextBuffer.CurrentSnapshot, 0)); app.WaitForCommandAvailable("Python.SendSelectionToInteractive", TimeSpan.FromSeconds(15)); var interactive = ReplWindowProxy.Prepare(app, settings, projectName, workspaceName, useIPython: false); interactive.ExecuteText("42").Wait(); interactive.ClearScreen(); WaitForText(interactive.TextView, ">>> "); var state = new StepState(interactive, app, doc, window); state.Content.Append(">>> "); foreach (var input in inputs) { input.Execute(state); } }
public abstract void Execute(StepState state);
public override void Execute(StepState state) { }
void PrevStep() { if (m_firstrun) { m_stateidx = m_stateSeq.Count; m_firstrun = false; } if (m_stateidx > -1) { m_stateidx--; } var ctrl = LibSequentiaMain.instance.stepControl; if (m_stateidx >= m_stateSeq.Count - 1) { var last = m_stateSeq[m_stateSeq.Count - 1]; ctrl.StartWithOneTrack(last.curtrack, last.step, true); m_prevState = last; } else if (m_stateidx < 0) { ctrl.StepMove(0, -1, true); } else { var cur = m_stateSeq[m_stateidx]; if (cur.newtrack != null && m_prevState.newtrack == null) { m_newTrackReverse = true; ctrl.StepMove(cur.newstep, cur.curtrack, cur.tscen, cur.step, true); } else if (!m_newTrackReverse && m_prevState.newstep == 3) { // 특수 케이스 처리 : 이전에 역방향으로 다음 트랙으로 넘어가는 자연 진행을 건 경우. // 새 트랙을 다시 올려줘야한다. m_newTrackReverse = true; ctrl.StepMove(cur.newstep, cur.curtrack, cur.tscen, cur.step, true); } else if (cur.newtrack != null && m_prevState.newtrack != null) { if (m_newTrackReverse) { ctrl.StepMove(cur.newstep, cur.curtrack, cur.tscen, cur.step, true); } else { ctrl.StepMove(cur.step, cur.curtrack, cur.tscen, cur.newstep, true); } } else { ctrl.StepMove(cur.step, -1, true); } m_prevState = cur; } Debug.LogWarning("PrevStep - " + m_stateidx); }
void Update() { if (Input.GetKeyDown(KeyCode.Quote)) { NextStep(); } if (Input.GetKeyDown(KeyCode.Semicolon)) { PrevStep(); } /* if (Input.GetKeyDown(KeyCode.N)) // 자연 진행 { Debug.Log("Natural Transition"); m_masterplayer.DoNaturalProgress(); } if (Input.GetKeyDown(KeyCode.M)) // 강제 진행 { Debug.Log("Manual Transition"); m_masterplayer.DoManualProgress(); } if (Input.GetKeyDown(KeyCode.C)) // C 키 : 다음 트랙 준비 { Debug.Log("newtrack"); m_trackIdx = (m_trackIdx + 1) % 2; m_masterplayer.SetNewTrack(m_tracks[m_trackIdx], m_tscen); } */ if(Input.GetKeyDown(KeyCode.Equals)) // '+' 키 (텐션 업) { m_tension = Mathf.Min(1f, m_tension + 0.1f); LibSequentiaMain.instance.tension = m_tension; } if (Input.GetKeyDown(KeyCode.Minus)) // '-' 키 (텐션 다운) { m_tension = Mathf.Max(0f, m_tension - 0.1f); LibSequentiaMain.instance.tension = m_tension; } if (Input.GetKeyDown(KeyCode.Comma)) // < 키 (이전 트랙쪽으로 트랜지션 옮기기) { LibSequentiaMain.instance.songTransition = Mathf.Max(0, LibSequentiaMain.instance.songTransition - 0.1f); } if (Input.GetKeyDown(KeyCode.Period)) // > 키 (다음 트랙쪽으로 트랜지션 옮기기) { LibSequentiaMain.instance.songTransition = Mathf.Min(1, LibSequentiaMain.instance.songTransition + 0.1f); } // 페이드아웃 if (Input.GetKeyDown(KeyCode.E)) { LibSequentiaMain.instance.stepControl.ForceOut(); m_firstrun = true; m_stateidx = -1; } // 강제 리셋 if(Input.GetKeyDown(KeyCode.R)) { LibSequentiaMain.instance.ResetModule(); m_firstrun = true; m_stateidx = -1; } if (m_firstrun) { int idx = -1; if (Input.GetKeyDown(KeyCode.Alpha1)) idx = 0; if (Input.GetKeyDown(KeyCode.Alpha2)) idx = 1; if (Input.GetKeyDown(KeyCode.Alpha3)) idx = 2; if (Input.GetKeyDown(KeyCode.Alpha4)) idx = 3; if (Input.GetKeyDown(KeyCode.Alpha5)) idx = 4; if (Input.GetKeyDown(KeyCode.Alpha6)) idx = 5; if (Input.GetKeyDown(KeyCode.Alpha7)) idx = 6; if (Input.GetKeyDown(KeyCode.Alpha8)) idx = 7; if (Input.GetKeyDown(KeyCode.Alpha9)) idx = 8; if (Input.GetKeyDown(KeyCode.Alpha0)) idx = 9; if (idx != -1) { m_stateidx = idx; var state = m_stateSeq[idx]; LibSequentiaMain.instance.stepControl.StartWithTwoTrack(state.curtrack, state.step, state.newtrack, state.newstep, state.tscen); m_prevState = state; m_firstrun = false; } } }