public void ShowYesNoMessage(string yesString, string noString, Action yesCallback, Action noCallback) { _isDisplayingMenu = true; _menuStrings = new List <string>(); _menuStrings.Add(yesString); _menuStrings.Add(noString); _menuCallbacks = new List <Action>(); _menuCallbacks.Add(yesCallback); _menuCallbacks.Add(noCallback); if (_textPanel != null) { UserInterface.Active.RemoveEntity(_textPanel); _textPanel = null; } float scaleY = HarvestMoon.Instance.Graphics.GraphicsDevice.Viewport.Height / 480.0f; // create a panel and position in bottom center of screen _textPanel = new Panel(new Vector2(620 * scaleY, 120 * scaleY), PanelSkin.Default, Anchor.BottomCenter); _textPanel.SetCustomSkin(_window_11Texture); UserInterface.Active.AddEntity(_textPanel); _textParagraph = new Paragraph(""); _textParagraph.Text = "> " + _menuStrings.First() + "\n" + " " + _menuStrings.Last(); _textPanel.AddChild(_textParagraph); //_textPanel.Opacity = 200; _npcMenu = NPCMenu.YesNo; }
// onPurchaseCallback name, amount, total public void ShowUpfrontStore(string title, List <string> items, List <string> classes, List <int> prices, Action onInteractionEnd, Func <List <string>, List <int>, int, string> onPurchaseCallback) { _isDisplayingMenu = true; if (_textPanel != null) { UserInterface.Active.RemoveEntity(_textPanel); _textPanel = null; } _selectedIndex = 1; _selectedAmount = 0; _selectedTotal = 0; _items = items; _classes = classes; _prices = prices; _amounts = new List <int>(); _storeOnAfterConfirmCallback = onInteractionEnd; _onPurchaseCallback = null; _onPurchaseCallback = onPurchaseCallback; float scaleY = HarvestMoon.Instance.Graphics.GraphicsDevice.Viewport.Height / 480.0f; // create panel and add to list of panels and manager Panel panel = new Panel(new Vector2(620 * scaleY, -1)); _textPanel = panel; _textPanel.SetCustomSkin(_window_11Texture); UserInterface.Active.AddEntity(panel); // list title panel.AddChild(new Header(title)); panel.AddChild(new HorizontalLine()); _gParagraph = new Paragraph("Current G: " + HarvestMoon.Instance.Gold.ToString()); _totalParagraph = new Paragraph("Total: " + "0G"); panel.AddChild(_gParagraph); panel.AddChild(_totalParagraph); // create the list _upfrontStoreList = new SelectList(new Vector2(0, 280)); // lock and create title _upfrontStoreList.LockedItems[0] = true; _upfrontStoreList.AddItem(System.String.Format("{0}{1,-8} {2,-8} {3, -10} {4, -10}", "{{RED}}", "Name", "Class", "Price", "Amount")); for (int i = 0; i < items.Count; ++i) { // add items as formatted table _amounts.Add(0); _upfrontStoreList.AddItem(System.String.Format("{0,-8} {1,-8} {2,-10} {3, -10}", items[i], classes[i], prices[i].ToString(), _amounts[i].ToString())); } if (_upfrontStoreList.Items.Length >= 2) { _upfrontStoreList.SelectedIndex = _selectedIndex; } else { _selectedIndex = 0; } panel.AddChild(_upfrontStoreList); _npcMenu = NPCMenu.UpfrontStore; }
public void ShowBookshelf(string title, List <string> items, List <string> text, Action onInteractionEnd) { _isDisplayingMenu = true; Bookshelf.Reading = false; if (_textPanel != null) { UserInterface.Active.RemoveEntity(_textPanel); _textPanel = null; } _selectedIndex = 1; _title = title; _items = items; _text = text; _bookshelfOnAfterConfirmCallback = onInteractionEnd; float scaleY = HarvestMoon.Instance.Graphics.GraphicsDevice.Viewport.Height / 480.0f; // create panel and add to list of panels and manager Panel panel = new Panel(new Vector2(620 * scaleY, -1)); _textPanel = panel; _textPanel.SetCustomSkin(_window_11Texture); UserInterface.Active.AddEntity(panel); // list title panel.AddChild(new Header(title)); panel.AddChild(new HorizontalLine()); // create the list _bookshelfList = new SelectList(new Vector2(0, 280)); // lock and create title _bookshelfList.LockedItems[0] = true; _bookshelfList.AddItem(System.String.Format("{0}{1,-8}", "{{RED}}", "Selection")); for (int i = 0; i < items.Count; ++i) { // add items as formatted table _bookshelfList.AddItem(System.String.Format("{0,-8}", items[i])); } if (_bookshelfList.Items.Length >= 2) { _bookshelfList.SelectedIndex = _selectedIndex; } else { _selectedIndex = 0; } panel.AddChild(_bookshelfList); _npcMenu = NPCMenu.Bookshelf; }