// TODO: Speed up rendering if possible public void Render() { lock (Application.DrawLock) { NeedsRender = false; _Activity = ActivityFlags.None; Graphics.DrawLine(new Point(0, 0), new Point(ConsoleHelper.Size.Width - 1, 0), ' ', ConsoleColor.DarkBlue); Graphics.WriteANSIString(new ANSIString(TitleBar), new Point(0, 0), ConsoleColor.DarkBlue, ConsoleColor.White); Graphics.DrawFilledBox(new Point(0, 1), new Point(ConsoleHelper.Size.Width - 1, ConsoleHelper.Size.Height - 2), ' '); using (var c = new CursorChanger(new Point(0, 1))) { lock (_ChatBuf) { var rendered = RenderedMessages.ToArray(); var shown = Math.Min(rendered.Length, Size.Height); var scroll = Scroll; for (int i = 0; i < shown; ++i) { var line = rendered[i + scroll]; Graphics.WriteANSIString(line.Value); Console.CursorLeft = 0; Console.CursorTop++; } } } } }
void IUIService.ShowAppWait() { if (Mouse.OverrideCursor == null) { CursorChanger.ChangeAsync(Cursors.Wait, DispatcherPriority.Background); } }
private void Awake() { LoadGridManager(); LoadUnitList(); _grid = new Grid(_gridManager.GetGridSize().x, _gridManager.GetGridSize().y, _gridManager.GetGridCellSize().x, new Vector3(_gridManager.GetGridPosition().x *_gridManager.GetGridCellSize().x, _gridManager.GetGridPosition().y *_gridManager.GetGridCellSize().x, 0), this._gridManager); _cursorChanger = gameObject.GetComponent <CursorChanger>(); }
public PolygonManager(PictureBox canvas, CursorChanger cursorChanger, StatusStripChanger statusStripChanger) { this.canvas = canvas; ChangeCursor = cursorChanger; ChangeStatusStrip = statusStripChanger; canvas.MouseMove += Canvas_MouseMove; canvas.MouseDown += Canvas_MouseDown; canvas.MouseUp += Canvas_MouseUp; canvas.Paint += CanvasDraw; }
public void OnPointerEnter(PointerEventData eventData) { if (cursorChanger) { cursorChanger.SetActiveCursor(); } else { cursorChanger = EventSystem.current.GetComponent <CursorChanger>().instance; } }
private void Start() { if (instance == null) { instance = this; } else if (instance == this) { Destroy(gameObject); } Application.runInBackground = true; }
// TODO: Speed up rendering if possible public void Render() { lock (Application.DrawLock) { RenderMessages(); _Activity = ActivityFlags.None; Graphics.DrawLine(new Point(0, 0), new Point(ConsoleHelper.Size.Width - 1, 0), ' ', ConsoleColor.DarkBlue); Graphics.WriteANSIString(TitleBar, new Point(0, 0), ConsoleColor.DarkBlue, ConsoleColor.White); Graphics.DrawFilledBox(new Point(0, 1), new Point(ConsoleHelper.Size.Width - 1, ConsoleHelper.Size.Height - 2), ' '); int height = ConsoleHelper.Size.Height - 4; int totalHeight = 0; // TODO Scrolling using (var c = new CursorChanger(new Point(0, 1))) { lock(_ChatBuf) foreach (var msg in Messages .Reverse() .TakeWhile(p => (totalHeight += p.Lines) < height) .Reverse() .Skip(totalHeight > height ? 1 : 0)) { if (msg.Timestamp.Date == DateTime.Now.Date) Graphics.WriteANSIString($"[{msg.Timestamp.ToString("HH:mm")}] ".Color(ConsoleColor.Gray)); else Graphics.WriteANSIString($"[{msg.Timestamp.ToString("yyyy-MM-dd")}] ".Color(ConsoleColor.Gray)); string message = msg[MessageDisplay]; bool action = message.StartsWith("/me", StringComparison.CurrentCultureIgnoreCase); if (action) Console.Write("* "); if (msg.Sender?.Name != null) Graphics.WriteANSIString(msg.Sender.ToANSIString(Channel, true)); else Graphics.WriteANSIString("System".Color(ConsoleColor.DarkGray)); if (action) { if (msg.PlainMessage.StartsWith("/me's", StringComparison.CurrentCultureIgnoreCase)) { Graphics.WriteANSIString(message.Substring(3), foreground: ConsoleColor.White); } else { Console.CursorLeft++; Graphics.WriteANSIString(message.Substring(4), foreground: ConsoleColor.White); } } else Graphics.WriteANSIString(": " + message, foreground: ConsoleColor.Gray); Console.CursorLeft = 0; Console.CursorTop++; } } } }
// Use this for initialization void Start() { Instance = this; }
public void Start() { //Sets the cursor changer to the parent of the object this is attached to. cursorChanger = GetComponentInParent <CursorChanger>(); }
void Start() { cursorChanger = EventSystem.current.GetComponent <CursorChanger>().instance; image = GetComponent <Image>(); }
public void Render() { lock (Application.DrawLock) { Graphics.DrawLine(new Point(0, ConsoleHelper.Size.Height - 1), new Point(ConsoleHelper.Size.Width - 1, ConsoleHelper.Size.Height - 1), ' '); Console.SetCursorPosition(Cursor, ConsoleHelper.Size.Height - 1); using (var cur = new CursorChanger(new Point(0, ConsoleHelper.Size.Height - 1))) using (var col = new ColorChanger(foreground: ConsoleColor.White)) Console.Write(_Content); Console.ForegroundColor = ConsoleColor.Gray; } }
private void LoadCursorChanger() { _cursorChanger = GameObject.Find("Testing").GetComponent <CursorChanger>(); }