示例#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();
                }
            }
        }
示例#2
0
        public void OpenFileDialog()
        {
            var fileFilter = "eap";
            var result     = EditorUtility.OpenFilePanel("Select file", "C://", fileFilter);

            if (result != "")
            {
                FileInfo file = new FileInfo(result);

                if (file.Exists)
                {
                    // Insert code to read the stream here.
                    Debug.Log("Opening project");
                    selectedGameProjectPath = file.FullName;
                    GameRources.LoadGameProject(selectedGameProjectPath);
                    Controller.OpenEditorWindow();
                    EditorWindowBase.RefreshWindows();
                }
            }
        }
示例#3
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();
                }
            }
        }