public void Clear()
 {
     Inited = false;
     First  = null;
     dic.Clear();
     Items.Clear();
 }
        public void Init()
        {
            if (!Table.Inited)
            {
                throw new Exception("Tabele has not been initialised,it is intialised in GameController");
            }
            if (!Inited)
            {
                TableGoodsBundle preItem  = null;
                string           tableStr = TableTool.GetTxt(FileName);
                JSONNode         data     = JSONNode.Parse(tableStr);
                foreach (var itemData in data.Children)
                {
                    TableGoodsBundle item = new TableGoodsBundle();
                    item.Id      = itemData["Id"];
                    item.Name    = itemData["Name"];
                    item.Icon    = itemData["Icon"];
                    item.Content = Table.string2Dic_int_int(itemData["Content"]);
                    item.Price   = itemData["Price"];


                    AddItem(item);
                    if (preItem != null)
                    {
                        preItem.Next = item;
                    }
                    preItem = item;
                }
                Inited = true;
            }
        }
 private static void AddItem(TableGoodsBundle item)
 {
     if (First == null)
     {
         First = item;
     }
     if (dic.ContainsKey(item.Id))
     {
         DebugUtil.LogError(FileName + " id duplicate :" + item.Id);
     }
     else
     {
         dic.Add(item.Id, item);
         Items.Add(item);
     }
 }
        public void Init(string tableStr)
        {
            TableGoodsBundle preItem = null;
            JSONNode         data    = JSONNode.Parse(tableStr);

            foreach (var itemData in data.Children)
            {
                TableGoodsBundle item = new TableGoodsBundle();
                item.Id      = itemData["Id"];
                item.Name    = itemData["Name"];
                item.Icon    = itemData["Icon"];
                item.Content = Table.string2Dic_int_int(itemData["Content"]);
                item.Price   = itemData["Price"];


                AddItem(item);
                if (preItem != null)
                {
                    preItem.Next = item;
                }
                preItem = item;
            }
        }