public InputWindow SelectInputWindow(AttrItem source, string name, string toEdit, MainWindow owner) { InputWindow window; switch (name) { case "bool": window = new Selector(toEdit, owner, SelectComboBox(name), "Input Bool"); break; case "code": window = new CodeInput(toEdit, owner); break; case "userDefinedNode": window = new NodeDefInput(toEdit, owner, source); break; default: window = new SingleLineInput(toEdit, owner); break; } window.AppendTitle(source.AttrCap); return(window); }
void SetupTutorialPanel() { if (GameObject.FindGameObjectWithTag("GameController") != null) { var manager = GameObject.FindGameObjectWithTag("GameController"); grid = manager.GetComponent <GridGeneration>(); code = manager.GetComponent <CodeInput>(); } if (grid != null) { level = grid.level; } playerDead = false; tutTextCount = 0; pauseMenu.SetActive(false); instructionsMenu.SetActive(false); inGameMenu.SetActive(false); tutorialUIHolder.SetActive(true); tutorialUIBackground.SetActive(true); tutorialUIText.SetActive(true); mainMenu.SetActive(false); mainmenuPanel.SetActive(true); optionsMenu.SetActive(false); optionsmenupanel.SetActive(false); restart.gameObject.SetActive(false); hints.SetActive(false); ChangeTutorialText(); }
void CloseTutorial() { if (GameObject.FindGameObjectWithTag("GameController") != null) { var manager = GameObject.FindGameObjectWithTag("GameController"); grid = manager.GetComponent <GridGeneration>(); code = manager.GetComponent <CodeInput>(); } if (grid != null) { level = grid.level; } //pController.HasControl = true; inGameMenu.SetActive(true); instructionsMenu.SetActive(false); tutorialUIHolder.SetActive(false); tutorialUIBackground.SetActive(false); tutorialUIText.SetActive(false); commandList.gameObject.SetActive(true); HUD.SetActive(true); if (!codeInputHolder.activeInHierarchy) { openCodeWindow.gameObject.SetActive(true); } instructions.gameObject.SetActive(true); hints.SetActive(false); playerDead = false; tutTextCount = 0; }
public static void Main() { CodeInput ci = CodeInput.Instance; DayTwo dayTwo = new DayTwo(); Console.Read(); }
public void can_generate_code() { var input = new CodeInput(); input.Registry = new JasperRegistry(); input.Registry.Handlers.DisableConventionalDiscovery(); input.Registry.Handlers.IncludeType <MessageConsumer>(); var cmd = new CodeCommand(); cmd.Execute(input); }
public static bool Test(IList<CodeInput> input, CodeInput[] pattern) { int count = input.Count; bool flag = false; for (int index = 0; index < pattern.Length && index < count && input[count - index - 1] == pattern[pattern.Length - index - 1]; ++index) { if (index == pattern.Length - 1) { flag = true; input.Clear(); break; } } return flag; }
public void can_generate_code() { var input = new CodeInput(); var registry = new JasperRegistry(); registry.Handlers.DisableConventionalDiscovery(); registry.Handlers.IncludeType <MessageConsumer>(); input.WebHostBuilder = JasperHost.CreateDefaultBuilder().UseJasper(registry); var cmd = new CodeCommand(); cmd.Execute(input); }
public void SendInput(string input) { int index = 0; CodeInput.Focus(); while (index < input.Length) { int tokenStart = input.IndexOf('{', index); if (tokenStart < 0) { break; } if (tokenStart > index) { Keyboard.Instance.Enter(input.Substring(index, tokenStart - index)); } int tokenEnd = input.IndexOf('}', tokenStart); Assert.True(tokenEnd >= 0); string token = input.Substring(tokenStart + 1, tokenEnd - tokenStart - 1); var values = Enum.GetValues(typeof(KeyboardInput.SpecialKeys)); bool found = false; foreach (var value in values) { if (value.ToString().ToLowerInvariant() == token.ToLowerInvariant()) { Keyboard.Instance.PressSpecialKey((KeyboardInput.SpecialKeys)value); found = true; } } index = tokenEnd + 1; if (!found) { Keyboard.Instance.Enter(token); } } if (index < input.Length) { Keyboard.Instance.Enter(input.Substring(index)); } }
private bool GrabInput() { CodeInput codeInput = CodeInput.None; if (this.InputManager.Jump == FezButtonState.Pressed) { codeInput = CodeInput.Jump; } else if (this.InputManager.RotateRight == FezButtonState.Pressed) { codeInput = CodeInput.SpinRight; } else if (this.InputManager.RotateLeft == FezButtonState.Pressed) { codeInput = CodeInput.SpinLeft; } else if (this.InputManager.Left == FezButtonState.Pressed) { codeInput = CodeInput.Left; } else if (this.InputManager.Right == FezButtonState.Pressed) { codeInput = CodeInput.Right; } else if (this.InputManager.Up == FezButtonState.Pressed) { codeInput = CodeInput.Up; } else if (this.InputManager.Down == FezButtonState.Pressed) { codeInput = CodeInput.Down; } if (codeInput == CodeInput.None) { return(false); } this.Input.Add(codeInput); if (this.Input.Count > 16) { this.Input.RemoveAt(0); } return(true); }
public string Format(CodeInput input) { var workspace = new AdhocWorkspace(); if (input.Language == Language.CSharp) { var tree = CSharpSyntaxTree.ParseText(input.Code); return(Formatter.Format(tree.GetRoot(), workspace).ToString()); } else if (input.Language == Language.VbNet) { var tree = VisualBasicSyntaxTree.ParseText(input.Code); return(Formatter.Format(tree.GetRoot(), workspace).ToString()); } else { throw new NotImplementedException(); } }
public SyntaxErrors CheckSyntax(CodeInput input) { var workspace = new AdhocWorkspace(); SyntaxTree tree = input.Language == Language.CSharp ? CSharpSyntaxTree.ParseText(input.Code) : VisualBasicSyntaxTree.ParseText(input.Code); SyntaxErrors errors = new SyntaxErrors(); foreach (var obj in tree.GetDiagnostics()) { errors.Add(new SyntaxError { Description = obj.Descriptor.Description.ToString(), Warning = obj.WarningLevel.ToString(), Severity = obj.Severity.ToString(), Location = obj.Location.Kind.ToString(), CharacterAt = obj.Location.GetLineSpan().StartLinePosition.Character.ToString(), OnLine = obj.Location.GetLineSpan().StartLinePosition.Line.ToString() }); } return errors; }
public SyntaxErrors CheckSyntax(CodeInput input) { var workspace = new AdhocWorkspace(); SyntaxTree tree = input.Language == Language.CSharp ? CSharpSyntaxTree.ParseText(input.Code) : VisualBasicSyntaxTree.ParseText(input.Code); SyntaxErrors errors = new SyntaxErrors(); foreach (var obj in tree.GetDiagnostics()) { errors.Add(new SyntaxError { Description = obj.Descriptor.Description.ToString(), Warning = obj.WarningLevel.ToString(), Severity = obj.Severity.ToString(), Location = obj.Location.Kind.ToString(), CharacterAt = obj.Location.GetLineSpan().StartLinePosition.Character.ToString(), OnLine = obj.Location.GetLineSpan().StartLinePosition.Line.ToString() }); } return(errors); }
public void FormatTest() { // Arrange IDEController controller = new IDEController(); string helloWorldCode = OpenFiddle.Resources.CodeSamples.HelloWorldConsoleCSharp; var modifiedCode = helloWorldCode.Insert(17, "\t\t"); CodeInput input = new CodeInput { Code = modifiedCode, Language = OpenFiddle.Models.Shared.Language.CSharp }; // Act var result = controller.Format(input); // Assert Assert.IsNotNull(result); Assert.AreEqual(helloWorldCode, result); }
private void OnInput(CodeInput newInput) { int[] numArray = CodeMachineHost.BitPatterns[newInput]; if (this.inputEmitter != null && !this.inputEmitter.Dead) { this.inputEmitter.Cue.Stop(false); } this.inputEmitter = SoundEffectExtensions.EmitAt(this.inputSound, this.CodeMachineAO.Position, RandomHelper.Between(-0.05, 0.05)); for (int index1 = 0; index1 < 36; ++index1) { for (int index2 = 0; index2 < 4; ++index2) { CodeMachineHost.BitState bitState = this.BitStates[index1 * 4 + index2]; bitState.On = numArray[index1] == 1; if (bitState.On) { bitState.SinceIdle = TimeSpan.Zero; } } } this.SinceInput = TimeSpan.Zero; }
//Gets the grid and sets up player ready for movement void Start() { var Manager = GameObject.FindGameObjectWithTag("GameController"); grid = Manager.GetComponent <GridGeneration>(); codeInput = Manager.GetComponent <CodeInput>(); camManager = GetComponent <CameraManager>(); pShoot = GetComponent <PlayerShoot>(); pHealth = GetComponent <PlayerHealth>(); GameObject.FindGameObjectWithTag("UITag").GetComponent <UI>().GetPlayer(this, pShoot, pHealth); xMax = grid.numberOfXGrid; yMax = grid.numberOfYGrid; currentX = grid.gridSquares[grid.startingTile].x; currentY = grid.gridSquares[grid.startingTile].y; nextGridSquare = 0; curRot = 0; }
private void Enter_Click(object sender, EventArgs e) { if (CodeInput.Text == "") { MessageBox.Show("Будь ласка, введіть номер Вашого рахунку."); } else { int num = Convert.ToInt32(CodeInput.Text); bool check = false; foreach (var person in clientData.Clients) { if (num == person.AccountNum) { CurrentClient = person; check = true; CodeInput.Clear(); ShowInfo(); break; } } if (!check) { MessageBox.Show("Такого клієнта не існує."); } else { Cheque.Clear(); LogInToolBarBox.Visible = false; ToolBarBox.Visible = true; LogOut.Visible = true; } CodeInput.Clear(); } }
public string Convert(CodeInput input) { //TOOD Write a conversion tool that utilises Roslyn's SyntaxTrees. switch (input.Language) { case Language.CSharp: if (input.Code == CodeSamples.HelloWorldConsoleVBNet) { return(CodeSamples.HelloWorldConsoleCSharp); } else if (input.Code == CodeSamples.HelloWorldScriptVBNet) { return(CodeSamples.HelloWorldScriptCSharp); } else { throw new NotImplementedException(); } case Language.VbNet: if (input.Code == CodeSamples.HelloWorldConsoleCSharp) { return(CodeSamples.HelloWorldConsoleVBNet); } else if (input.Code == CodeSamples.HelloWorldScriptCSharp) { return(CodeSamples.HelloWorldScriptVBNet); } else { throw new NotImplementedException(); } default: return(string.Empty); } }
public string Format(CodeInput input) { var workspace = new AdhocWorkspace(); if (input.Language == Language.CSharp) { var tree = CSharpSyntaxTree.ParseText(input.Code); return Formatter.Format(tree.GetRoot(), workspace).ToString(); } else if (input.Language == Language.VbNet) { var tree = VisualBasicSyntaxTree.ParseText(input.Code); return Formatter.Format(tree.GetRoot(), workspace).ToString(); } else { throw new NotImplementedException(); } }
private void OnInput(CodeInput newInput) { int[] numArray = CodeMachineHost.BitPatterns[newInput]; if (this.inputEmitter != null && !this.inputEmitter.Dead) this.inputEmitter.Cue.Stop(false); this.inputEmitter = SoundEffectExtensions.EmitAt(this.inputSound, this.CodeMachineAO.Position, RandomHelper.Between(-0.05, 0.05)); for (int index1 = 0; index1 < 36; ++index1) { for (int index2 = 0; index2 < 4; ++index2) { CodeMachineHost.BitState bitState = this.BitStates[index1 * 4 + index2]; bitState.On = numArray[index1] == 1; if (bitState.On) bitState.SinceIdle = TimeSpan.Zero; } } this.SinceInput = TimeSpan.Zero; }
private void TestInput() { CodeInput codeInput = CodeInput.None; if (this.InputManager.Jump == FezButtonState.Pressed) { codeInput = CodeInput.Jump; } else if (this.InputManager.RotateRight == FezButtonState.Pressed) { codeInput = CodeInput.SpinRight; } else if (this.InputManager.RotateLeft == FezButtonState.Pressed) { codeInput = CodeInput.SpinLeft; } else if (this.InputManager.Left == FezButtonState.Pressed) { codeInput = CodeInput.Left; } else if (this.InputManager.Right == FezButtonState.Pressed) { codeInput = CodeInput.Right; } else if (this.InputManager.Up == FezButtonState.Pressed) { codeInput = CodeInput.Up; } else if (this.InputManager.Down == FezButtonState.Pressed) { codeInput = CodeInput.Down; } if (codeInput == CodeInput.None) { return; } this.Input.Add(codeInput); if (this.Input.Count > 16) { this.Input.RemoveAt(0); } if (!this.isAchievementCode && !this.GameState.SaveData.AchievementCheatCodeDone && (!this.GameState.SaveData.FezHidden && PatternTester.Test((IList <CodeInput>) this.Input, GameWideCodes.AchievementCode)) && this.LevelManager.Name != "ELDERS") { this.Input.Clear(); this.isAchievementCode = true; this.LevelService.ResolvePuzzleSoundOnly(); Waiters.Wait((Func <bool>)(() => { if (this.CameraManager.ViewTransitionReached && this.PlayerManager.Grounded) { return(!this.PlayerManager.Background); } else { return(false); } }), (Action)(() => { Vector3 local_0 = this.PlayerManager.Center + new Vector3(0.0f, 2f, 0.0f); Trile local_1 = Enumerable.FirstOrDefault <Trile>(this.LevelManager.ActorTriles(ActorType.SecretCube)); if (local_1 == null) { return; } Vector3 local_2 = local_0 - Vector3.One / 2f; NearestTriles local_3 = this.LevelManager.NearestTrile(local_0); TrileInstance local_4 = local_3.Surface ?? local_3.Deep; if (local_4 != null) { local_2 = FezMath.ScreenSpaceMask(this.CameraManager.Viewpoint) * local_2 + local_4.Center * FezMath.DepthMask(this.CameraManager.Viewpoint) - FezMath.ForwardVector(this.CameraManager.Viewpoint) * 2f; } ServiceHelper.AddComponent((IGameComponent) new GlitchyRespawner(this.Game, this.waitingForTrile = new TrileInstance(Vector3.Clamp(local_2, Vector3.Zero, this.LevelManager.Size - Vector3.One), local_1.Id))); this.GomezService.CollectedAnti += new Action(this.GotTrile); })); } if (!this.isMapQr && !this.GameState.SaveData.MapCheatCodeDone && (this.GameState.SaveData.Maps.Contains("MAP_MYSTERY") && this.LevelManager.Name != "WATERTOWER_SECRET") && PatternTester.Test((IList <CodeInput>) this.Input, GameWideCodes.MapCode)) { this.Input.Clear(); this.GameState.SaveData.AnyCodeDeciphered = true; this.isMapQr = true; if (this.GameState.SaveData.World.ContainsKey("WATERTOWER_SECRET")) { this.GameState.SaveData.World["WATERTOWER_SECRET"].FilledConditions.SecretCount = 1; } this.LevelService.ResolvePuzzleSoundOnly(); Waiters.Wait((Func <bool>)(() => { if (this.CameraManager.ViewTransitionReached && this.PlayerManager.Grounded) { return(!this.PlayerManager.Background); } else { return(false); } }), (Action)(() => { Vector3 local_0 = this.PlayerManager.Center + new Vector3(0.0f, 2f, 0.0f); Trile local_1 = Enumerable.FirstOrDefault <Trile>(this.LevelManager.ActorTriles(ActorType.SecretCube)); if (local_1 == null) { return; } Vector3 local_2 = local_0 - Vector3.One / 2f; NearestTriles local_3 = this.LevelManager.NearestTrile(local_0); TrileInstance local_4 = local_3.Surface ?? local_3.Deep; if (local_4 != null) { local_2 = FezMath.ScreenSpaceMask(this.CameraManager.Viewpoint) * local_2 + local_4.Center * FezMath.DepthMask(this.CameraManager.Viewpoint) - FezMath.ForwardVector(this.CameraManager.Viewpoint) * 2f; } ServiceHelper.AddComponent((IGameComponent) new GlitchyRespawner(this.Game, this.waitingForTrile = new TrileInstance(Vector3.Clamp(local_2, Vector3.Zero, this.LevelManager.Size - Vector3.One), local_1.Id))); this.GomezService.CollectedAnti += new Action(this.GotTrile); })); } if (this.GameState.SaveData.HasNewGamePlus && PatternTester.Test((IList <CodeInput>) this.Input, GameWideCodes.JetpackCode)) { this.Input.Clear(); this.GameState.JetpackMode = true; } this.SinceInput = TimeSpan.Zero; }
public string Convert(CodeInput input) { //TOOD Write a conversion tool that utilises Roslyn's SyntaxTrees. switch (input.Language) { case Language.CSharp: if (input.Code == CodeSamples.HelloWorldConsoleVBNet) return CodeSamples.HelloWorldConsoleCSharp; else if (input.Code == CodeSamples.HelloWorldScriptVBNet) return CodeSamples.HelloWorldScriptCSharp; else throw new NotImplementedException(); case Language.VbNet: if (input.Code == CodeSamples.HelloWorldConsoleCSharp) return CodeSamples.HelloWorldConsoleVBNet; else if (input.Code == CodeSamples.HelloWorldScriptCSharp) return CodeSamples.HelloWorldScriptVBNet; else throw new NotImplementedException(); default: return string.Empty; } }