public void LoadExperiment(ExperimentalInfo info)
        {
            resourceLoad.LoadExperimentalInfo(info);

            //初始化所有编辑器
            SceneEditorManager.Init();
            EventEditorManager.Init();
            ObjectEditorManager.Init();
        }
예제 #2
0
    void OpenExperiment()
    {
        string path = Application.dataPath + @"/Datas";

        if (!Directory.Exists(path))
        {
            Directory.CreateDirectory(path);
        }
        DirectoryInfo root = new DirectoryInfo(path);

        FileInfo[] files = root.GetFiles("*.cl");
        List <DialogBox.DialogBoxDataBase> dataBases = new List <DialogBox.DialogBoxDataBase>();

        foreach (var t in files)
        {
            dataBases.Add(new DialogStrData(t.Name));
        }
        DialogBox.DialogBoxManager.dialogBoxManager.ListSelect("选择实验文件", "文件名称", 0, dataBases, index => {
            var f        = root.GetFiles("*.cl")[index];
            var filepath = f.FullName;
            var info     = Tool.ReadXml <ExperimentalInfo>(filepath);
            resourceLoad = GetComponent <ResourceLoad>();
            resourceLoad.LoadExperimentalInfo(info);
            ExperimentTitle.text = info.ExperimentTitle;
            SelectManager.Init(resourceLoad);
            SelectManager.OnStartSelect = SelectObjectStart;
            SelectManager.OnSelecting   = SelectObjecting;
            SelectManager.OnSelected    = SelectObjectSuccess;
            EventsManager = GetComponent <EventsManager>();
            EventsManager.Init(resourceLoad);
        });
        //var filepath=EditorUtility.OpenFilePanel("打开实验", path, "cl");
        //if (string.IsNullOrEmpty(filepath)) return;

        //var info= Tool.ReadXml<ExperimentalInfo>(filepath);
        //SceneEditorManager.ExperimentTitle.text = info.ExperimentTitle;
        //LoadExperiment(info);
    }