public void UpdatePosition() { if (!UIDriver.IgnoreChange()) { switch (uiDriver.State()) { //translate case 0: Vector3 position = new Vector3(sliders[0].value, sliders[1].value, sliders[2].value); currentSelection.transform.position = position; break; //scale case 1: Vector3 scale = new Vector3(sliders[0].value, sliders[1].value, sliders[2].value); currentSelection.transform.localScale = scale; break; //rotate case 2: Vector3 rotation = new Vector3(sliders[0].value, sliders[1].value, sliders[2].value); currentSelection.transform.eulerAngles = rotation; break; default: break; } } }
// init components // find if not assigned void InitializeComponents() { uiDriver = GameObject.Find("Canvas").GetComponent <UIDriver>(); plane = GameObject.Find("TheBarrier"); Projection = Instantiate(Resources.Load("Prefabs/projection") as GameObject, this.transform); Projection.GetComponent <MeshRenderer>().enabled = activeProjection; shadowTarget = GameObject.Find("thunderDome"); bigLineObject = GameObject.Find("BigLine").transform.GetChild(0).gameObject; bigLineProjection = Instantiate(Resources.Load("Prefabs/sphereProjection") as GameObject, this.transform); bigLineProjection.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f); }
public static void LoginToApplication(string loginType) { string PageName = loginType.ToLower() == "gmail" ? "Gmail" : "Yahoo"; GetLoginDetails(loginType); UIDriver.WebDriver.Navigate().GoToUrl(CommonVariables.URL); Logger.Log("Navigating to the URL: '{0}'", CommonVariables.URL); try { Logger.Log("Entering user name as: '" + CommonVariables.UserName + "'"); string xpathUserName = UIHelpers.GetXpathValue("LoginPage", PageName, "UserNameTextBox"); UIDriver.WaitForElementTo(xpathUserName, 15, "Visible"); IWebElement txtLogin = UIDriver.WebDriver.FindElement(By.XPath(xpathUserName)); txtLogin.SendKeys(CommonVariables.UserName); string xpathBtNext = UIHelpers.GetXpathValue("LoginPage", PageName, "NextButton"); IWebElement btnNext = UIDriver.WebDriver.FindElement(By.XPath(xpathBtNext)); btnNext.Click(); // Wait untill Password Element Appears in the next Page string xpathPassowrd = UIHelpers.GetXpathValue("LoginPage", PageName, "PasswordTextBox"); UIDriver.WaitForElementTo(xpathPassowrd, 15, "clickable"); Logger.Log("Entering password as: **********"); // to be encrypted IWebElement txtPassword = UIDriver.WebDriver.FindElement(By.XPath(xpathPassowrd)); txtPassword.SendKeys(CommonVariables.Password); // Click on the Next\Login button to Login string xpathBtLogin = UIHelpers.GetXpathValue("LoginPage", PageName, "LoginButton"); IWebElement btnLogin = UIDriver.WebDriver.FindElement(By.XPath(xpathBtLogin)); btnLogin.Click(); //Wait for the Inbox object to be appears if (PageName == "Yahoo") { string xpathEmailFolder = UIHelpers.GetXpathValue("InboxPage", PageName, "EmailFolder"); UIDriver.WaitForElementTo(xpathEmailFolder, 15, "visible"); IWebElement btnEmailBox = UIDriver.WebDriver.FindElement(By.XPath(xpathEmailFolder)); btnEmailBox.Click(); } string xpathInboxFolder = UIHelpers.GetXpathValue("InboxPage", PageName, "Inbox"); UIDriver.WaitForElementTo(xpathInboxFolder, 15, "visible"); Logger.Pass("Login to '" + PageName + "' is succesfull"); } catch (Exception ex) { Logger.Fail("Failed to login in " + loginType); Logger.Log(ex.Message); } }
public static IEnumerable <SentencePattern> Commands(Parser p, UIDriver repl) { yield return(new SentencePattern(p, "debug") .Action(() => SentencePattern.LogAllParsing = !SentencePattern.LogAllParsing) .Documentation("Toggles debugging of input parsing") .Command()); yield return(new SentencePattern(p, "help") .Action(() => { foreach (var r in p.SentencePatterns) { Driver.AppendResponseLine(r.HelpDescription); } }) .Documentation("Prints this list of commands") .Command()); yield return(new SentencePattern(p, "quit") .Action(Application.Quit) .Documentation("Ends the application") .Command()); yield return(new SentencePattern(p, "exit") .Action(Application.Quit) .Documentation("Ends the application") .Command()); yield return(new SentencePattern(p, "imagine", "!", p.Object) .Action(() => { var countRequest = p.Object.ExplicitCount; var count = countRequest ?? (p.Object.Number == Parser.Number.Plural ? 9 : 1); try { Generator.Current = new Generator(p.Object.CommonNoun, p.Object.Modifiers, count); } catch (ContradictionException e) { Driver.AppendResponseLine("<color=red><b>Contradiction found.</b></color>"); Driver.AppendResponseLine($"Internal error message: {e.Message}"); } }) .Command() .Documentation( "Generates one or more Objects. For example, 'imagine a cat' or 'imagine 10 long-haired cats'.")); yield return(new SentencePattern(p, "undo") .Action(() => repl.History.Undo()) .Command() .Documentation("Undoes the last change to the ontology.")); yield return(new SentencePattern(p, "start", "over") .Action(() => { repl.History.Clear(); Driver.AppendResponseLine("Knowledge-base erased. I don't know anything."); }) .Command() .Documentation("Tells the system to forget everything you've told it about the world.")); yield return(new SentencePattern(p, "save", p.ListName) .Action(() => { repl.History.Save(p.DefinitionFilePath(p.ListName.Text.Untokenize())); }) .Command() .Documentation("Saves assertions to a file.")); yield return(new SentencePattern(p, "test") .Action(() => { var total = 0; var failed = 0; foreach (var(test, success, example) in p.Ontology.TestResults()) { total++; if (!success) { failed++; } Driver.AppendResponseLine( success ? $"<B><color=green>{test.SucceedMessage}</color></b>" : $"<b><color=red>{test.FailMessage}</color></b>" ); if (example != null) { Driver.AppendResponseLine($"Example: {example.Description(example.Individuals[0])}"); } } if (total > 0) { Driver.PrependResponseLine( failed == 0 ? $"<color=green><b>All {total} tests passed.</b></color>\n\n" : $"<color=red><b>{failed} of {total} tests failed.</b></color>\n\n"); } else { Driver.AppendResponseLine("No tests have been defined."); } }) .Documentation("Run all tests currently defined") .Command()); yield return(new SentencePattern(p, "grade", p.Text) .Action(() => { Object.FindObjectOfType <UIDriver>().StartCoroutine(AutoGrader.GradeAssignment(p.Text.Text.Untokenize())); }) .Documentation("Run all tests currently defined") .Command()); yield return(new SentencePattern(p, "decompile") .Action(() => { var g = Generator.Current; Driver.AppendResponseLine(g != null ? g.Problem.Decompiled : "Please type an imagine command first"); }) .Documentation("Dump the clauses of the compiled SAT problem") .Command()); yield return(new SentencePattern(p, "stats") .Action(() => { var g = Generator.Current; if (g == null) { Driver.AppendResponseLine("Please type an imagine command first."); } else { Driver.AppendResponseLine(g.Problem.Stats); Driver.AppendResponseLine(g.Problem.PerformanceStatistics); } }) .Documentation("Dump the clauses of the compiled SAT problem") .Command()); }
public History(UIDriver uiDriver) { UIDriver = uiDriver; }
// Start is called before the first frame update void Start() { instance = this; }