public WindowArea(bool dummyTexBox = true) { width = height = 10; processedTextList = sourceText = new List <string>(); textColor = bgColor = ConsoleColor.White; this.consoleBox = WindowArea.Process(processedTextList, textColor, bgColor); }
public void SetArea(List <String> inputList, Area area) { var areaToEdit = GetTextBox(area); var editedArea = new WindowArea(areaToEdit.GetWidth(), areaToEdit.GetHeight(), inputList, areaToEdit.textColor, areaToEdit.bgColor); ReplaceArea(area, editedArea); }
public void TestCopyTo() { var area1 = new WindowArea(0, 10, 10, 1); var area2 = new WindowArea(0, 10, 10, 1); area1[0] = new ItemStack(10); area1[1] = new ItemStack(20); area1[2] = new ItemStack(30); area1.CopyTo(area2); Assert.AreEqual(area1[0], area2[0]); Assert.AreEqual(area1[1], area2[1]); Assert.AreEqual(area1[2], area2[2]); }
public void TestIndexing() { var area = new WindowArea(0, 10, 10, 1); area[0] = new ItemStack(10); Assert.AreEqual(new ItemStack(10), area[0]); area[1] = new ItemStack(20); Assert.AreEqual(new ItemStack(20), area[1]); var called = false; area.WindowChange += (sender, e) => called = true; area[0] = ItemStack.EmptyStack; Assert.IsTrue(called); }
// show notification message // <param name="type">blue-green-red-yellow</param> public void Message(string title, string message, NotificationType type) { try { WindowArea.Show(new NotificationContent { Type = type, Message = message, Title = title } , TimeSpan.FromSeconds(3), null, null); //, TimeSpan.FromSeconds(3), onClick: () => Console.WriteLine("Click"), onClose: () => Console.WriteLine("Closed!")); } catch (Exception ex) { Debug.Text(ex, "Message()"); } }
protected internal override int MoveOrMergeItem(int index, ItemStack slot, WindowArea from) { for (int i = 0; i < Length; i++) { if (IsValid(slot, i)) { if (this[i].Empty) { this[i] = slot; from[index] = ItemStack.EmptyStack; return i; } } } return -1; }
protected internal override int MoveOrMergeItem(int index, ItemStack slot, WindowArea from) { for (int i = 0; i < Length; i++) { if (IsValid(slot, i)) { if (this[i].Empty) { this[i] = slot; from[index] = ItemStack.EmptyStack; return(i); } } } return(-1); }
public View(string title = "", List <string> textA = null, List <string> textB = null, List <string> textC = null, List <string> textD = null, ViewLayoutType viewLayoutType = ViewLayoutType.twoStackOneLong, int width = 100, int height = 30, Display display = null) { textA = textA ?? new List <string>(); textB = textB ?? new List <string>(); textC = textC ?? new List <string>(); textD = textD ?? new List <string>(); if (display != null) { this.display = display; } type = viewLayoutType; Title = title; this.width = width; this.height = height; if (viewLayoutType == ViewLayoutType.twoStackOneLong) { //+--------Title---------------- + //+-----------------------------+ //| | | //| areaA | | //| | | //| | areaB | //+---------------+ | //| | | //| areaC | | //| | | //+---------------+-------------+ //+--------------Command-------- + int sixtyWidth = (int)Math.Ceiling(0.6 * width); int fortyWidth = (int)Math.Ceiling(0.4 * width); int fiftyHeight = (int)Math.Ceiling(0.5 * height); AreaA = new WindowArea(sixtyWidth, fiftyHeight, textA, ConsoleColor.White, ConsoleColor.DarkGreen); AreaB = new WindowArea(fortyWidth, height, textB, ConsoleColor.White, ConsoleColor.DarkBlue); AreaC = new WindowArea(sixtyWidth, fiftyHeight, textC, ConsoleColor.White, ConsoleColor.Black); } if (viewLayoutType == ViewLayoutType.singleView || viewLayoutType == ViewLayoutType.drawOnSingleView) { AreaA = new WindowArea(width, height, textA, ConsoleColor.White, ConsoleColor.DarkGreen); } }
public WindowArea(int width, int height, List <string> wrappedTextList, ConsoleColor textColor, ConsoleColor bgColor) { var processedText = new List <String>(); for (var i = 0; i < height; i += 1) { if (i > wrappedTextList.Count - 1) { processedText.Add("".PadRight(width)); } else { processedText.Add(wrappedTextList[i].PadRight(width)); } } this.width = width; this.height = height; processedTextList = processedText; sourceText = wrappedTextList; this.textColor = textColor; this.bgColor = bgColor; this.consoleBox = WindowArea.Process(processedText, textColor, bgColor); }
public void ReplaceArea(Area areToReplace, WindowArea replacement) { switch (areToReplace) { case Area.A: AreaA = replacement; break; case Area.B: AreaB = replacement; break; case Area.C: AreaC = replacement; break; case Area.D: AreaD = replacement; break; default: break; } }
public void CheckPosition() { ElementManager.Instance.Hit(Position); Position = WindowArea.TeleportIfNotInArea(Position); ElementManager.Instance.GetEat.CheckHead(Position); }