private void OnAdd() { Modal modal = new Modal(AppUI, "Contact Name", typeof(TextBox), "Phone Number", typeof(TextBox)); modal.Submit += OnSubmit; AppUI.OnModal(modal); }
public App() { ShouldExit = false; UI = new AppUI(); Data = new AppData(); }
private static string Start(int h, int w) { var turn = 0; var playerOne = true; var game = new Game(h, w); var yCord = new int[w]; for (int i = 0; i < w; i++) { yCord[i] = h - 1; } Console.Clear(); var done = false; do { Console.Clear(); AppUI.PrintBoard(game); var userX = -1; do { Console.WriteLine("Please enter a column number, player" + (playerOne ? "One" : "Two")); Console.WriteLine(">"); var userInput = Console.ReadLine(); if (!int.TryParse(userInput, out userX)) { Console.WriteLine($"{userInput} is not a number"); userX = -1; } else if (userX >= w) { userX = -1; } } while (userX < 0 || yCord[userX] < 0); if (game.Move(yCord[userX], userX) == "Ok") { turn++; yCord[userX]--; playerOne = !playerOne; } done = turn == h * w; } while (!done); AppUI.PrintBoard(game); Console.WriteLine("Game Over"); Console.ReadKey(); Console.Clear(); return(""); }
private void OnSubmit(object[] values) { Contact contact = new Contact(); contact.Name = values[1].ToString(); contact.PhoneNo = values[3].ToString(); Add(contact); AppUI.OnResume(); }
Vector2Int GetInventorySlotFromScreenPoint(Vector2 pScreenPoint, RectTransform pGridParent) { UpdateFocusedInventory(pGridParent); // Get the inventory object that the screen point overlaps Rect invPanelSS = AppUI.RectTransformToScreenSpace(pGridParent); Vector2Int inventorySelectionIndex = new Vector2Int( Mathf.FloorToInt(Math.Map(pScreenPoint.x, invPanelSS.x, invPanelSS.xMax, 0, FocusedInventory.Width)), Mathf.FloorToInt(Math.Map(Screen.height - pScreenPoint.y, invPanelSS.y, invPanelSS.yMax, 0, FocusedInventory.Height)) ); return(inventorySelectionIndex); }
private void Awake() { m_ui = GetComponent <AppUI>(); }
private void OnClear() { stringBuilder.Clear(); AppUI.OnRestart(); }