public QualityDistribution(BOX_QUALITY bQ, float r, int value, List <ItemSizePair> iL)
 {
     Quality  = bQ;
     Ratio    = r;
     Value    = value;
     ItemList = iL;
 }
    /// <summary>
    ///
    /// </summary>
    public void LoadShopData()
    {
        XmlReader   reader    = XmlReader.Create(new StringReader(_shopDataTA.text));
        int         tempLvl   = -1;
        int         tempStage = -1;
        string      qualityS;
        float       tempBoxProb = 1f;
        int         tempBoxVal  = -1;
        BOX_QUALITY bQuality    = BOX_QUALITY.S;

        //list init
        if (_tempDistr == null)
        {
            _tempDistr = new List <QualityDistribution>();
        }
        else
        {
            _tempDistr.Clear();
        }

        if (_tempSizePait == null)
        {
            _tempSizePait = new List <ItemSizePair>();
        }
        else
        {
            _tempSizePait.Clear();
        }

        if (_shopItemList == null)
        {
            _shopItemList = new List <ShopItemTableEntry>();
        }
        else
        {
            _shopItemList.Clear();
        }


        while (reader.Read())
        {
            switch (reader.NodeType)
            {
            case XmlNodeType.Element:
                if (reader.Name.CompareTo("stage_data") == 0)
                {
                    tempStage = XmlConvert.ToInt32(reader.GetAttribute("val"));
                }
                else if (reader.Name.CompareTo("data_entry") == 0)
                {
                    tempLvl = XmlConvert.ToInt32(reader.GetAttribute("breakLvl"));
                }
                else if (reader.Name.CompareTo("box_prob") == 0)
                {
                    tempBoxProb = float.Parse(reader.GetAttribute("prob"));
                    qualityS    = reader.GetAttribute("type");
                    tempBoxVal  = XmlConvert.ToInt32(reader.GetAttribute("val"));
                    if (qualityS.CompareTo("S") == 0)
                    {
                        bQuality = BOX_QUALITY.S;
                    }
                    else if (qualityS.CompareTo("M") == 0)
                    {
                        bQuality = BOX_QUALITY.M;
                    }
                    else if (qualityS.CompareTo("L") == 0)
                    {
                        bQuality = BOX_QUALITY.L;
                    }
                    else if (qualityS.CompareTo("XL") == 0)
                    {
                        bQuality = BOX_QUALITY.XL;
                    }
                    else
                    {
                        Debug.LogError("Error reading quality value");
                    }
                    //_tempDistr.Add(new QualityDistribution(bQuality, float.Parse(reader.GetAttribute("prob"))));
                }
                else if (reader.Name.CompareTo("item") == 0)
                {
                    //while (reader.Read() && reader.IsStartElement()/*reader.NodeType != XmlNodeType.EndElement && reader.NodeType != XmlNodeType.Whitespace*/)
                    //{
                    _tempSizePait.Add(new ItemSizePair(reader.GetAttribute("id"), float.Parse(reader.GetAttribute("prob"))));
                    //}
                }
                break;

            case XmlNodeType.EndElement:
                if (reader.Name.CompareTo("data_entry") == 0)
                {
                    //Debug.Log("Adding lists..... " + _tempDistr.Count + " / " + _tempSizePait.Count);
                    //Add Entry tp Table and clear temp vars
                    _shopItemList.Add(new ShopItemTableEntry(tempStage, tempLvl, _tempDistr));
                    _tempDistr = new List <QualityDistribution>();
                }
                else if (reader.Name.CompareTo("item_pool") == 0)
                {
                    Debug.Log("Adding box item list..... " + bQuality + "/" + tempBoxProb + " / " + _tempSizePait.Count);
                    _tempDistr.Add(new QualityDistribution(bQuality, tempBoxProb, tempBoxVal, _tempSizePait));
                    _tempSizePait = new List <ItemSizePair>();
                }
                else
                {
                    Debug.Log("End element:    " + reader.Name);
                }

                break;
            }
        }
        Debug.Log("Shop items loaded: " + _shopItemList.Count);
        for (int i = 0; i < _shopItemList.Count; ++i)
        {
            Debug.Log("entry" + i + " / " + _shopItemList[i].BreakStage + " / " + _shopItemList[i].BreakLvl + " item count first box" + _shopItemList[i].BoxQualityDistr[0].ItemList.Count);
        }
    }