public Pause() { Depth = -9; _menuOptions = new string[] { Strings.Continue, Strings.FullscreenOff, Strings.Exit }; _menu = new SelectionMenu("", _menuOptions, _menuPos, _menuSize); if (GameCntrl.WindowManager.IsFullScreen) { _menu.Items[1] = Strings.FullscreenOn; } }
public SelectionMenu ShowPotions() { if (_currentSelectionMenu == null) { string[] menuItems = new string[Potions.Count + 1]; var i = 0; foreach (KeyValuePair <string, InventoryItem> item in Potions) { menuItems[i] = item.Value.Name; menuItems[i] += " (" + item.Value.Amount + "/" + item.Value.Stack + ")"; i += 1; } menuItems[i] = Strings.Back; _currentSelectionMenu = new SelectionMenu(Strings.Potions, menuItems, _listPos, _listSize); _currentInventory = Potions; } return(_currentSelectionMenu); }
public SelectionMenu ShowItems() { if (_currentSelectionMenu == null) { string[] menuItems = new string[Items.Count + 1]; var i = 0; foreach (KeyValuePair <string, InventoryItem> item in Items) { menuItems[i] = item.Value.Name; if (item.Value.Amount > 1) { menuItems[i] += " x" + item.Value.Amount; } i += 1; } menuItems[i] = Strings.Back; _currentSelectionMenu = new SelectionMenu(Strings.Inventory, menuItems, _listPos, _listSize); _currentInventory = Items; } return(_currentSelectionMenu); }
public override void Update() { if (_currentSelectionMenu != null) { if (_currentSelectionMenu.Activated) { if (_currentSelectionMenu.SelectedItem >= _currentInventory.Count) { // Back button. Objects.Destroy(_currentSelectionMenu); _currentSelectionMenu = null; _currentInventory = null; SoundController.PlaySound(SoundController.Back); // Back button. } else { // Item. InventoryItem item = _currentInventory.ElementAt(_currentSelectionMenu.SelectedItem).Value; bool invoke = true; if (item.Spendable) { item.Amount -= 1; if (_currentInventory == Items) { if (item.Amount <= 0) { _currentInventory.Remove(item.Token); } } else { if (Objects.ObjExists <Battle.Arena>()) { if (item.Amount < 0) { item.Amount = 0; invoke = false; _currentSelectionMenu.Activated = false; } } else { Objects.Destroy(_currentSelectionMenu); new Dialogue(new string[] { "" }, new string[] { Strings.CantUsePotionsNow }); invoke = false; _currentSelectionMenu = null; _currentInventory = null; } } } if (invoke) { Objects.Destroy(_currentSelectionMenu); _currentSelectionMenu = null; _currentInventory = null; _itemActions[item.Token].Invoke(item); } // Item. } } } }