private void ShowContextMenu(int i, SerializedProperty step) { var menu = new GenericMenu(); var stepData = new StepData { step = step, index = i, dataArray = dataArray }; menu.AddItem(new GUIContent(ObjectNames.NicifyVariableName(nameof(Remove))), false, Remove, stepData); menu.AddSeparator(""); menu.AddItem(new GUIContent(ObjectNames.NicifyVariableName(nameof(Duplicate))), false, Duplicate, stepData); menu.AddItem(new GUIContent(ObjectNames.NicifyVariableName(nameof(Copy))), false, Copy, stepData); var currentroot = step.serializedObject.targetObject as ComposableObject; if (ClipboardItem && currentroot.ElementType.IsAssignableFrom(ClipboardItem.GetType())) { menu.AddItem(new GUIContent($"Paste new {ObjectNames.NicifyVariableName(ClipboardItem?.name)} above"), false, PasteNewAbove, stepData); menu.AddItem(new GUIContent($"Paste new {ObjectNames.NicifyVariableName(ClipboardItem?.name)}"), false, PasteNew, stepData); } else { menu.AddDisabledItem(new GUIContent($"Paste")); } menu.AddSeparator(""); menu.AddItem(new GUIContent(ObjectNames.NicifyVariableName(nameof(MoveToTop))), false, MoveToTop, stepData); menu.AddItem(new GUIContent(ObjectNames.NicifyVariableName(nameof(MoveUp))), false, MoveUp, stepData); menu.AddItem(new GUIContent(ObjectNames.NicifyVariableName(nameof(MoveDown))), false, MoveDown, stepData); menu.AddItem(new GUIContent(ObjectNames.NicifyVariableName(nameof(MoveToBottom))), false, MoveToBottom, stepData); menu.AddSeparator(""); menu.AddItem(new GUIContent(ObjectNames.NicifyVariableName(nameof(EditScript))), false, EditScript, stepData); menu.ShowAsContext(); }
private static StepData GenerateStepData(string name, string stepType, double current, double voltage, double power, double lowLimit, double highLimit) { Random random = new Random(); var status = new Status(StatusType.Running); var inputs = new List <NamedValue>(); var outputs = new List <NamedValue>(); var parameters = new List <Dictionary <string, string> >(); if (stepType.Equals("NumericLimit")) { var parameter = new Dictionary <string, string>(); parameter.Add("name", "Power Test"); parameter.Add("status", "status"); parameter.Add("measurement", $"{power}"); parameter.Add("units", null); parameter.Add("nominalValue", null); parameter.Add("lowLimit", $"{lowLimit}"); parameter.Add("highLimit", $"{highLimit}"); parameter.Add("comparisonType", "GELT"); parameters.Add(parameter); inputs = new List <NamedValue>() { new NamedValue("current", current), new NamedValue("voltage", voltage) }; outputs = new List <NamedValue>() { new NamedValue("power", power) }; if (power < lowLimit || power > highLimit) { status = new Status(StatusType.Failed); } else { status = new Status(StatusType.Passed); } } var stepData = new StepData() { Inputs = inputs, Name = name, Outputs = outputs, StepType = stepType, Status = status, TotalTimeInSeconds = random.NextDouble() * 10, Parameters = parameters, DataModel = "TestStand", }; return(stepData); }
public void Send(StepData stepData, IPipelineStep pipelineStep) { if (pipelineStep == _getTaskStep) { _initializingWebClientStep.SetData(stepData); _gettingEntityStep.SetData(stepData); } else if (pipelineStep == _gettingEntityStep) { _downloadStep.SetData(stepData); } else if (pipelineStep == _downloadStep) { _creatorStep.SetData(stepData); } else if (pipelineStep == _creatorStep) { _encodeStep.SetData(stepData); } else if (pipelineStep == _encodeStep) { _uploadStep.SetData(stepData); } else if (pipelineStep == _uploadStep) { _finishStep.SetData(stepData); } }
/// <summary> /// Creates a <see cref="StepData"/> object and /// populates it to match the TestStand data model. /// </summary> /// <param name="name">The test step's name.</param> /// <param name="stepType">The test step's type.</param> /// <param name="inputs">The test step's input values.</param> /// <param name="outputs">The test step's output values.</param> /// <param name="parameters">The measurement parameters.</param> /// <returns>The <see cref="StepData"/> used to create a test step.</returns> private static StepData GenerateStepData( string name, string stepType, List <NamedValue> inputs = null, List <NamedValue> outputs = null, List <Dictionary <String, String> > parameters = null, Status status = null) { var random = new Random(); var stepStatus = status ?? new Status(StatusType.Running); var stepData = new StepData() { Name = name, Inputs = inputs, Outputs = outputs, StepType = stepType, Status = stepStatus, TotalTimeInSeconds = random.NextDouble() * 10, Parameters = parameters, DataModel = "TestStand", }; return(stepData); }
public int RetrieveDeliveredToObject(StepData inputStep) { int targetStepIndex = inputStep.timeStep; int returnComponentID = 0; Level lvl = GameManager.Instance.GetDataManager().currentLevelData; foreach (StepData step in lvl.execution) { if (step.timeStep == targetStepIndex) { if ((step.componentID != inputStep.componentID) && step.eventType == "E") { if (step.componentPos == inputStep.componentPos) { if (step.componentStatus != null && step.componentStatus.delivered != null) { if (step.componentStatus.delivered != 0) { returnComponentID = step.componentID; } } } } } } return(returnComponentID); }
// Update is called once per frame void Update() { //BGMの再生時間と再生バーをリンク if (onMusic) { slider.value = source.time; } //マウスクリックをするとBGMが止まる if (Input.GetMouseButtonDown(0)) { source.Stop(); onMusic = false; } //スペースキーで再生 if (Input.GetKeyDown(KeyCode.Space)) { int num = StepData.GetTimeNearBeatTime(slider.value); slider.value = StepData.GetStepData[num].musicScore; source.time = slider.value; //再生バーの位置とBGM再生位置をリンク onMusic = true; source.Play(); //BGM再生 } }
private void CreateNewOption(ConversationData conversationData, StepData stepdata, Transform parent) { //Create Option data class OptionData optionData = new OptionData(); //Create Option UI Object GameObject optionPrefab = Instantiate(OptionPrefab, parent); //Option Component Transforms (for easy reference) Transform fieldDestinationInput = optionPrefab.transform.GetChild(5); Transform fieldTextInput = optionPrefab.transform.GetChild(4); Transform fieldValueInput = optionPrefab.transform.GetChild(6); Transform fieldDeleteButton = optionPrefab.transform.GetChild(7); //Set Option Text fieldTextInput.GetComponent <TMP_InputField>().text = "Response Text.."; //Set Option Destination fieldDestinationInput.GetComponent <TMP_InputField>().text = "-1"; //Set Option Value Amount fieldValueInput.GetComponent <TMP_InputField>().text = "-1"; //Setup Delete button fieldDeleteButton.GetComponent <Button>().onClick.AddListener(delegate { DeleteOption(optionPrefab.gameObject, stepdata, optionData); }); //Add Option to Step stepdata.OptionData.Add(optionData); }
public void LoadKitchen(StepData data) { ++current_day; current_mode = Gamemodes.Kitchen; audioSource.PlayOneShot(fireSound); StartCoroutine(LoadSceneTransition(2)); }
// Start is called before the first frame update void Start() { if (data == null) { data = Gamemachine.instance.GetData(); } goal_delta = data.delta; goal_salty = data.salty; goal_spicy = data.spicy; goal_sweet = data.sweet; if (data != null) { Reset(); } taste_effect.GetComponent <CanvasGroup>().alpha = 0; RectTransform rt = (RectTransform)taste_effect.transform.Find("Synesthesia"); rt.sizeDelta = new Vector2(0, 0); taste_effect.SetActive(false); taste_effect.GetComponent <Button>().onClick.AddListener(delegate { if (taste_effect.GetComponent <CanvasGroup>().alpha > 0.95f) { StartCoroutine("FadeOutTaste"); } }); DisplayTaste(goal_spicy, goal_sweet, goal_salty); }
public StepData CalcNextStep(char[,] desk) { char[,] virtualDesk; List <StepData> allStep = StepRemover.GetRemainningSteps(teamQueue[depth % 2], desk, fields); int score = -1000; int temp; StepData result = new StepData(); int count = 0; foreach (StepData sd in allStep) { virtualDesk = MakeVirtualStep(desk, sd); temp = CalcNextStep(virtualDesk, depth - 1, -1); temp += sd.score + sd.eatScore; if (score < temp) { score = temp; result = sd + temp; } } count += allStep.Count; Debug.Log(count); count = 0; return(result); }
public void Init(StepData _data, System.Action _onFinish) { data = _data; collected = 0; killed = 0; onFinishAction += _onFinish; }
private string CalculateNextStepName( ISaga saga, ISagaStep sagaStep, ISagaAction sagaAction, StepData stepData, Exception executionError) { if (saga.ExecutionState.IsBreaked) { return(null); } if (executionError != null) { saga.ExecutionState.IsResuming = false; saga.ExecutionState.IsCompensating = true; saga.ExecutionState.CurrentError = executionError.ToSagaStepException(); return(CalculateNextCompensationStep(saga)); } else { string nextStepName = CalculateNextStep(saga, sagaAction, sagaStep, stepData); saga.ExecutionState.IsResuming = false; return(nextStepName); } }
private static void InsertClipboard(StepData stepData, int offset) { var target = AssetDatabase.LoadMainAssetAtPath(AssetDatabase.GetAssetPath(stepData.step.serializedObject.targetObject)) as ComposableObject; target.InsertElement(ClipboardItem, stepData.index + offset); ClipboardItem = null; }
private bool Predict(out float predictedPeak, float horiz) { predictedPeak = 0f; StepData simData = new StepData(currRotationSpeed, currRotation); StepData lastSimData = new StepData(currRotationSpeed, currRotation); for (float t = 0f; t < 40f; t += Time.fixedDeltaTime) { float speedUpDir = Mathf.Sign(simData.rotation - lastSimData.rotation); simData.rotationSpeed += horiz * speedUpDir * rockingSpeed * Time.fixedDeltaTime; simData = SimulateStep(simData, Time.fixedDeltaTime); if (Mathf.Sign(simData.rotationSpeed) != Mathf.Sign(lastSimData.rotationSpeed)) { if (simData.rotation > 180f) { predictedPeak = 360f - simData.rotation; } else { predictedPeak = simData.rotation; } return(true); } lastSimData = new StepData(simData.rotationSpeed, simData.rotation); } return(false); }
public void Back() { int step = 0; StepData stepData = StepSaver.BackStep(ref step); if (stepData != null) { SetCellToStone(stepData.NewCell, stepData.PrevCell, stepData.Stone, true); } if (step == 0) { OnStepMade?.Invoke(0); } //{ // if (b != null) // { // GameObject sender = b as GameObject; // if (sender != null) // { // UIElemSwitchValue uIElemSwitch = sender.GetComponent<UIElemSwitchValue>(); // uIElemSwitch.Switch(false); // } // } //} }
private IEnumerator NextCorutine(StepData data) { _icon.Hide(); if (_stepData.Count - 1 <= _step) { _forcus.Release(); yield break; } _isChange = true; // フォーカスする if (data.targetObj != null) { yield return(StartCoroutine(_forcus.SetForcus(data.targetObj.gameObject))); } else if (data.isMove) { _forcus.Release(); } // 右下に対応した画像を表示 _icon.Show(data); _isChange = false; }
private async Task ExecuteStep(ISaga saga, ISagaStep sagaStep, StepData stepData) { ISagaEvent @event = stepData.Event; if (@event is EmptyEvent) { @event = null; } Type executionContextType = typeof(ExecutionContext <>).ConstructGenericType(saga.Data.GetType()); IExecutionContext context = (IExecutionContext)ActivatorUtilities.CreateInstance(serviceProvider, executionContextType, saga.Data, saga.ExecutionInfo, saga.ExecutionState, saga.ExecutionValues, stepData.ExecutionValues); if (saga.ExecutionState.IsResuming) { await sagaStep.Compensate(serviceProvider, context, @event, stepData); } else if (saga.ExecutionState.IsCompensating) { await sagaStep.Compensate(serviceProvider, context, @event, stepData); } else { await sagaStep.Execute(serviceProvider, context, @event, stepData); } }
static StepData StepData_; //自身を参照用 // Start is called before the first frame update private void Awake() { int count = 0; stepData.Clear(); fileName += scoreName + ".txt"; //Debug.Log(File.Exists(fileName)); //テキストの読み込み if (File.Exists(fileName)) { foreach (string str in File.ReadLines(fileName)) { string[] arr = str.Split(','); //(,)カンマで分ける stepData.Add(new Data()); textTime.Add(float.Parse(arr[(int)INPUT_TEXT.MusicScore])); stepData[count].musicScore = float.Parse(arr[(int)INPUT_TEXT.MusicScore]); stepData[count].ememyAttackType = (ENEMY_ATTACK_TYPE)int.Parse(arr[(int)INPUT_TEXT.EnemyAttackType]); stepData[count].plStep = (PL_STEP_TIMING)int.Parse(arr[(int)INPUT_TEXT.PlStep]); for (int i = (int)INPUT_TEXT.EnemyAttackLane0; i <= (int)INPUT_TEXT.EnemyAttackLane5; i++) { stepData[count].enemyAttackPos[i - (int)INPUT_TEXT.EnemyAttackLane0] = bool.Parse(arr[i]); } count++; } } StepData_ = this; //初期化と数値の代入(thisしないとバグる) }
public async Task <ISaga> Handle(ExecuteStepCommand command) { ISaga saga = command.Saga; ISagaStep step = command.SagaStep; ISagaAction sagaAction = command.SagaAction; ISagaModel model = command.Model; StepData stepData = GetOrCreateStepData(saga, step, model); MiddlewaresChain middlewaresChain = Middlewares.BuildFullChain( serviceProvider, SaveSaga, ExecuteStep); Exception executionError = null; try { await Middlewares.ExecuteChain( middlewaresChain, saga, step, stepData); stepData. SetSucceeded(saga.ExecutionState, dateTimeProvider); } catch (SagaStopException) { throw; return(null); } catch (Exception ex) { logger. LogError(ex, $"Saga: {saga.Data.ID}; Executing {(step.Async ? "async " : "")}step: {step.StepName}"); executionError = ex; stepData. SetFailed(saga.ExecutionState, dateTimeProvider, executionError.ToSagaStepException()); } finally { middlewaresChain. Clean(); stepData. SetEnded(saga.ExecutionState, dateTimeProvider); } string nextStepName = CalculateNextStepName( saga, step, sagaAction, stepData, executionError); SaveNextStep(saga, stepData, nextStepName); CheckIfSagaIsDeleted(saga); await sagaPersistance.Set(saga); return(saga); }
public override void DoStep(StepData inputStep) { base.DoStep(inputStep); if (inputStep.componentStatus.delivered != null) { // deliveryPopup.IncrementNumerator( inputStep.componentStatus.delivered ); } }
public async Task Execute(ISaga saga, ISagaStep sagaStep, StepData stepData) { foreach (var type in beforeRequestCallbacks) { var callback = ActivatorUtilities.CreateInstance(serviceProvider, type) as ISagaBeforeRequestCallback; await callback.InvokeAsync(saga); } }
public void SetData(StepData stepData) { StepData = stepData as T ?? new T { EncoderState = stepData.EncoderState, ErrorMessage = stepData.ErrorMessage }; }
public ITask StartStep(T step) { StepData stepData = null; int value = step.ToInt32(null); m_StepMap.TryGetValue(value, out stepData); return(StartTask(stepData.Description, stepData.StartProgress, stepData.Length)); }
public void Init(StepData _data, SavableStep step, System.Action _onFinish) { data = _data; collected = step.collected; killed = step.killed; isDone = step.isDone; onFinishAction += _onFinish; }
public static async Task ExecuteChain( List <NextMiddleware> middlewaresChain, ISaga saga, ISagaStep sagaStep, StepData stepData) { await middlewaresChain[0].Invoke(saga, sagaStep, stepData); }
/// <summary> /// Read the binary log file. To know whether the log information has been succesfully loaded /// or not, BinFileLoadSuccess can be checked after calling this method. /// </summary> /// <returns></returns> public bool LoadBinaryLog(string LogFileName) { try { using (FileStream logFile = File.OpenRead(LogFileName)) { using (BinaryReader binaryReader = new BinaryReader(logFile)) { ReadExperimentLogHeader(binaryReader); Episodes = new EpisodesData[TotalNumEpisodes]; for (int i = 0; i < TotalNumEpisodes; i++) { Episodes[i] = new EpisodesData(); EpisodesData episodeData = Episodes[i]; episodeData.ReadEpisodeHeader(binaryReader); //if we find an episode subindex greater than the current max, we update it //Episode subindex= Episode within an evaluation if (episodeData.subIndex > NumEpisodesPerEvaluation) { NumEpisodesPerEvaluation = episodeData.subIndex; } //count evaluation and training episodes if (episodeData.type == 0) { EvaluationEpisodes.Add(episodeData); } else { TrainingEpisodes.Add(episodeData); } StepData stepData = new StepData(); bool bLastStep = stepData.readStep(binaryReader, episodeData.numVariablesLogged); while (!bLastStep) { //we only add the step if it's not the last one //last steps don't contain any info but the end marker episodeData.steps.Add(stepData); stepData = new StepData(); bLastStep = stepData.readStep(binaryReader, episodeData.numVariablesLogged); } } SuccessfulLoad = true; } } } catch (Exception ex) { Console.WriteLine(ex.ToString()); SuccessfulLoad = false; } return(SuccessfulLoad); }
public static void AddStep(StepData stepData) { PrevStates.Add(stepData); if (PrevStates.Count > BackStepsLimit) { PrevStates.RemoveAt(0); } }
/// <summary> /// A step is generated before the coordinates of a click or drag are performed. This allows for the coordinates to be recorded later in the execution of an action, and after a step is generated. /// </summary> /// <param name="CoordinatesOfPress"></param> public static void UpdateCurrentStep(Vector2 CoordinatesOfPress = new Vector2()) { StepData currentStep = ReportData.Tests.Last().Steps.Last(); if (CoordinatesOfPress != default(Vector2)) { currentStep.Coordinates = $"x [{Math.Round(CoordinatesOfPress.x, 0)}] y [{Math.Round(CoordinatesOfPress.y, 0)}]"; } }
void StepListener(StepData inputStep) { if (inputStep.componentID == targetSimulationStep.componentID) { /* * if (targetButton != null) * { * targetButton.onClick.RemoveAllListeners(); * targetButton.enabled = true; * targetButton.onClick.AddListener(() => TriggerTutorialEventListener()); * } */ if (PlayerInteraction_GamePhaseBehavior.pauseSimulation != null && pause == true) { PlayerInteraction_GamePhaseBehavior.pauseSimulation(); //targetButton.onClick.AddListener(() => PlayerInteraction_GamePhaseBehavior.unpauseSimulation()); if (pauseDuration != 0) { PlayerInteraction_GamePhaseBehavior.delayedUnpause(pauseDuration, this); } } Vector3 targetPosition = GameManager.Instance.GetGridManager().GetGridObjectByID(inputStep.componentID).transform.position; targetPosition = GameManager.Instance.GetGridManager().worldCamera.WorldToScreenPoint(targetPosition); GameManager.Instance.CreateTutorialPopup(this, targetPosition); Debug.Log("Listen for step!"); PlayerInteraction_GamePhaseBehavior.onSimulationStep -= StepListener; } //if greater or equal 9000, the component is USER created so we can't assume its id else if (targetSimulationStep.componentID >= 9000 && inputStep.componentID >= 9000) { if (targetSimulationStep.componentStatus.passed > 0) { if (inputStep.componentStatus != null && inputStep.componentStatus.passed != null) { if (inputStep.componentStatus.passed > 0) { if (PlayerInteraction_GamePhaseBehavior.pauseSimulation != null && pause == true) { PlayerInteraction_GamePhaseBehavior.pauseSimulation(); //targetButton.onClick.AddListener(() => PlayerInteraction_GamePhaseBehavior.unpauseSimulation()); if (pauseDuration != 0) { PlayerInteraction_GamePhaseBehavior.delayedUnpause(pauseDuration, this); } } Vector3 targetPosition = GameManager.Instance.GetGridManager().GetGridObjectByID(inputStep.componentID).transform.position; targetPosition = GameManager.Instance.GetGridManager().worldCamera.WorldToScreenPoint(targetPosition); GameManager.Instance.CreateTutorialPopup(this, targetPosition); Debug.Log("Listen for step!"); PlayerInteraction_GamePhaseBehavior.onSimulationStep -= StepListener; } } } } }
void DoInput(StepData data) { var kernel = _cs.FindKernel(CSPARAM.KERNEL_INPUT); _cs.SetVector(CSPARAM.INPUT_POS, data.inputPos); _cs.SetFloat(CSPARAM.INPUT_RADIUS, _InputRadius); _cs.SetBuffer(kernel, CSPARAM.WRITE_BUF, _readBufs); Dispatch(_cs, kernel, new Vector3(_width, _height, 1)); }
public void Attack(StepData _stData) { AttackProtocol attk = new Attack1(); attk.ID_SKILL_ATTACK = _stData.skill; StartCoroutine(attk.handle_move_enemy(this.gameObject, BattleControls.It.lstCharater[_stData.enemyChaArr[0].enemyBattleId])); // attk.Attack(); }
IEnumerator attack_flow_step( float delay, StepData _stdata) { yield return new WaitForSeconds(delay); Charater chrt_attack = lstCharater[_stdata.chaBattleId].GetComponent<Charater>(); chrt_attack.Attack(_stdata); step_attack++; start_attack(); }