Example #1
0
        public void Init()
        {
            if (!Table.Inited)
            {
                throw new Exception("Tabele has not been initialised,it is intialised in GameController");
            }
            if (!Inited)
            {
                TableDailyTarget preItem  = null;
                string           tableStr = TableTool.GetTxt(FileName);
                JSONNode         data     = JSONNode.Parse(tableStr);
                foreach (var itemData in data.Children)
                {
                    TableDailyTarget item = new TableDailyTarget();
                    item.Id               = itemData["Id"];
                    item.Index            = itemData["Index"];
                    item.TargetType       = itemData["TargetType"];
                    item.Icon             = itemData["Icon"];
                    item.GoalNum          = itemData["GoalNum"];
                    item.TitleTxtId       = itemData["TitleTxtId"];
                    item.descriptionTxtId = itemData["descriptionTxtId"];
                    item.Rewards          = Table.string2Dic_int_int(itemData["Rewards"]);


                    AddItem(item);
                    if (preItem != null)
                    {
                        preItem.Next = item;
                    }
                    preItem = item;
                }
                Inited = true;
            }
        }
Example #2
0
 public void Clear()
 {
     Inited = false;
     First  = null;
     dic.Clear();
     Items.Clear();
 }
Example #3
0
        public void Init(string tableStr)
        {
            TableDailyTarget preItem = null;
            JSONNode         data    = JSONNode.Parse(tableStr);

            foreach (var itemData in data.Children)
            {
                TableDailyTarget item = new TableDailyTarget();
                item.Id               = itemData["Id"];
                item.Index            = itemData["Index"];
                item.TargetType       = itemData["TargetType"];
                item.Icon             = itemData["Icon"];
                item.GoalNum          = itemData["GoalNum"];
                item.TitleTxtId       = itemData["TitleTxtId"];
                item.descriptionTxtId = itemData["descriptionTxtId"];
                item.Rewards          = Table.string2Dic_int_int(itemData["Rewards"]);


                AddItem(item);
                if (preItem != null)
                {
                    preItem.Next = item;
                }
                preItem = item;
            }
        }
Example #4
0
 private static void AddItem(TableDailyTarget 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);
     }
 }