private IRace GetPlayerRace(IConsoleWindow console) { Console.Clear(); console.Clear(); console.Write(Position.Zero, ConsoleColor.Green, "Choose A Race: "); for (var i = 0; i < AvailableRaces.Count; i++) { var currentRace = AvailableRaces[i]; console.Write(new Position(0, i + 1), $"{i + 1}: " + $"{currentRace.Name} - " + $"(Health: {currentRace.Health}, Damage: {currentRace.Damage})"); } while (true) { console.Render(); var raceNumber = ConsoleInputReader.ReadKey(); if (int.TryParse(raceNumber.KeyChar.ToString(), out int index) && index >= 1 && index <= AvailableRaces.Count) { return(AvailableRaces[index - 1]); } console.Write(new Position(0, AvailableRaces.Count + 1), "Please enter a valid race number."); } }
protected virtual string GetPlayerName(IConsoleWindow console) { console.Write(Position.Zero, ConsoleColor.Green, "Enter Player's Name: "); console.Render(); Console.ForegroundColor = ConsoleColor.White; return(ConsoleInputReader.ReadLine()); }
public FieldView(Field <IAnimal> field, IConsoleOutput consoleOutput, IConsoleWindow consoleWindow, ISymbolProvider animalSymbolProvider, IStringDrawer stringDrawer, StringBuilder fieldAsStringBuilder) : this(field) { _consoleOutput = consoleOutput; _consoleWindow = consoleWindow; _animalSymbolProvider = animalSymbolProvider; _fieldAsStringBuilder = fieldAsStringBuilder; _stringDrawer = stringDrawer; }
public IPlayer CreatePlayer(IConsoleWindow console) { var name = GetPlayerName(console); var playerRace = GetPlayerRace(console); Console.Clear(); console.Clear(); return(new Player(name, playerRace)); }
private void OpenConsoleWindow() { if (this.consoleWindow == null) { this.consoleWindow = this.viewFactory.CreateConsoleWindow(); } this.consoleWindow.Show(); this.consoleWindow.Focus(); }
public virtual void Run(IConsoleWindow window) { _statusList.Enqueue("Press ? for Help."); IsRunning = true; new SpawnEnemiesCommand().Execute(this); new SpawnItemsCommand().Execute(this); while (IsRunning) { Console.CursorVisible = false; var mapWidth = window.Area.Width * 2 / 3; var mapHeight = window.Area.Height - 1; var mapArea = window.CreateConsoleArea(new Area(new Position(0, 1), new Size(mapWidth, mapHeight))); mapArea.Clear(); _renderer.Render(this, mapArea); var playerArea = window.CreateConsoleArea(new Area( new Position(mapWidth, 1), new Size(window.Area.Width - mapWidth, mapHeight))); playerArea.Clear(); _playerRenderer.Render(this, playerArea); var statusArea = window.CreateConsoleArea(new Area(Position.Zero, new Size(window.Area.Width, 1))); statusArea.Clear(); while (_statusList.Any()) { statusArea.Clear(); var status = _statusList.Dequeue(); if (_statusList.Any()) { status += " <more>"; } statusArea.Write(Position.Zero, status); window.Render(); if (_statusList.Any()) { KeyInfo.GetInput(); } } window.Render(); _commandFactory.Execute(this, KeyInfo.GetInput()); if (_characters.Count != 0) { continue; } IsRunning = false; window.Clear(); window.Write(Position.Zero, "All your enemies are dead. Congratulations!"); window.Write(new Position(0, 1), "You are the only one left on earth."); window.Render(); } }
private void LoginComplete(LoginInfo info, Instance inst) { string mainGameUrl = "minecraft.jar"; if (!info.Cancelled) { Console.WriteLine("Version: {0}", info.LatestVersion); GameUpdater updater = new GameUpdater(inst, info.LatestVersion, mainGameUrl, info.ForceUpdate); EventHandler startDelegate = new EventHandler((e, args) => { if (!DirectLaunch) { MainWindow.Visible = false; } inst.Launch(info.Username, info.SessionID); IConsoleWindow cwin = GUIManager.Main.ConsoleWindow(inst); cwin.DefaultPosition = DefWindowPosition.CenterScreen; cwin.ConsoleClosed += (e2, args2) => { if (DirectLaunch) { Environment.Exit(0); } else { MainWindow.Invoke((e3, args3) => MainWindow.Visible = true); } }; cwin.Show(); }); updater.Completed += (sender, e) => { if (inst.NeedsRebuild) { MainWindow.Invoke((sender2, e2) => { Modder modder = RebuildMCJar(inst); if (modder == null) { MainWindow.Invoke(startDelegate); } else { modder.Completed += (sender3, e3) => MainWindow.Invoke(startDelegate); } }); } else { MainWindow.Invoke(startDelegate); } }; if (!string.IsNullOrEmpty(info.SessionID)) { MainWindow.Invoke((o2, args2) => StartModalTask(updater)); } else { MainWindow.Invoke(startDelegate); } } }
/// <inheritdoc /> public ProgressBar(IConsoleWindow window) : base(window) { }
internal Label(IConsoleWindow window, IConsoleTextController?textController) : base(window, textController) { }
public Label(IConsoleWindow window) : base(window) { }
internal StubbedConsoleControl(IConsoleWindow window) : base(window) { deferrer = new DisposableBlock(() => OnDeferDrawingDisposed?.Invoke()); }
public Renderer(IConsoleWindow consoleWindow) { this._consoleWindow = consoleWindow; }
public MainForm(IUnityContainer Container, IMouseRobot MouseRobot, IScreenPaintForm ScreenPaintForm, IFeatureDetectionThread FeatureDetectionThread, ISettingsManager SettingsManager, IScriptManager ScriptManager, IAssetManager AssetManager, IHierarchyWindow HierarchyWindow, IPropertiesWindow PropertiesWindow, IScreenPreviewWindow ScreenPreviewWindow, IAssetsWindow AssetsWindow, IProfilerWindow ProfilerWindow, IInspectorWindow InspectorWindow, IScreenStateThread ScreenStateThread, IInputCallbacks InputCallbacks, IProjectSelectionDialog ProjectSelectionDialog, IConsoleWindow ConsoleWindow, IStatusManager StatusManager, ITestFixtureManager TestFixtureManager, ITestRunnerWindow TestRunnerWindow, ITestRunner TestRunner) { this.Container = Container; this.MouseRobot = MouseRobot; this.ScreenPaintForm = ScreenPaintForm; this.FeatureDetectionThread = FeatureDetectionThread; this.SettingsManager = SettingsManager; this.ScriptManager = ScriptManager; this.AssetManager = AssetManager; this.ScreenStateThread = ScreenStateThread; this.InputCallbacks = InputCallbacks; this.StatusManager = StatusManager; this.TestFixtureManager = TestFixtureManager; this.TestRunner = TestRunner; this.m_HierarchyWindow = HierarchyWindow; this.m_PropertiesWindow = PropertiesWindow; this.m_ScreenPreviewWindow = ScreenPreviewWindow; this.m_AssetsWindow = AssetsWindow; this.m_ProfilerWindow = ProfilerWindow; this.m_InspectorWindow = InspectorWindow; this.m_ConsoleWindow = ConsoleWindow; this.m_TestRunnerWindow = TestRunnerWindow; this.ProjectSelectionDialog = ProjectSelectionDialog; MouseRobot.AsyncOperationOnUI = AsyncOperationManager.CreateOperation(null); InitializeComponent(); AutoScaleMode = AutoScaleMode.Dpi; this.WindowState = FormWindowState.Maximized; //ShowSplashScreen(2000); ((Form)ScreenPaintForm).Owner = this; PutLayoutWindowsInArray(); SetWindowTheme(this.vS2015DarkTheme1, emptyLayout: true); DockLayout.Windows = m_Windows; DockLayout.Restore(m_DockPanel); visualStudioToolStripExtender.DefaultRenderer = new ToolStripProfessionalRenderer(); actionOnRec.SelectedIndex = 2; actionOnPlay.SelectedIndex = 2; InputCallbacks.InputEvent += OnInputEvent; m_AssetsWindow.AssetSelected += OnAssetSelected; m_HierarchyWindow.OnSelectionChanged += ShowSelectedObjectInInspector; MouseRobot.RecordingStateChanged += OnRecordingStateChanged; MouseRobot.PlayingStateChanged += OnPlayingStateChanged; MouseRobot.VisualizationStateChanged += OnVisualizationStateChanged; StatusManager.StatusUpdated += OnStatusUpdated; TestFixtureManager.FixtureAdded += OnFixtureAdded; TestFixtureManager.FixtureRemoved += OnFixtureRemoved; this.Activated += (x, y) => AssetManager.Refresh(); ((Form)ScreenPaintForm).Show(); }
public LI_Console(int _id, string _name, IConsoleWindow _consoleWindow) { Id = _id; Name = _name; ConsoleWindow = _consoleWindow; }
private void AddConsole(string _name, IConsoleWindow _consoleWindow) { m_Consoles.Add(new LI_Console(m_Consoles.Count, _name, _consoleWindow)); }
/// <inheritdoc /> public Panel(IConsoleWindow window) : base(window) { }