示例#1
0
    private void LoadLogicContent()
    {
        for (int i = 0; i < CurrentJsonData.Count; i++)
        {
            int    ID   = (int)CurrentJsonData [i] ["ID"];
            string Name = CurrentJsonData [i] ["Name"].ToString();
            List <LogicTypeContent> TypeList = new List <LogicTypeContent> ();

            for (int x = 0; x < CurrentJsonData[i]["Content"].Count; x++)
            {
                int    TypeID          = (int)CurrentJsonData [i] ["Content"] [x] ["ID"];
                string TypeName        = CurrentJsonData [i] ["Content"] [x] ["Name"].ToString();
                string TypeDescription = CurrentJsonData [i] ["Content"] [x] ["Description"].ToString();
                List <LogicSubTypeContent> SubTypeList = new List <LogicSubTypeContent> ();

                for (int y = 0; y < CurrentJsonData[i]["Content"][x]["SubtypeList"].Count; y++)
                {
                    int    SubtypeID               = (int)CurrentJsonData [i] ["Content"] [x] ["SubtypeList"] [y] ["ID"];
                    string SubtypeName             = CurrentJsonData[i]["Content"][x]["SubtypeList"][y]["Name"].ToString();
                    string SubtypeDescription      = CurrentJsonData [i] ["Content"] [x] ["SubtypeList"] [y] ["Description"].ToString();
                    LogicSubTypeContent NewSubtype = new LogicSubTypeContent(SubtypeID, SubtypeName, SubtypeDescription);
                    SubTypeList.Add(NewSubtype);
                }
                LogicTypeContent NewType = new LogicTypeContent(TypeID, TypeName, TypeDescription, SubTypeList);
                TypeList.Add(NewType);
            }

            DataLogic newlogic = new DataLogic(ID, Name, TypeList);
            CurrentDataLogic.Add(newlogic);
        }
    }
示例#2
0
    public void AddLogic(List <int> selection)
    {
        switch (selection.Count)
        {
        case 1:
            int currenttypeid = maindatabase.DatabaseMapLogic [selection[0]].Content.Count;
            List <LogicSubTypeContent> currentsubtypecontentlist = new List <LogicSubTypeContent> ();
            LogicTypeContent           currenttypelogic          = new LogicTypeContent(currenttypeid, "New type", "New Type", currentsubtypecontentlist);
            maindatabase.DatabaseMapLogic [selection[0]].Content.Add(currenttypelogic);
            break;

        case 2:
            int currentsubtypeid = maindatabase.DatabaseMapLogic [selection[0]].Content[selection[1]].SubtypeList.Count;
            LogicSubTypeContent currentsubtypelogic = new LogicSubTypeContent(currentsubtypeid, "New type", "New Subype");
            maindatabase.DatabaseMapLogic [selection[0]].Content[selection[1]].SubtypeList.Add(currentsubtypelogic);
            break;
        }
        SaveMapLogic();
    }
 public void SaveTypeLogic(List <int> selection, LogicTypeContent typelogic)
 {
     mapmanager.SaveTypeLogic(selection, typelogic);
 }
示例#4
0
 public void SaveTypeLogic(List <int> selection, LogicTypeContent logiccontent)
 {
     maindatabase.DatabaseMapLogic [selection[0]].Content[selection[1]] = logiccontent;
     SaveMapLogic();
 }