예제 #1
0
        public void InitializeData(CatProject _project)
        {
            _project.SynchronizeScene();
            project = _project;
            // scene for scene files
            sceneList.Items.Clear();
            string[] files          = Directory.GetFiles(project.projectRoot + CatProject.RESOURCE_DIR + "/scene/", "*.scene");
            int      selectionIndex = -1;
            int      index          = 0;

            foreach (string file in files)
            {
                string filename    = Path.GetFileNameWithoutExtension(file);
                string displayName = filename;
                if (filename == project.startupSceneName)
                {
                    displayName += "<Startup>";
                }
                sceneList.Items.Add(displayName);
                if (filename == project.currentSceneName)
                {
                    selectionIndex = index;
                }
                ++index;
            }
            if (selectionIndex != -1)
            {
                sceneList.SetSelected(selectionIndex, true);
            }
        }
예제 #2
0
        public bool Execute(MapEditor _mapEditor)
        {
            SaveFileDialog saveFileDialog = new SaveFileDialog();

            if (saveFileDialog.ShowDialog() == DialogResult.OK)
            {
                string filename    = saveFileDialog.FileName;
                int    index       = filename.LastIndexOf("\\");
                string projectName = filename.Substring(index + 1);
                string directory   = filename.Substring(0, index + 1);

                CatProject newProject = CatProject.CreateEmptyProject(projectName, directory, _mapEditor.m_gameEngine);
                _mapEditor.ExecuteCommend(new OpenProjectCommand(newProject.GetProjectXMLAddress()));

                return(true);
            }
            return(false);
        }
예제 #3
0
        public bool Execute(MapEditor _mapEditor)
        {
            if (projectPath == "")
            {
                OpenFileDialog openFileDialog = new OpenFileDialog();
                openFileDialog.Filter      = "Catsland Project|*.xml";
                openFileDialog.FilterIndex = 1;
                if (openFileDialog.ShowDialog() == DialogResult.OK)
                {
                    projectPath = openFileDialog.FileName;
                }
                else
                {
                    return(false);
                }
            }

            String     filename   = projectPath;
            CatProject newProject = CatProject.OpenProject(filename, _mapEditor.m_gameEngine);

            _mapEditor.curProject       = newProject;
            Mgr <CatProject> .Singleton = _mapEditor.curProject;
            _mapEditor.UpdateModelList(_mapEditor.curProject.modelList1.contentList);

            // load current project
            _mapEditor.OpenScene(_mapEditor.curProject.GetSceneFileAddress(_mapEditor.curProject.currentSceneName));

            _mapEditor.m_gameEngine._gameInEditorMode = GameEngine.InEditorMode.Editing;
            _mapEditor.btn_play.Enabled  = true;
            _mapEditor.btn_stop.Enabled  = false;
            _mapEditor.btn_pause.Enabled = false;
            //Mgr<Camera>.Singleton.Reset();

            _mapEditor.updateEditorScriptMenu();
            _mapEditor.updateInsertComponentMenu();
            _mapEditor.UpdateEditorWindowFrame();

            return(true);
        }