protected override IEnumerator ForcedSolveIEnumeratorShimmed() { yield return(null); while (!_component.GetValue <bool>("isActivated")) { yield return(true); } object[] wireInfo = _component.GetValue <object[]>("TwitchPlayWires"); int[] wireColors = new int[3]; for (int i = 0; i < 3; i++) { wireColors[i] = wireInfo[i].GetValue <int>("color"); } int[,] solutions = _component.GetValue <int[, ]>("solutions"); int seqIndex = _component.GetValue <int>("sequenceIndex"); while (true) { int timeIndex = ComponentType.CallMethod <int>("GetIndexFromTime", _component, Time.time, _component.GetValue <float>("blinkDelay")); for (int i = 0; i < 3; i++) { if (solutions[seqIndex, wireColors[i]] == timeIndex && !wireInfo[i].GetValue <bool>("isCut")) { yield return(DoInteractionClick(wireInfo[i].GetValue <KMSelectable>("wire"), 0)); yield break; } } yield return(true); } }
protected override IEnumerator ForcedSolveIEnumerator() { yield return(null); int tossType = _component.GetValue <int>("requiredTossType"); double tossValue = _component.GetValue <double>("requiredToss"); bool vegemite = _component.GetValue <bool>("vegemite"); if (tossType == 0 && !_component.GetValue <bool>("UHPressed")) { yield return(Click(3)); } else if (tossType == 1 && !_component.GetValue <bool>("FPressed")) { yield return(Click(4)); } if (ComponentType.CallMethod <double>("floatToEV", _component, _component.GetValue <double>("UH_noIntRot") % 1.0) == tossValue || ComponentType.CallMethod <double>("floatToEV", _component, _component.GetValue <double>("F_noIntRot") % 1.0) == tossValue) { yield return(Click(0)); } else if (ComponentType.CallMethod <double>("floatToEV", _component, _component.GetValue <double>("UH_decAccRot") % 1.0) == tossValue || ComponentType.CallMethod <double>("floatToEV", _component, _component.GetValue <double>("F_decAccRot") % 1.0) == tossValue) { yield return(Click(vegemite ? 1 : 2)); } else { yield return(Click(vegemite ? 2 : 1)); } }
protected override IEnumerator ForcedSolveIEnumeratorShimmed() { yield return(null); string target = ""; if (_component.GetValue <bool>("is12")) { int twelveH = ComponentType.CallMethod <int>("Format12h", _component, _component.GetValue <int>("toHour")); target = ComponentType.CallMethod <string>("FormatTwoDigits", _component, twelveH); } else { target = ComponentType.CallMethod <string>("FormatTwoDigits", _component, _component.GetValue <int>("toHour")); } target += ComponentType.CallMethod <string>("FormatTwoDigits", _component, _component.GetValue <int>("toMinutes")); string ans = _component.GetValue <TextMesh>("TextDisplay").text; int start = 0; if (ans.Select((x, a) => x == target[a]).All(x => x)) { start = 4; } else if (ans[1] == target[0] && ans[2] == target[1] && ans[3] == target[2]) { start = 3; } else if (ans[2] == target[0] && ans[3] == target[1]) { start = 2; } else if (ans[3] == target[0]) { start = 1; } for (int j = start; j < 4; j++) { yield return(DoInteractionClick(_buttons[int.Parse(target[j].ToString())])); } yield return(DoInteractionClick(_submit, 0)); }
// Attempted copy over from PR sent to Tangrams, but it does not work properly in all places (mainly where if a selection has already been made) protected override IEnumerator ForcedSolveIEnumeratorShimmed() { yield return(null); KMSelectable[] pins = _component.GetValue <object>("_chip").GetValue <KMSelectable[]>("PinSelectables"); if (_component.GetValue <object>("_displayBar").GetValue <float>("Progress") != 0.0f && !_component.GetValue <object>("_tangram").GetType().CallMethod <bool>("IsValidConnection", _component.GetValue <object>("_selectedConnection"))) { ((MonoBehaviour)_component).StopAllCoroutines(); _component.GetValue <object>("_displayBar").GetType().SetValue("Progress", 0.0f, _component); ComponentType.CallMethod("ModuleFinish", true); yield break; } else { while (_component.GetValue <object>("_displayBar").GetValue <float>("Progress") != 0.0f) { yield return(true); } } IList valids = _component.GetValue <object>("_tangram").GetValue <IList>("_validInputOutputConnections"); bool selectedValid = false; if (_component.GetValue <object>("_selectedConnection").GetValue <object>("PointA") != null) { for (int k = 0; k < valids.Count; k++) { if (valids[k].GetValue <object>("PointA").Equals(_component.GetValue <object>("_selectedConnection").GetValue <object>("PointA"))) { selectedValid = true; } } if (!selectedValid) { ComponentType.CallMethod("ModuleFinish", true); yield break; } } for (int j = 0; j < _component.GetValue <IList>("_previouslySelectedConnections").Count; j++) { for (int k = 0; k < valids.Count; k++) { if (valids[k].GetValue <object>("PointA").Equals(_component.GetValue <IList>("_previouslySelectedConnections")[j].GetValue <object>("PointA"))) { valids.RemoveAt(k); k--; } } } int end = _component.GetValue <int>("RequiredInputCount") - _component.GetValue <IList>("_previouslySelectedConnections").Count; for (int i = 0; i < end; i++) { object choice = valids[UnityEngine.Random.Range(0, valids.Count)]; if (!selectedValid) { yield return(DoInteractionClick(pins[Array.IndexOf(_component.GetValue <object>("_tangram").GetValue <object>("Grid").GetValue <object[]>("ExternalConnections"), choice.GetValue <object>("PointA"))])); } else { selectedValid = false; } yield return(DoInteractionClick(pins[Array.IndexOf(_component.GetValue <object>("_tangram").GetValue <object>("Grid").GetValue <object[]>("ExternalConnections"), choice.GetValue <object>("PointB"))], 0)); for (int k = 0; k < valids.Count; k++) { if (valids[k].GetValue <object>("PointA").Equals(choice.GetValue <object>("PointA"))) { valids.RemoveAt(k); k--; } } ComponentType.SetValue("_tpWaitingForResult", true, _component); while (_component.GetValue <bool>("_tpWaitingForResult")) { yield return(true); } } }