static void PerformVisibilityCheck(object sender, ElapsedEventArgs e) { List <Tuple <System.Windows.Forms.UserControl, BoolWrapper> > controlsToCheck; List <Action> triggers = null; lock (_lock) { controlsToCheck = _controlsToMonitor.CompactAndReturn(); foreach (var control in controlsToCheck) { if (control.Item1.Created != control.Item2.Value) { if (triggers == null) { triggers = new List <Action>(); } BoolWrapper wrap = control.Item2; triggers.Add(() => ((IMonitorPageVisibility)control.Item1).VisibilityChanged(wrap.Value = control.Item1.Created)); } } } if (triggers != null) { Repository.Instance.BackgroundTaskManager.Post( () => { foreach (var item in triggers) { item(); } return(true); }); } }
IEnumerable <SimEvent> AndConditionChecker <T1, T2, T3, T4, T5>(BoolWrapper finished, Condition <T1, T2, T3, T4, T5> cond, T1 ev1, T2 ev2, T3 ev3, T4 ev4, T5 ev5) where T1 : SimEvent where T2 : SimEvent where T3 : SimEvent where T4 : SimEvent where T5 : SimEvent { Debug.Assert(!finished); yield return(cond); Assert.AreEqual(5, cond.Value.Count); Assert.AreSame(Env, cond.Env); Assert.AreSame(ev1, cond.Ev1); Assert.AreSame(Env, cond.Ev1.Env); Assert.True(cond.Ev1 && cond.Ev1.Succeeded); Assert.AreSame(ev2, cond.Ev2); Assert.AreSame(Env, cond.Ev2.Env); Assert.True(cond.Ev2 && cond.Ev2.Succeeded); Assert.AreSame(ev3, cond.Ev3); Assert.AreSame(Env, cond.Ev3.Env); Assert.True(cond.Ev3 && cond.Ev3.Succeeded); Assert.AreSame(ev4, cond.Ev4); Assert.AreSame(Env, cond.Ev4.Env); Assert.True(cond.Ev4 && cond.Ev4.Succeeded); Assert.AreSame(ev5, cond.Ev5); Assert.AreSame(Env, cond.Ev5.Env); Assert.True(cond.Ev5 && cond.Ev5.Succeeded); finished.Value = true; }
public async Task <bool> DoesUserExist(string userName, string password) { bool doesExist = false; using (var client = new HttpClient()) { client.BaseAddress = _serverUri; client.Timeout = TimeSpan.FromSeconds(_timeoutInSec); client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); HttpResponseMessage response = await client.GetAsync("Users?username="******"&password=" + password).ConfigureAwait(false); if (response.IsSuccessStatusCode) { string responseString = await response.Content.ReadAsStringAsync(); BoolWrapper wrap = (JsonConvert.DeserializeObject <BoolWrapper>(responseString)); doesExist = wrap.Bool; } else { } } return(doesExist); }
public void OnDestroy() { DisableSceneViewInteraction(); tileEditModeOn = new BoolWrapper(false); unitEditModeOn = new BoolWrapper(false); Selection.selectionChanged -= OnSelectionChanged; Undo.undoRedoPerformed -= OnUndoPerformed; }
void Start() { playerHasMovedHorizontally = new BoolWrapper(false); playerHasJumped = new BoolWrapper(false); playerHasClickedWord = new BoolWrapper(false); playerHasUsedEquipment = new BoolWrapper(false); CurrentTutorialState = TutorialState.Standby; AdvanceTutorial(); }
private void InitWrappers() { _zero = new BoolWrapper(false); _one = new BoolWrapper(false); _up = new BoolWrapper(false); _down = new BoolWrapper(false); _left = new BoolWrapper(false); _right = new BoolWrapper(false); }
private void TilePaintingGUI() { GUILayout.Label("Tile painting", EditorStyles.boldLabel); if (!gridGameObjectPresent) { if (gridGameObject == null) { GUIStyle style = new GUIStyle(EditorStyles.boldLabel); style.normal.textColor = Color.red; GUILayout.Label("CellGrid GameObject missing", style); } gridGameObject = (GameObject)EditorGUILayout.ObjectField("CellGrid", gridGameObject, typeof(GameObject), true, new GUILayoutOption[0]); } tilePaintingRadius = EditorGUILayout.IntSlider(new GUIContent("Brush radius"), tilePaintingRadius, 1, 4); EditorGUI.BeginChangeCheck(); tilePrefab = (Cell)EditorGUILayout.ObjectField("Tile prefab", tilePrefab, typeof(Cell), true, new GUILayoutOption[0]); if (EditorGUI.EndChangeCheck()) { lastPaintedHash = -1; } GUILayout.Label(string.Format("Tile Edit Mode is {0}", tileEditModeOn.value ? "on" : "off")); if (toToggle != null && toToggle == tileEditModeOn) { GUILayout.Label("Press Ctrl + R to toggle tile painting mode on / off"); } if (tileEditModeOn.value) { GUI.enabled = false; } if (GUILayout.Button("Enter Tile Edit Mode")) { tileEditModeOn = new BoolWrapper(true); unitEditModeOn = new BoolWrapper(false); toToggle = tileEditModeOn; EnableSceneViewInteraction(); GameObject CellGrid = gridGameObjectPresent ? GameObject.Find("CellGrid") : gridGameObject; if (CellGrid == null) { Debug.LogError("CellGrid gameobject is missing, assign it in GridHelper"); } } GUI.enabled = true; if (!tileEditModeOn.value) { GUI.enabled = false; } if (GUILayout.Button("Exit Tile Edit Mode")) { tileEditModeOn = new BoolWrapper(false); DisableSceneViewInteraction(); } GUI.enabled = true; }
public void AllOf_2SingleTimeouts() { var t1 = Env.Timeout(1); var t2 = Env.Timeout(2); var finished = new BoolWrapper(); var cond = Env.AllOf(t1, t2); Env.Process(AndConditionChecker(finished, cond, t1, t2)); Env.Run(); Assert.True(finished); }
public void And_2SingleTimeouts_Method_LeftToRight() { var t1 = Env.Timeout(1); var t2 = Env.Timeout(2); var finished = new BoolWrapper(); var cond = t1.And(t2); Env.Process(AndConditionChecker(finished, cond, t1, t2)); Env.Run(); Assert.True(finished); }
/// <summary> /// Waits tutorialConfig.startDelay seconds, and if the condition passed as a parameter is the same as /// conditionEndState, fades in the tutorial text component with the message tutorialConfig.message /// </summary> private IEnumerator _DisplayTutorialWithConfig(TutorialConfig tutorialConfig, BoolWrapper condition, bool conditionEndState = false) { yield return(new WaitForSeconds(tutorialConfig.startDelay)); if (condition.value == conditionEndState) { tutorialTextComponent.gameObject.SetActive(true); tutorialTextComponent.text = tutorialConfig.message; UIUtils.Instance.FadeCanvasGroup(tutorialCanvasGroup, fadeInTime, 1); } }
/// <summary> /// Get files and directories from a directory and return the results as a tree /// </summary> /// <param name="info">Directory to look in for files and directories</param> /// <param name="searchOption">Search option</param> /// <param name="filePredicate">Predicate to determine which files to include</param> /// <param name="dirPredicate">Predicate to determine which directories to include</param> /// <param name="cancel">Flag to indicate if current iteration should cancel</param> /// <returns>Files and directories from a directory as a tree</returns> public static Tree <FileSystemInfo> GetFilesAndDirectoriesTree( this DirectoryInfo info, SearchOption searchOption, Func <FileInfo, bool> filePredicate, Func <DirectoryInfo, bool> dirPredicate, BoolWrapper cancel) { if ((info == null) || (filePredicate == null) || (dirPredicate == null)) { return(null); } if (s_shouldCancel(cancel)) { return(null); } if (!dirPredicate(info)) { return(null); } var root = new Tree <FileSystemInfo>(info); foreach (var dirInfo in info.GetDirectories(dirPredicate)) { if (s_shouldCancel(cancel)) { return(null); } var children = searchOption == SearchOption.AllDirectories ? GetFilesAndDirectoriesTree(dirInfo, searchOption, filePredicate, dirPredicate, cancel) : new Tree <FileSystemInfo>(dirInfo); if (children != null) { root.Children.Add(children); } } if (s_shouldCancel(cancel)) { return(null); } foreach (var fileInfo in info.GetFiles(filePredicate)) { root.Children.Add(new Tree <FileSystemInfo>(fileInfo)); } return(root); }
public void And_2SingleTimeouts_Method_LeftToRight_Nested() { var t1 = Env.Condition <SimEvent>(Env.Timeout(1), c => c.Ev1); var t2 = Env.Condition <SimEvent>(Env.Timeout(2), c => c.Ev1); var finished = new BoolWrapper(); var cond = t1.And(t2); Env.Process(AndConditionChecker(finished, cond, t1.Ev1, t2.Ev1)); Env.Run(); Assert.True(finished); }
public void And_2SingleTimeouts_Operator_LeftToRight() { SimEvent t1 = Env.Timeout(1); SimEvent t2 = Env.Timeout(2); var finished = new BoolWrapper(); var cond = t1 & t2; Env.Process(AndConditionChecker(finished, cond, t1, t2)); Env.Run(); Assert.True(finished); }
public void Or_2SingleTimeouts_Operator_RightToLeft_Nested() { var t1 = Env.Condition <SimEvent>(Env.Timeout(1), c => c.Ev1); var t2 = Env.Condition <SimEvent>(Env.Timeout(2), c => c.Ev1); var finished = new BoolWrapper(); var cond = t1 | (t2); Env.Process(OrConditionChecker(finished, cond, t1.Ev1, t2.Ev1)); Env.Run(); Assert.True(finished); }
public SpawnDialogGameState(HaxxitGameState background_state, Haxxit.Maps.Map map, Haxxit.Maps.Point spawn_point, BoolWrapper newSpawnDialogStatus) : base() { this.background_state = background_state; this.map = map; this.spawn_point = spawn_point; spawnDialogStatus = newSpawnDialogStatus; spawnDialogStatus.Status = true; selectedProgram = null; lastSelectedRectangle = null; }
public void AnyOf_3SingleTimeouts() { var t1 = Env.Timeout(1); var t2 = Env.Timeout(2); var t3 = Env.Timeout(3); var finished = new BoolWrapper(); var cond = Env.AnyOf(t1, t2, t3); Env.Process(OrConditionChecker(finished, cond, t1, t2, t3)); Env.Run(); Assert.True(finished); }
public void Or_3SingleTimeouts_Method_RightToLeft() { var t1 = Env.Timeout(1); var t2 = Env.Timeout(2); var t3 = Env.Timeout(3); var finished = new BoolWrapper(); var cond = t1.Or(t2.Or(t3)); Env.Process(OrConditionChecker(finished, cond, t1, t2, t3)); Env.Run(); Assert.True(finished); }
public void Or_3SingleTimeouts_Operator_RightToLeft() { SimEvent t1 = Env.Timeout(1); SimEvent t2 = Env.Timeout(2); SimEvent t3 = Env.Timeout(3); var finished = new BoolWrapper(); var cond = t1 | (t2 | (t3)); Env.Process(OrConditionChecker(finished, cond, t1, t2, t3)); Env.Run(); Assert.True(finished); }
/// <summary> /// Get files and directories from a directory and return the results as a tree /// </summary> /// <param name="info">Directory to look in for files and directories</param> /// <param name="searchOption">Search option</param> /// <param name="filePredicate">Predicate to determine which files to include</param> /// <param name="dirPredicate">Predicate to determine which directories to include</param> /// <returns>Files and directories from a directory, as a tree</returns> public static Tree <FileSystemInfo> GetFilesAndDirectoriesTree( this DirectoryInfo info, SearchOption searchOption, Func <FileInfo, bool> filePredicate, Func <DirectoryInfo, bool> dirPredicate) { var cancelObject = new BoolWrapper { Value = false }; return(GetFilesAndDirectoriesTree(info, searchOption, filePredicate, dirPredicate, cancelObject)); }
public void Or_4SingleTimeouts_Operator_LeftToRight() { SimEvent t1 = Env.Timeout(1); SimEvent t2 = Env.Timeout(2); SimEvent t3 = Env.Timeout(3); SimEvent t4 = Env.Timeout(4); var finished = new BoolWrapper(); var cond = t1 | t2 | t3 | t4; Env.Process(OrConditionChecker(finished, cond, t1, t2, t3, t4)); Env.Run(); Assert.True(finished); }
public void Or_4SingleTimeouts_Method_RightToLeft_Nested() { var t1 = Env.Condition <SimEvent>(Env.Timeout(1), c => c.Ev1); var t2 = Env.Condition <SimEvent>(Env.Timeout(2), c => c.Ev1); var t3 = Env.Condition <SimEvent>(Env.Timeout(3), c => c.Ev1); var t4 = Env.Condition <SimEvent>(Env.Timeout(4), c => c.Ev1); var finished = new BoolWrapper(); var cond = t1.Or(t2.Or(t3.Or(t4))); Env.Process(OrConditionChecker(finished, cond, t1.Ev1, t2.Ev1, t3.Ev1, t4.Ev1)); Env.Run(); Assert.True(finished); }
public void And_4SingleTimeouts_Operator_RightToLeft() { SimEvent t1 = Env.Timeout(1); SimEvent t2 = Env.Timeout(2); SimEvent t3 = Env.Timeout(3); SimEvent t4 = Env.Timeout(4); var finished = new BoolWrapper(); var cond = t1 & (t2 & (t3 & (t4))); Env.Process(AndConditionChecker(finished, cond, t1, t2, t3, t4)); Env.Run(); Assert.True(finished); }
public void And_4SingleTimeouts_Method_RightToLeft() { var t1 = Env.Timeout(1); var t2 = Env.Timeout(2); var t3 = Env.Timeout(3); var t4 = Env.Timeout(4); var finished = new BoolWrapper(); var cond = t1.And(t2.And(t3.And(t4))); Env.Process(AndConditionChecker(finished, cond, t1, t2, t3, t4)); Env.Run(); Assert.True(finished); }
public void And_4SingleTimeouts_Operator_LeftToRight_Nested() { var t1 = Env.Condition <SimEvent>(Env.Timeout(1), c => c.Ev1); var t2 = Env.Condition <SimEvent>(Env.Timeout(2), c => c.Ev1); var t3 = Env.Condition <SimEvent>(Env.Timeout(3), c => c.Ev1); var t4 = Env.Condition <SimEvent>(Env.Timeout(4), c => c.Ev1); var finished = new BoolWrapper(); var cond = t1 & t2 & t3 & t4; Env.Process(AndConditionChecker(finished, cond, t1.Ev1, t2.Ev1, t3.Ev1, t4.Ev1)); Env.Run(); Assert.True(finished); }
public void StartRecord(int time, BoolWrapper signal) { Debug.Log("EMGReader: StartRecord: Starting Function"); record = true; recordedValues = new List <float>(); this.signal = signal; timeToRecord = time * 1000; stopwatch.Reset(); stopwatch.Start(); int size = (int)Math.Round(RATE * AVERAGE_PERIOD); pastValues = new double[size]; Debug.Log("EMGReader: StartRecord: Leaving Function"); }
private void UnitPaintingGUI() { GUILayout.Label("Unit painting", EditorStyles.boldLabel); if (!unitsGameObjectPresent) { if (unitsGameObject == null) { GUIStyle style = new GUIStyle(EditorStyles.boldLabel); style.normal.textColor = Color.red; GUILayout.Label("Unit parent GameObject missing", style); } unitsGameObject = (GameObject)EditorGUILayout.ObjectField("Units parent", unitsGameObject, typeof(GameObject), true, new GUILayoutOption[0]); } unitPrefab = (Unit)EditorGUILayout.ObjectField("Unit prefab", unitPrefab, typeof(Unit), false, new GUILayoutOption[0]); playerNumber = EditorGUILayout.IntField(new GUIContent("Player number"), playerNumber); GUILayout.Label(string.Format("Unit Edit Mode is {0}", unitEditModeOn.value ? "on" : "off")); if (toToggle != null && toToggle == unitEditModeOn) { GUILayout.Label("Press Ctrl + R to toggle unit painting mode on / off"); } if (unitEditModeOn.value) { GUI.enabled = false; } if (GUILayout.Button("Enter Unit Edit Mode")) { unitEditModeOn = new BoolWrapper(true); tileEditModeOn = new BoolWrapper(false); toToggle = unitEditModeOn; GameObject UnitsParent = unitsGameObjectPresent ? GameObject.Find("Units") : unitsGameObject; if (UnitsParent == null) { Debug.LogError("Units parent gameobject is missing, assign it in GridHelper"); } } GUI.enabled = true; if (!unitEditModeOn.value) { GUI.enabled = false; } if (GUILayout.Button("Exit Unit Edit Mode")) { unitEditModeOn = new BoolWrapper(false); DisableSceneViewInteraction(); } GUI.enabled = true; }
private void Awake() { recording = new BoolWrapper(false); graphContainer = transform.Find("graphContainer").GetComponent <RectTransform>(); labelTemplateX = graphContainer.Find("labelTemplateX").GetComponent <RectTransform>(); labelTemplateY = graphContainer.Find("labelTemplateY").GetComponent <RectTransform>(); dashTemplateX = graphContainer.Find("dashTemplateX").GetComponent <RectTransform>(); dashMaxTemplate = graphContainer.Find("dashMax").GetComponent <RectTransform>(); gameObjectList = new List <GameObject>(); //valueList = new List<float>() { 0, 100, 20, 99, 20, 56, 30, 22, 88, 77, 13, 95, 86, 60, 66, 22, 59, 75, 5, 20, 99, 20, 56, 30, 22, 88, 77, 13, 20, 99, 20, 56, 30, 22, 88, 77, 13, 95, 86, 60, 66, 22, 59, 75, 5, 20 // , 100, 20, 99, 20, 56, 30, 22, 88, 77, 13, 95, 86, 60, 66, 22, 59, 75, 5, 20, 99, 20, 56, 30, 22, 88, 77, 13, 20, 99, 20, 56, 30, 22, 88, 77, 13, 95, 86, 60, 66, 22, 59, 75, 5, 20 // , 100, 20, 99, 20, 56, 30, 22, 88, 77, 13, 95, 86, 60, 66, 22, 59, 75, 5, 20, 99, 20, 56, 30, 22, 88, 77, 13, 20, 99, 20, 56, 30, 22, 88, 77, 13, 95, 86, 60, 66, 22, 59, 75, 5, 20}; valueList = new List <float>(); }
public void And_5SingleTimeouts_Operator_LeftToRight() { SimEvent t1 = Env.Timeout(1); SimEvent t2 = Env.Timeout(2); SimEvent t3 = Env.Timeout(3); SimEvent t4 = Env.Timeout(4); SimEvent t5 = Env.Timeout(5); var finished = new BoolWrapper(); var cond = t1 & t2 & t3 & t4 & t5; Env.Process(AndConditionChecker(finished, cond, t1, t2, t3, t4, t5)); Env.Run(); Assert.True(finished); }
public void Or_5SingleTimeouts_Method_LeftToRight() { var t1 = Env.Timeout(1); var t2 = Env.Timeout(2); var t3 = Env.Timeout(3); var t4 = Env.Timeout(4); var t5 = Env.Timeout(5); var finished = new BoolWrapper(); var cond = t1.Or(t2).Or(t3).Or(t4).Or(t5); Env.Process(OrConditionChecker(finished, cond, t1, t2, t3, t4, t5)); Env.Run(); Assert.True(finished); }
public void Or_5SingleTimeouts_Operator_LeftToRight_Nested() { var t1 = Env.Condition <SimEvent>(Env.Timeout(1), c => c.Ev1); var t2 = Env.Condition <SimEvent>(Env.Timeout(2), c => c.Ev1); var t3 = Env.Condition <SimEvent>(Env.Timeout(3), c => c.Ev1); var t4 = Env.Condition <SimEvent>(Env.Timeout(4), c => c.Ev1); var t5 = Env.Condition <SimEvent>(Env.Timeout(5), c => c.Ev1); var finished = new BoolWrapper(); var cond = t1 | t2 | t3 | t4 | t5; Env.Process(OrConditionChecker(finished, cond, t1.Ev1, t2.Ev1, t3.Ev1, t4.Ev1, t5.Ev1)); Env.Run(); Assert.True(finished); }
IEnumerable <SimEvent> AndConditionChecker <T1, T2>(BoolWrapper finished, Condition <T1, T2> cond, T1 ev1, T2 ev2) where T1 : SimEvent where T2 : SimEvent { Debug.Assert(!finished); yield return(cond); Assert.AreEqual(2, cond.Value.Count); Assert.AreSame(Env, cond.Env); Assert.AreSame(ev1, cond.Ev1); Assert.AreSame(Env, cond.Ev1.Env); Assert.True(cond.Ev1 && cond.Ev1.Succeeded); Assert.AreSame(ev2, cond.Ev2); Assert.AreSame(Env, cond.Ev2.Env); Assert.True(cond.Ev2 && cond.Ev2.Succeeded); finished.Value = true; }
public MapSpawnGameState(MapDisplayGameState background_state) { display_map_state = background_state; displayingSpawnDialog = false; }
public MapSpawnGameState(Haxxit.Maps.Map map) { display_map_state = new MapDisplayGameState(map); displayingSpawnDialog = false; }
public override void initTest(bool deserialized) { for (int i = 0; i < m_touching.Length; i++) { m_touching[i] = new BoolWrapper(); } { BodyDef bd = new BodyDef(); Body ground = getWorld().createBody(bd); { EdgeShape shape = new EdgeShape(); shape.set(new Vec2(-40.0f, 0.0f), new Vec2(40.0f, 0.0f)); ground.createFixture(shape, 0.0f); } { CircleShape shape = new CircleShape(); shape.m_radius = 5.0f; shape.m_p.set(0.0f, 10.0f); FixtureDef fd = new FixtureDef(); fd.shape = shape; fd._isSensor = true; m_sensor = ground.createFixture(fd); } } { CircleShape shape = new CircleShape(); shape.m_radius = 1.0f; for (int i = 0; i < _e_count; ++i) { BodyDef bd = new BodyDef(); bd.type = BodyType.DYNAMIC; bd.position.set(-10.0f + 3.0f*i, 20.0f); bd.userData = m_touching[i]; m_touching[i].tf = false; m_bodies[i] = getWorld().createBody(bd); m_bodies[i].createFixture(shape, 1.0f); } } }
public MapSpawnGameState() { displayingSpawnDialog = false; }