private void initDefaultSpaces() { inventory = new InventorySpace(); pShop = new PShopSpace(); expInventory = new ExpInventorySpace(); character = new CharacterSpace(); }
private void initInventoryDisplay() { if (currentInventory == null) { return; } InventorySpace inventory = currentInventory.inventory; int storageIndex = 0; resetInventory(); foreach (Button slot in inventory_grid.Children.Cast <UIElement>()) { Item current = inventory.items[storageIndex]; storageIndex++; if (current.isItemEmpty() || slot.Visibility == Visibility.Hidden) { changeSlotBackground(null, slot); continue; } DBItems storedItem = DBItems.findItem(current.category, current.index); if (storedItem != null) { storage_items.Add(slot, current); displayItemInInventory(storedItem, slot); } } }
public InventoryStorage(string hex) { if (hex.Length >= 7584 && hex.Length <= 7586) { int currentIndex, currentFinishIndex; if (string.Equals(hex.Substring(0, 2), "0x", StringComparison.OrdinalIgnoreCase)) { currentIndex = 2; currentFinishIndex = 386; } else { currentIndex = 0; currentFinishIndex = 384; } string characterHex = hex.Substring(currentIndex, currentFinishIndex); character = new CharacterSpace(characterHex); currentIndex += currentFinishIndex; currentFinishIndex = 2048; string inventoryHex = hex.Substring(currentIndex, currentFinishIndex); inventory = new InventorySpace(inventoryHex); currentIndex += currentFinishIndex; currentFinishIndex = 1024; string shopHex = hex.Substring(currentIndex, currentFinishIndex); pShop = new PShopSpace(shopHex); currentIndex += currentFinishIndex; currentFinishIndex = 2048; string expInventoryHex = hex.Substring(currentIndex, currentFinishIndex); expInventory = new ExpInventorySpace(); } else { initDefaultSpaces(); } }
public InventoryStorage(string hex) { if (hex.Length >= 7584 && hex.Length <= 7586) { int currentIndex, currentFinishIndex; if(string.Equals(hex.Substring(0, 2), "0x", StringComparison.OrdinalIgnoreCase)) { currentIndex = 2; currentFinishIndex = 386; } else { currentIndex = 0; currentFinishIndex = 384; } string characterHex = hex.Substring(currentIndex, currentFinishIndex); character = new CharacterSpace(characterHex); currentIndex += currentFinishIndex; currentFinishIndex = 2048; string inventoryHex = hex.Substring(currentIndex, currentFinishIndex); inventory = new InventorySpace(inventoryHex); currentIndex += currentFinishIndex; currentFinishIndex = 1024; string shopHex = hex.Substring(currentIndex, currentFinishIndex); pShop = new PShopSpace(shopHex); currentIndex += currentFinishIndex; currentFinishIndex = 2048; string expInventoryHex = hex.Substring(currentIndex, currentFinishIndex); expInventory = new ExpInventorySpace(); } else initDefaultSpaces(); }