void CMainFrame::OnFileOpenProject() { using namespace engine; util_update_obj_property_grid(GameObjectPtr()); util_update_object_view(GameObjectPtr()); CFileDialog dlg(TRUE, L"gp", NULL, OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, L"Game Project Files (*.gp)|*.gp||"); if(IDOK != dlg.DoModal()) { return; } ProjectPtr pProject = Project::Instance(); pProject->Close(); CString file = dlg.GetPathName(); if(pProject->Load(file) == false) { MessageBox(L"Fialed to load project.", L"error", MB_ICONERROR); pProject->Close(); return; } util_update_object_view(pProject->Root()); }
void CMainFrame::OnFileNewProject() { using namespace engine; util_update_obj_property_grid(GameObjectPtr()); util_update_object_view(GameObjectPtr()); if(IDYES != MessageBox(L"All unsaved data will be lost, are you sure?", L"error", MB_YESNO)) { util_update_object_view(Project::Instance()->Root()); return; } CFileDialog dlg(FALSE, L"gp", NULL, OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, L"Game Project Files (*.gp)|*.gp||"); if(IDOK != dlg.DoModal()) { util_update_object_view(Project::Instance()->Root()); return; } ProjectPtr pProject = Project::Instance(); pProject->Close(); CString file = dlg.GetPathName(); if(pProject->New(file) == false) { MessageBox(L"Fialed to create project, file or directory already exist.", L"error", MB_ICONERROR); pProject->Close(); return; } util_update_object_view(pProject->Root()); //util_output_info(L"Project created."); }
void CMainFrame::OnClose() { // TODO: 在此添加消息处理程序代码和/或调用默认值 UpdatePropGrid(engine::GameObjectPtr()); UpdateObjectView(engine::GameObjectPtr()); ProjectPtr pProject = Project::Instance(); pProject->Close(); CFrameWndEx::OnClose(); }
BOOL CGameEditorDoc::OnOpenDocument(LPCTSTR lpszPathName) { using namespace ld3d; util_update_obj_property_grid(GameObjectPtr()); util_update_object_view(GameObjectPtr()); ProjectPtr pProject = Project::Instance(); pProject->Close(); if(pProject->Load(lpszPathName) == false) { util_log_info(L"Failed to open project."); return FALSE; } util_log_info(L"Project openned."); util_update_object_view(Project::Instance()->Root()); return CDocument::OnOpenDocument(lpszPathName); }