Exemplo n.º 1
0
        public void OpenFileDialog()
        {
            Stream myStream = null;

            ofd.InitialDirectory = "c:\\";
            ofd.Filter           = "ead files (*.ead) | *.ead |eap files (*.eap) | *.eap | All files(*.*) | *.* ";
            ofd.FilterIndex      = 2;
            ofd.RestoreDirectory = true;

            if (ofd.ShowDialog() == DialogResult.OK)
            {
                if ((myStream = ofd.OpenFile()) != null)
                {
                    using (myStream)
                    {
                        // Insert code to read the stream here.
                        selectedGameProjectPath = ofd.FileName;
                        GameRources.LoadGameProject(selectedGameProjectPath);
                        EditorWindowBase.Init();
                        EditorWindowBase window = (EditorWindowBase)EditorWindow.GetWindow(typeof(EditorWindowBase));
                        window.Show();
                    }
                    myStream.Dispose();
                }
            }
        }
Exemplo n.º 2
0
        private void startNewGame()
        {
            int type = -1;

            switch (selectedGameType)
            {
            default:
            case GameType.FPS: type = Controller.FILE_ADVENTURE_1STPERSON_PLAYER; break;

            case GameType.TPS: type = Controller.FILE_ADVENTURE_3RDPERSON_PLAYER; break;
            }

            Stream myStream = null;

            sfd.InitialDirectory = "c:\\";
            sfd.Filter           = "ead files (*.ead) | *.ead |eap files (*.eap) | *.eap | All files(*.*) | *.* ";
            sfd.FilterIndex      = 2;
            sfd.RestoreDirectory = true;

            if (sfd.ShowDialog() == DialogResult.OK)
            {
                if ((myStream = sfd.OpenFile()) != null)
                {
                    using (myStream)
                    {
                        // Insert code to read the stream here.
                        selectedGameProjectPath = sfd.FileName;
                        if (GameRources.CreateGameProject(selectedGameProjectPath, type))
                        {
                            GameRources.LoadGameProject(selectedGameProjectPath);
                            EditorWindowBase.Init();
                            EditorWindowBase window = (EditorWindowBase)EditorWindow.GetWindow(typeof(EditorWindowBase));
                            window.Show();
                        }
                    }
                    myStream.Dispose();
                }
            }
        }