コード例 #1
0
ファイル: UIShapeDialog.cs プロジェクト: pilnine/GUIEditor
        /// <summary>
        /// Called when exporting the scene to engine archive. base implemenation calls function on engine object which in turn
        /// serializes itself
        /// </summary>
        /// <returns></returns>
        public override bool OnExport(CSharpFramework.Scene.SceneExportInfo info)
        {
            if (Filename != "")
            {
                string absoluteFileName = EditorManager.Project.MakeAbsolute(Filename);

                if (UIDialogInstance.BuildToXML(absoluteFileName) == false)
                {
                    EditorManager.ShowMessageBox("Cannot export dialog file");
                }
            }

            return(base.OnExport(info));
        }
コード例 #2
0
ファイル: UIShapeDialog.cs プロジェクト: pilnine/GUIEditor
        public override void CreateEngineInstance(bool bCreateChildren)
        {
            //   base.CreateEngineInstance(bCreateChildren);
            _engineInstance = new UIEngineInstanceDialog();
            //PropertyString
            UIDialogInstance.CreateBasicDialogInstance("VUINodeDialog", this.ID, null);
            SetEngineInstanceBaseProperties(); // sets the position etc.
            UpdateProperties();

            if (bCreateChildren)
            {
                foreach (ShapeBase shape in ChildCollection)
                {
                    shape.CreateEngineInstance(false);
                }
            }

            UIDialogInstance.ShowDialog(true);
            UIDialogInstance.SetVisibleDialog(m_bShowDialog);
        }
コード例 #3
0
ファイル: UIShapeDialog.cs プロジェクト: pilnine/GUIEditor
        public override void PerformRelevantOperation(string name, int iShapeIndex, int iShapeCount)
        {
            base.PerformRelevantOperation(name, iShapeIndex, iShapeCount);
            if (name == "Load XML")
            {
                OpenFileDlg dlg = new OpenFileDlg();
                dlg.Caption          = "Opening a model group file";
                dlg.Description      = "Please select a model group file and click OK to continue";
                dlg.Text             = "Opening an model group file";
                dlg.InitialDirectory = EditorManager.Project.ProjectDir;
                dlg.FileName         = _filename;
                dlg.Filter           = new string[] { ".xml" };
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    _filename = EditorManager.Project.MakeRelative(dlg.FileName);

                    if (UIDialogInstance.BuildFromXML(_filename) == false)
                    {
                        EditorManager.ShowMessageBox("Wrong Dialog resource file.");
                        _filename = "";
                    }
                }

                UpdateLayout();
                //UpdateShape
            }
            else if (name == "Save XML")
            {
                CreateFileDlg dlg = new CreateFileDlg();
                dlg.Caption          = "Opening a GUI Dialog file";
                dlg.Description      = "Please select a GUI Dialog file and click OK to continue";
                dlg.Text             = "Opening a GUI Dialog file";
                dlg.InitialDirectory = EditorManager.Project.ProjectDir;
                dlg.FileName         = _filename;
                dlg.Filter           = new string[] { ".xml" };
                dlg.AllowOverwrite   = true;
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    _filename = EditorManager.Project.MakeRelative(dlg.FileName);

                    if (UIDialogInstance.BuildToXML(dlg.FileName) == false)
                    {
                        EditorManager.ShowMessageBox("Write failed.");
                        _filename = "";
                    }
                }


                UpdateLayout();
            }
            else if (name == "Rebuild UI Shape tree from XML")
            {
                OpenFileDlg dlg = new OpenFileDlg();
                dlg.Caption          = "Opening a model group file";
                dlg.Description      = "Please select a model group file and click OK to continue";
                dlg.Text             = "Opening an model group file";
                dlg.InitialDirectory = EditorManager.Project.ProjectDir;
                dlg.FileName         = _filename;
                dlg.Filter           = new string[] { ".xml" };
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    _filename = EditorManager.Project.MakeRelative(dlg.FileName);

                    if (UIDialogInstance.BuildFromXML(_filename) == false)
                    {
                        EditorManager.ShowMessageBox("Wrong Dialog resource file.");
                        _filename = "";
                    }
                }

                ShapeCollection Collection = ChildCollection;
                foreach (ShapeBase shape in Collection)
                {
                    RemoveChild(shape);
                }


                int iItemCount = UIDialogInstance.GetChildUIInstanceCount();

                this.Bound = UIDialogInstance.GetBound();

                UpdateLayout();
            }
        }