public static FunctionElement createElement(FunctionsManager managerT,String title)
 {
     manager = managerT;
     element = new FunctionElement(manager);
     SmallDialog_FunctionsConfig dialog = new SmallDialog_FunctionsConfig(title);
     dialog.ShowDialog();
     return element;
 }
 //设置地图单元
 public static void configElement(FunctionElement elementT, String title)
 {
     if (elementT == null)
     {
         Console.WriteLine("error in configElement");
         return;
     }
     manager = (FunctionsManager)elementT.parent;
     element = elementT;
     SmallDialog_FunctionsConfig dialog = new SmallDialog_FunctionsConfig(title);
     dialog.textBox_name.Text = element.name;
     dialog.textBox_Commet.Text = element.commet;
     dialog.showParamsList();
     dialog.ShowDialog();
 }
 public void releaseRes()
 {
     m_HistoryManager=null;
     textsManager = null;
     mapImagesManager = null;
     mapsManager = null;
     varIntManager = null;
     varStringManager = null;
     triggerFunctionManager = null;
     contextFunctionManager = null;
     executionFunctionManager = null;
     //triggersManager = null;
     propertyTypesManager = null;
 }
        //初始化参数===========================================================
        public void initData(String path)
        {
            path_file = path;
            path_folder = path_file.Substring(0, path_file.LastIndexOf('\\') + 1);

            m_HistoryManager = new UndoManager();
            m_HistoryManager.MaxUndoLevel = 100;
            textsManager = new TextsManager(this);

            mapImagesManager = new MImgsManager(this);
            mapsManager = new MapsManager(this, mapImagesManager);

            varIntManager = new VarsManager(this);
            varStringManager = new VarsManager(this);
            triggerFunctionManager = new FunctionsManager(this);
            contextFunctionManager = new FunctionsManager(this);
            executionFunctionManager = new FunctionsManager(this);
            iDsManager = new VarsManager(this);
            propertyTypesManager = new PropertyTypesManager(this);

            form_MAnimation = new Form_MAnimation(this);
            mapsManager.initAntetype(form_MAnimation.form_MActorList.actorsManager);
            if (Consts.PATH_PROJECT_FILEPATH != null)
            {
                this.Text = Consts.PATH_PROJECT_FILEPATH;
            }
            userDoc.initUserData(path);//读入数据
        }
 //生成函数体
 private void genFunctionToHead(FileStream fs, FunctionsManager functionManager)
 {
     for (int i = 0; i < functionManager.getElementCount(); i++)
     {
         FunctionElement fun = (FunctionElement)functionManager.getElement(i);
         String strParams = " (";
         ArrayList paramList = (ArrayList)fun.getValue();
         for (int j = 0; j < paramList.Count; j++)
         {
             strParams += "p" + j;
             if (j < paramList.Count - 1)
             {
                 strParams += ",";
             }
         }
         strParams += ");";
         IOUtil.writeTextLine(fs, "host " + fun.name + strParams);
     }
 }
 //合并入
 public void combineTo(FunctionsManager parentT)
 {
     parent = parentT;
     parent.addElement(this);
 }
 public FunctionElement(FunctionsManager parentT)
     : base(parentT)
 {
     value = new ArrayList();
 }
 //合并
 public void combine(FunctionsManager srcFunctionsManager)
 {
     short len = (short)srcFunctionsManager.getElementCount();
     for (int i = 0; i < len; i++)
     {
         FunctionElement srcFunctionElement = (FunctionElement)srcFunctionsManager.getElement(i);
         //检查相同
         FunctionElement localFunctionElement = null;
         bool findSame=false;
         for (int j = 0; j < getElementCount(); j++)
         {
             localFunctionElement = (FunctionElement)getElement(j);
             if (localFunctionElement.equalsFunctionElement(srcFunctionElement))
             {
                 findSame = true;
                 break;
             }
         }
         //处理
         if (!findSame)//将自身合并入
         {
             srcFunctionElement.combineTo(this);
         }
         else
         {
             localFunctionElement.commet = srcFunctionElement.commet+"";//更新注释
             srcFunctionElement.changeUseInfor(localFunctionElement);//转移引用
         }
     }
 }