コード例 #1
0
        public void GetScreenSizeForInstance(int instanceID, out int width, out int height)
        {
            QBInstanceData instanceData = GetInstanceData(instanceID);

            if (instanceData != null && instanceData.screenSize.Override)
            {
                width  = instanceData.screenSize.Width;
                height = instanceData.screenSize.Height;
            }
            else
            {
                width  = advancedSettings.screenSettings.screenWidth;
                height = advancedSettings.screenSettings.screenHeight;
            }
        }
コード例 #2
0
        private void MoveProcessWindowIfRequired(Process process)
        {
            if (process.MainWindowHandle.ToInt32() == 0)
            {
                return;
            }

            QBInstanceData instanceData = _profile.GetInstanceData(_instanceID);

            if (instanceData != null && instanceData.screenPosition.Override)
            {
#if UNITY_EDITOR_WIN
                int width, height;
                _profile.GetScreenSizeForInstance(_instanceID, out width, out height);
                IntPtr id = GetForegroundWindow();

                UnityEngine.Debug.LogFormat("Move window [{0}, {1}, {2}, {3}]", instanceData.screenPosition.X, instanceData.screenPosition.Y, width, height);
//				bool repaint = true;
//              QBProcess.MoveWindow(
//                  id,
//                  instanceData.screenPosition.X, instanceData.screenPosition.Y,
//                  width, height,
//                  repaint
//                  );

                bool result = QBProcess.SetWindowPos(
                    id,
                    instanceData.screenPosition.X, instanceData.screenPosition.Y,
                    width, height,
                    0x0010 | 0x0200 | 0x0001 | 0x0004
                    );

                UnityEngine.Debug.LogFormat("Move success : {0}", result);
                if (!result)
                {
                    int errorCode = Marshal.GetLastWin32Error();
                    UnityEngine.Debug.LogFormat("Error code : {0}", errorCode);
                }
#endif
            }
        }
コード例 #3
0
        private string  BuildCommandLineArguments(QBProfile editorProfile, QBPlayerSettings playerSettings, int instanceID)
        {
            StringBuilder sb = new StringBuilder();

            AddCommandLineArgument(sb, QBCommandLineParameters.EnableQuickBuild);
            AddCommandLineArgument(sb, QBCommandLineParameters.InstanceID, instanceID);

            AddCommandLineArgument(sb, QBCommandLineParameters.Screen_FullscreenMode, editorProfile.advancedSettings.screenSettings.isFullScreen ? 1 : 0);

            int width, height;

            editorProfile.GetScreenSizeForInstance(instanceID, out width, out height);
            AddCommandLineArgument(sb, QBCommandLineParameters.Screen_Width, width);
            AddCommandLineArgument(sb, QBCommandLineParameters.Screen_Height, height);

            string outputLogFileName = string.Empty;

            if (!editorProfile.advancedSettings.redirectOutputLog)
            {
                outputLogFileName = editorProfile.BuildDirectoryPath + "/" + string.Format(QBCommandLineParameters.LogFileFormat, instanceID);
                AddCommandLineArgument(sb, QBCommandLineParameters.LogFile, outputLogFileName);
            }
            else
            {
                AddCommandLineArgument(sb, QBCommandLineParameters.RedirectOutput);
            }

            if (editorProfile.expertSettings.launchInBatchMode)
            {
                AddCommandLineArgument(sb, QBCommandLineParameters.Batchmode);
                AddCommandLineArgument(sb, QBCommandLineParameters.NoGraphics);
            }

            if (editorProfile.advancedSettings.displayInstanceID)
            {
                AddCommandLineArgument(sb, QBCommandLineParameters.DisplayInstanceID);
            }


            if (playerSettings.AdditiveScenes.Length > 0)
            {
                AddCommandLineArgument(sb, QBCommandLineParameters.AdditiveScenes, QBCommandLineHelper.PackStringArray(playerSettings.AdditiveScenes));
            }

            if (instanceID < editorProfile.expertSettings.customInstanceDatas.Length)
            {
                QBInstanceData qbInstanceData = editorProfile.expertSettings.customInstanceDatas[instanceID];
                if (qbInstanceData)
                {
                    AddCommandLineArgument(sb, qbInstanceData.commandLineArguments);

                    if (!string.IsNullOrEmpty(qbInstanceData.customName))
                    {
                        AddCommandLineArgument(sb, QBCommandLineParameters.CustomName, qbInstanceData.customName);
                    }
                }
            }

            AddCommandLineArgument(sb, editorProfile.advancedSettings.commandLineArguments);
            return(sb.ToString());
        }