Ejemplo n.º 1
0
    public void InitiateInventoryMenu() // Updates items on the inventory menu from the database
    {
        string[,] rowElements = new string[7, 4];
        int[] rowChildIndex = FindRowsWithinMenu(inventoryMenu);

        // Goes through all the items in the PlayerInventory table and assigns them to the 2d array of strings
        for (int i = 0; i < 7; i++)
        {
            string[] tempElements = _dataBaseConnector.DataBasePlayerInventorySelectForInventoryMenu(i.ToString());
            rowElements[i, 0] = tempElements[0];
            rowElements[i, 1] = tempElements[1];
            rowElements[i, 2] = tempElements[2];
            rowElements[i, 3] = tempElements[3];
        }

        // Goes through all the rows in the menu and assigns them values from the 2d array
        for (int x = 0; x < rowChildIndex.Length; x++)
        {
            GameObject tempRow = inventoryMenu.transform.GetChild(rowChildIndex[x]).gameObject;
            WriteRow(tempRow, rowElements[x, 0], float.Parse(rowElements[x, 2]), int.Parse(rowElements[x, 3]));
        }

        // Find row indexes and then paste whats in rowElements onto those rows
    }